List of usage examples for com.google.gwt.user.client.ui DialogBox DialogBox
public DialogBox(boolean autoHide, boolean modal)
From source file:com.google.gwt.sample.hellomaps.client.HelloMaps.java
License:Apache License
private void createMap() { // Set the map up in a Dialog box, just for fun. final DialogBox dialog = new DialogBox(false, false); final Map theMap = new Map(); final Button findButton = new Button("Address:"); final TextBox tb = new TextBox(); tb.addKeyboardListener(new KeyboardListenerAdapter() { @Override/*from w ww . j a v a 2 s . c o m*/ public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KEY_ENTER) { theMap.setLocation(((TextBox) sender).getText()); } else if (keyCode == KEY_ESCAPE) { dialog.removeFromParent(); } } }); findButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { theMap.setLocation(tb.getText()); } }); tb.setWidth("100%"); final HorizontalPanel hp = new HorizontalPanel(); hp.add(findButton); hp.setCellWidth(findButton, "15%"); hp.add(tb); hp.setCellWidth(tb, "85%"); final VerticalPanel vp = new VerticalPanel(); vp.add(hp); vp.add(theMap); dialog.setText("Drag me!"); dialog.setWidget(vp); dialog.center(); }
From source file:com.google.gwt.sample.mobilewebapp.client.desktop.MobileWebAppShellDesktop.java
License:Apache License
/** * Show a tutorial video./*from w w w .j av a 2 s.c o m*/ */ private void showTutorial() { // Reuse the tutorial dialog if it is already created. if (tutoralPopup != null) { // Reset the video. // TODO(jlabanca): Is cache-control=private making the video non-seekable? if (tutorialVideo != null) { tutorialVideo.setSrc(tutorialVideo.getCurrentSrc()); } tutoralPopup.center(); return; } /* * Forward the use to YouTube if video is not supported or if none of the * source formats are supported. */ tutorialVideo = Video.createIfSupported(); if (tutorialVideo == null) { Label label = new Label("Click the link below to view the tutoral:"); Anchor anchor = new Anchor(EXTERNAL_TUTORIAL_URL, EXTERNAL_TUTORIAL_URL); anchor.setTarget("_blank"); FlowPanel panel = new FlowPanel(); panel.add(label); panel.add(anchor); tutoralPopup = new PopupPanel(true, false); tutoralPopup.setWidget(panel); tutoralPopup.setGlassEnabled(true); // Hide the popup when the user clicks the link. anchor.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { tutoralPopup.hide(); } }); tutoralPopup.center(); return; } // Add the video sources. tutorialVideo.addSource("video/tutorial.ogv", VideoElement.TYPE_OGG); tutorialVideo.addSource("video/tutorial.mp4", VideoElement.TYPE_MP4); // Setup the video player. tutorialVideo.setControls(true); tutorialVideo.setAutoplay(true); // Put the video in a dialog. final DialogBox popup = new DialogBox(false, false); popup.setText("Tutorial"); VerticalPanel vPanel = new VerticalPanel(); vPanel.add(tutorialVideo); vPanel.add(new Button("Close", new ClickHandler() { public void onClick(ClickEvent event) { tutorialVideo.pause(); popup.hide(); } })); popup.setWidget(vPanel); tutoralPopup = popup; popup.center(); }
From source file:com.googlecode.simplegwt.tbg.client.TbgEntryPoint.java
License:Apache License
/** * @see com.google.gwt.core.client.EntryPoint#onModuleLoad() */// w w w . j a v a 2s. c o m public void onModuleLoad() { final ButtonGrid buttonGrid = new ButtonGrid(DEFAULT_GRID_HEIGHT, DEFAULT_GRID_WIDTH); final GridControls gridControls = new GridControls(buttonGrid); final DialogBox dialog = new DialogBox(false, false); dialog.setWidget(new Label( "Click a button to toggle it on/off. " + "Adjacent buttons will also reverse their state.", true)); dialog.setText("Help - ToggleButtonGame"); dialog.addStyleName("tbg-help-dialog"); final FlowPanel gridHeaderBar = new FlowPanel(); final Label helpLabel = new CommandLabel("Help", new Command() { boolean shownOnce = false; public void execute() { if (dialog.isShowing()) { dialog.hide(); } else { if (shownOnce) { dialog.show(); } else { dialog.center(); shownOnce = true; } } } }); helpLabel.setStylePrimaryName("tbg-help"); gridHeaderBar.add(new LoginWidget(gridControls)); gridHeaderBar.add(helpLabel); final DecoratorPanel decoration = new DecoratorPanel(); final FlowPanel wrapper = new FlowPanel(); wrapper.add(gridHeaderBar); wrapper.add(gridControls); wrapper.add(buttonGrid); decoration.add(wrapper); RootPanel.get("gwt").add(decoration); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { resize(event.getHeight(), event.getWidth()); } }); resize(Window.getClientHeight(), Window.getClientWidth()); }
From source file:com.gwtmodel.table.view.util.ModalDialog.java
License:Apache License
public ModalDialog(VerticalPanel vP, String title, boolean autohide, boolean modal) { this.vP = vP; this.title = iMess.getMessage(title); dBox = new DialogBox(autohide, modal); }
From source file:com.mecatran.otp.gwt.client.PlannerWidgetEntryPoint.java
License:Open Source License
private void showIntroDialogBox() { if (config.getIntroMessage() == null) return;/*ww w . j av a 2s .c o m*/ final DialogBox dialogBox = new DialogBox(true, true); VerticalPanel dialogBoxContents = new VerticalPanel(); dialogBox.setText(I18nUtils.tr("welcome")); HTML message = new HTML(config.getIntroMessage()); Button button = new Button(I18nUtils.tr("ok"), new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBox.setWidth("400px"); dialogBoxContents.add(message); dialogBoxContents.add(button); dialogBox.setWidget(dialogBoxContents); dialogBox.center(); }
From source file:com.mecatran.otp.gwt.client.view.PlannerFormWidget.java
License:Open Source License
private void linkTo() { // Create URL String url = new PlannerState(getPlanRequestBean()).getUrl(); // Display dialog box final DialogBox dialogBox = new DialogBox(true, true); VerticalPanel dialogBoxContents = new VerticalPanel(); dialogBoxContents.setWidth("100%"); dialogBox.setText(I18nUtils.tr("link.to.this.page")); Label message = new Label(I18nUtils.tr("copy.paste.link.hint")); dialogBoxContents.add(message);/*from ww w. j a v a 2 s. co m*/ final TextBox urlTextBox = new TextBox(); urlTextBox.setText(url); urlTextBox.setWidth("100%"); dialogBoxContents.add(urlTextBox); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { urlTextBox.selectAll(); urlTextBox.setFocus(true); } }); Button button = new Button(I18nUtils.tr("ok"), new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); dialogBoxContents.add(button); dialogBox.setWidth("400px"); dialogBox.setWidget(dialogBoxContents); dialogBox.center(); }
From source file:com.ponysdk.ui.terminal.ui.PTDialogBox.java
License:Apache License
@Override public void create(final PTInstruction create, final UIService uiService) { boolean autoHide = false; boolean modal = false; if (create.containsKey(PROPERTY.POPUP_AUTO_HIDE)) { autoHide = create.getBoolean(PROPERTY.POPUP_AUTO_HIDE); }/*from w ww.j a v a 2s .com*/ if (create.containsKey(PROPERTY.POPUP_MODAL)) { modal = create.getBoolean(PROPERTY.POPUP_MODAL); } init(create, uiService, new DialogBox(autoHide, modal)); addCloseHandler(create, uiService); }
From source file:com.rhizospherejs.gwt.showcase.client.books.BookRenderer.java
License:Open Source License
@Override public void render(final Book book, boolean expanded, RenderingOutput helper) { HorizontalPanel hp = new HorizontalPanel(); // Create a drag handle: users will be able to drag Book renderings by using // this handle. Label dragHandler = new Label(); dragHandler.setHeight(book.getThumbnailHeight() + "px"); dragHandler.setWidth("1em"); dragHandler.setStyleName(Resources.INSTANCE.booksCss().bookDragHandler(), true); // Tell Rhizosphere about the handler (otherwise Rhizosphere will make the // entire widget draggable). Remember to include the HasCustomDragHandlers // interface. helper.addDragHandler(dragHandler);/*from w w w .java 2 s. c o m*/ hp.add(dragHandler); // Book thumbnail. Image img = new Image(book.getThumbnailUrl(), 0, 0, book.getThumbnailWidth(), book.getThumbnailHeight()); hp.add(img); // Register events on the image thumbnail, to show a dialog box with // additional information about the selected book. img.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { final DialogBox db = new DialogBox(true, true); db.setAnimationEnabled(true); db.setGlassEnabled(true); HorizontalPanel hp = new HorizontalPanel(); Image img = new Image(book.getThumbnailUrl(), 0, 0, book.getThumbnailWidth(), book.getThumbnailHeight()); img.getElement().getStyle().setMargin(0.5, Unit.EM); hp.add(img); VerticalPanel p = new VerticalPanel(); p.setStyleName(Resources.INSTANCE.booksCss().bookData(), true); Label authors = new Label(book.getAuthors()); authors.setStyleName(Resources.INSTANCE.booksCss().bookAuthors()); p.add(authors); Label title = new Label(book.getTitle()); title.setStyleName(Resources.INSTANCE.booksCss().bookTitle(), true); p.add(title); Label details = new Label("Published:" + String.valueOf(book.getPublishedYear()) + " " + "Pages: " + String.valueOf(book.getNumberOfPages())); details.setStyleName(Resources.INSTANCE.booksCss().bookDetails(), true); p.add(details); Anchor viewInGoogleBooks = new Anchor("View in Google Books", book.getUrl(), "_blank"); viewInGoogleBooks.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { db.hide(); } }); p.add(viewInGoogleBooks); hp.add(p); db.add(hp); db.center(); } }); // Emit the widget to Rhizosphere once you have finished assembling it. helper.emitWidget(hp); }
From source file:com.rhizospherejs.gwt.showcase.client.books.BooksTab.java
License:Open Source License
@UiHandler("submitButton") void searchBooks(ClickEvent event) { // Disable the search fields and buttons while a search is already in // progress.//w w w . j a v a 2 s . c om showSearchStarted(); String query = searchInput.getValue(); if (query.length() == 0) { return; } if (!searchApiLoaded) { DialogBox d = new DialogBox(true, true); d.setText("Still loading Book Search APIs..."); d.center(); return; } doNativeSearch(this, query); }
From source file:com.seanchenxi.gwt.ui.widget.MessageBox.java
License:Apache License
private MessageBox() { buttons = new FlowPanel(); container = new FlexTable(); container.setSize(getResourceStyle().containerWidth(), getResourceStyle().containerHeight()); container.setCellPadding(getResourceStyle().containerCellPadding()); container.setCellSpacing(getResourceStyle().containerCellSpacing()); CellFormatter cellFormatter = container.getCellFormatter(); container.setHTML(0, 0, ""); cellFormatter.getElement(0, 0).setClassName(getResourceStyle().messageBoxIconCell()); container.setHTML(0, 1, ""); container.setWidget(1, 0, buttons);/*w w w. ja v a 2 s .co m*/ container.getFlexCellFormatter().setColSpan(1, 0, 2); cellFormatter.getElement(1, 0).setClassName(getResourceStyle().messageBoxButtonCell()); dialog = new DialogBox(false, true); dialog.setStyleName(getResourceStyle().messageBox()); dialog.getCaption().asWidget().setStyleName(getResourceStyle().messageBoxCaption()); dialog.setWidget(container); }