protected void bind() { super.bind(); if (bound) { return; } final Display d = (Display) display; d.getCancelEditButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { display.setEditMode(false); display.refresh(); } }); d.getAddButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { boolean down = ((ToggleButton) event.getSource()).isDown(); d.setAddingMode(down); } }); d.getDeleteButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { boolean down = ((ToggleButton) event.getSource()).isDown(); d.setDeletingMode(down); } }); d.getMeasureLengthButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Object source = event.getSource(); if (source instanceof ToggleButton) { ToggleButton button = (ToggleButton) source; if (button.isDown()) { d.startMeasuringDistanceAlongLine(); } else { d.stopMeasuringDistanceAlongLine(); } } } }); d.getMeasureAreaButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Object source = event.getSource(); if (source instanceof ToggleButton) { ToggleButton button = (ToggleButton) source; if (button.isDown()) { d.startMeasuringAreaInPolygon(); } else { d.stopMeasuringAreaInPolygon(); } } } }); d.getShowFlowlinesButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { HasClickHandlers flowLineButton = d.getShowFlowlinesButton(); if (flowLineButton instanceof ToggleButton) { ToggleButton flowButton = (ToggleButton) flowLineButton; if (flowButton.isDown()) { d.showFlowLines(); } else { d.hideFlowLines(); } } else { Window.alert("This button should be a toggle!!"); } } }); d.getDisplayElevationButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { HasClickHandlers button = d.getDisplayElevationButton(); if (button instanceof ToggleButton) { ToggleButton tb = (ToggleButton) button; if (tb.isDown()) { d.startClickingForElevation(); } else { d.stopClickingForElevation(); } } } }); d.getDisplayElevationProfileButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { HasClickHandlers button = d.getDisplayElevationProfileButton(); if (button instanceof ToggleButton) { ToggleButton tb = (ToggleButton) button; if (tb.isDown()) { d.startDrawingElevationProfileLine(); } else { d.stopDrawingElevationProfileLine(); } } } }); d.getFindTextBox() .addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { zoomAndCenterOnElement("node"); } } }); d.getFindNodeButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { zoomAndCenterOnElement("node"); } }); d.getFindChannelButton() .addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { zoomAndCenterOnElement("channel"); d.showInfoPanel(); } }); bound = true; }
public void go(HasWidgets container) { super.go(container); }