List of usage examples for com.google.gwt.user.client.ui DialogBox DialogBox
public DialogBox()
From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java
License:Apache License
/** * Creates the dialogue to view/edit text content. *//*from ww w .j av a 2 s. co m*/ private void createTextDialog() { textDialog = new DialogBox(); textDialog.setModal(false); try { textDialog.ensureDebugId("cwDialogBox"); textDialog.setText("Text Content"); VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); textDialog.setWidget(dialogContents); textContentView = new TextContentView(false); textContentView.getWidget().getElement().setId("TextContentView"); dialogContents.add(textContentView.getWidget()); selectionManager.addListener(textContentView); textContentView.getWidget().addStyleName("textContentView"); textContentView.addChangeListener(this); //Virtual keyboard virtualKeyboard = new VirtualKeyboard(false); virtualKeyboard.addListener(textContentView); dialogContents.add(virtualKeyboard); // Add buttons at the bottom of the dialog HorizontalPanel textDlgbuttons = new HorizontalPanel(); textDlgbuttons.setSpacing(5); dialogContents.add(textDlgbuttons); dialogContents.setCellHorizontalAlignment(textDlgbuttons, HasHorizontalAlignment.ALIGN_RIGHT); /*Button applyButton = new Button(CONSTANTS.TextDialogButtonCaptionApply(), new ClickHandler() { public void onClick(ClickEvent event) { saveTextContent(); } }); textDlgbuttons.add(applyButton); */ Button closeButton = new Button(CONSTANTS.TextDialogButtonCaptionClose(), new ClickHandler() { public void onClick(ClickEvent event) { saveTextContent(); textDialog.hide(); } }); textDlgbuttons.add(closeButton); } catch (Exception exc) { logManager.logError(ERROR_CREATING_TEXT_DIALOG, "Error creating text 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. *//* w w w . j a v a 2 s.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.psystems.dicom.browser.client.Browser.java
License:Open Source License
/** * ?? //from w w w .j ava 2 s. co m */ private void createErorrDlg() { errorDialogBox = new DialogBox(); errorDialogBox.setText("!"); errorDialogBox.setAnimationEnabled(true); final Button closeButton = new Button(" ??"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); errorResponseMsg = new Label(); errorResponseLabel = new HTML(); errorResponseLabel.setVisible(false); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(closeButton); dialogVPanel.add(new HTML("<b>:</b>")); dialogVPanel.add(errorResponseMsg); Button showtraceBtn = new Button("/? ?"); showtraceBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub if (errorResponseLabel.isVisible()) errorResponseLabel.setVisible(false); else errorResponseLabel.setVisible(true); errorDialogBox.center(); } }); dialogVPanel.add(showtraceBtn); dialogVPanel.add(errorResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); errorDialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { errorDialogBox.hide(); } }); }
From source file:org.qualipso.factory.ui.core.login.client.Login.java
License:Open Source License
/** * Do the real login through the servlet. * /*from w w w . j a v a 2 s. c om*/ * @param username * the username * @param password * the password */ public void login(final String username, final String password) { loginServlet.login(username, password, new AsyncCallback<Boolean>() { @Override public void onSuccess(Boolean logged) { if (logged) { RootPanel.get("loginComponent").remove(loginPanel); RootPanel.get("loginComponent").add(new Label("Welcome, " + username)); Utils.refreshAllRegisteredWidgets(); return; } loginPanel.error("Login failed."); } @Override public void onFailure(Throwable ex) { final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Something bad happened..."); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.add(new Label("An error occured while trying to log in to the Factory server:")); dialogVPanel.add(new Label(ex.toString())); final Button closeButton = new Button("Close"); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBox.center(); closeButton.setFocus(true); } }); }
From source file:org.qualipso.funkyfactory.ui.clock.client.Funkyfactory_ui_clock.java
License:Open Source License
public void onModuleLoad() { final Button sendButton = new Button("Send"); sendButton.addStyleName("sendButton"); RootPanel.get("sendButtonContainer").add(sendButton); final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); final Button closeButton = new Button("Close"); closeButton.getElement().setId("closeButton"); final HTML serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Asking time to the server</b>")); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton);//from w w w.j av a 2s . c o m dialogBox.setWidget(dialogVPanel); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }); class MyHandler implements ClickHandler, KeyUpHandler { public void onClick(ClickEvent event) { askTimeToServer(); } public void onKeyUp(KeyUpEvent event) { } private void askTimeToServer() { sendButton.setEnabled(false); serverResponseLabel.setText(""); clock.getTime(new AsyncCallback<String>() { public void onFailure(Throwable caught) { dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(String result) { dialogBox.setText("Remote Procedure Call"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(result); dialogBox.center(); closeButton.setFocus(true); } }); } } MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); }
From source file:org.rebioma.client.maps.EnvLayerLegend.java
License:Apache License
@Override protected DialogBox getDetails() { final DialogBox dialogBox = new DialogBox(); String metadata;/*www. j av a 2s . c o m*/ dialogBox.setText(dataSummary()); VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); dialogBox.setWidget(dialogContents); HTML info = new HTML(dataAsHtml()); dialogContents.add(info); metadata = "<a href='" + data.getMetadata() + "' target='_blank'>Metadata</a>"; HTML link = new HTML(metadata); link.setStyleName("metadatalink"); dialogContents.add(link); dialogContents.setCellHorizontalAlignment(info, HasHorizontalAlignment.ALIGN_LEFT); Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogContents.add(closeButton); dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_LEFT); return dialogBox; }
From source file:org.sagarius.radix.client.view.GWTCProgress.java
License:Apache License
public void initialize(int options, int elements) { // Read the options and set variables if ((options & SHOW_TIME_REMAINING) == SHOW_TIME_REMAINING) showRemaining = true;// www . ja va 2s.c o m if ((options & SHOW_TEXT) == SHOW_TEXT) showText = true; if ((options & SHOW_NUMBERS) == SHOW_NUMBERS) showNumbers = true; if ((options & SHOW_AS_DIALOG) == SHOW_AS_DIALOG) showAsDialog = true; if ((options & SHOW_LEFT_TEXT) == SHOW_LEFT_TEXT) showText = showLeftText = true; // Set element count this.elements = elements; // Styling contentTable.setStyleName(StyleCProgress); numberLabel.setStyleName(StyleCPrgNumbers); remainLabel.setStyleName(StyleCPrgTime); textLabel.setStyleName(StyleCPrgText); // Create the out container Grid containerElementGrid = new Grid(1, 1); containerElementGrid.setStyleName(StyleCBarOuter); containerElementGrid.setCellPadding(0); containerElementGrid.setCellSpacing(0); // Create container for elements elementGrid = new Grid(1, elements); elementGrid.setStyleName(StyleCBarInner); elementGrid.setCellPadding(0); elementGrid.setCellSpacing(0); containerElementGrid.setWidget(0, 0, elementGrid); // Create elements for (int loop = 0; loop < elements; loop++) { Grid elm = new Grid(1, 1); elm.setHTML(0, 0, ""); elm.setStyleName(StyleCBarDone); elm.addStyleName(StyleCBarElement); elementGrid.setWidget(0, loop, elm); } // Set up the surrounding flex table based on the options int row = 0; int col = 0; if (showLeftText) contentTable.setWidget(row, col++, textLabel); else if (showText) contentTable.setWidget(row++, col, textLabel); if (showNumbers) contentTable.setWidget(row, col + 1, numberLabel); contentTable.setWidget(row++, col, containerElementGrid); contentTable.setWidget(row++, col, remainLabel); // Initialize progress bar setProgress(0); if (showAsDialog) { // Create the background // put the container into a dialog progressDlg = new DialogBox(); progressDlg.setWidget(contentTable); progressDlg.setStyleName(StyleCProgress); progressDlg.addStyleDependentName(StyleCProgressDlg); progressDlg.center(); hide(); // Initialize this composite with an empty element initWidget(new SimplePanel()); } else { initWidget(contentTable); } }
From source file:org.senchalabs.gwt.gwtdriver.models.client.SimpleWidgetsEP.java
License:Apache License
@Override public void onModuleLoad() { RootPanel.get().add(new Label("testing")); FlowPanel panel = new FlowPanel(); RootPanel.get().add(panel);//from ww w . java2 s .c om final TextBox textBox = new TextBox(); textBox.setValue("asdf"); panel.add(textBox); panel.add(new Button("Open dialog", new ClickHandler() { @Override public void onClick(ClickEvent event) { DialogBox box = new DialogBox(); box.setText("Heading Text For Dialog"); box.add(new HTML(textBox.getValue())); box.show(); } })); }
From source file:org.utgenome.gwt.utgb.client.track.lib.ViewLoaderTrack.java
License:Apache License
private void setViewSilk(String viewSilk) { if (viewSilk == null) return;//w w w . j ava 2s. c om UTGBEntryPointBase.showLoadingMessage(); getBrowserService().createTrackView(viewSilk, new AsyncCallback<TrackView>() { public void onFailure(Throwable e) { GWT.log(e.getMessage(), e); DialogBox dialog = new DialogBox(); dialog.setText(e.getMessage()); dialog.show(); UTGBEntryPointBase.hideLoadingMessage(); } public void onSuccess(TrackView v) { TrackGroup newGroup; try { newGroup = TrackGroup.createTrackGroup(v); TrackGroup rootTrackGroup = getTrackGroup().getRootTrackGroup(); rootTrackGroup.clear(); rootTrackGroup.addTrackGroup(newGroup); } catch (UTGBClientException e) { GWT.log(e.getMessage(), e); DialogBox dialog = new DialogBox(); dialog.setText(e.getMessage()); dialog.show(); } UTGBEntryPointBase.hideLoadingMessage(); } }); }
From source file:org.vectomatic.svg.edu.client.commons.ConfirmBox.java
License:Open Source License
private ConfirmBox(Widget root) { confirmBox = new DialogBox(); confirmBox.setTitle(constants.restart()); confirmBox.setWidget(restartBinder.createAndBindUi(this)); this.root = root; }