[Bug #1157] Sorted input fields

FEA: ItEr75S04BugFixing
This commit is contained in:
Cristina Alvarino 2011-09-27 11:53:34 +02:00 committed by Manuel Rego Casasnovas
parent b6e27c07fc
commit ed16e9b1ad
7 changed files with 33 additions and 14 deletions

View file

@ -39,7 +39,7 @@ import org.navalplanner.business.orders.entities.OrderElement;
* @author Diego Pino Garcia<dpino@igalia.com>
*
*/
public class Label extends IntegrationEntity {
public class Label extends IntegrationEntity implements Comparable<Label> {
@NotEmpty(message = "name not specified")
private String name;
@ -122,4 +122,14 @@ public class Label extends IntegrationEntity {
public Boolean isCodeAutogenerated() {
return getType() != null ? getType().isCodeAutogenerated() : false;
}
private String getTypeAndName() {
return String.format("%s :: %s", type.getName(), name);
}
@Override
public int compareTo(Label o) {
return getTypeAndName().compareToIgnoreCase(o.getTypeAndName());
}
}

View file

@ -51,7 +51,8 @@ import org.navalplanner.business.resources.daos.ICriterionDAO;
* @author Óscar González Fernández <ogonzalez@igalia.com>
* @author Fernando Bellas Permuy <fbellas@udc.es>
*/
public class Criterion extends IntegrationEntity implements ICriterion {
public class Criterion extends IntegrationEntity implements ICriterion,
Comparable<Criterion> {
public static Criterion createUnvalidated(String code, String name,
CriterionType type, Criterion parent, Boolean active) {
@ -465,4 +466,9 @@ public class Criterion extends IntegrationEntity implements ICriterion {
return String.format("%s :: %s", type, name);
}
@Override
public int compareTo(Criterion o) {
return toString().compareToIgnoreCase(o.toString());
}
}

View file

@ -73,7 +73,7 @@ import org.navalplanner.business.workingday.IntraDayDate.PartialDay;
* @author Jacobo Aragunde Perez <jaragunde@igalia.com>
*/
public abstract class Resource extends IntegrationEntity implements
IHumanIdentifiable {
IHumanIdentifiable, Comparable<Resource> {
public static class AllResourceAssignments implements IAssignmentsOnResourceCalculator {
@ -1186,4 +1186,10 @@ public abstract class Resource extends IntegrationEntity implements
this.limitingResourceQueue = limitingResourceQueue;
}
@Override
public int compareTo(Resource resource) {
return this.getShortDescription().compareToIgnoreCase(
resource.getShortDescription());
}
}

View file

@ -36,7 +36,7 @@ import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
* @author Fernando Bellas Permuy <fbellas@udc.es>
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public class Worker extends Resource implements Comparable {
public class Worker extends Resource {
public static Worker create() {
return create(new Worker());
@ -191,15 +191,6 @@ public class Worker extends Resource implements Comparable {
return type;
}
@Override
public int compareTo(Object arg0) {
if (!(arg0 instanceof Worker)) {
return -1;
}
Worker worker = (Worker) arg0;
return worker.getShortDescription().compareTo(getShortDescription());
}
@Override
public String getHumanId() {
if (firstName == null) {

View file

@ -21,6 +21,7 @@
package org.navalplanner.web.common.components.finders;
import java.util.Collections;
import java.util.List;
import org.navalplanner.business.resources.daos.IResourceDAO;
@ -41,7 +42,9 @@ public class ResourceFinder extends Finder implements IFinder {
@Transactional(readOnly = true)
public List<Resource> getAll() {
return resourceDAO.getResources();
List<Resource> resources = resourceDAO.getResources();
Collections.sort(resources);
return resources;
}
@Override

View file

@ -25,6 +25,7 @@ import static org.navalplanner.web.I18nHelper._;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;

View file

@ -157,6 +157,7 @@ public class HoursWorkedPerWorkerModel implements IHoursWorkedPerWorkerModel {
for (Label label : allLabels) {
label.getType().getName();
}
Collections.sort(allLabels);
return allLabels;
}
@ -183,6 +184,7 @@ public class HoursWorkedPerWorkerModel implements IHoursWorkedPerWorkerModel {
@Override
public List<Criterion> getCriterions() {
Collections.sort(allCriterions);
return this.allCriterions;
}