List of usage examples for com.google.gwt.user.client.ui DialogBox show
@Override public void show()
From source file:org.opennms.dashboard.client.portlet.Dashboard.java
License:Open Source License
/** * <p>//from w ww . j a va 2s . c o m * error * </p> * * @param err * a {@link java.lang.String} object. */ public void error(String err) { final DialogBox dialog = new DialogBox(); dialog.setText("Error Occurred"); VerticalPanel panel = new VerticalPanel(); HTMLPanel html = new HTMLPanel(err); html.setStyleName("Message"); panel.add(html); Button ok = new Button("OK"); SimplePanel buttonPanel = new SimplePanel(); buttonPanel.setWidget(ok); buttonPanel.setStyleName("Button"); panel.add(buttonPanel); dialog.setPopupPosition(Window.getScrollLeft() + 100, Window.getScrollTop() + 100); dialog.setWidget(panel); ok.addClickHandler(new ClickHandler() { public void onClick(ClickEvent arg0) { dialog.hide(); } }); dialog.show(); }
From source file:org.opennms.features.poller.remote.gwt.client.DefaultLocationManager.java
License:Open Source License
/** * <p>displayDialog</p>//from www. j ava2 s . c o m * * @param title a {@link java.lang.String} object. * @param contents a {@link java.lang.String} object. */ protected void displayDialog(final String title, final String contents) { final DialogBox db = new DialogBox(); db.setAutoHideEnabled(true); db.setModal(true); db.setText(title); db.setWidget(new Label(contents, true)); db.show(); }
From source file:org.primaresearch.web.gwt.client.ui.page.tool.DeleteContentObjectTool.java
License:Apache License
private static void showConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageLayoutC layout, final ContentObjectC object, final PageSyncManager syncManager, final SelectionManager selectionManager) { final DialogBox confirmationDialog = new DialogBox(); final VerticalPanel vertPanel = new VerticalPanel(); confirmationDialog.add(vertPanel);/*from w ww .jav a 2 s. c om*/ Label confirmLabel = new Label(); vertPanel.add(confirmLabel); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.setWidth("100%"); horPanel.setSpacing(5); horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR)); vertPanel.add(horPanel); Button buttonCancel = new Button("Cancel"); horPanel.add(buttonCancel); buttonCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { confirmationDialog.hide(); } }); Button buttonDelete = new Button("Delete"); horPanel.add(buttonDelete); buttonDelete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { syncManager.deleteContentObject(object); layout.remove(object); selectionManager.clearSelection(); confirmationDialog.hide(); } }); String text = "Delete selected "; if (object.getType() instanceof RegionType) text += "region"; else if (LowLevelTextType.TextLine.equals(object.getType())) text += "text line"; else if (LowLevelTextType.Word.equals(object.getType())) text += "word"; else if (LowLevelTextType.Glyph.equals(object.getType())) text += "glyph"; text += "?"; confirmLabel.setText(text); parent.add(confirmationDialog); if (showRelativeTo != null) confirmationDialog.showRelativeTo(showRelativeTo); else confirmationDialog.show(); }
From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java
License:Apache License
/** * Shows the help dialogue./*from www . j av a 2s . c o m*/ */ private void showHelp() { try { final DialogBox helpDialog = new DialogBox(true); helpDialog.setGlassEnabled(true); //Renders "help.html" in an iframe. Frame frame = new Frame("Help.html"); frame.setWidth(CONSTANTS.HelpDialogWidth()); frame.setHeight(CONSTANTS.HelpDialogWidth()); frame.getElement().getStyle().setBorderWidth(0, Unit.PX); helpDialog.setWidget(frame); helpDialog.center(); helpDialog.show(); } catch (Exception exc) { logManager.logError(ERROR_SHOWING_HELP_DIALOG, "Error on trying to display the help dialogue"); exc.printStackTrace(); } }
From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java
License:Apache License
/** * Shows a dialogue asking for confirmation to revert all changes. Proceeds with 'revert' if confirmed by the user. *//*from w ww .ja v a 2s . c o m*/ private void showRevertConfiramtionDialog(Panel parent, UIObject showRelativeTo, final PageSyncManager pageSync) { try { final DialogBox confirmationDialog = new DialogBox(); final VerticalPanel vertPanel = new VerticalPanel(); confirmationDialog.add(vertPanel); Label confirmLabel = new Label(CONSTANTS.MessagePromptRevertChanges()); vertPanel.add(confirmLabel); final HorizontalPanel horPanel = new HorizontalPanel(); horPanel.setWidth("100%"); horPanel.setSpacing(5); horPanel.setHorizontalAlignment(HorizontalAlignmentConstant.endOf(Direction.LTR)); vertPanel.add(horPanel); //Cancel button Button buttonCancel = new Button(CONSTANTS.RevertDialogButtonCaptionCancel()); horPanel.add(buttonCancel); buttonCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { confirmationDialog.hide(); } }); //Revert button Button buttonDelete = new Button(CONSTANTS.RevertDialogButtonCaptionRevert()); horPanel.add(buttonDelete); buttonDelete.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { pageSync.revertChanges(); confirmationDialog.hide(); } }); parent.add(confirmationDialog); if (showRelativeTo != null) confirmationDialog.showRelativeTo(showRelativeTo); else confirmationDialog.show(); } catch (Exception exc) { logManager.logError(ERROR_REVERT_CONFIRMATION_DIALOG, "Error on diplaying the revert confiramtion dialogue"); exc.printStackTrace(); } }
From source file:org.primordion.xholon.io.AbstractXholonGui.java
License:Open Source License
/** * Provide some "getting started" help information. *///from ww w. ja v a 2 s .c o m protected void gettingStarted(String title, String htmlText, int width, int height) { final DialogBox db = new DialogBox(true); db.setText(title); // htmlText is safe to use here; it's just the static final splashText in this class db.setWidget(new HTML(htmlText)); // HTML(String) is safe to use here //Button ok = new Button("OK"); //ok.addClickHandler(new ClickHandler() { // public void onClick(ClickEvent event) { // db.hide(); // } //}); //db.setWidget(ok); db.show(); }
From source file:org.rest.client.activity.RequestActivity.java
License:Apache License
private void fromGoogleDriveFile(final String entryId) { final DialogBox loader = new DialogBox(false); loader.setAnimationEnabled(false);/*from www .j a v a 2 s . c o m*/ loader.setAutoHideEnabled(false); loader.setAutoHideOnHistoryEventsEnabled(true); loader.setGlassEnabled(true); HTML html = new HTML("<div class=\"dialogTitle\">Loading file from Google Drive </div>"); loader.add(html); loader.show(); loader.center(); DriveApi.hasSession(new DriveApi.SessionHandler() { @Override public void onResult(DriveAuth result) { if (result == null) { //not logged in user DriveApi.auth(new DriveApi.SessionHandler() { @Override public void onResult(DriveAuth result) { if (result == null) { loader.hide(); return; } getFileMetadataFromDrive(entryId, loader); } }, false); return; } getFileMetadataFromDrive(entryId, loader); } }); }
From source file:org.rest.client.ui.desktop.RequestViewImpl.java
License:Apache License
@UiHandler("deleteEndpoint") void onDeleteEndpoint(ClickEvent e) { e.preventDefault();//from www.j a v a 2 s.com final DialogBox dialog = new DialogBox(true); dialog.setAnimationEnabled(true); dialog.setGlassEnabled(true); dialog.setModal(true); HTMLPanel wrapper = new HTMLPanel(""); Label message = new Label("Delete selected endpoint?"); HTMLPanel buttons = new HTMLPanel(""); buttons.setStyleName("dialogButtons"); Button confirm = new Button("Confirm"); confirm.setStyleName("button"); Button cancel = new Button("Cancel"); cancel.setStyleName("button"); buttons.add(confirm); buttons.add(cancel); wrapper.add(message); wrapper.add(buttons); dialog.add(wrapper); dialog.show(); dialog.center(); cancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialog.hide(); } }); confirm.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialog.hide(); listener.deleteCurrentEndpoint(); } }); }
From source file:org.roda.wui.client.common.dialogs.Dialogs.java
public static void showInformationDialog(String title, String message, String continueButtonText, final AsyncCallback<Void> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);//from w w w. j a va 2s.com FlowPanel layout = new FlowPanel(); HTML messageLabel = new HTML(message); Button continueButton = new Button(continueButtonText); layout.add(messageLabel); layout.add(continueButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); continueButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onSuccess(null); } }); dialogBox.addStyleName("wui-dialog-information"); layout.addStyleName("wui-dialog-layout"); messageLabel.addStyleName("wui-dialog-message"); continueButton.addStyleName("btn btn-play"); dialogBox.center(); dialogBox.show(); }
From source file:org.roda.wui.client.common.dialogs.Dialogs.java
public static void showPromptDialog(String title, String message, String value, String placeHolder, final RegExp validator, String cancelButtonText, String confirmButtonText, boolean mandatory, final AsyncCallback<String> callback) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setText(title);//from w w w.j ava 2 s . c o m final FlowPanel layout = new FlowPanel(); if (message != null) { final Label messageLabel = new Label(message); layout.add(messageLabel); messageLabel.addStyleName("wui-dialog-message"); } final TextBox inputBox = new TextBox(); inputBox.setTitle("input box"); if (value != null) { inputBox.setText(value); } if (placeHolder != null) { inputBox.getElement().setPropertyString("placeholder", placeHolder); } final Button cancelButton = new Button(cancelButtonText); final Button confirmButton = new Button(confirmButtonText); confirmButton.setEnabled(!mandatory); layout.add(inputBox); layout.add(cancelButton); layout.add(confirmButton); dialogBox.setWidget(layout); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(false); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); callback.onFailure(null); } }); confirmButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (validator.test(inputBox.getText())) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } } }); inputBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { boolean isValid = validator.test(event.getValue()); confirmButton.setEnabled(isValid); if (isValid) { inputBox.removeStyleName("error"); } else { inputBox.addStyleName("error"); } } }); inputBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { TextBox box = (TextBox) event.getSource(); confirmButton.setEnabled(validator.test(box.getText())); } }); inputBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { TextBox box = (TextBox) event.getSource(); confirmButton.setEnabled(validator.test(box.getText())); } }); inputBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (validator.test(inputBox.getText())) { dialogBox.hide(); callback.onSuccess(inputBox.getText()); } } else { TextBox box = (TextBox) event.getSource(); confirmButton.setEnabled(validator.test(box.getText())); } } }); dialogBox.addStyleName("wui-dialog-prompt"); layout.addStyleName("wui-dialog-layout"); inputBox.addStyleName("form-textbox wui-dialog-message"); cancelButton.addStyleName("btn btn-link"); confirmButton.addStyleName("pull-right btn btn-play"); dialogBox.center(); dialogBox.show(); inputBox.setFocus(true); }