GeoGWT - GridWidget
This example shows the how to create a GridWidget associated to a custom GeoServer REST service to get a paginated list of layers.
Source
Below is all you need to setup the example.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byName">
<context:annotation-config />
<context:component-scan base-package="it.geosolutions.geogwt.web.examples" />
<!-- GWT Configuration -->
<bean id="geoGWTGlobalConfiguration" class="it.geosolutions.geogwt.gui.client.configuration.GeoGWTConfiguration" lazy-init="false">
</bean>
<!-- Startup service -->
<bean id="geogwtStartupService" class="it.geosolutions.geogwt.gui.service.impl.StartupService" lazy-init="false">
</bean>
<!-- Toolbar configuration -->
<bean name="toolbarItemManager" class="it.geosolutions.geogwt.gui.client.ToolbarItemManager">
<property name="clientTools">
<list>
</list>
</property>
</bean>
<!-- Layers Manager Service configuration -->
<bean name="layersManagerServiceGWT" class="it.geosolutions.geogwt.web.examples.server.service.impl.LayersManagerServiceImpl">
<property name="geoServerUrl" value="http://demo1.geo-solutions.it/playground"/>
<!-- property name="geoServerUser" value="admin"/>
<property name="geoServerPassword" value="*******"/ -->
</bean>
</beans>
/**
* The Class Gridwidget.
*/
public class Gridwidget implements EntryPoint {
/** The main. */
private ContentPanel main;
private LayerGridWidget layerGridWidget;
/*
* (non-Javadoc)
*
* @see com.google.gwt.core.client.EntryPoint#onModuleLoad()
*/
public void onModuleLoad() {
GXT.hideLoadingPanel("loading");
GeoGWTConfigurationRemote.Util.getInstance().initServerConfiguration(
new AsyncCallback() {
public void onSuccess(GeoGWTConfiguration result) {
GeoGWTUtils.getInstance().setGlobalConfiguration(result);
/**
* Adding widgets to Viewport panels
*/
main = new ContentPanel();
main.setLayout(new BorderLayout());
main.setHeaderVisible(true);
main.setHeading("GeoGWT GridWidget Example");
createCenter();
main.setWidth(558);
main.setHeight(333);
RootPanel.get("gridpanel").add(main);
}
public void onFailure(Throwable caught) {
Info.display("Configuration Service Error", caught.getMessage());
}
});
}
/**
* Creates the center.
*/
private void createCenter() {
ContentPanel layerGridPanel = new ContentPanel();
layerGridPanel.setMonitorWindowResize(true);
layerGridPanel.setHeaderVisible(false);
layerGridPanel.setFrame(true);
layerGridPanel.setLayout(new FitLayout());
layerGridPanel.setScrollMode(Scroll.NONE);
layerGridPanel.setAutoWidth(true);
layerGridPanel.setHeight(333 - 25);
this.layerGridWidget = new LayerGridWidget(10, 333, LayersManagerServiceRemote.Util
.getInstance());
layerGridPanel.setBottomComponent(this.layerGridWidget.getToolBar());
layerGridPanel.add(this.layerGridWidget.getGrid());
this.layerGridWidget.getLoader().load();
main.add(layerGridPanel);
}
}