final ArrayList<String> sortedDsNames = new ArrayList<String>(getAvailableDataStores()
.keySet());
Collections.sort(sortedDsNames);
final CatalogIconFactory icons = CatalogIconFactory.get();
final ListView dataStoreLinks = new ListView("vectorResources", sortedDsNames) {
@Override
protected void populateItem(ListItem item) {
final String dataStoreFactoryName = item.getDefaultModelObjectAsString();
final DataAccessFactory factory = getAvailableDataStores()
.get(dataStoreFactoryName);
final String description = factory.getDescription();
SubmitLink link;
link = new SubmitLink("resourcelink") {
@Override
public void onSubmit() {
setResponsePage(new DataAccessNewPage(dataStoreFactoryName));
}
};
link.setEnabled(thereAreWorkspaces);
link.add(new Label("resourcelabel", dataStoreFactoryName));
item.add(link);
item.add(new Label("resourceDescription", description));
Image icon = new Image("storeIcon", icons.getStoreIcon(factory.getClass()));
// TODO: icons could provide a description too to be used in alt=...
icon.add(new AttributeModifier("alt", true, new Model("")));
item.add(icon);
}
};
final List<String> sortedCoverageNames = new ArrayList<String>();
sortedCoverageNames.addAll(getAvailableCoverageStores().keySet());
Collections.sort(sortedCoverageNames);
final ListView coverageLinks = new ListView("rasterResources", sortedCoverageNames) {
@Override
protected void populateItem(ListItem item) {
final String coverageFactoryName = item.getDefaultModelObjectAsString();
final Map<String, Format> coverages = getAvailableCoverageStores();
Format format = coverages.get(coverageFactoryName);
final String description = format.getDescription();
SubmitLink link;
link = new SubmitLink("resourcelink") {
@Override
public void onSubmit() {
setResponsePage(new CoverageStoreNewPage(coverageFactoryName));
}
};
link.setEnabled(thereAreWorkspaces);
link.add(new Label("resourcelabel", coverageFactoryName));
item.add(link);
item.add(new Label("resourceDescription", description));
Image icon = new Image("storeIcon", icons.getStoreIcon(format.getClass()));
// TODO: icons could provide a description too to be used in alt=...
icon.add(new AttributeModifier("alt", true, new Model("")));
item.add(icon);
}
};