Java Code Examples for com.google.gwt.user.client.ui.DialogBox#setWidget()
The following examples show how to use
com.google.gwt.user.client.ui.DialogBox#setWidget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppUtils.java From swcv with MIT License | 6 votes |
public static DialogBox createLoadingBox() { final DialogBox box = new DialogBox(); VerticalPanel rows = new VerticalPanel(); rows.setSpacing(1); HTML html = new HTML("<img src=\"" + GWT.getHostPageBaseURL() + "static/imgs/loader.gif\" alt=\"loading\" />"); rows.add(html); rows.addStyleName("whiteWithBorder"); rows.setCellHeight(html, "100"); rows.setCellWidth(html, "300"); rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER); rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel hp = new HorizontalPanel(); hp.add(rows); box.setWidget(hp); box.hide(); return box; }
Example 2
Source File: AppUtils.java From swcv with MIT License | 6 votes |
public static DialogBox createShadow() { final DialogBox box = new DialogBox(); VerticalPanel rows = new VerticalPanel(); rows.setSpacing(1); HTML html = new HTML("<div></div>"); rows.add(html); rows.addStyleName("blackTransparent"); rows.setCellHeight(html, "" + Window.getClientHeight()); rows.setCellWidth(html, "" + Window.getClientWidth()); rows.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER); rows.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel hp = new HorizontalPanel(); hp.add(rows); box.setWidget(hp); return box; }
Example 3
Source File: YoungAndroidFormUpgrader.java From appinventor-extensions with Apache License 2.0 | 6 votes |
private static void upgradeWarnDialog(String aMessage) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.warningDialogTitle()); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); final HTML message = new HTML(aMessage); message.setStyleName("DialogBox-message"); VerticalPanel vPanel = new VerticalPanel(); Button okButton = new Button("OK"); okButton.addClickListener(new ClickListener() { @Override public void onClick(Widget sender) { dialogBox.hide(); } }); vPanel.add(message); vPanel.add(okButton); dialogBox.setWidget(vPanel); dialogBox.center(); dialogBox.show(); }
Example 4
Source File: User.java From sc2gears with Apache License 2.0 | 6 votes |
private static DialogBox createWaitingDialog( final String message ) { final DialogBox dialogBox = new DialogBox(); dialogBox.setText( "Info" ); final HorizontalPanel hp = new HorizontalPanel(); DOM.setStyleAttribute( hp.getElement(), "padding", "20px" ); hp.setHeight( "20px" ); hp.add( new Image( "/images/loading.gif" ) ); hp.add( ClientUtils.createHorizontalEmptyWidget( 5 ) ); hp.add( new Label( message ) ); dialogBox.setWidget( hp ); dialogBox.center(); return dialogBox; }
Example 5
Source File: ApiUser.java From sc2gears with Apache License 2.0 | 6 votes |
private static DialogBox createWaitingDialog( final String message ) { final DialogBox dialogBox = new DialogBox(); dialogBox.setText( "Info" ); final HorizontalPanel hp = new HorizontalPanel(); DOM.setStyleAttribute( hp.getElement(), "padding", "20px" ); hp.setHeight( "20px" ); hp.add( new Image( "/images/loading.gif" ) ); hp.add( ClientUtils.createHorizontalEmptyWidget( 5 ) ); hp.add( new Label( message ) ); dialogBox.setWidget( hp ); dialogBox.center(); return dialogBox; }
Example 6
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * This dialog is showned if an account is disabled. It is * completely modal with no escape. The provided URL is displayed in * an iframe, so it can be tailored to each person whose account is * disabled. * * @param Url the Url to display in the dialog box. */ public void disabledAccountDialog(String Url) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.accountDisabledMessage()); dialogBox.setHeight("700px"); dialogBox.setWidth("700px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML("<iframe src=\"" + Url + "\" style=\"border: 0; width: 680px; height: 660px;\"></iframe>"); message.setStyleName("DialogBox-message"); DialogBoxContents.add(message); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 7
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * The "Final" Dialog box. When a user chooses to end their session * due to a conflicting login, we should show this dialog which is modal * and has no exit! My preference would have been to close the window * altogether, but the browsers won't let javascript code close windows * that it didn't open itself (like the main window). I also tried to * use document.write() to write replacement HTML but that caused errors * in Firefox and strange behavior in Chrome. So we do this... * * We are called from invalidSessionDialog() (above). */ private void finalDialog() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.finalDialogText()); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.finalDialogMessage()); message.setStyleName("DialogBox-message"); DialogBoxContents.add(message); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 8
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * corruptionDialog -- Put up a dialog box explaining that we detected corruption * while reading in a project file. There is no continuing once this happens. * */ void corruptionDialog() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.corruptionDialogText()); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.corruptionDialogMessage()); message.setStyleName("DialogBox-message"); DialogBoxContents.add(message); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 9
Source File: AppUtils.java From swcv with MIT License | 5 votes |
public static DialogBox createMessageBox(String message, final DialogBox shadow) { // Create a dialog box and set the caption text final DialogBox dialogBox = new DialogBox(); // Create a table to layout the content VerticalPanel dialogContents = new VerticalPanel(); dialogContents.setSpacing(4); dialogBox.setWidget(dialogContents); // Add an image to the dialog HTML html = new HTML(message); dialogContents.add(html); dialogContents.setCellHorizontalAlignment(html, HasHorizontalAlignment.ALIGN_CENTER); // Add a close button at the bottom of the dialog Button closeButton = new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { if (shadow != null) shadow.hide(); dialogBox.hide(); } }); dialogContents.add(closeButton); dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_RIGHT); dialogBox.addStyleName("errorBox inconsolataNormal"); // Return the dialog box return dialogBox; }
Example 10
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Display a Dialog box that explains that you cannot connect a * device or the emulator to App Inventor until you have a project * selected. */ private void wontConnectDialog() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.noprojectDialogTitle()); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML("<p>" + MESSAGES.noprojectDuringConnect() + "</p>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button okButton = new Button("OK"); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); holder.add(okButton); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 11
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Display a dialog box with a provided warning message. * * @param message The message to display */ public void genericWarning(String inputMessage) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.warningDialogTitle()); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML("<p>" + inputMessage + "</p>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button okButton = new Button("OK"); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); holder.add(okButton); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 12
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Show a Dialog Box when we receive an SC_PRECONDITION_FAILED * response code to any Async RPC call. This is a signal that * either our session has expired, or our login cookie has otherwise * become invalid. This is a fatal error and the user should not * be permitted to continue (many ignore the red error bar and keep * working, in vain). So now when this happens, we put up this * modal dialog box which cannot be dismissed. Instead it presents * just one option, a "Reload" button which reloads the browser. * This should trigger a re-authentication (or in the case of an * App Inventor upgrade trigging the problem, the loading of newer * code). */ public void sessionDead() { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.invalidSessionDialogText()); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.sessionDead()); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button reloadSession = new Button(MESSAGES.reloadWindow()); reloadSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); reloadWindow(true); } }); holder.add(reloadSession); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 13
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Possibly display the MIT App Inventor "Splash Screen" * * @param force Bypass the check to see if they have dimissed this version */ private void createWelcomeDialog(boolean force) { if (!shouldShowWelcomeDialog() && !force) { maybeShowNoProjectsDialog(); return; } // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.createWelcomeDialogText()); dialogBox.setHeight(splashConfig.height + "px"); dialogBox.setWidth(splashConfig.width + "px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(splashConfig.content); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button ok = new Button(MESSAGES.createWelcomeDialogButton()); final CheckBox noshow = new CheckBox(MESSAGES.doNotShow()); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); if (noshow.getValue()) { // User checked the box userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS). changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION, "" + splashConfig.version); userSettings.saveSettings(null); } maybeShowNoProjectsDialog(); } }); holder.add(ok); holder.add(noshow); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
Example 14
Source File: TutorialPanel.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Creates video on page! */ private static void createVideoDialog(String tutorialId) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText("Tutorial Video"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); // Adds Youtube Video HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); holder.add(ok); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
Example 15
Source File: TopToolbar.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public void execute() { final DialogBox db = new DialogBox(false, true); db.setText("About The Companion"); db.setStyleName("ode-DialogBox"); db.setHeight("200px"); db.setWidth("400px"); db.setGlassEnabled(true); db.setAnimationEnabled(true); db.center(); String downloadinfo = ""; if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) { String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1; downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n"; downloadinfo += BlocklyPanel.getQRCode(url); } VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML( "Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo ); SimplePanel holder = new SimplePanel(); 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(); }
Example 16
Source File: Ode.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Creates a dialog box to show empty trash list message. * @param showDialog Convenience variable to show the created DialogBox. * @return The created and optionally displayed Dialog box. */ public DialogBox createEmptyTrashDialog(boolean showDialog) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, false); //DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.createNoProjectsDialogText()); Grid mainGrid = new Grid(2, 2); mainGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); mainGrid.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); mainGrid.getCellFormatter().setAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT, HasVerticalAlignment.ALIGN_MIDDLE); Image dialogImage = new Image(Ode.getImageBundle().codiVert()); Grid messageGrid = new Grid(2, 1); messageGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_JUSTIFY, HasVerticalAlignment.ALIGN_MIDDLE); messageGrid.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE); Label messageChunk2 = new Label(MESSAGES.showEmptyTrashMessage()); messageGrid.setWidget(1, 0, messageChunk2); mainGrid.setWidget(0, 0, dialogImage); mainGrid.setWidget(0, 1, messageGrid); dialogBox.setWidget(mainGrid); dialogBox.center(); if (showDialog) { dialogBox.show(); } return dialogBox; }
Example 17
Source File: TutorialPanel.java From appinventor-extensions with Apache License 2.0 | 4 votes |
/** * Enlarges image on page */ private static void createImageDialog(String img) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); VerticalPanel DialogBoxContents = new VerticalPanel(); FlowPanel holder = new FlowPanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); } }); ok.setStyleName("DialogBox-button"); // Adds Image final Image image = new Image(img); image.addLoadHandler(new LoadHandler() { public void onLoad(LoadEvent evt) { final int imageWidth = image.getWidth(); final int imageHeight = image.getHeight(); final int windowWidth = (int) ((float) Window.getClientWidth() * 0.8); final int windowHeight = (int) ((float) Window.getClientHeight() * 0.9); int effectiveWidth = imageWidth; int effectiveHeight = imageHeight; if (imageWidth > windowWidth) { effectiveWidth = windowWidth; effectiveHeight = (int)(imageHeight * ((float)effectiveWidth / imageWidth)); } if (effectiveHeight > windowHeight) { effectiveHeight = windowHeight; effectiveWidth = (int)(imageWidth * ((float)effectiveHeight / imageHeight)); } image.setPixelSize(effectiveWidth, effectiveHeight); dialogBox.center(); } }); image.setStyleName("DialogBox-image"); holder.add(ok); DialogBoxContents.add(image); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.center(); dialogBox.show(); }
Example 18
Source File: ClientUtils.java From sc2gears with Apache License 2.0 | 4 votes |
/** * Displays a Details dialog box.<br> * Renders a table with 2 columns: name and value pairs. * @param caption title of the dialog * @param values values to be displayed; each element is an array (name-value pair) which defines a row */ public static void displayDetailsDialog( final String caption, final Object[][] values ) { final DialogBox dialogBox = new DialogBox( true ); dialogBox.setText( caption ); dialogBox.setGlassEnabled( true ); final VerticalPanel content = new VerticalPanel(); content.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER ); final FlexTable table = new FlexTable(); table.setBorderWidth( 1 ); table.setCellSpacing( 0 ); table.setCellPadding( 3 ); final CellFormatter cellFormatter = table.getCellFormatter(); for ( int i = 0; i < values.length; i++ ) { // Name table.setWidget( i, 0, new Label( values[ i ][ 0 ].toString() ) ); cellFormatter.addStyleName( i, 0, "headerRow" ); final Object value = values[ i ] [ 1 ]; if ( value == null ) table.setWidget( i, 1, new Label() ); else if ( value instanceof Widget ) table.setWidget( i, 1, (Widget) value ); else if ( value instanceof Date ) table.setWidget( i, 1, createTimestampWidget( (Date) value ) ); else { String stringValue; if ( value instanceof String ) stringValue = (String) value; else if ( value instanceof Number ) stringValue = NUMBER_FORMAT .format( (Number) value ); else stringValue = value.toString(); table.setWidget( i, 1, new Label( stringValue ) ); } cellFormatter.addStyleName( i, 1, "row" + ( i & 0x01 ) ); cellFormatter.setHorizontalAlignment( i, 1, HasHorizontalAlignment.ALIGN_LEFT ); } content.add( table ); content.add( createVerticalEmptyWidget( 8 ) ); content.add( ClientUtils.createDialogCloseButton( dialogBox, "Close" ) ); content.add( createVerticalEmptyWidget( 8 ) ); dialogBox.setWidget( content ); dialogBox.center(); }
Example 19
Source File: TopToolbar.java From appinventor-extensions with Apache License 2.0 | 4 votes |
@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(); String html = MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) + "<BR/>" + MESSAGES.useCompanion(YaVersion.PREFERRED_COMPANION, YaVersion.PREFERRED_COMPANION + "u") + "<BR/>" + MESSAGES.targetSdkVersion(YaVersion.TARGET_SDK_VERSION, YaVersion.TARGET_ANDROID_VERSION); Config config = Ode.getInstance().getSystemConfig(); String releaseNotesUrl = config.getReleaseNotesUrl(); if (!Strings.isNullOrEmpty(releaseNotesUrl)) { html += "<BR/><BR/>Please see <a href=\"" + releaseNotesUrl + "\" target=\"_blank\">release notes</a>"; } String tosUrl = config.getTosUrl(); if (!Strings.isNullOrEmpty(tosUrl)) { html += "<BR/><BR/><a href=\"" + tosUrl + "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>"; } HTML message = new HTML(html); SimplePanel holder = new SimplePanel(); 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(); }
Example 20
Source File: PreviewFileCommand.java From appinventor-extensions with Apache License 2.0 | 4 votes |
@Override public void execute(final ProjectNode node) { final DialogBox dialogBox = new DialogBox(); dialogBox.setText(node.getName()); dialogBox.setStylePrimaryName("ode-DialogBox"); //setting position of dialog box dialogBox.center(); dialogBox.setAnimationEnabled(true); //button element final Button closeButton = new Button(MESSAGES.closeFilePreview()); closeButton.getElement().setId("closeButton"); closeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); buttonPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); buttonPanel.add(closeButton); VerticalPanel dialogPanel = new VerticalPanel(); dialogPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); Widget filePreview = generateFilePreview(node); dialogPanel.clear(); dialogPanel.add(filePreview); dialogPanel.add(buttonPanel); dialogPanel.setWidth("300px"); dialogBox.setGlassEnabled(false); dialogBox.setModal(false); // Set the contents of the Widget dialogBox.setWidget(dialogPanel); dialogBox.center(); dialogBox.show(); }