Commit 7931e3cf authored by Andrea Aime's avatar Andrea Aime
Browse files

Porting over wms-eo

parent ad5e465d
......@@ -10,13 +10,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.convert.IConverter;
import org.geoserver.catalog.LayerGroupInfo;
import org.geoserver.catalog.LayerInfo;
......@@ -59,12 +59,12 @@ public class BandsLayerEntryPanel extends Panel {
Link link = new Link("bandsLayer") {
@Override
public void onClick() {
Map<String,String> params = new HashMap<String,String>(2);
PageParameters pp = new PageParameters();
if (layer.getResource().getStore().getWorkspace() != null) {
params.put(ResourceConfigurationPage.WORKSPACE, layer.getResource().getStore().getWorkspace().getName());
pp.set(ResourceConfigurationPage.WORKSPACE, layer.getResource().getStore().getWorkspace().getName());
}
params.put(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, new PageParameters(params));
pp.set(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, pp);
}
};
link.add(new Label("bandsLayerName", new PropertyModel(layer, "name")));
......@@ -88,10 +88,13 @@ public class BandsLayerEntryPanel extends Panel {
Collections.sort(styles, new StyleInfoNameComparator());
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("bandsLayerStyle", new PropertyModel<StyleInfo>(this, "layerStyle"), styles) {
@Override
public IConverter getConverter(Class<?> type) {
public <C> IConverter<C> getConverter(Class<C> type) {
return form.getConverter(type);
}
}
};
styleField.setNullValid(true);
styleField.setOutputMarkupId(true);
......
......@@ -10,13 +10,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.convert.IConverter;
import org.geoserver.catalog.LayerGroupInfo;
import org.geoserver.catalog.LayerInfo;
......@@ -47,12 +47,12 @@ public class BrowseImageLayerEntryPanel extends Panel {
Link link = new Link("rootLayer") {
@Override
public void onClick() {
Map<String,String> params = new HashMap<String,String>(2);
PageParameters pp = new PageParameters();
if (layer.getResource().getStore().getWorkspace() != null) {
params.put(ResourceConfigurationPage.WORKSPACE, layer.getResource().getStore().getWorkspace().getName());
pp.set(ResourceConfigurationPage.WORKSPACE, layer.getResource().getStore().getWorkspace().getName());
}
params.put(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, new PageParameters(params));
pp.set(ResourceConfigurationPage.NAME, layer.getName());
setResponsePage(ResourceConfigurationPage.class, pp);
}
};
link.add(new Label("rootLayerName", new PropertyModel(layer, "name")));
......@@ -76,10 +76,12 @@ public class BrowseImageLayerEntryPanel extends Panel {
Collections.sort(styles, new StyleInfoNameComparator());
DropDownChoice<StyleInfo> styleField = new DropDownChoice<StyleInfo>("rootLayerStyle", new PropertyModel<StyleInfo>(this, "layerStyle"), styles) {
@Override
public IConverter getConverter(Class<?> type) {
public <C> IConverter<C> getConverter(Class<C> type) {
return form.getConverter(type);
}
}
};
styleField.setNullValid(true);
add(styleField);
......
......@@ -78,9 +78,9 @@ class DeleteEoGroupLink extends AjaxLink {
// occurred, so refresh the table
if (groupTable.getSelection().size() == 0) {
setEnabled(false);
target.addComponent(groupTable);
target.add(groupTable);
for (AbstractLink link : groupTable.getSelectionLinks()) {
target.addComponent(link);
target.add(link);
}
}
}
......
......@@ -41,9 +41,9 @@ import org.geoserver.web.GeoServerSecuredPage;
import org.geoserver.web.data.store.StoreChoiceRenderer;
import org.geoserver.web.data.store.StoreNameComparator;
import org.geoserver.web.wicket.GeoServerDataProvider;
import org.geoserver.web.wicket.ParamResourceModel;
import org.geoserver.web.wicket.GeoServerDataProvider.Property;
import org.geoserver.web.wicket.GeoServerTablePanel;
import org.geoserver.web.wicket.ParamResourceModel;
import org.geoserver.wms.eo.EoLayerType;
import org.geotools.coverage.grid.io.GridCoverage2DReader;
import org.geotools.util.logging.Logging;
......@@ -120,8 +120,8 @@ public class EoCoverageSelectorPage extends GeoServerSecuredPage {
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateCoveragesList(true);
target.addComponent(coveragesContainer);
target.addComponent(feedbackPanel);
target.add(coveragesContainer);
target.add(feedbackPanel);
}
});
......
......@@ -86,13 +86,14 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
add(popupWindow = new ModalWindow("popup"));
add(dialog = new GeoServerDialog("dialog"));
Form form = new Form( "form", new CompoundPropertyModel( lgModel ) ) {
Form form = new Form("form", new CompoundPropertyModel(lgModel)) {
@Override
public IConverter getConverter(Class<?> type) {
public <C> IConverter<C> getConverter(Class<C> type) {
if (LayerInfo.class.isAssignableFrom(type)) {
return new LayerInfoConverter();
} else if (StyleInfo.class.isAssignableFrom(type)) {
return new StyleInfoConverter();
return new StyleInfoConverter();
} else {
return super.getConverter(type);
}
......@@ -150,7 +151,7 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
}
envelopePanel.setModelObject( lg.getBounds() );
target.addComponent( envelopePanel );
target.add( envelopePanel );
}
catch (Exception e) {
......@@ -221,9 +222,9 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
lgEntryPanel.entryProvider.getItems().add(
new EoLayerGroupEntry( layer, layer.getDefaultStyle(), groupName));
target.addComponent(lgEntryPanel);
target.add(lgEntryPanel);
layerTypes.setDefaultModelObject(layerTypes.getDefaultModelObject());
target.addComponent(layerTypes);
target.add(layerTypes);
}
});
......@@ -262,9 +263,9 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
} finally {
outlinesEntryChooser.setDefaultModelObject(null);
}
target.addComponent(lgEntryPanel);
target.addComponent(getFeedbackPanel());
target.addComponent(outlinesEntryChooser);
target.add(lgEntryPanel);
target.add(getFeedbackPanel());
target.add(outlinesEntryChooser);
}
});
......@@ -276,7 +277,7 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
layerTypes.processInput();
boolean input = layerTypes.getModelObject() != null;
addLayerLink.setEnabled(input);
target.addComponent(addLayerLink);
target.add(addLayerLink);
}
});
......@@ -295,9 +296,9 @@ public abstract class EoLayerGroupAbstractPage extends GeoServerSecuredPage {
info (new ParamResourceModel("layerRenameWarning", EoLayerGroupAbstractPage.this, groupName).getString());
}
}
target.addComponent(createStoreLink);
target.addComponent(addFromStoreLink);
target.addComponent(getFeedbackPanel());
target.add(createStoreLink);
target.add(addFromStoreLink);
target.add(getFeedbackPanel());
}
});
......
......@@ -5,11 +5,13 @@
package org.geoserver.wms.eo.web;
import org.apache.wicket.Component;
import org.apache.wicket.PageParameters;
import org.apache.wicket.Session;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.AbstractLink;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.visit.IVisit;
import org.apache.wicket.util.visit.IVisitor;
import org.geoserver.catalog.LayerGroupInfo;
import org.geoserver.web.data.layergroup.LayerGroupPage;
import org.geoserver.web.wicket.ParamResourceModel;
......@@ -20,8 +22,8 @@ public class EoLayerGroupEditPage extends EoLayerGroupAbstractPage {
public static final String WORKSPACE = "workspace";
public EoLayerGroupEditPage(PageParameters parameters) {
String groupName = parameters.getString(GROUP);
String wsName = parameters.getString(WORKSPACE);
String groupName = parameters.get(GROUP).toString();
String wsName = parameters.get(WORKSPACE).toString();
LayerGroupInfo lg = wsName != null ? getCatalog().getLayerGroupByName(wsName, groupName) :
getCatalog().getLayerGroupByName(groupName);
......@@ -40,13 +42,13 @@ public class EoLayerGroupEditPage extends EoLayerGroupAbstractPage {
//global layer groups only editable by full admin
if (lg.getWorkspace() == null) {
//disable all form components but cancel
f.visitChildren(new IVisitor<Component>() {
f.visitChildren(new IVisitor<Component, Void>() {
@Override
public Object component(Component c) {
public void component(Component c, IVisit<Void> visit) {
if (!(c instanceof AbstractLink && "cancel".equals(c.getId()))) {
c.setEnabled(false);
}
return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
visit.dontGoDeeper();
}
});
f.get("save").setVisible(false);
......
......@@ -10,7 +10,6 @@ import java.util.List;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.Component;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.ComponentTag;
......@@ -19,6 +18,7 @@ import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.DefaultItemReuseStrategy;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.resource.PackageResourceReference;
import org.geoserver.catalog.Catalog;
import org.geoserver.catalog.LayerGroupInfo;
import org.geoserver.catalog.LayerInfo;
......@@ -141,7 +141,7 @@ public class EoLayerGroupEntryPanel extends Panel {
entry.setStyle( style );
//redraw
target.addComponent( layerTable );
target.add( layerTable );
popupWindow.close( target );
}
});
......@@ -155,12 +155,12 @@ public class EoLayerGroupEntryPanel extends Panel {
Component removeLink(String id, IModel itemModel) {
final EoLayerGroupEntry entry = (EoLayerGroupEntry) itemModel.getObject();
ImageAjaxLink link = new ImageAjaxLink( id, new ResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/delete.png") ) {
ImageAjaxLink link = new ImageAjaxLink( id, new PackageResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/delete.png") ) {
@Override
protected void onClick(AjaxRequestTarget target) {
items.remove( entry );
target.addComponent( layerTable );
target.add( layerTable );
}
};
link.getImage().add(new AttributeModifier("alt", true, new ParamResourceModel("AbstractLayerGroupPage.th.remove", link)));
......@@ -224,16 +224,16 @@ public class EoLayerGroupEntryPanel extends Panel {
this.entry = entry;
this.setOutputMarkupId(true);
upLink = new ImageAjaxLink( "up", new ResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/arrow_up.png") ) {
upLink = new ImageAjaxLink( "up", new PackageResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/arrow_up.png") ) {
@Override
protected void onClick(AjaxRequestTarget target) {
int index = items.indexOf( PositionPanel.this.entry );
items.remove( index );
items.add(Math.max(0, index - 1), PositionPanel.this.entry);
target.addComponent( layerTable );
target.addComponent(this);
target.addComponent(downLink);
target.addComponent(upLink);
target.add( layerTable );
target.add(this);
target.add(downLink);
target.add(upLink);
}
@Override
......@@ -249,16 +249,16 @@ public class EoLayerGroupEntryPanel extends Panel {
upLink.setOutputMarkupId(true);
add( upLink);
downLink = new ImageAjaxLink( "down", new ResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/arrow_down.png") ) {
downLink = new ImageAjaxLink( "down", new PackageResourceReference( LayerGroupEntryPanel.class, "../../img/icons/silk/arrow_down.png") ) {
@Override
protected void onClick(AjaxRequestTarget target) {
int index = items.indexOf( PositionPanel.this.entry );
items.remove( index );
items.add(Math.min(items.size(), index + 1), PositionPanel.this.entry);
target.addComponent( layerTable );
target.addComponent(this);
target.addComponent(downLink);
target.addComponent(upLink);
target.add( layerTable );
target.add(this);
target.add(downLink);
target.add(upLink);
}
@Override
......
......@@ -81,7 +81,7 @@ public class LayerGroupTablePanel extends GeoServerTablePanel<LayerGroupInfo> {
if (editSelectionLinks != null) {
for (AbstractLink link : editSelectionLinks) {
link.setEnabled(canEdit);
target.addComponent(link);
target.add(link);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment