List of usage examples for com.google.gwt.user.client.ui Button Button
public Button()
From source file:com.ephesoft.dcma.gwt.rv.client.view.TableExtractionView.java
License:Open Source License
private void setTableUI(final FlexTable flexTable, final DataTable dataTable) { ScrollPanel panel = new ScrollPanel(); if (dataTable.getRows().getRow().size() == 0) { setEmptyTableView(flexTable, dataTable.getHeaderRow()); }/*from ww w . j av a 2 s . c om*/ panel.add(flexTable); panel.setHeight("150px"); panel.setWidth("400px"); panel.setTitle(dataTable.getName()); HorizontalPanel hPanel = new HorizontalPanel(); insertRowButton = new Button(); deleteRowButton = new Button(); deleteAllRowButton = new Button(); manualExtractionButton = new Button(); setButtonsText(); onInsertButtonClicked(insertRowButton, dataTable); onDeleteButtonClicked(deleteRowButton, dataTable); onDeleteAllButtonClicked(deleteAllRowButton, dataTable); onManualExtractionButtonClicked(manualExtractionButton, dataTable); final String tableName = dataTable.getName(); tableNameVsButtonMap.put(insertRowButton, tableName); tableNameVsButtonMap.put(deleteRowButton, tableName); tableNameVsButtonMap.put(deleteAllRowButton, tableName); tableNameVsButtonMap.put(manualExtractionButton, tableName); Label label = new Label(); label.setWidth(GAP_BETWEEN_BUTTONS); hPanel.add(insertRowButton); hPanel.add(label); label = new Label(); label.setWidth(GAP_BETWEEN_BUTTONS); hPanel.add(deleteRowButton); hPanel.add(label); label = new Label(); label.setWidth(GAP_BETWEEN_BUTTONS); hPanel.add(deleteAllRowButton); hPanel.add(label); hPanel.add(manualExtractionButton); Label emptyLabel = new Label(); emptyLabel.setHeight("20px"); verticalPanel.add(emptyLabel); emptyLabel = new Label(); emptyLabel.setText(dataTable.getName()); verticalPanel.add(emptyLabel); verticalPanel.add(hPanel); emptyLabel = new Label(); emptyLabel.setHeight("10px"); verticalPanel.add(emptyLabel); verticalPanel.add(panel); }
From source file:com.ephesoft.dcma.gwt.rv.client.view.ValidatePanel.java
License:Open Source License
public ValidatePanel() { super();// w ww .j a v a 2 s. c om initWidget(BINDER.createAndBindUi(this)); scrollPanel.addStyleName(ReviewValidateConstants.OVERFLOW_SCROLL); scrollValidationTableFocusPanel.add(validationTable); scrollValidationTableFocusPanel.setHeight("98%"); scrollValidationTableFocusPanel.setWidth("99%"); scrollPanel.setHeight("100%"); scrollPanel.add(scrollValidationTableFocusPanel); fuzzySearchBtn = new Button(); showTableViewBtn = new Button(); showTableViewBtn.setStyleName("tableViewButton"); showTableViewBtn.setTitle( LocaleDictionary.get().getConstantValue(ReviewValidateConstants.TITLE_TABLE_VIEW_TOOLTIP)); fuzzySearchText = new TextBox(); fuzzySearchBtn .setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_GO_BTN)); fuzzySearchBtn .setTitle(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_TOOLTIP)); fuzzySearchBtn.setStyleName("fuzzySearchButton"); fuzzySearchTextBox = new ValidatableWidget<TextBox>(fuzzySearchText); fuzzySearchTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { fuzzySearchTextBox.toggleValidDateBox(); fuzzySearchTextBox.getWidget().addStyleName("validatePanelListBox"); } }); // fuzzySearchTextBox.addValidator(new EmptyStringValidator(fuzzySearchText)); fuzzySearchTextBox.getWidget().addStyleName("validatePanelListBox"); fuzzySearchText.addKeyboardListener(new KeyboardListenerAdapter() { public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == (char) KEY_ENTER) { fuzzySearchBtn.click(); } } }); showTableViewBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { presenter.setTableView(Boolean.TRUE); presenter.onTableViewButtonClicked(); } }); fuzzySearchBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { ScreenMaskUtility.maskScreen(); String value = fuzzySearchText.getValue(); if (null == value || value.trim().isEmpty()) { final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog( LocaleDictionary.get() .getMessageValue(ReviewValidateMessages.MSG_FUZZY_SEARCH_INVALID_ENTRY), LocaleDictionary.get().getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_TOOLTIP), Boolean.TRUE); confirmationDialog.addDialogListener(new DialogListener() { @Override public void onOkClick() { confirmationDialog.hide(); ScreenMaskUtility.unmaskScreen(); presenter.setFocus(); } @Override public void onCancelClick() { ScreenMaskUtility.unmaskScreen(); presenter.setFocus(); } }); } else { performFuzzySearch(value); } fuzzySearchText.setText(""); } }); }
From source file:com.ephesoft.dcma.gwt.uploadbatch.client.view.AssociateBCFView.java
License:Open Source License
public void setView() { cancel = new Button(); cancel.setText("Cancel"); cancel.addClickHandler(new ClickHandler() { @Override//from w w w . j a va 2 s. com public void onClick(ClickEvent event) { validationMessage = new Label(); dialogBox.hide(); } }); save = new Button(); save.setText("Ok"); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { presenter.onSave(); if (presenter.isSetVisibleDialogue()) { dialogBox.hide(); } } }); editTable = new FlexTable(); editTable.setWidth("100%"); flexEditTable.setWidget(1, 0, editTable); flexEditTable.setWidget(0, 0, validationMessage); flexEditTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); }
From source file:com.ephesoft.gxt.core.client.ui.widget.VerticalToolbar.java
License:Open Source License
/** * Constructor with the Rotatable Image. * //from ww w . j av a2s .c o m * @param image {@link RotatableImage} */ public VerticalToolbar(final RotatableImage image) { super(); imagePanel = new VerticalPanel(); imagePanel.addStyleName("overlayPanel"); imagePanel.addStyleName("overlayPanelInitialView"); toolbarPanel = new VerticalPanel(); toolbarPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); // setting swap toolbar button. final Button moveToolbarButton = new Button(); moveToolbarButton.setStyleName(BUTTON_CSS); moveToolbarButton.setTitle(LocaleConstants.MOVE_RIGHT); moveToolbarButton.addStyleName("btnfirst"); toolbarPanel.add(moveToolbarButton); borderLayoutContainer = new BorderLayoutContainer(); if (null == image) { overlayImage = new RotatableImage(); } else { overlayImage = image; } imageScrollPanel = new ScrollPanel(); imageScrollPanel.addStyleName("overlayImageScrollPanel"); imagePanel.addStyleName("overlayImagePanel"); imagePanel.add(overlayImage); imageScrollPanel.add(imagePanel); borderLayoutContainer.setCenterWidget(imageScrollPanel); final VerticalPanel toolbarPanelContainer = new VerticalPanel(); toolbarPanelContainer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); toolbarPanelContainer.setStyleName(TOOLBAR_CONTAINER_CSS); toolbarPanelContainer.add(toolbarPanel); final BorderLayoutData regionLayout = new BorderLayoutData(BORDER_LAYOUT_DATA_SIZE); borderLayoutContainer.setWestWidget(toolbarPanelContainer, regionLayout); final ClickHandler switchToolbar = new ClickHandler() { public void onClick(final ClickEvent event) { final Widget toolbar = borderLayoutContainer.getEastWidget(); imagePanel.removeStyleName("overlayPanelInitialView"); if (null == toolbar) { toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); borderLayoutContainer.setWestWidget(null); borderLayoutContainer.setEastWidget(toolbarPanelContainer); toolbarPanelContainer.addStyleName("toolbarEast"); moveToolbarButton.addStyleName("move_toolbar_button_east"); moveToolbarButton.setTitle(LocaleConstants.MOVE_LEFT); } else { borderLayoutContainer.setEastWidget(null); toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); borderLayoutContainer.setWestWidget(toolbarPanelContainer); toolbarPanelContainer.removeStyleName("toolbarEast"); moveToolbarButton.removeStyleName("move_toolbar_button_east"); moveToolbarButton.setTitle(LocaleConstants.MOVE_RIGHT); } toolbarPanelContainer.add(getToolbaarPanel()); borderLayoutContainer.forceLayout(); } }; moveToolbarButton.addClickHandler(switchToolbar); initWidget(borderLayoutContainer); this.addStyleName("imageOverlayContainer"); }
From source file:com.github.gilbertotorrezan.gwtcloudinary.client.CloudinaryUploadWidget.java
License:Open Source License
public CloudinaryUploadWidget() { button = new Button(); initialize(); }
From source file:com.google.appinventor.client.editor.simple.components.MockButtonBase.java
License:Open Source License
/** * Creates a new MockButtonBase component. * * @param editor editor of source file the component belongs to *///from w w w . ja v a2 s . c o m MockButtonBase(SimpleEditor editor, String type, ImageResource icon) { super(editor, type, icon); // Initialize mock button UI buttonWidget = new Button(); buttonWidget.addStyleName("ode-SimpleMockButton"); image = new Image(); image.addErrorHandler(new ErrorHandler() { @Override public void onError(ErrorEvent event) { if (imagePropValue != null && !imagePropValue.isEmpty()) { OdeLog.elog("Error occurred while loading image " + imagePropValue); } refreshForm(); } }); image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { refreshForm(); } }); DeckPanel deckPanel = new DeckPanel(); deckPanel.setStylePrimaryName("ode-SimpleMockComponent"); deckPanel.add(buttonWidget); deckPanel.add(image); deckPanel.showWidget(0); initComponent(deckPanel); }
From source file:com.google.gerrit.client.auth.openid.OpenIdSignInDialog.java
License:Apache License
private void createIdentBox() { boolean remember = mode == SignInMode.SIGN_IN || mode == SignInMode.REGISTER; final FlowPanel group = new FlowPanel(); group.setStyleName(OpenIdResources.I.css().loginLine()); final FlowPanel line1 = new FlowPanel(); group.add(line1);//from www . java2s . com providerId = new NpTextBox(); providerId.setVisibleLength(60); providerId.setStyleName(OpenIdResources.I.css().identifier()); providerId.setTabIndex(0); providerId.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { event.preventDefault(); form.submit(); } } }); line1.add(providerId); login = new Button(); switch (mode) { case LINK_IDENTIY: login.setText(OpenIdUtil.C.buttonLinkId()); break; case REGISTER: login.setText(OpenIdUtil.C.buttonRegister()); break; case SIGN_IN: default: login.setText(OpenIdUtil.C.buttonSignIn()); break; } login.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { form.submit(); } }); login.setTabIndex(remember ? 2 : 1); line1.add(login); Button close = new Button(Gerrit.C.signInDialogClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); close.setTabIndex(remember ? 3 : 2); line1.add(close); if (remember) { rememberId = new CheckBox(OpenIdUtil.C.rememberMe()); rememberId.setTabIndex(1); group.add(rememberId); String last = Cookies.getCookie(OpenIdUrls.LASTID_COOKIE); if (last != null && !"".equals(last)) { if (last.startsWith("\"") && last.endsWith("\"")) { // Dequote the value. We shouldn't have to do this, but // something is causing some Google Account tokens to get // wrapped up in double quotes when obtained from the cookie. // last = last.substring(1, last.length() - 2); } providerId.setText(last); rememberId.setValue(true); } } formBody.add(group); }
From source file:com.google.gerrit.client.auth.userpass.UserPassSignInDialog.java
License:Apache License
private void createUsernameBox() { username = new NpTextBox(); username.setVisibleLength(25);/* ww w. j a va2s .co m*/ username.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { event.preventDefault(); password.selectAll(); password.setFocus(true); } } }); password = new PasswordTextBox(); password.setVisibleLength(25); password.addKeyPressHandler(GlobalKey.STOP_PROPAGATION); password.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(final KeyPressEvent event) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { event.preventDefault(); onLogin(); } } }); final FlowPanel buttons = new FlowPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().errorDialogButtons()); login = new Button(); login.setText(Util.C.buttonSignIn()); login.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { onLogin(); } }); buttons.add(login); close = new Button(); DOM.setStyleAttribute(close.getElement(), "marginLeft", "45px"); close.setText(Gerrit.C.signInDialogClose()); close.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); buttons.add(close); final Grid formGrid = new Grid(3, 2); formGrid.setText(0, 0, Util.C.username()); formGrid.setText(1, 0, Util.C.password()); formGrid.setWidget(0, 1, username); formGrid.setWidget(1, 1, password); formGrid.setWidget(2, 1, buttons); formBody.add(formGrid); username.setTabIndex(1); password.setTabIndex(2); login.setTabIndex(3); close.setTabIndex(4); }
From source file:com.google.gerrit.client.ConfirmationDialog.java
License:Apache License
public ConfirmationDialog(final String dialogTitle, final SafeHtml message, final ConfirmationCallback callback) { super(/* auto hide */false, /* modal */true); setGlassEnabled(true);/*from www. jav a2 s . c o m*/ setText(dialogTitle); final FlowPanel buttons = new FlowPanel(); final Button okButton = new Button(); okButton.setText(Gerrit.C.confirmationDialogOk()); okButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); callback.onOk(); } }); buttons.add(okButton); cancelButton = new Button(); DOM.setStyleAttribute(cancelButton.getElement(), "marginLeft", "300px"); cancelButton.setText(Gerrit.C.confirmationDialogCancel()); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); buttons.add(cancelButton); final FlowPanel center = new FlowPanel(); final Widget msgWidget = message.toBlockWidget(); center.add(msgWidget); center.add(buttons); add(center); msgWidget.setWidth("400px"); setWidget(center); }
From source file:com.google.gerrit.client.ErrorDialog.java
License:Apache License
protected ErrorDialog() { super(/* auto hide */false, /* modal */true); setGlassEnabled(true);/*w w w . j a v a2 s . co m*/ getGlassElement().addClassName(Gerrit.RESOURCES.css().errorDialogGlass()); text = new Label(); text.setStyleName(Gerrit.RESOURCES.css().errorDialogTitle()); body = new FlowPanel(); final FlowPanel buttons = new FlowPanel(); buttons.setStyleName(Gerrit.RESOURCES.css().errorDialogButtons()); closey = new Button(); closey.setText(Gerrit.C.errorDialogContinue()); closey.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); closey.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { // if the close button is triggered by a key we need to consume the key // event, otherwise the key event would be propagated to the parent // screen and eventually trigger some unwanted action there after the // error dialog was closed event.stopPropagation(); } }); buttons.add(closey); final FlowPanel center = new FlowPanel(); center.add(text); center.add(body); center.add(buttons); setText(Gerrit.C.errorDialogTitle()); addStyleName(Gerrit.RESOURCES.css().errorDialog()); add(center); int l = Window.getScrollLeft() + 20; int t = Window.getScrollTop() + 20; setPopupPosition(l, t); }