List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * 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). *//*from ww w . j a v a2s . c o m*/ 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(); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
/** * corruptionDialog -- Put up a dialog box explaining that we detected corruption * while reading in a project file. There is no continuing once this happens. * *//*from ww w . j av a 2 s.com*/ 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(); }
From source file:com.google.appinventor.client.Ode.java
License:Open Source License
public void blocksTruncatedDialog(final long projectId, final String fileId, final String content, final OdeAsyncCallback callback) { final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal) dialogBox.setStylePrimaryName("ode-DialogBox"); dialogBox.setText(MESSAGES.blocksTruncatedDialogText()); dialogBox.setHeight("150px"); dialogBox.setWidth("600px"); dialogBox.setGlassEnabled(true);/*from w w w . ja v a2 s .c om*/ dialogBox.setAnimationEnabled(true); dialogBox.center(); String[] fileParts = fileId.split("/"); String screenNameParts = fileParts[fileParts.length - 1]; final String screenName = screenNameParts.split("\\.")[0]; // Get rid of the .bky part final String userEmail = user.getUserEmail(); VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML(MESSAGES.blocksTruncatedDialogMessage().replace("%1", screenName)); message.setStyleName("DialogBox-message"); FlowPanel holder = new FlowPanel(); final Button continueSession = new Button(MESSAGES.blocksTruncatedDialogButtonSave()); continueSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { dialogBox.hide(); // call save2 again, this time with force = true so the empty workspace will be written getProjectService().save2(getSessionId(), projectId, fileId, true, content, callback); } }); holder.add(continueSession); final Button cancelSession = new Button(MESSAGES.blocksTruncatedDialogButtonNoSave()); final OdeAsyncCallback<Void> logReturn = new OdeAsyncCallback<Void>() { @Override public void onSuccess(Void result) { reloadWindow(false); } }; cancelSession.addClickListener(new ClickListener() { public void onClick(Widget sender) { // Note: We do *not* remove the dialog, this locks the UI up (our intent) // Wait for a few seconds for other I/O to complete cancelSession.setEnabled(false); // Disable button to prevent further clicking continueSession.setEnabled(false); // This one as well Timer t = new Timer() { int count = 5; @Override public void run() { if (count > 0) { HTML html = (HTML) ((VerticalPanel) dialogBox.getWidget()).getWidget(0); html.setHTML(MESSAGES.blocksTruncatedDialogButtonHTML().replace("%1", "" + count)); count -= 1; } else { this.cancel(); getProjectService().log("Disappearing Blocks: ProjectId = " + projectId + " fileId = " + fileId + " User = " + userEmail, logReturn); } } }; t.scheduleRepeating(1000); // Run every second } }); holder.add(cancelSession); DialogBoxContents.add(message); DialogBoxContents.add(holder); dialogBox.setWidget(DialogBoxContents); dialogBox.show(); }
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.// ww w. ja v a 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. j av a2 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./*from w ww .ja v a2 s .c o m*/ * * 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.StatusPanel.java
License:Open Source License
/** * Initializes and assembles all UI elements shown in the status panel. *//*from www.jav a 2 s. c o m*/ public StatusPanel() { HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); String tosUrl = Ode.getInstance().getSystemConfig().getTosUrl(); if (!Strings.isNullOrEmpty(tosUrl)) { String appInventorFooter = "<a href=\"" + tosUrl + "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>"; hpanel.add(new HTML(appInventorFooter)); } // This shows the git version and the date of the build // String version = GitBuildId.getVersion(); // String date = GitBuildId.getDate(); // if (version != null && date != null) { // Label buildId = new Label(MESSAGES.gitBuildId(date, version)); // hpanel.add(buildId); // hpanel.setCellHorizontalAlignment(buildId, HorizontalPanel.ALIGN_RIGHT); // } initWidget(hpanel); setStyleName("ode-StatusPanel"); }
From source file:com.google.appinventor.client.utils.MessageDialog.java
License:Open Source License
/** * Put up a modal dialog box.//from ww w . ja va 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 w w w. java 2 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);// w ww . j av a2 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(); }