Revision 43557 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.fmap.control/src/main/java/org/gvsig/propertypage/impl/DefaultPropertiesPageManager.java
DefaultPropertiesPageManager.java | ||
---|---|---|
1 | 1 |
package org.gvsig.propertypage.impl; |
2 | 2 |
|
3 | 3 |
import java.util.ArrayList; |
4 |
import java.util.Collection; |
|
4 | 5 |
import java.util.Collections; |
5 | 6 |
import java.util.Comparator; |
6 | 7 |
import java.util.HashMap; |
... | ... | |
21 | 22 |
|
22 | 23 |
private static final Logger logger = LoggerFactory.getLogger(DefaultPropertiesPageManager.class); |
23 | 24 |
|
24 |
private final Map<String, List<PropertiesPageFactory>> groups = new HashMap<>();
|
|
25 |
private final Map<String, Map<String, PropertiesPageFactory>> groups = new HashMap<>();
|
|
25 | 26 |
|
26 | 27 |
public DefaultPropertiesPageManager() { |
27 | 28 |
|
... | ... | |
30 | 31 |
@Override |
31 | 32 |
public void registerFactory(PropertiesPageFactory factory) { |
32 | 33 |
logger.info("Register PropertisPageFactory " + factory.getClass().getName() + " , groupID=" + factory.getGroupID() + " (" + factory.toString() + ")."); |
33 |
List<PropertiesPageFactory> group = this.getFactories(factory.getGroupID());
|
|
34 |
group.add(factory);
|
|
34 |
Map<String, PropertiesPageFactory> group = this.getFactories(factory.getGroupID());
|
|
35 |
group.put(factory.getName(), factory);
|
|
35 | 36 |
} |
36 | 37 |
|
37 |
private List<PropertiesPageFactory> getFactories(String groupID) {
|
|
38 |
private Map<String, PropertiesPageFactory> getFactories(String groupID) {
|
|
38 | 39 |
logger.info("get propeties page factories for groupID '" + groupID + "'"); |
39 |
List<PropertiesPageFactory> group = this.groups.get(groupID);
|
|
40 |
Map<String,PropertiesPageFactory> group = this.groups.get(groupID);
|
|
40 | 41 |
if (group == null) { |
41 |
group = new ArrayList<>();
|
|
42 |
group = new HashMap<>();
|
|
42 | 43 |
this.groups.put(groupID, group); |
43 | 44 |
} |
44 | 45 |
return group; |
... | ... | |
54 | 55 |
return pages; // Empty list, no access to pages authoriced |
55 | 56 |
} |
56 | 57 |
|
57 |
List<PropertiesPageFactory> factories = this.getFactories(groupID);
|
|
58 |
Collection<PropertiesPageFactory> factories = this.getFactories(groupID).values();
|
|
58 | 59 |
String authorizationId = ACCESS_PAGE_AUTHORIZATION+"-"+groupID; |
59 | 60 |
for (PropertiesPageFactory factory : factories) { |
60 | 61 |
if (factory.isVisible(obj)) { |
... | ... | |
65 | 66 |
} |
66 | 67 |
} |
67 | 68 |
Collections.sort(pages, new Comparator<PropertiesPage>() { |
69 |
@Override |
|
68 | 70 |
public int compare(PropertiesPage f1, PropertiesPage f2) { |
69 | 71 |
int n = f2.getPriority() - f1.getPriority(); |
70 | 72 |
if (n != 0) { |
Also available in: Unified diff