List of usage examples for com.google.gwt.user.client.ui Button Button
public Button(String html, ClickHandler handler)
From source file:client.template.dialog.ErrorDialog.java
License:Open Source License
public ErrorDialog(final String title, final Throwable caught) { String message;/* w w w . j av a2s. c o m*/ if ((null == caught.getMessage()) || ("" == caught.getMessage())) { message = "Unknown reason (" + caught.toString() + ")"; } else { message = caught.getMessage(); } GuiLogger.errorLog(message); message = StringUtils.escape(message); String stackTrace = null; try { final GuiException ex = (GuiException) caught; stackTrace = ex.getStackTraceString(); } catch (final Exception e) { stackTrace = GuiException.exception2string(caught); } this.setText(title); this.vPanel.add(new HTML(message + "<br> <br>")); if ((null != stackTrace) && ("" != stackTrace)) { final DisclosurePanel details = new DisclosurePanel("Details"); final HTML stackTraceWidget = new HTML(stackTrace); stackTraceWidget.setStyleName("gui-ErrorPanel"); details.add(stackTraceWidget); this.vPanel.add(details); } this.vPanel.setStyleName("gwt-DialogBoxContent"); this.vPanel.add(new Button("Close", new ClickListener() { public void onClick(final Widget sender) { ErrorDialog.this.hide(); } })); this.setWidget(this.vPanel); }
From source file:client.template.dialog.InfoDialog.java
License:Open Source License
public InfoDialog(final String title, final String text) { this.text = title + " " + text; // this.setTitle(title); this.setText(title); this.vPanel.add(new HTML(text)); this.vPanel.setStyleName("gwt-DialogBoxContent"); this.vPanel.add(new Button("Close", new ClickListener() { public void onClick(final Widget sender) { InfoDialog.this.hide(); }// w w w. j av a2 s . c o m })); this.setWidget(this.vPanel); }
From source file:client.template.dialog.InfoDialog.java
License:Open Source License
public InfoDialog(final String title, final HTML html) { this.text = title + " " + html.getText(); this.setText(title); this.vPanel.add(html); this.vPanel.setStyleName("gwt-DialogBoxContent"); this.vPanel.add(new Button("Close", new ClickListener() { public void onClick(final Widget sender) { InfoDialog.this.hide(); }/*from w ww . jav a 2 s. com*/ })); this.setWidget(this.vPanel); }
From source file:client.template.dialog.LoginDialog.java
License:Open Source License
public LoginDialog(final String title) { this.setText(title); final FlexTable panel = new FlexTable(); panel.setStyleName("gwt-DialogBoxContent"); this.username = new TextBox(); this.password = new PasswordTextBox(); panel.setWidget(0, 0, new Label("Username ")); panel.setWidget(0, 1, this.username); panel.setWidget(1, 0, new Label("Password ")); panel.setWidget(1, 1, this.password); panel.setWidget(2, 0, new Button("Close", new ClickListener() { public void onClick(final Widget sender) { LoginDialog.this.hide(); }/*w w w.j a v a2s .c o m*/ })); panel.setWidget(2, 1, new Button("Sign In", new ClickListener() { public void onClick(final Widget sender) { LoginDialog.this.logIn(); } })); this.setWidget(panel); }
From source file:com.appspot.codsallarts.client.texteditor.RichTextToolbar.java
License:Apache License
/** * Creates a new toolbar that drives the given rich text area. * /*from w w w . j a v a 2s. c o m*/ * @param richText the rich text area to be controlled */ public RichTextToolbar(RichTextArea richText, EditCompleteHandler parent) { this.richText = richText; this.basic = richText.getBasicFormatter(); this.extended = richText.getExtendedFormatter(); this.parent = parent; outer.add(topPanel); outer.add(bottomPanel); topPanel.setWidth("100%"); bottomPanel.setWidth("100%"); initWidget(outer); setStyleName("gwt-RichTextToolbar"); richText.addStyleName("hasRichTextToolbar"); if (basic != null) { topPanel.add(bold = createToggleButton(images.bold(), strings.bold())); topPanel.add(italic = createToggleButton(images.italic(), strings.italic())); topPanel.add(underline = createToggleButton(images.underline(), strings.underline())); topPanel.add(subscript = createToggleButton(images.subscript(), strings.subscript())); topPanel.add(superscript = createToggleButton(images.superscript(), strings.superscript())); topPanel.add(justifyLeft = createPushButton(images.justifyLeft(), strings.justifyLeft())); topPanel.add(justifyCenter = createPushButton(images.justifyCenter(), strings.justifyCenter())); topPanel.add(justifyRight = createPushButton(images.justifyRight(), strings.justifyRight())); } if (extended != null) { topPanel.add(strikethrough = createToggleButton(images.strikeThrough(), strings.strikeThrough())); topPanel.add(indent = createPushButton(images.indent(), strings.indent())); topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent())); topPanel.add(hr = createPushButton(images.hr(), strings.hr())); topPanel.add(ol = createPushButton(images.ol(), strings.ol())); topPanel.add(ul = createPushButton(images.ul(), strings.ul())); topPanel.add(insertImage = createPushButton(images.insertImage(), strings.insertImage())); topPanel.add(createLink = createPushButton(images.createLink(), strings.createLink())); topPanel.add(removeLink = createPushButton(images.removeLink(), strings.removeLink())); topPanel.add(removeFormat = createPushButton(images.removeFormat(), strings.removeFormat())); } if (basic != null) { bottomPanel.add(foreColors = createColorList("Foreground")); bottomPanel.add(fontSizes = createFontSizes()); bottomPanel.add(saveButton = new Button("Save", handler)); bottomPanel.add(cancelButton = new Button("Cancel", handler)); // We only use these handlers for updating status, so don't hook them up // unless at least basic editing is supported. richText.addKeyUpHandler(handler); richText.addClickHandler(handler); } }
From source file:com.apress.progwt.client.college.gui.LoginWindow.java
License:Apache License
private Widget getUPTab() { VerticalPanel uptab = new VerticalPanel(); username = new TextBox(); username.setName("j_username"); username.setText(lastNameEntered);//w ww .j av a 2 s. c o m KeyboardListener enterListener = new KeyboardListenerAdapter() { public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KEY_ENTER) { form.submit(); } } }; final PasswordTextBox password = new PasswordTextBox(); password.setName("j_password"); password.addKeyboardListener(enterListener); username.setText("test"); password.setText("testaroo"); HorizontalPanel userP = new HorizontalPanel(); userP.add(new Label("Username")); userP.add(username); HorizontalPanel passPanel = new HorizontalPanel(); passPanel.add(new Label("Password")); passPanel.add(password); uptab.add(userP); uptab.add(passPanel); uptab.add(new Button("Login", new ClickListener() { public void onClick(Widget sender) { form.submit(); } })); return uptab; }
From source file:com.audata.client.authentication.LoginDialog.java
License:Open Source License
public LoginDialog(AuDoc parent) { this.parent = parent; setText(CONSTANTS.welcome_Text()); // Create a DockPanel to contain the 'about' label and the 'OK' button. DockPanel outer = new DockPanel(); outer.setSpacing(4);//from w w w . j a v a 2s . c om outer.add(new Image("images/48x48/security.gif"), DockPanel.WEST); VerticalPanel formPanel = new VerticalPanel(); formPanel.setSpacing(1); HorizontalPanel userPanel = new HorizontalPanel(); this.username = new TextBox(); Label l = new Label(CONSTANTS.username_Text()); l.addStyleName("audoc-label"); l.setWidth("85px"); userPanel.add(l); userPanel.add(this.username); formPanel.add(userPanel); HorizontalPanel passPanel = new HorizontalPanel(); this.password = new PasswordTextBox(); l = new Label(CONSTANTS.password_Text()); l.addStyleName("audoc-label"); l.setWidth("85px"); passPanel.add(l); passPanel.add(this.password); formPanel.add(passPanel); HorizontalPanel langPanel = new HorizontalPanel(); l = new Label(CONSTANTS.lang_Text()); l.addStyleName("audoc-label"); l.setWidth("85px"); langPanel.add(l); formPanel.add(langPanel); this.languages = new ListBox(); this.populateLocales(); this.languages.setWidth("146px"); langPanel.add(this.languages); this.languages.addChangeListener(new ChangeListener() { public void onChange(Widget sender) { //refreshes the browser in the selected locale Location loc = WindowUtils.getLocation(); String path = loc.getProtocol() + "//" + loc.getHost() + loc.getPath(); String locale = languages.getValue(languages.getSelectedIndex()); Window.open(path + "?locale=" + locale, "_self", ""); } }); this.loginButton = new Button(CONSTANTS.login_Text(), this); formPanel.add(loginButton); formPanel.setCellHorizontalAlignment(this.loginButton, HasAlignment.ALIGN_RIGHT); outer.add(formPanel, DockPanel.SOUTH); HTML text = new HTML(CONSTANTS.message_Text()); text.setStyleName("audoc-LoginDialogText"); outer.add(text, DockPanel.CENTER); // Add a bit of spacing and margin to the dock to keep the components from // being placed too closely together. outer.setSpacing(8); this.setWidget(outer); }
From source file:com.calclab.emite.example.pingpong.client.PingPongWidget.java
License:Open Source License
@Override public void addAction(final String label, final ClickHandler handler) { buttons.add(new Button(label, handler)); }
From source file:com.calclab.emite.hablar.client.pages.roster.RosterView.java
License:Open Source License
private FlowPanel createNewContactPanel() { final FlowPanel newContactPanel = getToolbar(); final TextBox fieldAddContact = new TextBox(); newContactPanel.add(fieldAddContact); final Button btnAddContact = new Button("add", new ClickHandler() { public void onClick(final ClickEvent event) { onAddItem.fire(fieldAddContact.getText()); fieldAddContact.setText(""); }//from w ww .j a v a 2s .c om }); newContactPanel.add(btnAddContact); return newContactPanel; }
From source file:com.calclab.emite.hablar.client.pages.roster.SubscriptionRequestedPanel.java
License:Open Source License
public SubscriptionRequestedPanel(final XmppURI jid, final String nick, final SubscriptionRequestedListener listener) { setStyleName("notification"); add(new Label(nick + " (" + jid.toString() + ") wants to subscribe to your presence.")); final FlowPanel flow = new FlowPanel(); final Button btnAccept = new Button("Accept", new ClickHandler() { public void onClick(final ClickEvent event) { listener.accepted(SubscriptionRequestedPanel.this, jid, nick); }//w ww .j a va2 s .c om }); flow.add(btnAccept); final Button btnReject = new Button("Reject", new ClickHandler() { public void onClick(final ClickEvent event) { listener.rejected(SubscriptionRequestedPanel.this, jid); } }); flow.add(btnReject); add(flow); }