public LASAnnotationsButton() { mainPanel.add(layoutPanel); annotationsButton = new ToggleButton(new Image(GWT.getModuleBaseURL()+"../images/i_off.png"), new Image(GWT.getModuleBaseURL()+"../images/i_on.png"), new ClickHandler() { @Override public void onClick(ClickEvent event) { if ( annotationsButton.isDown() ) { setOpen(true); annotationsButton.setTitle(DEFAULT_UP_TOOLTIP); } else { setOpen(false); annotationsButton.setTitle(DEFAULT_DOWN_TOOLTIP); } } }); annotationsButton.setTitle(DEFAULT_UP_TOOLTIP); annotationsButton.setStylePrimaryName("OL_MAP-ToggleButton"); annotationsButton.addStyleDependentName("WIDTH"); initWidget(annotationsButton); }
public LASAnnotationsButtonPanelImpl(String outputPanelID) { setName(outputPanelID); String moduleBaseURL = GWT.getModuleBaseURL(); String upImageURL = moduleBaseURL + "../images/i_off.png"; Image upImage = new Image(upImageURL); String downImageURL = moduleBaseURL + "../images/i_on.png"; Image downImage = new Image(downImageURL); button = new ToggleButton( upImage, downImage); button.setTitle("Plot Annotations"); button.setStylePrimaryName("OL_MAP-ToggleButton"); button.addStyleDependentName("WIDTH"); button.addValueChangeHandler(new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { annotations.setVisible(button.isDown()); } }); initWidget(button); }
/** * Sets the selected Data Source type button to the down position. * This method does not fire an event, just changes toggle position * @param dsType the data source type */ public void setSelectedDataSourceType(String dsType) { if(dsType!=null) { // de-select all toggle buttons deselectDSTypeButtons(); // Set new button toggle state down for(ToggleButton tButton : dsTypeButtons) { String buttonId = tButton.getElement().getId(); if(buttonId.equals(dsType)) { tButton.setValue(true); this.selectedSourceType = dsType; } } } updateStatus(); }
public ButtonsExample() { super("Buttons"); Button button = new Button("Disabled button"); button.setEnabled(false); add(button); CheckBox check = new CheckBox("Check box"); check.setChecked(true); add(check); PushButton push = new PushButton("Click me", "Clicked"); add(push); ToggleButton toggle = new ToggleButton("Up", "Down"); add(toggle); }
/** * {@inheritDoc} */ @Override protected void addComponentListeners() { ComboBoxSelectItem value = getSelectedValue(); ToggleButton button = getChoiceButton(); getListPanel().addChangeHandler(getDelegateHandler()); //value.addChangeHandler(getDelegateHandler()); button.addFocusHandler(getDelegateHandler()); value.addFocusHandler(getDelegateHandler()); button.addBlurHandler(getDelegateHandler()); value.addBlurHandler(getDelegateHandler()); value.addClickHandler(getDelegateHandler()); button.addClickHandler(getDelegateHandler()); value.addKeyUpHandler(getDelegateHandler()); value.addKeyDownHandler(getDelegateHandler()); value.addKeyPressHandler(getDelegateHandler()); }
@Override public void onClick(ClickEvent event) { ToggleButton button = (ToggleButton) event.getSource(); int index = buttons.indexOf(button); if ( button.isDown() ) { enable(index); } else { disable(index, true); } }
@Override public void buildPanel() { viewerPanel = new ViewerPanel(); showCartographicPositionOnMouseOver(); _showPosOnMouseOverTBtn = new ToggleButton("Show Cartographic Position on Mouse Over"); _showPosOnMouseOverTBtn.setValue(true); _showPosOnMouseOverTBtn.addValueChangeHandler(new MValueChangeHandler()); _pickEntityTBtn = new ToggleButton("Pick Entity"); _pickEntityTBtn.addValueChangeHandler(new MValueChangeHandler()); _drillDownPickingTBtn = new ToggleButton("Drill-Down Picking"); _drillDownPickingTBtn.addValueChangeHandler(new MValueChangeHandler()); _pickPositionTBtn = new ToggleButton("Pick position"); _pickPositionTBtn.addValueChangeHandler(new MValueChangeHandler()); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(_showPosOnMouseOverTBtn); hPanel.add(_pickEntityTBtn); hPanel.add(_drillDownPickingTBtn); hPanel.add(_pickPositionTBtn); AbsolutePanel aPanel = new AbsolutePanel(); aPanel.add(viewerPanel); aPanel.add(hPanel, 20, 20); contentPanel.add(new HTML("<p>Use the mouse to select and manipulate objects in the scene.</p>")); contentPanel.add(aPanel); initWidget(contentPanel); }
@Override public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) { ToggleButton source = (ToggleButton) valueChangeEvent.getSource(); reset(); if (source.equals(_showPosOnMouseOverTBtn)) { showCartographicPositionOnMouseOver(); _pickEntityTBtn.setValue(false); _drillDownPickingTBtn.setValue(false); _pickPositionTBtn.setValue(false); } else if (source.equals(_pickEntityTBtn)) { pickEntity(); _showPosOnMouseOverTBtn.setValue(false); _drillDownPickingTBtn.setValue(false); _pickPositionTBtn.setValue(false); } else if (source.equals(_drillDownPickingTBtn)) { drillDownPicking(); _showPosOnMouseOverTBtn.setValue(false); _pickEntityTBtn.setValue(false); _pickPositionTBtn.setValue(false); } else if (source.equals(_pickPositionTBtn)) { pickPosition(); _showPosOnMouseOverTBtn.setValue(false); _pickEntityTBtn.setValue(false); _drillDownPickingTBtn.setValue(false); } }
private void deselectDSTypeButtons() { // First de-select all to clear current toggle for(ToggleButton tButton : dsTypeButtons) { tButton.setValue(false); } // Also make sure addType button is unToggled if(this.addTypeButton!=null) { this.addTypeButton.setValue(false); } }
private void addTabButton(ToggleButton p_button, String p_title) { p_button.addValueChangeHandler( this ); p_button.setTitle( p_title ); p_button.setStyleName( "fmp-PushButton32" ); m_vTabPanel.add( p_button ); }
/** Method to create a Toggle button for the toolbar **/ private ToggleButton createToggleButton(String url, Integer top, Integer left, Integer width, Integer height, String tip) { Image extract = new Image(url, left, top, width, height); ToggleButton tb = new ToggleButton(extract); tb.setHeight(height+"px"); tb.setWidth(width+"px"); tb.addClickHandler(evHandler); if (tip != null) { tb.setTitle(tip); } return tb; }
public void setOpen(ToggleButton annotationsButton) { this.setVisible(true); }
private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) { ToggleButton tb = new ToggleButton(img.createImage()); tb.addClickListener(listener); tb.setTitle(tip); return tb; }
private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) { ToggleButton tb = new ToggleButton(img.createImage()); tb.addClickHandler(handler); tb.setTitle(tip); return tb; }
private ToggleButton createToggleButton(ImageResource img, String tip) { ToggleButton tb = new ToggleButton(new Image(img)); tb.addClickHandler(handler); tb.setTitle(tip); return tb; }
/** * Initialize this example. */ @ShowcaseSource @Override public Widget onInitialize() { // Create a panel to layout the widgets VerticalPanel vpanel = new VerticalPanel(); HorizontalPanel pushPanel = new HorizontalPanel(); pushPanel.setSpacing(10); HorizontalPanel togglePanel = new HorizontalPanel(); togglePanel.setSpacing(10); // Combine all the panels vpanel.add(new HTML(constants.cwCustomButtonPush())); vpanel.add(pushPanel); vpanel.add(new HTML("<br><br>" + constants.cwCustomButtonToggle())); vpanel.add(togglePanel); // Add a normal PushButton PushButton normalPushButton = new PushButton( new Image(Showcase.images.gwtLogo())); normalPushButton.ensureDebugId("cwCustomButton-push-normal"); pushPanel.add(normalPushButton); // Add a disabled PushButton PushButton disabledPushButton = new PushButton( new Image(Showcase.images.gwtLogo())); disabledPushButton.ensureDebugId("cwCustomButton-push-disabled"); disabledPushButton.setEnabled(false); pushPanel.add(disabledPushButton); // Add a normal ToggleButton ToggleButton normalToggleButton = new ToggleButton( new Image(Showcase.images.gwtLogo())); normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal"); togglePanel.add(normalToggleButton); // Add a disabled ToggleButton ToggleButton disabledToggleButton = new ToggleButton( new Image(Showcase.images.gwtLogo())); disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled"); disabledToggleButton.setEnabled(false); togglePanel.add(disabledToggleButton); // Return the panel return vpanel; }
@Override public ToggleButton getOptionsButton() { return options_button; }
@Override public ToggleButton getAnnotationsButton() { return anno_button; }
@Override public ToggleButton getMetadataButton() { return meta_button; }
@Override public ToggleButton getTextAnnotationsButton() { return text_button; }
/** * Creates a {@link ToggleButton} with the specified face images and * stylename. * * @param upImage * the image to be used on the up face * @param hvImage * the image to be used on the hover face * @param dnImage * the image to be used on the down face * @param styleName * the stylename to use for the widget * @param handler * a click handler to which to bind the button * @return the button */ public static ToggleButton createToggleButtonWithImageStates(Image upImage, Image hvImage, Image dnImage, String styleName, ClickHandler handler) { final ToggleButton button = createToggleButtonWithImageStates(upImage, hvImage, styleName, handler); button.getDownFace().setImage(dnImage); return button; }
/** * Creates a {@link ToggleButton} with the specified face images and * stylename. * * @param upImage * the image to be used on the up face * @param hvImage * the image to be used on the hover face * @param styleName * the stylename to use for the widget * @param handler * a click handler to which to bind the button * @return the button */ public static ToggleButton createToggleButtonWithImageStates(Image upImage, Image hvImage, String styleName, ClickHandler handler) { final ToggleButton button = createToggleButtonWithImageStates(upImage, styleName, handler); button.getUpHoveringFace().setImage(hvImage); return button; }
/** * Creates a {@link ToggleButton} with the specified face images and * stylename. * * @param upImage * the image to be used on the up face * @param styleName * the stylename to use for the widget * @param handler * a click handler to which to bind the button * @return the button */ public static ToggleButton createToggleButtonWithImageStates(Image upImage, String styleName, ClickHandler handler) { final ToggleButton button = new ToggleButton(upImage, handler); button.setStyleName(styleName); return button; }
/** * Gets the button that is used to show and hide the surface list view. * * @return */ public ToggleButton getButton() { return button; }
ToggleButton getOptionsButton();
ToggleButton getAnnotationsButton();
ToggleButton getMetadataButton();
ToggleButton getTextAnnotationsButton();