/** Override show to also center the dialog. */ @Override public void show() { super.show(); super.center(); // set a body class to mark the dialog show RootPanel.get().addStyleName("gwt-ModalDialog-show"); }
private void showLogonDialog() { final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Login"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(4); dialogBox.setWidget(verticalPanel); final TextBox username = new TextBox(); verticalPanel.add(new HTML("Username:"******"Logon", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); login(username.getValue()); } }); verticalPanel.add(closeButton); dialogBox.center(); dialogBox.show(); }
public void showError(String title, String message) { dialogBox.setText(title); errorLabel.setText(message); closeButton.setVisible(true); errorLabel.setStyleName("serverResponseLabelError"); dialogBox.center(); }
private void showSetCellAlignmentDialog(final ListBox listBox, final IAlignment iAlignment) { final DialogBox origDialog = new DialogBox(); DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE)); final VerticalPanel dialog = new VerticalPanel(); origDialog.add(dialog); origDialog.setText("Cell Alignment Dialog"); dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialog.add(new Label("Please choose the Widget :")); final ListBox widgetIndexLb = new ListBox(); for (Iterator<Widget> iterator = iterator(); iterator.hasNext(); ) { Widget next = iterator.next(); widgetIndexLb.addItem( ((IVkWidget) next).getWidgetName() + " - at index - " + getWidgetIndex(next)); } widgetIndexLb.setWidth("300px"); dialog.add(widgetIndexLb); widgetIndexLb.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { iAlignment.doAlignment( widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex())); } }); dialog.add(new Label("Please choose Alignment")); dialog.add(listBox); listBox.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { iAlignment.doAlignment( widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex())); } }); HorizontalPanel buttonsPanel = new HorizontalPanel(); dialog.add(buttonsPanel); Button saveButton = new Button("OK"); buttonsPanel.add(saveButton); saveButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { // iAlignment.doAlignment(widgetIndexLb.getSelectedIndex(), // listBox.getValue(listBox.getSelectedIndex())); origDialog.hide(); } }); Button cancelButton = new Button("Cancel"); buttonsPanel.add(cancelButton); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { origDialog.hide(); } }); origDialog.center(); }
@Override public DialogBox getDialogBox() throws PopUpException { dialogBox.setWidget(getPanel()); dialogBox.setGlassEnabled(true); dialogBox.center(); return dialogBox; }
/** Show message dilaog. The dialog is centered and the screen is blocked for edition */ private void doShow() { try { dialogBox.center(); dialogBox.show(); okButton.setFocus(true); OpenEvent.fire(ConfirmDialog.this, ConfirmDialog.this); } catch (Exception e) { Crux.getErrorHandler().handleError(e); Screen.unblockToUser(); } }
@Override public void onUncaughtException(Throwable exception) { Throwable e = unwrapUmbrellaException(exception); Log.fatal("uncaught exception", e); String stackTrace = buildStackTraceMessages(e); /* disable server side logging for now to avoid email bombing RemoteLoggingAction action = new RemoteLoggingAction(stackTrace); action.addContextInfo("selected Doc", appPresenter.getSelectedDocumentInfoOrNull()); action.addContextInfo("selected TransUnitId", targetContentsPresenter.getCurrentTransUnitIdOrNull()); action.addContextInfo("editor contents", targetContentsPresenter.getNewTargets()); dispatcher.execute(action, new NoOpAsyncCallback<NoOpResult>()); */ if (!configHolder.getState().isShowError()) { return; } globalPopup .getCaption() .setHTML("<div class=\"globalPopupCaption\">ERROR: " + e.getMessage() + "</div>"); VerticalPanel popupContent = new VerticalPanel(); // description text SafeHtmlBuilder htmlBuilder = new SafeHtmlBuilder(); // @formatter:off htmlBuilder .appendHtmlConstant("<h3>You may close this window and continue with your work</h3>") .appendHtmlConstant( "<div>If you want to let us know the error, Please recall your actions and take one of the following steps:</div>") .appendHtmlConstant("<ul>") .appendHtmlConstant("<li>Email administration; Or</li>") .appendHtmlConstant( "<li>Check if it's a <a href=\"https://bugzilla.redhat.com/buglist.cgi?product=Zanata&bug_status=__open__\" target=\"_blank\">known issue</a>; Or</li>") .appendHtmlConstant( "<li><a href=\"https://bugzilla.redhat.com/enter_bug.cgi?format=guided&product=Zanata\" target=\"_blank\">Report a problem</a>; Or</li>") .appendHtmlConstant( "<li>Email <a href=\"mailto:[email protected]\">Zanata users mailing list</a></li>") .appendHtmlConstant("</ul>") // @formatter:on ; // stack trace DisclosurePanel disclosurePanel = buildStackTraceDisclosurePanel(stackTrace); // send stack trace log to server popupContent.add(new HTMLPanel(htmlBuilder.toSafeHtml())); popupContent.add(disclosurePanel); popupContent.add(closeButton); globalPopup.setWidget(popupContent); globalPopup.center(); }
@UiHandler("uploadForm") protected void uploadSubmitComplete(SubmitCompleteEvent event) { int status = -1; if (event.getResults() != null) { status = Integer.parseInt(event.getResults()); } if (status != HttpServletResponse.SC_OK) { uploadDialogText.setText("Error code given by server: " + status + ". Please try again."); uploadDialog.center(); } }
public void showInfo(String title, String message) { dialogBox.setText(title); errorLabel.setText(message); errorLabel.setStyleName("infoText"); closeButton.setVisible(false); dialogBox.center(); new Timer() { public void run() { dialogBox.hide(); } }.schedule(2000); }
public void showHTMLCode(String codeSource) { final DialogBox codePopup = new DialogBox(true, true); codePopup.setGlassEnabled(true); codePopup.setText(constants.showCodeTitle()); String[] lignesCode = codeSource.split("\n"); VerticalPanel tab = new VerticalPanel(); for (String ligneCode : lignesCode) { String maLigne = new String(ligneCode); String[] ligne = ligneCode.split("\t"); for (String texte : ligne) { if (texte.equals("")) { maLigne = " " + maLigne; } } maLigne = maLigne.replace("<", "<"); maLigne = maLigne.replace("div", "<span style='color: blue;'>div</span>"); maLigne = maLigne.replace("id=", "<span style='color: red;'>id</span>="); maLigne = maLigne.replace("class", "<span style='color: red;'>class</span>"); int commentBegin = maLigne.indexOf("<!--"); if (commentBegin != -1) { int commentEnd = maLigne.indexOf("-->"); String comment = maLigne.substring(commentBegin, commentEnd + 3); maLigne = maLigne.replace(comment, "<span style='color: #008000;'>" + comment + "</span>"); } HTML htmlLine = new HTML(maLigne); htmlLine.setStyleName("builder-source"); tab.add(htmlLine); } Button closeButton = new Button( constants.close(), new ClickHandler() { public void onClick(ClickEvent event) { codePopup.hide(); } }); tab.add(closeButton); tab.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER); codePopup.add(tab); codePopup.center(); codePopup.show(); }
@Override public synchronized void inc(String reason) { if (waitCount.size() == 0) { StringBuffer reasons = new StringBuffer("<ul>Please Wait..."); waitCount.add(reason); for (String wait : waitCount) { reasons.append("<li>" + wait + "</li>"); } reasons.append("</ul>"); wait.setHTML(reasons.toString()); wait.setAnimationEnabled(true); wait.setModal(true); wait.center(); wait.show(); } }
private void popupDbCurator() { ClientSequenceDatabase csd = (ClientSequenceDatabase) dlb.getSelected(); Integer selected = csd.getId(); Map<String, String> emailInitialPairs = new TreeMap<String, String>(); for (Map.Entry<String, ClientUser> me : userInfo.entrySet()) { emailInitialPairs.put(me.getKey(), me.getValue().getInitials()); } final DialogBox dialogBox = new DialogBox(false); CurationEditor ce = new CurationEditor( selected, user.getEmail(), emailInitialPairs, new EditorCloseCallback() { public void editorClosed(final Integer openCurationID) { validationController.getAllowedValues( dlb, new Callback() { public void done() { if (openCurationID != null) { dlb.select(openCurationID, validationController); } dialogBox.hide(); } }); } }); DOM.setElementAttribute(dialogBox.getElement(), "id", "db-curator"); dialogBox.setStyleName("dbCuratorEmbed"); dialogBox.setWidget(ce); dialogBox.setSize(Window.getClientWidth() * .8 + "px", Window.getClientHeight() * .8 + "px"); ce.setPixelSize( Math.max((int) (Window.getClientWidth() * .8), 770), (int) (Window.getClientHeight() * .8)); // LightBox lb = new LightBox(dialogBox); // try { // lb.show(); // } catch (Exception ignore) { dialogBox.show(); // } dialogBox.center(); }
@Override public void center() { super.center(); SE = new ArrayList<SelectorPanel>(); for (TextSelectorClient TS : annotation.getTextSelectors()) { SelectorPanel SEE = new SelectorPanel( TS.getX().intValue(), TS.getY().intValue(), image.getAbsoluteLeft(), image.getAbsoluteTop(), TS.getWidth().intValue(), TS.getHeight().intValue()); SEE.show(); SE.add(SEE); } }
/** Displays the dialog box at the center of the browser window. */ public void center() { // If there is any progress dialog box, close it. FormUtil.dlg.hide(); // Let the base GWT implementation of centering take control. super.center(); // Some how focus will not get to the user name unless when called within // a deffered command. Scheduler.get() .scheduleDeferred( new Command() { public void execute() { if (txtFormName != null) { txtFormName.setFocus(true); } } }); }
@Override public void execute() { final DialogBox db = new DialogBox(false, true); db.setText("About MIT App Inventor"); db.setStyleName("ode-DialogBox"); db.setHeight("200px"); db.setWidth("400px"); db.setGlassEnabled(true); db.setAnimationEnabled(true); db.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML( MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) + "<BR/>Use Companion: " + BlocklyPanel.getCompVersion() + "<BR/><BR/>Please see " + RELEASE_NOTES_LINK_AND_TEXT + "<BR/><BR/>" + termsOfServiceText); SimplePanel holder = new SimplePanel(); // holder.setStyleName("DialogBox-footer"); Button ok = new Button("Close"); ok.addClickListener( new ClickListener() { public void onClick(Widget sender) { db.hide(); } }); holder.add(ok); DialogBoxContents.add(message); DialogBoxContents.add(holder); db.setWidget(DialogBoxContents); db.show(); }
public void center() { if (dialog == null) return; dialog.center(); }
public void Configure_start_time() { final DialogBox dialogBox = new DialogBox(); dialogBox.addStyleName("g-DialogBox"); DOM.setStyleAttribute(dialogBox.getElement(), "border", "0px"); dialogBox.setText("Set Time"); dialogBox.setSize("294", "207"); final AbsolutePanel absolutePanel = new AbsolutePanel(); dialogBox.setWidget(absolutePanel); absolutePanel.setSize("294px", "187px"); // 自定义datebox的输出格式,在这里采用了简洁的输出格式"M/d/yy H:mm" final DateBox dateBox = new DateBox(); DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( "M/d/yy H:mm"); // DateTimeFormat只能通过函数getFormat来生成满足特定pattern的对象,因为其构造函数为protected DateBox.DefaultFormat defaultFormat = new DateBox.DefaultFormat(dateTimeFormat); dateBox.setFormat(defaultFormat); absolutePanel.add(dateBox, 109, 35); dateBox.setWidth("150px"); final Label dateLabel = new Label("Date:"); absolutePanel.add(dateLabel, 36, 35); dateLabel.setSize("38px", "18px"); final Label dateLabel_1 = new Label("Time:"); absolutePanel.add(dateLabel_1, 36, 80); dateLabel_1.setSize("38px", "18px"); final ListBox listBox = new ListBox(); absolutePanel.add(listBox, 109, 77); listBox.setSize("150px", "21px"); String[] minutes = {"00", "15", "30", "45"}; String[] hours = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }; String[] times = new String[96]; // System.out.println(minutes.length+" "+hours.length+" "+times.length); for (int i = 0; i < 24; i++) { for (int j = 0; j < 4; j++) { times[4 * i + j] = hours[i] + ":" + minutes[j]; } } for (int i = 0; i < 96; i++) { listBox.addItem(times[i]); } final Button okButton = new Button(); DOM.setStyleAttribute(okButton.getElement(), "fontSize", "10pt"); okButton.removeStyleName("gwt-Button"); okButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // TODO Auto-generated method stub TextBox inner_textBox = dateBox.getTextBox(); if (inner_textBox.getText() == null || inner_textBox.getText().equals("")) { dateBox.addStyleName("dateBoxFormatError"); // 如果用户没编辑日期,则datebox框变红,等待用户更正 } else { String dateString = inner_textBox.getText(); int index = listBox.getSelectedIndex(); String timeString = listBox.getValue(index); if (timeString != null) { String[] date_and_time = dateString.split(" "); date_and_time[1] = timeString; dateString = date_and_time[0] + " " + date_and_time[1]; start_time = dateString; } dialogBox.hide(); } System.out.println(start_time); } }); absolutePanel.add(okButton, 93, 129); okButton.setSize("105px", "21px"); okButton.setText("OK"); dialogBox.center(); }
public void center() { dialogBox.center(); }
@Override public void run() { dialogBox.center(); dialogBox.setVisible(true); afterShow(); }
private void showAddItemAttributeDialog(final VkMenuBarHorizontal menuBar) { final DialogBox origDialog = new DialogBox(); DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE)); final VerticalPanel dialog = new VerticalPanel(); origDialog.add(dialog); origDialog.setText("Provide html for item name and JS to execute on its click"); dialog.setWidth("100%"); dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.MAX_VALUE + ""); HorizontalPanel nameHp = new HorizontalPanel(); nameHp.setWidth("100%"); dialog.add(nameHp); nameHp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); nameHp.add(new Label("Name HTML:")); nameHp.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); nameHp.setCellWidth(nameHp.getWidget(0), "35%"); final TextArea nameTextArea = new TextArea(); nameHp.add(nameTextArea); nameTextArea.setSize("300px", "100px"); Timer t = new Timer() { @Override public void run() { VkDesignerUtil.centerDialog(dialog); nameTextArea.setFocus(true); } }; t.schedule(100); HorizontalPanel jsHp = new HorizontalPanel(); jsHp.setWidth("100%"); dialog.add(jsHp); jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT); jsHp.add(new Label("Command Js:")); jsHp.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT); jsHp.setCellWidth(jsHp.getWidget(0), "35%"); final VkEventTextArea jsTextArea = new VkEventTextArea(); jsTextArea.setSize("300px", "100px"); jsHp.add(jsTextArea); HorizontalPanel buttonsPanel = new HorizontalPanel(); dialog.add(buttonsPanel); Button saveButton = new Button("Save"); buttonsPanel.add(saveButton); saveButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { menuBar.getCommandJs().put(menuBar.getItemCount(), jsTextArea.getText()); addMenuItem(menuBar, nameTextArea.getText(), jsTextArea.getText()); origDialog.hide(); } }); Button cancelButton = new Button("Cancel"); buttonsPanel.add(cancelButton); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { origDialog.hide(); } }); origDialog.center(); origDialog.setPopupPosition(origDialog.getPopupLeft() + 1, origDialog.getPopupTop()); }
protected void positionAndShowDialog() { super.center(); }
public void show() { createDialog(); dialog.center(); dialog.show(); Widgets.focusAndSelect(editorWidget); }
@SuppressWarnings("unchecked") public void populateFilesList( SolutionBrowserPerspective perspective, SolutionTree solutionTree, TreeItem item) { filesList.clear(); ArrayList<Element> files = (ArrayList<Element>) item.getUserObject(); // let's sort this list based on localized name Collections.sort( files, new Comparator<Element>() { public int compare(Element o1, Element o2) { String name1 = o1.getAttribute("localized-name"); // $NON-NLS-1$ String name2 = o2.getAttribute("localized-name"); // $NON-NLS-1$ return name1.compareTo(name2); } }); if (files != null) { int rowCounter = 0; for (int i = 0; i < files.size(); i++) { Element fileElement = files.get(i); if ("false".equals(fileElement.getAttribute("isDirectory"))) { // $NON-NLS-1$ //$NON-NLS-2$ String name = fileElement.getAttribute("name"); // $NON-NLS-1$ String solution = solutionTree.getSolution(); String path = solutionTree.getPath(); String lastModifiedDateStr = fileElement.getAttribute("lastModifiedDate"); // $NON-NLS-1$ String url = fileElement.getAttribute("url"); // $NON-NLS-1$ ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(name); String icon = null; if (plugin != null) { icon = plugin.getFileIcon(); } String localizedName = fileElement.getAttribute("localized-name"); String description = fileElement.getAttribute("description"); String tooltip = localizedName; if (solutionTree.isUseDescriptionsForTooltip() && !StringUtils.isEmpty(description)) { tooltip = description; } final FileItem fileLabel = new FileItem( name, localizedName, tooltip, solution, path, //$NON-NLS-1$ lastModifiedDateStr, url, this, PluginOptionsHelper.getEnabledOptions(name), toolbar.getSupportsACLs(), icon); // BISERVER-2317: Request for more IDs for Mantle UI elements // set element id as the filename fileLabel.getElement().setId("file-" + name); // $NON-NLS-1$ fileLabel.addFileSelectionChangedListener(toolbar); fileLabel.setWidth("100%"); // $NON-NLS-1$ try { perspective.getDragController().makeDraggable(fileLabel); } catch (Exception e) { Throwable throwable = e; String text = "Uncaught exception: "; while (throwable != null) { StackTraceElement[] stackTraceElements = throwable.getStackTrace(); text += throwable.toString() + "\n"; for (int ii = 0; ii < stackTraceElements.length; ii++) { text += " at " + stackTraceElements[ii] + "\n"; } throwable = throwable.getCause(); if (throwable != null) { text += "Caused by: "; } } DialogBox dialogBox = new DialogBox(true); DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF"); System.err.print(text); text = text.replaceAll(" ", " "); dialogBox.setHTML("<pre>" + text + "</pre>"); dialogBox.center(); } filesList.setWidget(rowCounter++, 0, fileLabel); if (selectedFileItem != null && selectedFileItem.getFullPath().equals(fileLabel.getFullPath())) { fileLabel.setStyleName("fileLabelSelected"); // $NON-NLS-1$ selectedFileItem = fileLabel; } else { fileLabel.setStyleName("fileLabel"); // $NON-NLS-1$ } } } } }