[Bug #885] Added single-click edition support to CRUD grids

FEA: ItEr72S04BugFixing
This commit is contained in:
Lorenzo Tilve Álvaro 2011-03-17 17:34:58 +01:00
parent 8f1dec3109
commit 7ee3d555f4
16 changed files with 43 additions and 30 deletions

View file

@ -38,6 +38,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
@ -263,12 +264,17 @@ public class AdvanceTypeCRUDController extends GenericForwardComposer {
@Override
public void render(Row row, Object data) throws Exception {
AdvanceType advanceType = (AdvanceType) data;
final AdvanceType advanceType = (AdvanceType) data;
appendLabelName(row, advanceType);
appendCheckboxEnabled(row, advanceType);
appendCheckboxPredefined(row, advanceType);
appendOperations(row, advanceType);
row.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
goToEditForm(advanceType);
}
});
}
private void appendLabelName(Row row, AdvanceType advanceType) {

View file

@ -39,6 +39,7 @@ import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.CheckEvent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.Hbox;
@ -95,10 +96,16 @@ public class UnitTypeController extends GenericForwardComposer {
return new RowRenderer() {
@Override
public void render(Row row, Object data) throws Exception {
UnitType unitType = (UnitType) data;
final UnitType unitType = (UnitType) data;
appendUnitTypeName(row, unitType);
appendOperations(row, unitType);
row.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
goToEditFormInEditionMode(unitType);
}
});
}
private void appendUnitTypeName(Row row, UnitType unitType) {
@ -248,11 +255,11 @@ public class UnitTypeController extends GenericForwardComposer {
private void validateAll() {
Textbox codeTextBox = (Textbox) editWindow.
getFellowIfAny("codeTextBox");
validate((InputElement) codeTextBox,codeTextBox.getValue());
validate(codeTextBox,codeTextBox.getValue());
Textbox measureTextBox = (Textbox) editWindow.
getFellowIfAny("measureTextBox");
validate((InputElement) measureTextBox,measureTextBox.getValue());
validate(measureTextBox,measureTextBox.getValue());
}
/**

View file

@ -21,7 +21,7 @@
<window id="${arg.top_id}" title="${i18n:_('Progress Types List')}">
<newdatasortablegrid id="listing" model="@{controller.advanceTypes}" mold="paging"
pageSize="10" fixedLayout="true"
pageSize="10" fixedLayout="true" sclass="clickable-rows"
rowRenderer="@{controller.advanceTypeRenderer}" >
<columns>
<newdatasortablecolumn label="${i18n:_('Name')}" sort="auto(unitName)"/>

View file

@ -21,14 +21,14 @@
<window id="${arg.top_id}" title="${i18n:_('Cost Categories List')}">
<newdatasortablegrid id="listing" model="@{controller.costCategories}" mold="paging"
pageSize="10">
pageSize="10" sclass="clickable-rows">
<columns sizable="true">
<newdatasortablecolumn label="${i18n:_('Category name')}" sort="auto(lower(name))" />
<newdatasortablecolumn label="${i18n:_('Enabled')}" sort="auto(enabled)"/>
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='costCategory'}" value="@{costCategory}">
<row self="@{each='costCategory'}" value="@{costCategory}" onClick="controller.goToEditForm(self.value);">
<label value="@{costCategory.name}" />
<checkbox checked="@{costCategory.enabled}" disabled="true" />
<hbox>

View file

@ -21,7 +21,7 @@
<window id="${arg.top_id}" title="${i18n:_('Work Hours Types List')}">
<newdatasortablegrid id="listing" model="@{controller.typesOfWorkHours}" mold="paging"
pageSize="10" fixedLayout="true">
pageSize="10" fixedLayout="true" sclass="clickable-rows">
<columns sizable="true">
<newdatasortablecolumn label="${i18n:_('Code')}" sort="auto(code)" />
<newdatasortablecolumn label="${i18n:_('Type name')}" sort="auto(name)" />
@ -30,7 +30,7 @@
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='typeOfWorkHours'}" value="@{typeOfWorkHours}">
<row self="@{each='typeOfWorkHours'}" value="@{typeOfWorkHours}" onClick="controller.goToEditForm(self.value);">
<label value="@{typeOfWorkHours.code}" />
<label value="@{typeOfWorkHours.name}" />
<label value="@{typeOfWorkHours.defaultPrice}" />

View file

@ -23,7 +23,7 @@
<newdatasortablegrid id="listExceptionDayTypes"
model="@{controller.exceptionDayTypes}"
mold="paging" pageSize="10"
mold="paging" pageSize="10" class="clickable-rows"
fixedLayout="true">
<columns>
@ -35,7 +35,7 @@
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='exceptionDayType'}" value="@{exceptionDayType}">
<row self="@{each='exceptionDayType'}" value="@{exceptionDayType}" onClick="controller.goToEditForm(self.value)">
<label value="@{exceptionDayType.name}" />
<label value="@{exceptionDayType.color}" />
<label value="@{exceptionDayType.overAssignableStr}" />

View file

@ -21,7 +21,7 @@
<window id="${arg.top_id}" title="${i18n:_('Companies List')}">
<newdatasortablegrid id="listing" model="@{controller.companiesDTO}" mold="paging"
pageSize="10"
pageSize="10" sclass="clickable-rows"
onInitRender="controller.sortByDefaultByName();">
<columns sizable="true">
<newdatasortablecolumn id="columnName" label="${i18n:_('Name')}" sort="auto(lower(name))" sortDirection="descending"/>
@ -32,7 +32,7 @@
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='company'}" value="@{company}">
<row self="@{each='company'}" value="@{company}" onClick="controller.goToEditForm(self.value)">
<label value="@{company.name}" />
<label value="@{company.nif}" />
<checkbox checked="@{company.client}" disabled="true" />

View file

@ -21,14 +21,14 @@
<window id="${arg.id}" title="${i18n:_('Label Types List')}">
<newdatasortablegrid id="labelTypes" model="@{controller.labelTypes}"
mold="paging" pageSize="10" fixedLayout="true">
mold="paging" pageSize="10" fixedLayout="true" sclass="clickable-rows">
<columns>
<newdatasortablecolumn label="${i18n:_('Name')}" sort="auto(lower(name))" sortDirection="ascending" />
<newdatasortablecolumn label="${i18n:_('Code')}"/>
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='labelType'}" value="@{labelType}">
<row self="@{each='labelType'}" value="@{labelType}" onClick="controller.goToEditForm(self.value);">
<label value="@{labelType.name}" />
<label value="@{labelType.code}" />
<hbox>

View file

@ -21,7 +21,7 @@
<window id="${arg.top_id}" title="${i18n:_('Unit Measures List')}">
<newdatasortablegrid id="listing" model="@{controller.unitTypes}" mold="paging"
pageSize="10" fixedLayout="true"
pageSize="10" fixedLayout="true" sclass="clickable-rows"
rowRenderer="@{controller.unitTypeRenderer}" >
<columns>
<newdatasortablecolumn label="${i18n:_('Unit Measure')}"

View file

@ -30,7 +30,7 @@
</hbox>
</div>
<separator bar="false" spacing="5px" orient="vertical"/>
<grid id="qualityFormsList" model="@{controller.qualityForms}"
<grid id="qualityFormsList" model="@{controller.qualityForms}" sclass="clickable-rows"
mold="paging" pageSize="10" fixedLayout="true">
<columns>
<column label="${i18n:_('Name')}" sort="auto(lower(name))" sortDirection="ascending" />
@ -38,7 +38,7 @@
<column label="${i18n:_('Operations')}" width="120px"/>
</columns>
<rows>
<row self="@{each='qualityForm'}" value="@{qualityForm}">
<row self="@{each='qualityForm'}" value="@{qualityForm}" onClick="controller.goToEditForm(self.value)">
<label value="@{qualityForm.name}" />
<label value="@{qualityForm.description}" />
<hbox>

View file

@ -37,7 +37,7 @@
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='virtualWorker'}" value="@{virtualWorker}" onDoubleClick="controller.goToEditVirtualWorkerForm(self.value);">
<row self="@{each='virtualWorker'}" value="@{virtualWorker}" onClick="controller.goToEditVirtualWorkerForm(self.value);">
<label value="@{virtualWorker.firstName}" />
<label value="@{virtualWorker.calendar.capacity}" />
<label value="@{virtualWorker.observations}" maxlength="40"/>

View file

@ -20,7 +20,7 @@
-->
<window id="${arg.top_id}" title="${i18n:_('Templates List')}">
<grid id="listing" model="@{templatesForOrdersController.templates}" mold="paging"
pageSize="10" fixedLayout="true">
pageSize="10" fixedLayout="true" sclass="clickable-rows">
<columns>
<column label="${i18n:_('Type')}" sort="auto(type)" />
<column label="${i18n:_('Code')}" sort="auto(code)" />
@ -34,7 +34,7 @@
<column label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='template'}" value="@{template}">
<row self="@{each='template'}" value="@{template}" onClick="templatesForOrdersController.goToEditForm(self.value);">
<label value="@{template.type}" />
<label value="@{template.code}" />
<label value="@{template.name}" />

View file

@ -21,13 +21,13 @@
<window id="${arg.top_id}" title="${i18n:_('Profiles List')}">
<newdatasortablegrid id="listing" model="@{controller.profiles}" mold="paging"
pageSize="10">
pageSize="10" sclass="clickable-rows">
<columns sizable="true">
<newdatasortablecolumn label="${i18n:_('Profile name')}" sort="auto(profileName)" />
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='profile'}" value="@{profile}">
<row self="@{each='profile'}" value="@{profile}" onClick="controller.goToEditForm(self.value);">
<label value="@{profile.profileName}" />
<hbox>
<button sclass="icono" image="/common/img/ico_editar1.png"

View file

@ -21,7 +21,7 @@
<window id="${arg.top_id}" title="${i18n:_('Users List')}">
<newdatasortablegrid id="listing" model="@{controller.users}" mold="paging"
pageSize="10">
pageSize="10" sclass="clickable-rows">
<columns sizable="true">
<newdatasortablecolumn label="${i18n:_('User login name')}" sort="auto(loginName)" />
<newdatasortablecolumn label="${i18n:_('Disabled')}" />
@ -29,7 +29,7 @@
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='user'}" value="@{user}">
<row self="@{each='user'}" value="@{user}" onClick="controller.goToEditForm(self.value);">
<label value="@{user.loginName}" />
<checkbox checked="@{user.disabled}" disabled="true" />
<checkbox checked="@{user.administrator}" disabled="true" />

View file

@ -21,14 +21,14 @@
<window id="${arg.top_id}" title="${i18n:_('Work Report Models')}">
<grid id="listing" mold="paging" pageSize="10"
model="@{controller.workReportTypes}"
model="@{controller.workReportTypes}" sclass="clickable-rows"
onInitRender ="controller.sortWorkReportTypes();">
<columns>
<column id="workReportTypeName" label="${i18n:_('Name')}" sort="auto(lower(name))" sortDirection="descending"/>
<column label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='workReportType'}" value="@{workReportType}">
<row self="@{each='workReportType'}" value="@{workReportType}" onClick="controller.goToEditNewWorkReportForm(self.value);">
<label value="@{workReportType.name}" />
<hbox>

View file

@ -56,7 +56,7 @@
</div>
<separator bar="false" spacing="20px" orient="horizontal"/>
<grid id="listing" mold="paging" pageSize="10"
model="@{controller.workReportDTOs}"
model="@{controller.workReportDTOs}" sclass="clickable-rows"
onInitRender ="controller.sortWorkReports();">
<columns sizable="true">
<column id="columnDateStart" label="${i18n:_('Date Start')}" sort="auto(dateStart, dateFinish)" sortDirection="ascending"/>
@ -66,7 +66,7 @@
<column label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='workReportDTO'}" value="@{workReportDTO}">
<row self="@{each='workReportDTO'}" value="@{workReportDTO}" onClick="controller.goToEditForm(self.value);">
<label value="@{workReportDTO.dateStart, converter='org.navalplanner.web.common.typeconverters.DateConverter'}" />
<label value="@{workReportDTO.dateFinish, converter='org.navalplanner.web.common.typeconverters.DateConverter'}"/>
<label value="@{workReportDTO.type}" />