public Application() {
}
public void onModuleLoad() {
VLayout mainLayout = new VLayout();
mainLayout.setWidth100();
mainLayout.setHeight100();
mainLayout.setBackgroundColor("#A0A0A0");
HLayout layout = new HLayout();
layout.setWidth100();
layout.setHeight100();
layout.setMembersMargin(10);
layout.setMargin(10);
// ---------------------------------------------------------------------
// Create the left-side (map and tabs):
// ---------------------------------------------------------------------
final MapWidget map = new MapWidget("mapMain", "app");
final Toolbar toolbar = new Toolbar(map);
toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);
toolbar.setBackgroundColor("#647386");
toolbar.setBackgroundImage("");
toolbar.setBorder("0px");
map.getMapModel().addMapModelHandler(new MapModelHandler() {
public void onMapModelChange(MapModelEvent event) {
Label title = new Label("Geomajas GWT: hello world");
title.setStyleName("appTitle");
title.setWidth(260);
toolbar.addFill();
toolbar.addMember(title);
GetMapImageAction getMapImage = new GetMapImageAction(map);
toolbar.addSeparator();
toolbar.addActionButton(getMapImage);
GetLegendImageAction getLegendImageAll = new GetLegendImageAction(map, true);
toolbar.addSeparator();
toolbar.addActionButton(getLegendImageAll);
GetLegendImageAction getLegendImage = new GetLegendImageAction(map, false);
toolbar.addSeparator();
toolbar.addActionButton(getLegendImage);
// switch all labels on
for (Layer layer : map.getMapModel().getLayers()) {
layer.setLabeled(true);
}
}
});
map.getMapModel().addLayerSelectionHandler(new LayerSelectionHandler() {
public void onSelectLayer(LayerSelectedEvent event) {
for (Layer layer : map.getMapModel().getLayers()) {
if (layer.isSelected()) {
layer.setVisible(true);
} else {
layer.setVisible(false);
}
}
}
public void onDeselectLayer(LayerDeselectedEvent event) {
}
});
VLayout mapLayout = new VLayout();
mapLayout.addMember(toolbar);
mapLayout.addMember(map);
mapLayout.setHeight("65%");
VLayout leftLayout = new VLayout();
leftLayout.setBorder("10px solid #777777");
leftLayout.setStyleName("round_corner");
leftLayout.addMember(mapLayout);
layout.addMember(leftLayout);
// Add a search panel to the top-right of the map:
SearchPanel searchPanel = new SearchPanel(map.getMapModel(), mapLayout);