[Bug #992] Fix bug
Revert "[Bug #952] Show list of resources in 'Resource load view' in
order". The left part is always ordered by alphabetic order, but the
right part remained in the original order.
This reverts commit 7bb18e5ea4.
FEA: ItEr74S04BugFixing
This commit is contained in:
parent
fad2f076f8
commit
45af764729
2 changed files with 2 additions and 38 deletions
|
|
@ -30,7 +30,7 @@ import org.apache.commons.lang.Validate;
|
|||
import org.joda.time.LocalDate;
|
||||
import org.zkoss.ganttz.util.Interval;
|
||||
|
||||
public class LoadTimeLine implements Comparable<LoadTimeLine>{
|
||||
public class LoadTimeLine {
|
||||
|
||||
private final String conceptName;
|
||||
private final List<LoadPeriod> loadPeriods;
|
||||
|
|
@ -196,13 +196,4 @@ public class LoadTimeLine implements Comparable<LoadTimeLine>{
|
|||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return conceptName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LoadTimeLine o) {
|
||||
return conceptName.compareTo(o.getConceptName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ package org.zkoss.ganttz.resourceload;
|
|||
|
||||
import static org.zkoss.ganttz.i18n.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.LocalDate;
|
||||
|
|
@ -297,33 +294,9 @@ public class ResourcesLoadPanel extends HtmlMacroComponent {
|
|||
result.addToRoot(loadTimeLine);
|
||||
result = addNodes(result, loadTimeLine);
|
||||
}
|
||||
return sortModelTree(result);
|
||||
}
|
||||
|
||||
private MutableTreeModel<LoadTimeLine> sortModelTree(MutableTreeModel<LoadTimeLine> modelForTree) {
|
||||
LoadTimeLine root = modelForTree.getRoot();
|
||||
MutableTreeModel<LoadTimeLine> result = MutableTreeModel.create(LoadTimeLine.class, root);
|
||||
sortModelTree(result, modelForTree, root);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void sortModelTree(MutableTreeModel<LoadTimeLine> result,
|
||||
MutableTreeModel<LoadTimeLine> source, LoadTimeLine parent) {
|
||||
List<LoadTimeLine> children = getChildrenInOrderFor(source, parent);
|
||||
result.add(parent, children);
|
||||
for (LoadTimeLine each: children) {
|
||||
sortModelTree(result, source, each);
|
||||
}
|
||||
}
|
||||
|
||||
private List<LoadTimeLine> getChildrenInOrderFor(
|
||||
MutableTreeModel<LoadTimeLine> modelForTree, LoadTimeLine parent) {
|
||||
SortedSet<LoadTimeLine> result = new TreeSet<LoadTimeLine>();
|
||||
for (int i = 0; i < modelForTree.getChildCount(parent); i++) {
|
||||
result.add(modelForTree.getChild(parent, i));
|
||||
}
|
||||
return new ArrayList<LoadTimeLine>(result);
|
||||
}
|
||||
|
||||
private MutableTreeModel<LoadTimeLine> addNodes(
|
||||
MutableTreeModel<LoadTimeLine> tree, LoadTimeLine parent) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue