ItEr30S04XestionDaComunidadeItEr29S04: Refactoring task to replace <grid> by <newdatasortablegrid>

This patches replaces in  several pages of the application the <grid> component by the
<newdatasortablegrid> macrocomponent and the <column> component by the <newdatasortablecolumn> component.
This commit is contained in:
Javier Moran Rua 2009-10-16 23:22:52 +02:00
parent ead8d27bca
commit 98cf958be6
9 changed files with 60 additions and 58 deletions

View file

@ -150,7 +150,7 @@ public class AssignedCriterionsModel implements IAssignedCriterionsModel {
@Override
public void remove(CriterionSatisfactionDTO criterionSatisfactionDTO){
if(criterionSatisfactionDTO.isIsNewObject()){
if(criterionSatisfactionDTO.isNewObject()){
criterionSatisfactionDTOs.remove(criterionSatisfactionDTO);
}else{
criterionSatisfactionDTO.setIsDeleted(true);
@ -309,7 +309,7 @@ public class AssignedCriterionsModel implements IAssignedCriterionsModel {
Set<CriterionSatisfaction> newList = new HashSet<CriterionSatisfaction>();
for(CriterionSatisfactionDTO satisfactionDTO :criterionSatisfactionDTOs){
CriterionSatisfaction satisfaction;
if(satisfactionDTO.isIsNewObject()){
if(satisfactionDTO.isNewObject()){
Criterion criterion = satisfactionDTO.getCriterionWithItsType().getCriterion();
Interval interval = satisfactionDTO.getInterval();
satisfaction = CriterionSatisfaction.create(criterion, worker, interval);

View file

@ -5,12 +5,12 @@
package org.navalplanner.web.resources.worker;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import org.hibernate.validator.NotNull;
import org.navalplanner.business.resources.entities.CriterionSatisfaction;
import org.navalplanner.business.INewObject;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.CriterionSatisfaction;
import org.navalplanner.business.resources.entities.CriterionType;
import org.navalplanner.business.resources.entities.CriterionWithItsType;
import org.navalplanner.business.resources.entities.Interval;
@ -19,7 +19,7 @@ import org.navalplanner.business.resources.entities.Interval;
* DTO represents the handled data in the form of assigning satisfaction criterions.
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public class CriterionSatisfactionDTO {
public class CriterionSatisfactionDTO implements INewObject {
public static final String START_DATE = "startDate";
@ -39,12 +39,12 @@ public class CriterionSatisfactionDTO {
private Boolean isDeleted = false;
private Boolean isNewObject = false;
private Boolean newObject = false;
private CriterionSatisfaction criterionSatisfaction;
public CriterionSatisfactionDTO(){
this.setIsNewObject(true);
this.setNewObject(true);
this.state = "";
this.criterionAndType = "";
this.startDate = new Date();
@ -77,16 +77,13 @@ public class CriterionSatisfactionDTO {
this.state = state;
}
public void setIsNewObject(Boolean isNewObject) {
this.isNewObject = isNewObject;
public void setNewObject(Boolean isNewObject) {
this.newObject = isNewObject;
}
public Boolean isIsNewObject() {
return isNewObject == null ? false : isNewObject;
}
public Boolean isIsOldObject(){
return !isIsNewObject();
public Boolean isOldObject(){
return !isNewObject();
}
public CriterionWithItsType getCriterionWithItsType() {
@ -156,7 +153,7 @@ public class CriterionSatisfactionDTO {
}
public boolean isPreviousStartDate(Date startDate){
if(isNewObject) return true;
if(newObject) return true;
if((getStartDate() == null) ||
(startDate == null)) return true;
if(startDate.compareTo(getCriterionSatisfaction().getStartDate()) <= 0)
@ -172,7 +169,7 @@ public class CriterionSatisfactionDTO {
}
public boolean isPostEndDate(Date endDate){
if(isNewObject) return true;
if(newObject) return true;
if((getEndDate() == null) ||
(endDate == null)) return true;
if(getCriterionSatisfaction().getEndDate() == null)
@ -187,4 +184,9 @@ public class CriterionSatisfactionDTO {
return criterionWithItsType.getNameAndType();
}
@Override
public boolean isNewObject() {
return newObject == null ? false : newObject;
}
}

View file

@ -19,12 +19,12 @@
-->
<window id="${arg.top_id}" title="${i18n:_('Advance type list')}">
<grid id="listing" model="@{controller.advanceTypes}" mold="paging"
<newdatasortablegrid id="listing" model="@{controller.advanceTypes}" mold="paging"
pageSize="5" fixedLayout="true">
<columns>
<column label="${i18n:_('Name')}" sort="auto(unitName)"/>
<column label="${i18n:_('Enabled')}"/>
<column label="${i18n:_('Operations')}"/>
<newdatasortablecolumn label="${i18n:_('Name')}" sort="auto(unitName)"/>
<newdatasortablecolumn label="${i18n:_('Enabled')}"/>
<newdatasortablecolumn label="${i18n:_('Operations')}"/>
</columns>
<rows>
@ -50,7 +50,7 @@
</row>
</rows>
</grid>
</newdatasortablegrid>
<button id="show_create_form" onClick="controller.goToCreateForm();" label="${i18n:_('Create')}">
</button>
</window>

View file

@ -19,11 +19,11 @@
-->
<window id="${arg.id}" title="${i18n:_('List label types')}">
<grid id="labelTypes" model="@{controller.labelTypes}"
<newdatasortablegrid id="labelTypes" model="@{controller.labelTypes}"
mold="paging" pageSize="10" fixedLayout="true">
<columns>
<column label="${i18n:_('Name')}" sort="auto(name)" sortDirection="ascending" />
<column label="${i18n:_('Operations')}" />
<newdatasortablecolumn label="${i18n:_('Name')}" sort="auto(name)" sortDirection="ascending" />
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='labelType'}" value="@{labelType}">
@ -41,6 +41,6 @@
</hbox>
</row>
</rows>
</grid>
</newdatasortablegrid>
<button label="${i18n:_('Create')}" onClick="controller.goToCreateForm()"/>
</window>

View file

@ -44,12 +44,12 @@
<vbox>
<panel title="${i18n:_('Direct labels')}" border="normal">
<panelchildren>
<grid id="directLabels" height="200px" fixedLayout="true"
<newdatasortablegrid id="directLabels" height="200px" fixedLayout="true"
model="@{assignedLabelsController.labels}">
<columns>
<column label="${i18n:_('Label type')}" />
<column label="${i18n:_('Value')}" />
<column label="${i18n:_('Operations')}" />
<newdatasortablecolumn label="${i18n:_('Label type')}" sort="auto(type.name)"/>
<newdatasortablecolumn label="${i18n:_('Value')}" />
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='label'}" value="@{label}">
@ -65,7 +65,7 @@
</row>
</rows>
</grid>
</newdatasortablegrid>
<!-- Assign label -->
<vbox>

View file

@ -19,11 +19,11 @@
-->
<window id="listing" title="${i18n:_('Criterion type list')}">
<grid model="@{controller.criterionTypes}" fixedLayout="true">
<newdatasortablegrid model="@{controller.criterionTypes}" fixedLayout="true">
<columns>
<column label="${i18n:_('Name')}" sort="auto(name)"/>
<column width="60px" label="${i18n:_('Enabled')}"/>
<column width="200px" label="${i18n:_('Operations')}"/>
<newdatasortablecolumn label="${i18n:_('Name')}" sort="auto(name)"/>
<newdatasortablecolumn width="60px" label="${i18n:_('Enabled')}"/>
<newdatasortablecolumn width="200px" label="${i18n:_('Operations')}"/>
</columns>
<rows>
<row self="@{each='criterionType'}" value="@{criterionType}">
@ -45,7 +45,7 @@
</hbox>
</row>
</rows>
</grid>
</newdatasortablegrid>
<button id="show_create_form" onClick="controller.goToCreateForm();" label="${i18n:_('Create')}">
</button>
</window>

View file

@ -13,20 +13,20 @@
</combobox>
<separator bar="false" spacing="20px" orient="vertical"/>
</hbox>
<grid id="listingCriterions" mold="paging" pageSize="10" fixedLayout="true"
<newdatasortablegrid id="listingCriterions" mold="paging" pageSize="10" fixedLayout="true"
model="@{assignedCriterionsController.criterionSatisfactionDTOs}">
<columns>
<column label="${i18n:_('Criterion name')}" sort="auto(criterionAndType)" sortDirection="ascending"/>
<column label="${i18n:_('Starting date')}" width="200px" align="center"/>
<column label="${i18n:_('Ending date')}" width="200px" align="center"/>
<column label="${i18n:_('State')}" width="70px" align="center"/>
<column label="${i18n:_('Operations')}" width="70px" align="center"/>
<newdatasortablecolumn label="${i18n:_('Criterion name')}" sort="auto(criterionAndType)" sortDirection="ascending"/>
<newdatasortablecolumn label="${i18n:_('Starting date')}" sort="auto(startDate)" width="200px" align="center"/>
<newdatasortablecolumn label="${i18n:_('Ending date')}" sort="auto(endDate)" width="200px" align="center"/>
<newdatasortablecolumn label="${i18n:_('State')}" sort="auto(state)" width="70px" align="center"/>
<newdatasortablecolumn label="${i18n:_('Operations')}" width="70px" align="center"/>
</columns>
<rows>
<row self="@{each='criterionSatisfactionDTO'}" value="@{criterionSatisfactionDTO}">
<hbox>
<bandbox
visible ="@{criterionSatisfactionDTO.isNewObject}"
visible ="@{criterionSatisfactionDTO.newObject}"
value = "@{criterionSatisfactionDTO.criterionAndType}">
<bandpopup>
<listbox width="500px" height="150px" fixedLayout="true"
@ -44,7 +44,7 @@
</listbox>
</bandpopup>
</bandbox>
<label visible="@{criterionSatisfactionDTO.isOldObject}"
<label visible="@{criterionSatisfactionDTO.oldObject}"
value="@{criterionSatisfactionDTO.criterionAndType}"/>
</hbox>
@ -65,6 +65,6 @@
</button>
</row>
</rows>
</grid>
</newdatasortablegrid>
</panelchildren>
</panel>

View file

@ -19,13 +19,13 @@
-->
<window id="${arg.top_id}" title="${i18n:_('Workers list')}">
<grid id="listing" model="@{controller.workers}" mold="paging"
<newdatasortablegrid id="listing" model="@{controller.workers}" mold="paging"
pageSize="5" fixedLayout="true">
<columns>
<column label="${i18n:_('First name')}" sort="auto(firstName)" />
<column label="${i18n:_('Surname')}" sort="auto(surname)" />
<column label="${i18n:_('NIF')}" sort="auto(nif)" />
<column label="${i18n:_('Operations')}" />
<newdatasortablecolumn label="${i18n:_('First name')}" sort="auto(firstName)"/>
<newdatasortablecolumn label="${i18n:_('Surname')}" sort="auto(surname)" />
<newdatasortablecolumn label="${i18n:_('NIF')}" sort="auto(nif)" />
<newdatasortablecolumn label="${i18n:_('Operations')}" />
</columns>
<rows>
<row self="@{each='worker'}" value="@{worker}">
@ -42,7 +42,7 @@
</hbox>
</row>
</rows>
</grid>
</newdatasortablegrid>
<button id="show_create_form" onClick="controller.goToCreateForm();"
label="${i18n:_('Create')}">
</button>

View file

@ -19,14 +19,14 @@
-->
<window id="${arg.top_id}" title="${i18n:_('Work report listing')}">
<grid id="listing" model="@{controller.workReports}" mold="paging"
<newdatasortablegrid id="listing" model="@{controller.workReports}" mold="paging"
pageSize="5">
<columns sizable="true">
<column label="${i18n:_('Date')}" sort="auto(date)" />
<column label="${i18n:_('Responsible')}" sort="auto(responsible)" />
<column label="${i18n:_('Place')}" sort="auto(place)" />
<column label="${i18n:_('Type')}" sort="auto(workReportType.name)"/>
<column label="${i18n:_('Actions')}" />
<newdatasortablecolumn label="${i18n:_('Date')}" sort="auto(date)" />
<newdatasortablecolumn label="${i18n:_('Responsible')}" sort="auto(responsible)" />
<newdatasortablecolumn label="${i18n:_('Place')}" sort="auto(place)" />
<newdatasortablecolumn label="${i18n:_('Type')}" sort="auto(workReportType.name)"/>
<newdatasortablecolumn label="${i18n:_('Actions')}" />
</columns>
<rows>
<row self="@{each='workReport'}" value="@{workReport}">
@ -50,5 +50,5 @@
</hbox>
</row>
</rows>
</grid>
</newdatasortablegrid>
</window>