List of usage examples for org.apache.wicket.markup.html.form Form getConverter
@SuppressWarnings("unchecked") @Override public <C> IConverter<C> getConverter(Class<C> type)
From source file:org.geoserver.web.data.layergroup.RootLayerEntryPanel.java
License:Open Source License
@SuppressWarnings({ "rawtypes" })
public RootLayerEntryPanel(String id, final Form form, WorkspaceInfo workspace) {
super(id);/*from ww w. j av a 2s . c o m*/
setOutputMarkupId(true);
final TextField<LayerInfo> rootLayerField = new TextField<LayerInfo>("rootLayer") {
@Override
public IConverter getConverter(Class<?> type) {
return form.getConverter(type);
}
};
rootLayerField.setOutputMarkupId(true);
rootLayerField.setRequired(true);
add(rootLayerField);
// global styles
List<StyleInfo> globalStyles = new ArrayList<StyleInfo>();
List<StyleInfo> allStyles = GeoServerApplication.get().getCatalog().getStyles();
for (StyleInfo s : allStyles) {
if (s.getWorkspace() == null) {
globalStyles.add(s);
}
}
// available styles
List<StyleInfo> styles = new ArrayList<StyleInfo>();
styles.addAll(globalStyles);
if (workspace != null) {
styles.addAll(GeoServerApplication.get().getCatalog().getStylesByWorkspace(workspace));
}
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("rootLayerStyle", styles) {
@Override
public IConverter getConverter(Class<?> type) {
return form.getConverter(type);
}
};
styleField.setNullValid(true);
add(styleField);
final ModalWindow popupWindow = new ModalWindow("popup");
add(popupWindow);
add(new AjaxLink("add") {
@Override
public void onClick(AjaxRequestTarget target) {
popupWindow.setInitialHeight(375);
popupWindow.setInitialWidth(525);
popupWindow.setTitle(new ParamResourceModel("chooseLayer", this));
popupWindow.setContent(new LayerListPanel(popupWindow.getContentId()) {
@Override
protected void handleLayer(LayerInfo layer, AjaxRequestTarget target) {
popupWindow.close(target);
((LayerGroupInfo) form.getModelObject()).setRootLayer(layer);
target.addComponent(rootLayerField);
}
});
popupWindow.show(target);
}
});
}
From source file:org.geoserver.wms.eo.web.BandsLayerEntryPanel.java
License:Open Source License
@SuppressWarnings({ "rawtypes" })
public BandsLayerEntryPanel(String id, final Form form, WorkspaceInfo workspace) {
super(id);/*from w ww. j a v a 2s . c om*/
setOutputMarkupId(true);
LayerGroupInfo group = (LayerGroupInfo) form.getModel().getObject();
int pos = 0;
for (PublishedInfo p : group.getLayers()) {
if (p instanceof LayerInfo) {
if (EoLayerType.BAND_COVERAGE.name().equals(((LayerInfo) p).getMetadata().get(EoLayerType.KEY))) {
layer = (LayerInfo) p;
layerStyle = group.getStyles().get(pos);
}
}
pos++;
}
Link link = new Link("bandsLayer") {
@Override
public void onClick() {
Map<String, String> params = new HashMap<String, String>(2);
if (layer.getResource().getStore().getWorkspace() != null) {
params.put(ResourceConfigurationPage.WORKSPACE,
layer.getResource().getStore().getWorkspace().getName());
}
params.put(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, new PageParameters(params));
}
};
link.add(new Label("bandsLayerName", new PropertyModel(layer, "name")));
add(link);
// global styles
List<StyleInfo> globalStyles = new ArrayList<StyleInfo>();
List<StyleInfo> allStyles = GeoServerApplication.get().getCatalog().getStyles();
for (StyleInfo s : allStyles) {
if (s.getWorkspace() == null) {
globalStyles.add(s);
}
}
// available styles
List<StyleInfo> styles = new ArrayList<StyleInfo>();
styles.addAll(globalStyles);
if (workspace != null) {
styles.addAll(GeoServerApplication.get().getCatalog().getStylesByWorkspace(workspace));
}
Collections.sort(styles, new StyleInfoNameComparator());
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("bandsLayerStyle",
new PropertyModel<StyleInfo>(this, "layerStyle"), styles) {
@Override
public IConverter getConverter(Class<?> type) {
return form.getConverter(type);
}
};
styleField.setNullValid(true);
styleField.setOutputMarkupId(true);
add(styleField);
}
From source file:org.geoserver.wms.eo.web.BrowseImageLayerEntryPanel.java
License:Open Source License
@SuppressWarnings({ "rawtypes" })
public BrowseImageLayerEntryPanel(String id, final Form form, WorkspaceInfo workspace) {
super(id);//from w ww . j a v a 2 s . c o m
setOutputMarkupId(true);
LayerGroupInfo group = (LayerGroupInfo) form.getModel().getObject();
layer = group.getRootLayer();
layerStyle = group.getRootLayerStyle();
Link link = new Link("rootLayer") {
@Override
public void onClick() {
Map<String, String> params = new HashMap<String, String>(2);
if (layer.getResource().getStore().getWorkspace() != null) {
params.put(ResourceConfigurationPage.WORKSPACE,
layer.getResource().getStore().getWorkspace().getName());
}
params.put(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, new PageParameters(params));
}
};
link.add(new Label("rootLayerName", new PropertyModel(layer, "name")));
add(link);
// global styles
List<StyleInfo> globalStyles = new ArrayList<StyleInfo>();
List<StyleInfo> allStyles = GeoServerApplication.get().getCatalog().getStyles();
for (StyleInfo s : allStyles) {
if (s.getWorkspace() == null) {
globalStyles.add(s);
}
}
// available styles
List<StyleInfo> styles = new ArrayList<StyleInfo>();
styles.addAll(globalStyles);
if (workspace != null) {
styles.addAll(GeoServerApplication.get().getCatalog().getStylesByWorkspace(workspace));
}
Collections.sort(styles, new StyleInfoNameComparator());
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("rootLayerStyle",
new PropertyModel<StyleInfo>(this, "layerStyle"), styles) {
@Override
public IConverter getConverter(Class<?> type) {
return form.getConverter(type);
}
};
styleField.setNullValid(true);
add(styleField);
}
From source file:org.geoserver.wms.eo.web.OutlineLayerEntryPanel.java
License:Open Source License
@SuppressWarnings({ "rawtypes" })
public OutlineLayerEntryPanel(String id, final Form form, WorkspaceInfo workspace) {
super(id);//from w w w . j a va 2s.c om
setOutputMarkupId(true);
LayerGroupInfo group = (LayerGroupInfo) form.getModel().getObject();
int pos = 0;
for (PublishedInfo p : group.getLayers()) {
if (p instanceof LayerInfo) {
if (EoLayerType.COVERAGE_OUTLINE.name()
.equals(((LayerInfo) p).getMetadata().get(EoLayerType.KEY))) {
layer = (LayerInfo) p;
layerStyle = group.getStyles().get(pos);
}
}
pos++;
}
Link link = new Link("outlineLayer") {
@Override
public void onClick() {
Map<String, String> params = new HashMap<String, String>(2);
if (layer.getResource().getStore().getWorkspace() != null) {
params.put(ResourceConfigurationPage.WORKSPACE,
layer.getResource().getStore().getWorkspace().getName());
}
params.put(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, new PageParameters(params));
}
};
link.add(new Label("outlineLayerName", new PropertyModel(layer, "name")));
add(link);
// available styles
List<StyleInfo> styles = new ArrayList<StyleInfo>(layer.getStyles());
Collections.sort(styles, new StyleInfoNameComparator());
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("outlineLayerStyle",
new PropertyModel<StyleInfo>(this, "layerStyle"), styles) {
@Override
public IConverter getConverter(Class<?> type) {
return form.getConverter(type);
}
};
styleField.setNullValid(true);
styleField.setOutputMarkupId(true);
add(styleField);
}