selectLayers.setVisible(storeId != null);
selectLayersContainer.add(selectLayers);
selectLayers.add(storeName = new Label("storeName", new Model()));
if(storeId != null) {
StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
storeName.setDefaultModelObject(store.getName());
}
provider = new NewLayerPageProvider();
provider.setStoreId(storeId);
provider.setShowPublished(true);
layers = new GeoServerTablePanel<Resource>("layers", provider) {
@Override
protected Component getComponentForProperty(String id,
IModel itemModel, Property<Resource> property) {
if (property == NewLayerPageProvider.NAME) {
return new Label(id, property.getModel(itemModel));
} else if (property == NewLayerPageProvider.PUBLISHED) {
final Resource resource = (Resource) itemModel.getObject();
final CatalogIconFactory icons = CatalogIconFactory.get();
if(resource.isPublished()) {
ResourceReference icon = icons.getEnabledIcon();
Fragment f = new Fragment(id, "iconFragment", NewLayerPage.this);
f.add(new Image("layerIcon", icon));
return f;
} else {
return new Label(id);
}
} else if(property == NewLayerPageProvider.ACTION) {
final Resource resource = (Resource) itemModel.getObject();
if(resource.isPublished()) {
return resourceChooserLink(id, itemModel, new ParamResourceModel("publishAgain", this));
} else {
return resourceChooserLink(id, itemModel, new ParamResourceModel("publish", this));
}
} else {
throw new IllegalArgumentException(
"Don't know of property " + property.getName());
}
}
};
layers.setFilterVisible(true);
selectLayers.add(layers);
createTypeContainer = new WebMarkupContainer("createTypeContainer");
createTypeContainer.setVisible(false);
createTypeContainer.add(newFeatureTypeLink());
selectLayersContainer.add(createTypeContainer);
createSQLViewContainer = new WebMarkupContainer("createSQLViewContainer");
createSQLViewContainer.setVisible(false);
createSQLViewContainer.add(newSQLViewLink());
selectLayersContainer.add(createSQLViewContainer);
createWMSLayerImportContainer = new WebMarkupContainer("createWMSLayerImportContainer");
createWMSLayerImportContainer.setVisible(false);
createWMSLayerImportContainer.add(newWMSImportLink());
selectLayersContainer.add(createWMSLayerImportContainer);
// case where the store is selected, or we have just created new one
if(storeId != null) {
StoreInfo store = getCatalog().getStore(storeId, StoreInfo.class);
updateSpecialFunctionPanels(store);
}
}