Is there any way to control the order of the entities that appear in GWT's left hand menu (proxy places list)?
Tracing through code, I found ScaffoldApp.java's getTopPlaces() calls ApplicationEntityTypesProcessor.getAll(). However, the order of the entities in getAll() seems arbitrary -- it may be reverse of order in which entities were added. Worse, these methods return HashSet which does not guarantee iterator order will be the same over time.
GUI design principles encourage consistent and logical arrangement of menus.
Is there any way (perhaps an annotation) that I could use to customize the entity order?
Unfortunately, ApplicationEntityTypesProcessor.java is one of those quot;DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.quot; files in ROO 1.1.1.
pareTo(MAP.get(p2));}};5)Add sort method to ScaffoldApp class:
private Setlt;Classlt;? extends EntityProxygt;gt; sort(Setlt;Classlt;? extends EntityProxygt;gt; in) {Setlt;Classlt;? extends EntityProxygt;gt; out = new TreeSetlt;Classlt;? extends EntityProxygt;gt;(COMP);
out.addAll(in);
return out;}This will now sort you entities in the left hand menu.
Enjoy.
Or simply replace the getTopPlaces() method in ${topLevelPackage}.client.scaffold.ScaffoldApp with this:
protected Listlt roxyListPlacegt; getTopPlaces() {Listlt roxyListPlacegt; rtn = new ArrayListlt roxyListPlacegt;();
rtn.add(new ProxyListPlace(AnimalProxy.class));
rtn.add(new ProxyListPlace(ExhibitProxy.class));
rtn.add(new ProxyListPlace(KeeperProxy.class));
return rtn;}Remember to still change the return type of the method from HashMap to List else the order will still be random. |