List of usage examples for com.google.gwt.user.client.ui DialogBox setWidget
@Override public void setWidget(Widget w)
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * Display a Dialog box that explains that you cannot connect a * device or the emulator to App Inventor until you have a project * selected.//from w w w . j ava 2 s. c o m */ 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(); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * 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.//from w w w . ja v a 2 s . co m * * @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(); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * Display a generic warning dialog box. * This method is public because it is intended to be used from other * parts of the client GWT side system./* w w w . ja v a 2s . com*/ * * Note: We expect our caller to internationalize the messages to be * displayed. * * @param title The title for the dialog box * @param message The message to display * @param buttonString the name of the button, i.e., "OK" */ public void warningDialog(String title, String messageString, String buttonString) { // Create the UI elements of the DialogBox final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(title); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML("<p>" + messageString + "</p>"); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button okButton = new Button(buttonString); 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(); }
From source file:com.google.appinventor.client.utils.MessageDialog.java
License:Open Source License
/** * Put up a modal dialog box.//from w w w . j a v a 2 s . c o m * * @param title Title for the dialog, already internationalized * @param message Message box content, already internationalized * @param OK String for OK button, already internationalized * @param Cancel String for Cancel button, null if non, internationalized * @param actions Actions object to call upon completion, can be null */ public static void messageDialog(String title, String message, String OK, String Cancel, final Actions actions) { final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(title); dialogBox.setHeight("100px"); dialogBox.setWidth("400px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML messageHtml = new HTML("<p>" + message + "</p>"); messageHtml.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); Button okButton = new Button(OK); okButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); if (actions != null) actions.onOK(); } }); holder.add(okButton); if (Cancel != null) { Button cancelButton = new Button(Cancel); cancelButton.addClickListener(new ClickListener() { @Override public void onClick(Widget sender) { dialogBox.hide(); if (actions != null) actions.onCancel(); } }); holder.add(cancelButton); } DialogBoxContents.add(messageHtml); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
From source file:com.google.appinventor.client.wizards.FileUploadWizard.java
License:Open Source License
private void createErrorDialog(String title, String body, Error e, final FolderNode folderNode, final FileUploadedCallback fileUploadedCallback) { final DialogBox dialogBox = new DialogBox(false, true); HTML message;/*from ww w. ja v a2 s . co m*/ dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setHeight("150px"); dialogBox.setWidth("350px"); dialogBox.setGlassEnabled(true); dialogBox.setAnimationEnabled(true); dialogBox.center(); VerticalPanel DialogBoxContents = new VerticalPanel(); FlowPanel holder = new FlowPanel(); Button ok = new Button("OK"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); new FileUploadWizard(folderNode, fileUploadedCallback).show(); } }); holder.add(ok); dialogBox.setText(title); message = new HTML(body); switch (e) { case AIAMEDIAASSET: Button info = new Button("More Info"); info.addClickListener(new ClickListener() { public void onClick(Widget sender) { Window.open(MESSAGES.aiaMediaAssetHelp(), "AIA Help", ""); } }); holder.add(info); case NOFILESELECETED: case MALFORMEDFILENAME: case FILENAMEBADSIZE: default: break; } message.setStyleName("DialogBox-message"); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
From source file:com.google.appinventor.client.youngandroid.YoungAndroidFormUpgrader.java
License:Open Source License
private static void upgradeWarnDialog(String aMessage) { final DialogBox dialogBox = new DialogBox(false, true); dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.warningDialogTitle()); dialogBox.setGlassEnabled(true);//from w w w .j av a 2 s .c om 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(); }
From source file:com.google.code.gwt.appcache.sample.helloappcache.client.HelloApplicationCache.java
License:Apache License
/** * This is the entry point method.//from ww w . jav a 2 s. co m */ public void onModuleLoad() { Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png"); Button button = new Button("Click me"); VerticalPanel vPanel = new VerticalPanel(); // We can add style names. vPanel.addStyleName("widePanel"); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vPanel.add(img); vPanel.add(button); // Add image and button to the RootPanel RootPanel.get().add(vPanel); // Create the dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Welcome to GWT ApplicationCache Demo!"); dialogBox.setAnimationEnabled(true); Button closeButton = new Button("close"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setWidth("100%"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogVPanel.add(closeButton); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); // Set the contents of the Widget dialogBox.setWidget(dialogVPanel); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // Invoke service: HelloServiceAsync service = GWT.create(HelloService.class); service.sayHello("Bart", new AsyncCallback<String>() { public void onFailure(Throwable caught) { dialogBox.setText("Could not invoke 'sayHello' service: " + caught); dialogBox.center(); dialogBox.show(); } public void onSuccess(String result) { dialogBox.setText(result + "! Welcome to GWT ApplicationCache Demo!"); dialogBox.center(); dialogBox.show(); } }); } }); }
From source file:com.google.code.gwt.database.sample.hellodatabase.client.HelloDatabase.java
License:Apache License
/** * This is the entry point method./*from ww w . ja v a 2 s . co m*/ */ public void onModuleLoad() { if (!Database.isSupported()) { Window.alert("HTML 5 Database is NOT supported in this browser!"); return; } // Create the dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Welcome to GWT Database Demo!"); dialogBox.setAnimationEnabled(true); Button closeButton = new Button("close", new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setWidth("100%"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); final VerticalPanel clickedData = new VerticalPanel(); dialogVPanel.add(clickedData); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png"); Button addClickButton = new Button("Add Click", new ClickHandler() { public void onClick(ClickEvent event) { dbService.insertClick(new Date(), new RowIdListCallback() { public void onFailure(DataServiceException error) { Window.alert("Failed to add click! " + error); } public void onSuccess(final List<Integer> rowIds) { dbService.getClicks(new ListCallback<ClickRow>() { public void onFailure(DataServiceException error) { Window.alert("Failed to query clicks! " + error); } public void onSuccess(List<ClickRow> result) { clickedData.clear(); clickedData.add(new Label("Last click insert ID: " + rowIds.get(0))); for (ClickRow row : result) { clickedData.add(new Label("Clicked on " + row.getClicked())); } dialogBox.center(); dialogBox.show(); } }); } }); } }); Button getCountButton = new Button("Get Counts", new ClickHandler() { public void onClick(ClickEvent event) { getCount(); } }); vPanel = new VerticalPanel(); // We can add style names. vPanel.addStyleName("widePanel"); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vPanel.add(img); vPanel.add(addClickButton); vPanel.add(getCountButton); // Add image and button to the RootPanel RootPanel.get().add(vPanel); // Create table 'clickcount' if it doesn't exist already: dbService.initTable(new VoidCallback() { public void onFailure(DataServiceException error) { Window.alert("Failed to initialize table! " + error); } public void onSuccess() { Window.alert("Database initialized successfully."); getCount(); } }); getVersion(); }
From source file:com.google.code.gwt.iui.sample.helloiui.client.HelloiUI.java
License:Apache License
/** * This is the entry point method.//w ww. ja v a 2 s .co m */ public void onModuleLoad() { Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png"); Button button = new Button("Click me"); VerticalPanel vPanel = new VerticalPanel(); // We can add style names. vPanel.addStyleName("widePanel"); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vPanel.add(img); vPanel.add(button); // Add image and button to the RootPanel RootPanel.get().add(vPanel); // Create the dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Welcome to GWT iUI Demo!"); dialogBox.setAnimationEnabled(true); Button closeButton = new Button("close"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setWidth("100%"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogVPanel.add(closeButton); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); // Set the contents of the Widget dialogBox.setWidget(dialogVPanel); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.center(); dialogBox.show(); } }); }
From source file:com.google.code.gwt.template.sample.hellotemplate.client.HelloTemplate.java
License:Apache License
/** * This is the entry point method.// w w w . j ava 2s. co m */ public void onModuleLoad() { Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png"); Button button = new Button("Click me"); VerticalPanel vPanel = new VerticalPanel(); // We can add style names. vPanel.addStyleName("widePanel"); vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vPanel.add(img); vPanel.add(button); // Add image and button to the RootPanel RootPanel.get().add(vPanel); // Create the dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Welcome to GWT Template Demo!"); dialogBox.setAnimationEnabled(true); Button closeButton = new Button("close"); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.setWidth("100%"); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); dialogVPanel.add(closeButton); closeButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); // Set the contents of the Widget dialogBox.setWidget(dialogVPanel); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.center(); dialogBox.show(); } }); }