/** * panel with a {@link #sensorOnOff "sensor-on-off" button}, a {@link #captionLabel label} with * the name of the sensor and a {@link #collapse button} to expand/collapse the settings for this * sensor. if sensor is turned off, it stops logging the data values of this sensor. */ private void addCaption() { FlowPanel caption = new FlowPanel(); caption.addStyleName("panelTitle"); this.captionLabel = new Label(); updateCaptionLabel(); collapse = new ToggleButton( new Image(GuiResources.INSTANCE.collapse()), new Image(GuiResources.INSTANCE.expand())); collapse.addStyleName("collapse"); collapse.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { dataValues.setVisible(!collapse.isDown()); } }); sensorOnOff = new SimplePanel(); sensorON = new Image(AppResources.INSTANCE.shown()); sensorOFF = new Image(AppResources.INSTANCE.hidden()); sensorOnOff.add(sensorOFF); sensorOnOff.addStyleName("sensorOnOffButton"); caption.add(sensorOnOff); caption.add(this.captionLabel); caption.add(collapse); this.add(caption); }
private void initEditorToggle() { final RootPanel togglePanel = RootPanel.get("paramsToggleButton"); editorToggle = new ToggleButton(new Image("images/triright.png"), new Image("images/tridown.png")); editorToggle.setDown(false); editorToggle.addStyleName("toggle-button"); togglePanel.add(editorToggle); editorToggle.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { paramsEditor.setEditorExpanded(editorToggle.isDown()); } }); }
public HideShowAnnotationsButton(final AnnotationController annotationController) { final TranslationConstants translationConstants = GWT.create(TranslationConstants.class); final ToggleButton button = new ToggleButton( translationConstants.showAnnotations(), translationConstants.hideAnnotations()); button.setStyleName("annotation-hide-show-button"); button.setDown(annotationController.isAnnotationsVisible()); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (button.isDown()) { showAnnotations(); } else { hideAnnotations(); } } }); initWidget(button); }
public CompositeToggleButton(String leftText, String rightText, final boolean ask) { holder = new HorizontalPanel(); holder.setStyleName("tae-Composite-ToggleButton"); holder.addStyleName("no-Padding"); initWidget(holder); left = new com.google.gwt.user.client.ui.ToggleButton(leftText); left.setStylePrimaryName("tae-Composite-ToggleButton-Left"); holder.add(left); right = new com.google.gwt.user.client.ui.ToggleButton(rightText); right.setStylePrimaryName("tae-Composite-ToggleButton-Right"); holder.add(right); left.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (ask) { new ConfirmDialog( new ConfirmDialog.RequiresUserResponse() { @Override public void onResponse(boolean response) { if (response) { setValue(true, true); } else { setValue(false, true); } } }, "Are you sure you want to change task status?", "YES", "NO"); } else { setValue(true, true); } } }); right.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (ask) { new ConfirmDialog( new ConfirmDialog.RequiresUserResponse() { @Override public void onResponse(boolean response) { if (response) { setValue(false, true); } else { setValue(true, true); } } }, "Are you sure you want to change task status?", "YES", "NO"); } else { setValue(false, true); } } }); }