Java Code Examples for com.google.gwt.user.client.ui.Button
The following examples show how to use
com.google.gwt.user.client.ui.Button. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gwt-boot-samples Source File: DominoRestEntryPoint.java License: Apache License 2.0 | 6 votes |
@Override public void onModuleLoad() { DominoRestConfig.initDefaults(); DominoRestConfig.getInstance().setDefaultServiceRoot("http://localhost:9090/server"); PersonDto coolPerson = new PersonDto(); coolPerson.setDate(new Date()); coolPerson.setName("Lofi"); coolPerson.setPersonType(PersonType.COOL); Button personListButton = new Button("Click me: " + coolPerson.getPersonType().name()); personListButton.addClickHandler(clickEvent -> { logger.info("Hello World: executePersonList"); PersonClientFactory.INSTANCE.getPersons().onSuccess(response -> { response.forEach(p -> logger .info("Person: " + p.getName() + " - Date: " + p.getDate() + " - Type: " + p.getPersonType())); }).onFailed(failedResponse -> { logger.info( "Error: " + failedResponse.getStatusCode() + "\nMessages: " + failedResponse.getStatusText()); }).send(); }); }
Example 2
Source Project: circuitjs1 Source File: AboutBox.java License: GNU General Public License v2.0 | 6 votes |
AboutBox(String version) { super(); vp = new VerticalPanel(); setWidget(vp); vp.setWidth("400px"); vp.add(new HTML("<iframe src=\"help/aboutbox.html\" width=\"400\" height=\"430\" scrolling=\"auto\" frameborder=\"0\"></iframe><br>")); vp.add(okButton = new Button("OK")); okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { close(); } }); center(); show(); }
Example 3
Source Project: circuitjs1 Source File: LicenseDialog.java License: GNU General Public License v2.0 | 6 votes |
LicenseDialog() { super(); vp = new VerticalPanel(); setWidget(vp); setText(sim.LS("License")); vp.setWidth("500px"); vp.add(new HTML("<iframe style=\"border:0;\" src=\"help/license.html\" width=\"500\" height=\"400\" scrolling=\"auto\" frameborder=\"1\"></iframe>")); vp.add(okButton = new Button("OK")); okButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { closeDialog(); } }); center(); show(); }
Example 4
Source Project: appinventor-extensions Source File: GalleryPage.java License: Apache License 2.0 | 6 votes |
/** * Helper method called by constructor to initialize the edit it button * Only seen by app owner. */ private void initEdititButton() { final User currentUser = Ode.getInstance().getUser(); if(app.getDeveloperId().equals(currentUser.getUserId())){ editButton = new Button(MESSAGES.galleryEditText()); editButton.addClickHandler(new ClickHandler() { // Open up source file if clicked the action button public void onClick(ClickEvent event) { editButton.setEnabled(false); Ode.getInstance().switchToGalleryAppView(app, GalleryPage.UPDATEAPP); } }); editButton.addStyleName("app-action-button"); appAction.add(editButton); } }
Example 5
Source Project: unitime Source File: UniTimeHeaderPanel.java License: Apache License 2.0 | 6 votes |
private Button addButton(String operation, String name, Character accessKey, String width, ClickHandler clickHandler) { Button button = new AriaButton(name); button.addClickHandler(clickHandler); ToolBox.setWhiteSpace(button.getElement().getStyle(), "nowrap"); if (accessKey != null) button.setAccessKey(accessKey); if (width != null) ToolBox.setMinWidth(button.getElement().getStyle(), width); iOperations.put(operation, iButtons.getWidgetCount()); iClickHandlers.put(operation, clickHandler); iButtons.add(button); button.getElement().getStyle().setMarginLeft(4, Unit.PX); for (UniTimeHeaderPanel clone: iClones) { Button clonedButton = clone.addButton(operation, name, null, width, clickHandler); clonedButton.addKeyDownHandler(iKeyDownHandler); } button.addKeyDownHandler(iKeyDownHandler); return button; }
Example 6
Source Project: appinventor-extensions Source File: GalleryList.java License: Apache License 2.0 | 6 votes |
/** * Creates the GUI components for search tab. * * @param searchApp: the FlowPanel that search tab will reside. */ private void addGallerySearchTab(FlowPanel searchApp) { // Add search GUI FlowPanel searchPanel = new FlowPanel(); final TextBox searchText = new TextBox(); searchText.addStyleName("gallery-search-textarea"); Button sb = new Button(MESSAGES.gallerySearchForAppsButton()); searchPanel.add(searchText); searchPanel.add(sb); searchPanel.addStyleName("gallery-search-panel"); searchApp.add(searchPanel); appSearchContent.addStyleName("gallery-search-results"); searchApp.add(appSearchContent); searchApp.addStyleName("gallery-search"); sb.addClickHandler(new ClickHandler() { // @Override public void onClick(ClickEvent event) { gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true); } }); }
Example 7
Source Project: swellrt Source File: DialogBox.java License: Apache License 2.0 | 6 votes |
/** * Creates dialog box. * * @param popup - UniversalPopup on which the dialog is based * @param title - title placed in the title bar * @param innerWidget - the inner widget of the dialog * @param dialogButtons - buttons */ static public void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) { // Title popup.getTitleBar().setTitleText(title); VerticalPanel contents = new VerticalPanel(); popup.add(contents); // Message contents.add(innerWidget); // Buttons HorizontalPanel buttonPanel = new HorizontalPanel(); for(DialogButton dialogButton : dialogButtons) { Button button = new Button(dialogButton.getTitle()); button.setStyleName(Dialog.getCss().dialogButton()); buttonPanel.add(button); dialogButton.link(button); } contents.add(buttonPanel); buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel()); contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT); }
Example 8
Source Project: appinventor-extensions Source File: MockForm.java License: Apache License 2.0 | 6 votes |
TitleBar() { title = new Label(); title.setStylePrimaryName("ode-SimpleMockFormTitle"); title.setHorizontalAlignment(Label.ALIGN_LEFT); menuButton = new Button(); menuButton.setText("\u22ee"); menuButton.setStylePrimaryName("ode-SimpleMockFormMenuButton"); bar = new AbsolutePanel(); bar.add(title); bar.add(menuButton); initWidget(bar); setStylePrimaryName("ode-SimpleMockFormTitleBar"); setSize("100%", TITLEBAR_HEIGHT + "px"); }
Example 9
Source Project: unitime Source File: UniTimeMobileMenu.java License: Apache License 2.0 | 6 votes |
public UniTimeMobileMenu() { iMenuButton = new Button(MESSAGES.mobileMenuSymbol()); iMenuButton.addStyleName("unitime-MobileMenuButton"); iMenuButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (iStackPanel.isVisible()) hideMenu(); else showMenu(); } }); iStackPanel = new MyStackPanel(); iStackPanel.setVisible(false); initWidget(iMenuButton); }
Example 10
Source Project: document-management-system Source File: DebugConsolePopup.java License: GNU General Public License v2.0 | 6 votes |
/** * Logout popup */ public DebugConsolePopup() { // Establishes auto-close when click outside super(false, false); setText(Main.i18n("debug.console.label")); vPanel = new VerticalPanel(); button = new Button(Main.i18n("button.close"), this); text = new HTML(Main.i18n("debug.enable.disable")); vPanel.add(new HTML("<br>")); vPanel.add(text); vPanel.add(Log.getLogger(DivLogger.class).getWidget()); vPanel.add(new HTML("<br>")); vPanel.add(button); vPanel.add(new HTML("<br>")); vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER); button.setStyleName("okm-YesButton"); super.hide(); Log.getLogger(DivLogger.class).getWidget().setVisible(true); setWidget(vPanel); }
Example 11
Source Project: document-management-system Source File: LogoutPopup.java License: GNU General Public License v2.0 | 6 votes |
/** * Logout popup */ public LogoutPopup() { // Establishes auto-close when click outside super(false, true); vPanel = new VerticalPanel(); text = new HTML(Main.i18n("logout.logout")); button = new Button(Main.i18n("button.close"), this); vPanel.setWidth("250px"); vPanel.setHeight("100px"); vPanel.add(new HTML("<br>")); vPanel.add(text); vPanel.add(new HTML("<br>")); vPanel.add(button); vPanel.add(new HTML("<br>")); vPanel.setCellHorizontalAlignment(text, VerticalPanel.ALIGN_CENTER); vPanel.setCellHorizontalAlignment(button, VerticalPanel.ALIGN_CENTER); button.setStyleName("okm-YesButton"); super.hide(); setWidget(vPanel); }
Example 12
Source Project: codenvy Source File: BadConnectionNotifierViewImpl.java License: Eclipse Public License 1.0 | 6 votes |
@Inject public BadConnectionNotifierViewImpl( final HostedLocalizationConstant localizationConstant, final PromptToLoginViewImplUiBinder uiBinder, final HostedResources resources) { this.resources = resources; this.setWidget(uiBinder.createAndBindUi(this)); final Button okButton = createButton( localizationConstant.okButtonTitle(), "ok-button", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onOkClicked(); } }); okButton.addStyleName(this.resources.hostedCSS().blueButton()); addButtonToFooter(okButton); }
Example 13
Source Project: jolie Source File: Echoes.java License: GNU Lesser General Public License v2.1 | 6 votes |
private void createLyricsDialog() { lyricsDialog = new DialogBox(); VerticalPanel vPanel = new VerticalPanel(); vPanel.setHeight( "100%" ); vPanel.setHorizontalAlignment( VerticalPanel.ALIGN_CENTER ); vPanel.setVerticalAlignment( VerticalPanel.ALIGN_MIDDLE ); lyricsDialog.add( vPanel ); lyrics = new HTML(); ScrollPanel scrollPanel = new ScrollPanel(); scrollPanel.setWidth( "300px" ); scrollPanel.setHeight( "250px" ); scrollPanel.add( lyrics ); vPanel.add( scrollPanel ); Button close = new NativeButton( "Close" ); close.addClickListener( new ClickListener() { public void onClick( Widget arg0 ) { lyricsDialog.hide(); } } ); vPanel.add( close ); }
Example 14
Source Project: incubator-retired-wave Source File: DialogBox.java License: Apache License 2.0 | 6 votes |
/** * Creates dialog box. * * @param popup - UniversalPopup on which the dialog is based * @param title - title placed in the title bar * @param innerWidget - the inner widget of the dialog * @param dialogButtons - buttons */ static public void create(UniversalPopup popup, String title, Widget innerWidget, DialogButton[] dialogButtons) { // Title popup.getTitleBar().setTitleText(title); VerticalPanel contents = new VerticalPanel(); popup.add(contents); // Message contents.add(innerWidget); // Buttons HorizontalPanel buttonPanel = new HorizontalPanel(); for(DialogButton dialogButton : dialogButtons) { Button button = new Button(dialogButton.getTitle()); button.setStyleName(Dialog.getCss().dialogButton()); buttonPanel.add(button); dialogButton.link(button); } contents.add(buttonPanel); buttonPanel.setStyleName(Dialog.getCss().dialogButtonPanel()); contents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT); }
Example 15
Source Project: gwt-boot-samples Source File: BasicGwtEntryPoint.java License: Apache License 2.0 | 5 votes |
@Override public void onModuleLoad() { Button button = new Button("Click me"); button.addClickHandler(clickEvent -> { Window.alert("Hello World!"); logger.info("Hello World!"); }); RootPanel.get("helloButton").add(button); }
Example 16
Source Project: core Source File: LogFilePanel.java License: GNU Lesser General Public License v2.1 | 5 votes |
private Button hiddenButton(String action, String styleName) { Button button = new Button(); button.setStyleName(styleName); button.getElement().setAttribute("action", action); button.setVisible(false); return button; }
Example 17
Source Project: hawkbit Source File: GridButtonRenderer.java License: Eclipse Public License 1.0 | 5 votes |
@Override public Button createWidget() { Button b = GWT.create(Button.class); b.addClickHandler(this); b.setStylePrimaryName("v-nativebutton"); return b; }
Example 18
Source Project: gwt-traction Source File: SingleListBoxDemo.java License: Apache License 2.0 | 5 votes |
private Button createSelectButton(final String value) { Button ret = new Button("setValue(\"" + value + "\",true)"); ret.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { singleListBox.setValue(value, true); } }); return ret; }
Example 19
Source Project: swcv Source File: WordCloudDetailApp.java License: MIT License | 5 votes |
private void createUpdateWordCloudButton() { Button sendButton = Button.wrap(Document.get().getElementById("btn_create_new_wc")); sendButton.removeStyleName("invisible"); sendButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { updateWordCloud(false); } }); }
Example 20
Source Project: core Source File: SignInPageView.java License: GNU Lesser General Public License v2.1 | 5 votes |
@Inject public SignInPageView() { userNameField = new TextBox(); passwordField = new PasswordTextBox(); signInButton = new Button("Sign in"); signInButton.setStyleName("default-button"); userNameField.setText("admin"); panel.add(userNameField, "userNameFieldContainer"); panel.add(passwordField, "passwordFieldContainer"); panel.add(signInButton, "signInButtonContainer"); panel.sinkEvents(Event.ONKEYDOWN); // dev options /*checkbox = new CheckBox(); checkbox.addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { presenter.setBootStandalone(checkbox.getValue()); } }); */ HorizontalPanel options = new HorizontalPanel(); options.getElement().setAttribute("style", "margin-top:20px; vertical-align:bottom;"); options.getElement().setAttribute("align", "center"); HTML version = new HTML("Version TBD"); version.getElement().setAttribute("style", "color:#cccccc;font-size:10px; align:center"); options.add(version); panel.add(options); }
Example 21
Source Project: gwt-traction Source File: ColorDemo.java License: Apache License 2.0 | 5 votes |
@Override public void onModuleLoad() { Panel controls = RootPanel.get("controls"); startColor = createTextBox("rgba(255,255,0,1)"); endColor = createTextBox("rgba(255,0,255,0)"); duration = createTextBox("5000"); addTextBox(controls, "Start Color", startColor); addTextBox(controls, "End Color", endColor); addTextBox(controls, "Duration", duration); Button start = new Button("Start"); start.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ColorAnimation animation = new ColorAnimation(new Element[] { Document.get().getElementById("box1"), Document.get().getElementById("box2"), Document.get().getElementById("box3") }, "backgroundColor", RgbaColor.from(startColor.getText()), RgbaColor.from(endColor.getText())); animation.run(Integer.parseInt(duration.getText())); } }); controls.add(start); }
Example 22
Source Project: incubator-retired-wave Source File: DialogBox.java License: Apache License 2.0 | 5 votes |
void link(Button button) { this.button = button; button.setText(title); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { execute(); } }); }
Example 23
Source Project: EasyML Source File: JobDescPopupPanel.java License: Apache License 2.0 | 5 votes |
public JobDescPopupPanel(String title) { Label label = new Label(title); label.setStyleName("bda-newjob-head"); verticalPanel.add(label); verticalPanel.add(createGrid()); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setStyleName("bda-newjob-hpanel"); verticalPanel.add(errorLabel); Button cancelBtn = new Button(Constants.studioUIMsg.cancel()); cancelBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { JobDescPopupPanel.this.hide(); } }); hpanel.add(submitBtn); hpanel.add(cancelBtn); submitBtn.removeStyleName("gwt-Button"); cancelBtn.removeStyleName("gwt-Button"); submitBtn.addStyleName("button-style"); cancelBtn.addStyleName("button-style"); errorLabel.setStyleName("error-label"); verticalPanel.add(hpanel); verticalPanel.addStyleName("bda-newjob"); this.setCloseEnable(false); }
Example 24
Source Project: core Source File: StreamingProgress.java License: GNU Lesser General Public License v2.1 | 5 votes |
public StreamingProgress(final LogStore logStore, int timeout) { super(false, true); this.timeout = timeout; setWidth(WIDTH + "px"); setHeight(HEIGHT + "px"); setGlassEnabled(true); setId(getElement(), WINDOW, BASE_ID, "stream_in_progress"); setStyleName("default-window"); FlowPanel content = new FlowPanel(); content.addStyleName("stream-log-file-pending"); content.add(new Pending(Console.CONSTANTS.downloadInProgress())); cancel = new Button(Console.CONSTANTS.common_label_cancel()); setId(cancel.getElement(), BUTTON, BASE_ID, "cancel_stream"); cancel.addStyleName("cancel"); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { PendingStreamingRequest request = logStore.getPendingStreamingRequest(); if (request != null) { request.cancel(); done(); } } }); content.add(cancel); setWidget(content); }
Example 25
Source Project: sc2gears Source File: ClientUtils.java License: Apache License 2.0 | 5 votes |
/** * Creates and returns a {@link Button} which when activated closes the specified dialog box. * @param dialogBox dialog box to close when the close button is activated * @param buttonText text of the close button * @return a button which when activated closes the specified dialog box */ public static Button createDialogCloseButton( final DialogBox dialogBox, final String buttonText ) { return new Button( buttonText, new ClickHandler() { @Override public void onClick( final ClickEvent event ) { dialogBox.hide(); } } ); }
Example 26
Source Project: gwt-traction Source File: GroupedListBoxDemo.java License: Apache License 2.0 | 5 votes |
@Override public void onModuleLoad() { groupedListBox1 = new GroupedListBox(false); groupedListBox2 = new GroupedListBox(true); RootPanel.get("select1").add(groupedListBox1); RootPanel.get("select2").add(groupedListBox2); addItem("Fruits|Apples"); addItem("Fruits|Bananas"); addItem("Fruits|Oranges"); addItem("Fruits|Pears"); addItem("Vegetables|Tomatoes"); addItem("Vegetables|Carrots"); Panel controls = RootPanel.get("controls"); controls.add(createAddButton("Fruits|Blueberries")); controls.add(createAddButton("Vegetables|Broccoli")); controls.add(createAddButton("Meats|Chicken")); controls.add(createAddButton("Meats|Turkey")); Button remove = new Button("Remove Selected"); remove.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { removeSelected(); } }); controls.add(remove); }
Example 27
Source Project: sc2gears Source File: ClientUtils.java License: Apache License 2.0 | 5 votes |
/** * Adds a {@link KeyPressHandler} to the specified widget which calls {@link Button#click()} on <code>targetButton</code> * when the Enter key is pressed. * @param widget widget to add the key handler to * @param targetButton target button to activate when the enter key is pressed */ public static void addEnterTarget( final HasKeyPressHandlers widget, final Button targetButton ) { widget.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress( final KeyPressEvent event ) { if ( event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER ) targetButton.click(); } } ); }
Example 28
Source Project: swcv Source File: WordCloudDetailApp.java License: MIT License | 5 votes |
private void createRandomWordCloudButton() { Button sendButton = Button.wrap(Document.get().getElementById("btn_create_random_wc")); sendButton.removeStyleName("invisible"); sendButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { updateWordCloud(true); } }); }
Example 29
Source Project: appinventor-extensions Source File: GalleryPage.java License: Apache License 2.0 | 5 votes |
/** * Helper method called by constructor to initialize the app's comment area */ private void initAppComments() { // App details - comments appDetails.add(appComments); appComments.addStyleName("app-comments-wrapper"); Label commentsHeader = new Label("Comments and Reviews"); commentsHeader.addStyleName("app-comments-header"); appComments.add(commentsHeader); final TextArea commentTextArea = new TextArea(); commentTextArea.addStyleName("app-comments-textarea"); appComments.add(commentTextArea); Button commentSubmit = new Button("Submit my comment"); commentSubmit.addStyleName("app-comments-submit"); commentSubmit.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final OdeAsyncCallback<Long> commentPublishCallback = new OdeAsyncCallback<Long>( // failure message MESSAGES.galleryError()) { @Override public void onSuccess(Long date) { // get the new comment list so gui updates // note: we might modify the call to publishComment so it returns // the list instead, this would save one server call gallery.GetComments(app.getGalleryAppId(), 0, 100); } }; Ode.getInstance().getGalleryService().publishComment(app.getGalleryAppId(), commentTextArea.getText(), commentPublishCallback); } }); appComments.add(commentSubmit); // Add list of comments gallery.GetComments(app.getGalleryAppId(), 0, 100); appComments.add(appCommentsList); appCommentsList.addStyleName("app-comments"); }
Example 30
Source Project: appinventor-extensions Source File: GalleryPage.java License: Apache License 2.0 | 5 votes |
/** * Helper method called by constructor to initialize the publish button */ private void initUpdateButton() { actionButton = new Button(MESSAGES.galleryUpdateText()); actionButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if(!checkIfReadyToPublishOrUpdateApp(app)){ return; } actionButton.setEnabled(false); actionButton.setText(MESSAGES.galleryAppUpdating()); final OdeAsyncCallback<Void> updateSourceCallback = new OdeAsyncCallback<Void>( MESSAGES.galleryError()) { @Override public void onSuccess(Void result) { gallery.appWasChanged(); // to update the gallery list and page Ode.getInstance().switchToGalleryAppView(app, GalleryPage.VIEWAPP); } @Override public void onFailure(Throwable caught) { Window.alert(MESSAGES.galleryNoExtensionsPlease()); actionButton.setEnabled(true); actionButton.setText(MESSAGES.galleryUpdateText()); } }; Ode.getInstance().getGalleryService().updateApp(app,imageUploaded,updateSourceCallback); } }); actionButton.addStyleName("app-action-button"); appAction.add(actionButton); }