List of usage examples for com.google.gwt.user.client.ui DialogBox hide
@Override public void hide()
From source file:org.opennms.dashboard.client.portlet.Dashboard.java
License:Open Source License
/** * <p>/*from w w w.j a v a2s. 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.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$ }/*from w w w . j a v a 2s.c o m*/ 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(); }
From source file:org.pentaho.reporting.platform.plugin.gwt.client.ReportViewerUtil.java
License:Open Source License
public static void showMessageDialog(final ResourceBundle messages, final String title, final String message) { if (ReportViewerUtil.isInPUC()) { ReportViewerUtil.showPUCMessageDialog(title, message); return;// www .ja v a2 s .c o m } final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("pentaho-dialog"); dialogBox.setText(title); final VerticalPanel dialogContent = new VerticalPanel(); DOM.setStyleAttribute(dialogContent.getElement(), "padding", "0px 5px 0px 5px"); //$NON-NLS-1$ //$NON-NLS-2$ dialogContent.add(new HTML(message, true)); 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); 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(); } }); buttonPanel.add(okButton); dialogContent.add(buttonPanel); dialogBox.setWidget(dialogContent); dialogBox.center(); // prompt }
From source file:org.phrasebook.transword.client.CwAdminTerminBox.java
License:Apache License
/** * Initialize this example.// www . ja va2 s . c om */ @Override public Widget onInitialize() { // Top ToolBar panel final Button newFE = new Button(constants.cwNewFE()); final Button newRefresh = new Button("Refresh"); final Button newEdit = new Button("Edit"); final TextBoxAdvanced searchFilter = new TextBoxAdvanced(); newEdit.setEnabled(false); DockPanel admin = new DockPanel(); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setSpacing(5); hPanel.add(newFE); HorizontalPanel sPanel = new HorizontalPanel(); sPanel.setSpacing(5); sPanel.add(searchFilter); hPanel.add(newRefresh); hPanel.add(newEdit); VerticalPanel svPanel = new VerticalPanel(); svPanel.add(hPanel); svPanel.add(sPanel); searchFilter.addValueChangeHandler(new IStringValueChanged() { public void valueChanged(String newValue) { dataProvider.setFilter(newValue); dataProvider.refresh(); } }); admin.add(svPanel, DockPanel.NORTH); NewFEHandler handler = new NewFEHandler(); newFE.addClickHandler(handler); NewRefFEHandler refhandler = new NewRefFEHandler(); NewEditFEHandler edithandler = new NewEditFEHandler(); newRefresh.addClickHandler(refhandler); newEdit.addClickHandler(edithandler); // Create a DataGrid. /* * Set a key provider that provides a unique key for each contact. If * key is used to identify contacts when fields (such as the name and * address) change. */ dataGrid = new DataGrid<FixedExpression>(); dataGrid.setWidth("100%"); /* * Do not refresh the headers every time the data is updated. The footer * depends on the current data, so we do not disable auto refresh on the * footer. */ dataGrid.setAutoHeaderRefreshDisabled(true); // Set the message to display when the table is empty. // Create a Pager to control the table. SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true); pager.setDisplay(dataGrid); pager.setVisible(true); //dataProvider = new FilteredListDataProvider<FixedExpression>(); dataProvider.setList(new ArrayList<FixedExpression>()); dataGrid.setEmptyTableWidget(new Label("Loading, please wait. There are no fixed expressions yet!")); // Attach a column sort handler to the ListDataProvider to sort the // list. final DialogBox dlgBox = new DialogBox(); final HTML serverResponseLabel = new HTML(); final Button clsButton = new Button("Close"); dlgBox.setText("Fixed Expression Result"); dlgBox.setAnimationEnabled(true); // We can set the id of a widget by accessing its // Element clsButton.getElement().setId("closeButton"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(clsButton); dlgBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox clsButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dlgBox.hide(); } }); final List<FixedExpression> lst = new ArrayList<FixedExpression>(); feService.listFixedExpression(new AsyncCallback<List<FixedExpression>>() { public void onFailure(Throwable caught) { // Show the RPC error message to the // user dlgBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR + caught.toString()); dlgBox.center(); clsButton.setFocus(true); } public void onSuccess(List<FixedExpression> list) { for (FixedExpression f : list) { lst.add(f); } dlgBox.setText("Fixed Expression - Add Result"); serverResponseLabel.removeStyleName("Server Response Label Error"); serverResponseLabel.setHTML("OK" + lst.size()); // dlgBox.center(); clsButton.setFocus(true); } }); ListHandler<FixedExpression> sortHandler = new ListHandler<FixedExpression>(dataProvider.getList()); dataGrid.addColumnSortHandler(sortHandler); final NoSelectionModel<FixedExpression> selectionModel = new NoSelectionModel<FixedExpression>(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { public void onSelectionChange(SelectionChangeEvent event) { @SuppressWarnings("unchecked") NoSelectionModel<FixedExpression> sel = (NoSelectionModel<FixedExpression>) event.getSource(); selExpression.setCoreString(sel.getLastSelectedObject().getCoreString()); selExpression.setId(sel.getLastSelectedObject().getId()); if (selExpression.getId() != null) { newEdit.setEnabled(true); } else { newEdit.setEnabled(false); } } }); dataGrid.setSelectionModel(selectionModel);// , // DefaultSelectionEventManager.<FixedExpression> // createCheckboxManager()); // dataGrid.setSele dataGrid.setVisible(true); initTableColumns(selectionModel, sortHandler); dataProvider.addDataDisplay(dataGrid); dataGrid.addColumnSortHandler(sortHandler); // dataGrid.add admin.add(dataGrid, DockPanel.CENTER); admin.add(pager, DockPanel.SOUTH); admin.setWidth("100%"); dataGrid.setHeight("450px"); admin.setCellWidth(dataGrid, "100%"); admin.setCellWidth(pager, "100%"); Timer t = new Timer() { public void run() { dataList = lst; List<FixedExpression> list2 = dataProvider.getList(); list2.addAll(dataList); dataProvider.refresh(); } }; // Schedule the timer to run once in 40 seconds. t.schedule(40000); return admin; }
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);//ww w . j a v a 2 s. c o m 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 a dialogue asking for confirmation to revert all changes. Proceeds with 'revert' if confirmed by the user. *///from 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.qualipso.factory.ui.core.login.client.Login.java
License:Open Source License
/** * Do the real login through the servlet. * /*from w ww .j a v a2 s.co m*/ * @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 a v a2 s .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;//from ww w . ja va2 s.com 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.rest.client.activity.RequestActivity.java
License:Apache License
private void fromGoogleDriveFile(final String entryId) { final DialogBox loader = new DialogBox(false); loader.setAnimationEnabled(false);/*from ww w . jav a 2 s. co 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); } }); }