[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview SpaceTreeView.java,1.7,1.8 Surfa
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nikolaj B. <nbr...@us...> - 2006-05-15 12:12:12
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21560/src/net/sourceforge/bprocessor/gui/treeview Modified Files: SpaceTreeView.java SurfaceTreeView.java Log Message: The tree now sorts nodes by names in alpha order. Index: SurfaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SurfaceTreeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SurfaceTreeView.java 23 Jan 2006 10:16:26 -0000 1.4 --- SurfaceTreeView.java 15 May 2006 12:11:58 -0000 1.5 *************** *** 8,13 **** package net.sourceforge.bprocessor.gui.treeview; ! import java.util.Collection; import net.sourceforge.bprocessor.model.Project; /** --- 8,17 ---- package net.sourceforge.bprocessor.gui.treeview; ! import java.util.Collections; ! import java.util.Comparator; ! import java.util.LinkedList; ! import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 27,32 **** */ public void update() { root.removeAllChildren(); ! Collection surfaces = Project.getInstance().getSurfaces(); root.add(new SurfaceContainer("Surfaces", surfaces)); model.nodeStructureChanged(root); --- 31,43 ---- */ public void update() { + final Comparator alpha = + new Comparator() { + public int compare(Object s1, Object s2) { + return ((Surface) s1).getName().compareToIgnoreCase(((Surface) s2).getName()); + } + }; root.removeAllChildren(); ! LinkedList surfaces = new LinkedList(Project.getInstance().getSurfaces()); ! Collections.sort(surfaces, alpha); root.add(new SurfaceContainer("Surfaces", surfaces)); model.nodeStructureChanged(root); Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SpaceTreeView.java 12 Apr 2006 15:10:09 -0000 1.7 --- SpaceTreeView.java 15 May 2006 12:11:58 -0000 1.8 *************** *** 9,14 **** import java.util.ArrayList; ! import java.util.Collection; import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; --- 9,16 ---- import java.util.ArrayList; ! import java.util.Collections; ! import java.util.Comparator; import java.util.Enumeration; + import java.util.LinkedList; import javax.swing.tree.DefaultMutableTreeNode; *************** *** 16,19 **** --- 18,22 ---- import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Space; /** *************** *** 38,44 **** */ public void update() { ! Collection construction = Project.getInstance().getConstructionSpaces(); ! Collection functional = Project.getInstance().getFunctionalSpaces(); ! Collection constraints = Project.getInstance().getConstraints(); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); --- 41,56 ---- */ public void update() { ! final Comparator alpha = ! new Comparator() { ! public int compare(Object s1, Object s2) { ! return ((Space) s1).getName().compareToIgnoreCase(((Space) s2).getName()); ! } ! }; ! LinkedList construction = new LinkedList(Project.getInstance().getConstructionSpaces()); ! Collections.sort(construction, alpha); ! LinkedList functional = new LinkedList(Project.getInstance().getFunctionalSpaces()); ! Collections.sort(functional, alpha); ! LinkedList constraints = new LinkedList(Project.getInstance().getConstraints()); ! Collections.sort(constraints, alpha); Enumeration e = getExpandedDescendants(new TreePath(root)); Object[] paths = findPaths(e); |