List of usage examples for com.google.gwt.user.client.ui PushButton setEnabled
@Override public final void setEnabled(boolean enabled)
From source file:com.dingziran.effective.client.content.widgets.CwCustomButton.java
License:Apache License
/** * Constructor./*from w w w . ja v a 2s. co m*/ * * @param constants the constants */ public CwCustomButton(CwConstants constants) { super(constants.cwCustomButtonName(), constants.cwCustomButtonDescription()); this.constants = constants; view = new ContentWidgetView(hasMargins(), hasScrollableContent()); view.setName(getName()); view.setDescription(getDescription()); setWidget(view); // 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); view.setExample(vpanel); }
From source file:com.google.gerrit.client.changes.ApprovalTable.java
License:Apache License
private void doRemove(ApprovalDetail ad, final PushButton remove) { remove.setEnabled(false); ChangeApi.reviewer(lastChange.legacy_id().get(), ad.getAccount().get()) .delete(new GerritCallback<JavaScriptObject>() { @Override//from w ww . ja v a 2 s . com public void onSuccess(JavaScriptObject result) { reload(); } @Override public void onFailure(final Throwable caught) { remove.setEnabled(true); super.onFailure(caught); } }); }
From source file:com.google.gwt.sample.showcase.client.content.widgets.CwCustomButton.java
License:Apache License
/** * Initialize this example./*from ww w . ja v a2s. c om*/ */ @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; }
From source file:com.googlecode.gwtgl.example.client.AbstractGwtGLExample.java
License:Apache License
/** * Constructs a new instance of a GwtGL example with a launch button and a * Canvas to render on./*from www .j av a2s .co m*/ */ protected AbstractGwtGLExample() { // create the button to launch the example final PushButton button = new PushButton("Launch example!"); setWidget(0, 0, button); WebGLContextAttributes contextAttributes = WebGLContextAttributes.create(); contextAttributes.setAlpha(false); // create the WebGL Canvas webGLCanvas = new WebGLCanvas(contextAttributes, "500px", "500px"); glContext = webGLCanvas.getGlContext(); glContext.viewport(0, 0, 500, 500); setWidget(1, 0, webGLCanvas); // add a ClickHandler to start the example when the button is clicked button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { button.setEnabled(false); start(); webGLCanvas.setFocus(true); } }); }
From source file:de.catma.ui.client.ui.tagger.menu.TagMenuPopup.java
License:Open Source License
public void addTag(final String tagInstanceID) { ClientTagInstance tagInstance = vTagger.getTagInstance(tagInstanceID); Grid grid = new Grid(1, 3); Label l = new HTML("#" + tagInstanceID); grid.setWidget(0, 0, l);//ww w .j a va2 s . com PushButton tagRemoveButton = new PushButton("remove"); //tagRemoveButton.addStyleName("tagger-pushButton"); grid.setWidget(0, 1, tagRemoveButton); HandlerRegistration tagRemoveBtReg = tagRemoveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { vTagger.removeTagInstance(tagInstanceID); hide(); } }); handlerRegistrations.add(tagRemoveBtReg); PushButton tagEditButton = new PushButton("edit"); //tagEditButton.addStyleName("tagger-pushButton"); tagEditButton.setEnabled(false); grid.setWidget(0, 2, tagEditButton); HandlerRegistration tagEditBtReg = tagEditButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { } }); handlerRegistrations.add(tagEditBtReg); root.addItem(grid); root.setState(true); }
From source file:net.s17fabu.vip.gwt.showcase.client.content.widgets.CwCustomButton.java
License:Apache License
/** * Initialize this example.//from ww w . j a va 2 s .c om */ @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(Showcase.images.gwtLogo().createImage()); normalPushButton.ensureDebugId("cwCustomButton-push-normal"); pushPanel.add(normalPushButton); // Add a disabled PushButton PushButton disabledPushButton = new PushButton(Showcase.images.gwtLogo().createImage()); disabledPushButton.ensureDebugId("cwCustomButton-push-disabled"); disabledPushButton.setEnabled(false); pushPanel.add(disabledPushButton); // Add a normal ToggleButton ToggleButton normalToggleButton = new ToggleButton(Showcase.images.gwtLogo().createImage()); normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal"); togglePanel.add(normalToggleButton); // Add a disabled ToggleButton ToggleButton disabledToggleButton = new ToggleButton(Showcase.images.gwtLogo().createImage()); disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled"); disabledToggleButton.setEnabled(false); togglePanel.add(disabledToggleButton); // Return the panel return vpanel; }
From source file:org.gwtlib.client.table.ui.PagingBar.java
License:Apache License
protected Widget createBrowserItemWidget(final int type, boolean enabled) { final ClickHandler clickHandler = new ClickHandler() { public void onClick(ClickEvent event) { switch (type) { case FIRST: _page = 0;/* www .ja v a 2 s . c o m*/ break; case PREV: --_page; break; case NEXT: ++_page; break; case LAST: _page = _pages - 1; break; } fireChange(); } }; PushButton button = new PushButton(); button.setStylePrimaryName(STYLES_BROWSER[type]); button.setEnabled(enabled); if (enabled) button.addClickHandler(clickHandler); return button; }
From source file:org.gwtlib.client.table.ui.PagingBar.java
License:Apache License
protected Widget createGotoWidget() { final TextBox gotoPage = new TextBox(); int maxlen = String.valueOf(computeNumPages()).length(); gotoPage.setMaxLength(maxlen);//from w w w .j a va2 s .c om gotoPage.setVisibleLength(maxlen); final PushButton go = new PushButton(); go.setStylePrimaryName(STYLE_GOTO_BUTTON); go.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setPage(Integer.parseInt(gotoPage.getText()) - 1); gotoPage.setText(""); go.setEnabled(false); fireChange(); } }); go.setEnabled(false); gotoPage.addKeyDownHandler(new KeyDownHandler() { public void onKeyDown(final KeyDownEvent event) { final int keyCode = event.getNativeKeyCode(); DeferredCommand.addCommand(new Command() { public void execute() { int page = -1; try { page = Integer.parseInt(gotoPage.getText()) - 1; } catch (NumberFormatException e) { } go.setEnabled(page >= 0 && page < computeNumPages()); if (keyCode == KeyCodes.KEY_ENTER && go.isEnabled()) { setPage(Integer.parseInt(gotoPage.getText()) - 1); gotoPage.setText(""); go.setEnabled(false); fireChange(); } } }); } }); HorizontalPanel panel = new HorizontalPanel(); panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); panel.add(new HTML(_messages.go())); panel.add(gotoPage); panel.add(go); panel.setStylePrimaryName(STYLE_GOTO); return panel; }
From source file:org.openstreetmap.beboj.client.gui.Toolbar.java
License:GNU General Public License
public Toolbar() { setSpacing(2);/*from w w w . j a v a 2 s . co m*/ Image i1 = new Image("images/download.png"); Image i2 = new Image("images/upload.png"); Image i3 = new Image("images/preference.png"); Image i5 = new Image("images/imagery_menu.png"); Image i7 = new Image("images2/zoom-in.png"); Image i8 = new Image("images2/zoom-out.png"); PushButton t1 = new PushButton(i1, new DownloadCommand()); PushButton t1a = new PushButton("Load sample dataset", new SampleDataSetCommand()); PushButton t2 = new PushButton(i2, new UploadCommand()); PushButton t3 = new PushButton(i3, new PrefCommand()); t3.setEnabled(false); PushButton t4 = new PushButton("Repaint", new RepaintCommand()); PushButton t5 = new PushButton(i5, new ImageryCommand()); PushButton t6 = new PushButton("zoomToData", new ZoomToDataCommand()); PushButton t7 = new PushButton(i7, new ZoomInCommand()); PushButton t8 = new PushButton(i8, new ZoomOutCommand()); add(t1); add(t1a); add(t2); add(t3); add(t4); add(t5); add(t6); add(t7); add(t8); }
From source file:org.openxdata.designer.client.Toolbar.java
private void setDesignSurfaceButtonsEnabled(boolean enabled) { PushButton[] buttons = { btnJustifyLeft, btnJustifyRight, btnAlignTop, btnAlignBottom, btnSameWidth, btnSameHeight, btnSameSize }; for (PushButton b : buttons) b.setEnabled(enabled); }