List of usage examples for com.google.gwt.user.client.ui DialogBox setWidget
@Override public void setWidget(Widget w)
From source file:org.geosdi.maplite.client.model.LegendBuilder.java
private static DialogBox getCQLDialogBox(final ClientRasterInfo raster, final Map map) { // Create a dialog box and set the caption text final DialogBox cqlDialogBox = new DialogBox(); cqlDialogBox.ensureDebugId("cwDialogBox"); cqlDialogBox.setText("FILTER"); // Create a table to layout the content VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4);//from w w w . j a v a2s. c o m cqlDialogBox.setWidget(dialogContents); // Add some text to the top of the dialog HTML details = new HTML("CQL Filter"); dialogContents.add(details); dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER); // Add a text area final TextArea textArea = new TextArea(); textArea.ensureDebugId("cwBasicText-textarea"); textArea.setVisibleLines(5); if (GPSharedUtils.isNotEmpty(raster.getCqlFilter())) { textArea.setText(raster.getCqlFilter()); } dialogContents.add(textArea); dialogContents.setCellHorizontalAlignment(textArea, HasHorizontalAlignment.ALIGN_CENTER); // Add a close button at the bottom of the dialog Button closeButton = new Button("Apply", new ClickHandler() { @Override public void onClick(ClickEvent event) { logger.info("Applico cql filter su raster: " + raster.getLayerName()); raster.setCqlFilter(textArea.getText()); Layer layer = map.getLayer(raster.getWmsLayerId()); WMS wms = WMS.narrowToLayer(layer.getJSObject()); WMSParams params; if (raster.getCqlFilter() == null || raster.getCqlFilter().trim().equals("")) { params = wms.getParams(); params.removeCQLFilter(); } else { params = new WMSParams(); params.setCQLFilter(raster.getCqlFilter()); } logger.info("Filtro CQL: " + raster.getCqlFilter()); wms.mergeNewParams(params); cqlDialogBox.hide(); } }); dialogContents.add(closeButton); if (LocaleInfo.getCurrentLocale().isRTL()) { dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_LEFT); } else { dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_RIGHT); } // Return the dialog box cqlDialogBox.setGlassEnabled(true); cqlDialogBox.setAnimationEnabled(true); cqlDialogBox.center(); return cqlDialogBox; }
From source file:org.gss_project.gss.admin.client.ui.UsersTable.java
License:Open Source License
public DialogBox createDialogBox(UserDTO m, StatsDTO s) { // Create a dialog box and set the caption text final DialogBox dialogBox = new DialogBox(); dialogBox.setHTML("User Details: " + m.getUsername()); // Create a table to layout the content VerticalPanel dialogVPanel = new VerticalPanel(); dialogBox.setSize("50%", "50%"); ClickHandler cancelHandler = new ClickHandler() { @Override/*from w w w .j a v a 2 s . com*/ public void onClick(ClickEvent event) { dialogBox.hide(); } }; dialogBox.setWidget(dialogVPanel); dialogVPanel.add(new Label("Username: " + m.getUsername())); dialogVPanel.add(new Label("Email: " + m.getEmail())); dialogVPanel.add(new Label("Name: " + m.getName())); if (m.getUserClass() != null) dialogVPanel.add(new Label("Quota: " + m.getUserClass().getQuotaAsString())); dialogVPanel.add(new Label("File Count: " + s.getFileCount())); dialogVPanel.add(new Label("File Size: " + s.getFileSizeAsString())); dialogVPanel.add(new Label("Quota Left: " + s.getQuotaLeftAsString())); Button close = new Button("Close"); close.addClickHandler(cancelHandler); dialogVPanel.add(close); // Return the dialog box return dialogBox; }
From source file:org.gss_project.gss.web.client.commands.ViewImageCommand.java
License:Open Source License
@Override public void execute() { containerPanel.hide();/*from ww w .ja v a 2 s . co m*/ final Image image = new Image(); // Hook up a load handler, so that we can be informed if the image // fails to load. image.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { errorLabel.setText(""); } }); image.addErrorHandler(new ErrorHandler() { @Override public void onError(ErrorEvent event) { errorLabel.setText("An error occurred while loading."); } }); image.setUrl(imageDownloadURL); final DialogBox imagePopup = new DialogBox(true, true); imagePopup.setAnimationEnabled(true); imagePopup.setText("Showing image in actual size"); VerticalPanel imageViewPanel = new VerticalPanel(); errorLabel.setText("loading image..."); imageViewPanel.add(errorLabel); imageViewPanel.add(image); imagePopup.setWidget(imageViewPanel); image.setTitle("Click to close"); image.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { imagePopup.hide(); } }); imagePopup.setPopupPosition(0, 0); imagePopup.show(); }
From source file:org.jboss.mjolnir.client.LoginScreen.java
License:Open Source License
private void displayErrorBox(String errorHeader, String message) { final DialogBox errorBox = new DialogBox(); errorBox.setText(errorHeader);//from w w w .j ava2 s. c o m final HTML errorLabel = new HTML(); errorLabel.setHTML(message); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); final Button closeButton = new Button("Close"); closeButton.setEnabled(true); closeButton.getElement().setId("close"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { errorBox.hide(); loginButton.setFocus(true); loginButton.setEnabled(true); } }); verticalPanel.add(errorLabel); verticalPanel.add(closeButton); errorBox.setWidget(verticalPanel); errorBox.center(); }
From source file:org.jboss.mjolnir.client.SubscriptionScreen.java
License:Open Source License
private void displayPopupBox(String header, String message) { final DialogBox box = new DialogBox(); box.setText(header);/*from ww w . j a v a 2 s.c o m*/ final HTML html = new HTML(); html.setHTML(message); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); final Button closeButton = buildCloseButton(box); verticalPanel.add(html); verticalPanel.add(closeButton); box.setWidget(verticalPanel); box.center(); }
From source file:org.nightcode.gwt.selectio.client.Selector.java
License:Apache License
private static DialogBox createDialogBox(final String url, final RootPanel input, final String function, final String selection, final String title) { final DialogBox dialogBox = new DialogBox(new SelectorHeader()); dialogBox.setStyleName("modal-content"); if (title != null) { dialogBox.getCaption().setText(title); }//from w w w . j a v a 2 s . co m SelectorRequestFactory requestFactory = new SelectorRequestFactoryJson(url); final ItemSelector itemSelector = new ItemSelector(requestFactory, 490); if (selection != null) { SelectionJso selectionJso = SelectionJso.selectionFromJson(selection); itemSelector.setSelection(selectionJso); } VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSize("300px", "500px"); dialogContents.setStyleName("selectio"); dialogBox.setWidget(dialogContents); dialogContents.add(itemSelector); dialogContents.setCellHeight(itemSelector, "490px"); Button doneButton = new Button(MESSAGES.done(), new ClickHandler() { @Override public void onClick(ClickEvent event) { final SelectionJso selection = SelectionJso.create(); itemSelector.fillSelection(selection); input.getElement().setAttribute("value", new JSONObject(selection).toString()); onChange(function, input.getElement()); dialogBox.hide(); } }); doneButton.setStyleName("btn btn-primary"); Button cancelButton = new Button(MESSAGES.cancel(), new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { dialogBox.hide(); } }); cancelButton.setStyleName("btn btn-default"); Panel buttonPanel = new FlowPanel(); buttonPanel.setStyleName("btn-toolbar pull-right"); buttonPanel.add(doneButton); buttonPanel.add(cancelButton); dialogContents.add(buttonPanel); dialogContents.setCellHeight(buttonPanel, "20px"); dialogContents.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT); return dialogBox; }
From source file:org.opendatakit.dwc.client.DemoWebClient.java
License:Apache License
private void defineDialogIneractions(final TextBox nameField, final Button sendButton, final Label errorLabel, final BUTTON_FIELD_ACTION api) { // Create the popup dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); final Button closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); final Label textToServerLabel = new Label(); final HTML serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setWidth(Integer.toString(Window.getClientWidth() - 10) + "px"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton);/*from w w w .j a va 2 s . c o m*/ dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }); // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** * Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendNameToServer(); } /** * Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendNameToServer(); } } /** * Send the name from the nameField to the server and wait for a response. */ private void sendNameToServer() { // First, we validate the input. errorLabel.setText(""); String textToServer = nameField.getText(); if (!FieldVerifier.isValidName(textToServer)) { errorLabel.setText("Please enter at least four characters"); return; } // Then, we send the input to the server. sendButton.setEnabled(false); textToServerLabel.setText(textToServer); serverResponseLabel.setText(""); AsyncCallback<String> callback = new AsyncCallback<String>() { public void onFailure(Throwable caught) { // Show the RPC error message to the user dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel .setHTML("<verbatim>" + SafeHtmlUtils.htmlEscape(SERVER_ERROR) + "</verbatim>"); dialogBox.getWidget().setWidth("90%"); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(String result) { dialogBox.setText("Remote Procedure Call"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel .setHTML("<verbatim>" + SafeHtmlUtils.htmlEscape(result) + "</verbatim>"); dialogBox.getWidget().setWidth("90%"); dialogBox.center(); closeButton.setFocus(true); } }; if (api == BUTTON_FIELD_ACTION.OAUTH2_FETCH) { greetingService.obtainOauth2Data(textToServer, callback); } else if (api == BUTTON_FIELD_ACTION.OAUTH1_FETCH) { greetingService.obtainOauth1Data(textToServer, callback); } else { greetingService.greetServer(textToServer, callback); } } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); }
From source file:org.opennms.dashboard.client.portlet.Dashboard.java
License:Open Source License
/** * <p>//from ww w. j a va2s . co 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>/* w w w . j a v a 2 s . com*/ * * @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.pentaho.reporting.platform.plugin.gwt.client.ReportViewer.java
License:Open Source License
public void openUrlInDialog(final String title, final String url, String width, String height) { if (StringUtils.isEmpty(height)) { height = "600px"; //$NON-NLS-1$ }/* w w w . j a v a 2s . c om*/ if (StringUtils.isEmpty(width)) { width = "800px"; //$NON-NLS-1$ } if (height.endsWith("px") == false) //$NON-NLS-1$ { height += "px"; //$NON-NLS-1$ } if (width.endsWith("px") == false) //$NON-NLS-1$ { width += "px"; //$NON-NLS-1$ } final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("pentaho-dialog"); dialogBox.setText(title); final Frame frame = new Frame(url); frame.setSize(width, height); final Button okButton = new Button(messages.getString("ok", "OK")); //$NON-NLS-1$ //$NON-NLS-2$ okButton.setStyleName("pentaho-button"); okButton.addClickHandler(new ClickHandler() { public void onClick(final ClickEvent event) { dialogBox.hide(); } }); final HorizontalPanel buttonPanel = new HorizontalPanel(); DOM.setStyleAttribute(buttonPanel.getElement(), "padding", "0px 5px 5px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ buttonPanel.setWidth("100%"); //$NON-NLS-1$ buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); buttonPanel.add(okButton); final VerticalPanel dialogContent = new VerticalPanel(); DOM.setStyleAttribute(dialogContent.getElement(), "padding", "0px 5px 0px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ dialogContent.add(frame); dialogContent.add(buttonPanel); dialogBox.setWidget(dialogContent); // dialogBox.setHeight(height); // dialogBox.setWidth(width); dialogBox.center(); }