Example usage for com.google.gwt.user.client.ui HTML HTML

List of usage examples for com.google.gwt.user.client.ui HTML HTML

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTML HTML.

Prototype

protected HTML(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:com.appspot.socialinquirer.client.util.UiUtils.java

License:Apache License

/**
 * Show spell check dialog.//from  ww w. j  a  v a2 s . co  m
 *
 * @param result the result
 * @param constants the constants
 */
public static void showSpellCheckDialog(String result, EverScribeConstants constants) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Spell Checker");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setWidth("400px");
    dialogBox.setHeight("200px");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML(result));
    final Button closeButton = new Button(constants.closeButton());
    // We can set the id of a widget by accessing its
    // Element
    closeButton.getElement().setId("closeButton");
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.center();
}

From source file:com.appspot.socialinquirer.client.util.UiUtils.java

License:Apache License

/**
 * Show run code dialog./* w  w w. j av  a  2  s  .  c om*/
 *
 * @param result the result
 * @param constants the constants
 */
public static void showRunCodeDialog(String result, EverScribeConstants constants) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Code Evaluation");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setWidth("400px");
    dialogBox.setHeight("200px");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML(result));
    final Button closeButton = new Button(constants.closeButton());
    // We can set the id of a widget by accessing its
    // Element
    closeButton.getElement().setId("closeButton");
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.center();
}

From source file:com.appspot.socialinquirer.client.util.UiUtils.java

License:Apache License

/**
 * Show speak dialog./*from   w w w  .j  a  v  a  2  s .co m*/
 *
 * @param result the result
 * @param constants the constants
 */
public static void showSpeakDialog(ArrayList<String> result, EverScribeConstants constants) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Speak");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setWidth("400px");
    dialogBox.setHeight("500px");
    VerticalPanel dialogVPanel = new VerticalPanel();
    StringBuilder builder = new StringBuilder();
    for (String url : result) {
        builder.append("<embed src='" + url
                + "' controller='true' type='audio/wav' height='80px' width='400px' pluginspage='http://www.apple.com/quicktime/download/' />");
        builder.append("<br/>");
    }
    dialogVPanel.add(new HTML(builder.toString()));
    final Button closeButton = new Button(constants.closeButton());
    // We can set the id of a widget by accessing its
    // Element
    closeButton.getElement().setId("closeButton");
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.center();
}

From source file:com.appspot.socialinquirer.client.util.UiUtils.java

License:Apache License

/**
 * Show classification dialog.// w ww .  j a  v  a  2 s.  co  m
 *
 * @param result the result
 * @param constants the constants
 */
public static void showClassificationDialog(List<Classification> result, EverScribeConstants constants) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Classification");
    dialogBox.setAnimationEnabled(true);
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    StringBuilder builder = new StringBuilder();
    builder.append("<table style='text-align: left; width: 100%;' border='1' cellpadding='2' cellspacing='2'>");
    builder.append("<tbody>");
    builder.append("<tr><th nowrap='nowrap'>Class</th><th nowrap='nowrap'>Probability</th></tr>");
    for (Classification classification : result) {
        builder.append("<tr><td nowrap='nowrap'>" + classification.getCategory() + "</td><td nowrap='nowrap'>"
                + classification.getProbability() + "</td></tr>");
    }
    builder.append("</tbody>");
    builder.append("</table>");
    dialogVPanel.add(new HTML(builder.toString()));
    final Button closeButton = new Button(constants.closeButton());
    closeButton.getElement().setId("closeButton");
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.center();
}

From source file:com.appspot.socialinquirer.client.util.UiUtils.java

License:Apache License

/**
 * Show translation dialog./*ww w.  j  a  v  a2 s  .co m*/
 *
 * @param result the result
 * @param constants the constants
 */
public static void showTranslationDialog(String result, EverScribeConstants constants) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Translation");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setWidth("400px");
    dialogBox.setHeight("200px");
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML(result));
    final Button closeButton = new Button(constants.closeButton());
    // We can set the id of a widget by accessing its
    // Element
    closeButton.getElement().setId("closeButton");
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            dialogBox.hide();
        }
    });
    dialogBox.center();
}

From source file:com.areahomeschoolers.baconbits.client.widgets.UserAgreementDialog.java

License:Open Source License

@Override
public void show() {
    if (vp.getWidgetCount() > 0) {
        super.show();
        return;/*from  ww  w.  ja v  a  2 s  .co m*/
    }

    String msg = "Hello,<br><br>Our site policies have changed. To continue using our site, please review them, then check the box below and continue on to your privacy settings.";
    HTML h = new HTML(msg);
    h.addStyleName("mediumText heavyPadding");
    vp.add(h);

    String txt = "I agree to the site ";
    txt += "<a href=\"" + Constants.TOS_URL + "&noTitle=true\" target=\"_blank\">terms of service</a> ";
    txt += "and <a href=\"" + Constants.PRIVACY_POLICY_URL
            + "&noTitle=true\" target=\"_blank\">privacy policy</a> ";
    final CheckBox scb = new CheckBox(txt, true);
    scb.addStyleName("heavyPadding");
    vp.add(scb);

    ButtonPanel bp = new ButtonPanel();

    final Button settings = new Button("Continue to Privacy Settings");
    settings.setEnabled(false);
    settings.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (!scb.getValue()) {
                scb.addStyleName("gwt-TextBoxError");
                return;
            }

            settings.setEnabled(false);
            User u = Application.getCurrentUser();
            u.setShowUserAgreement(false);
            u.setDirectoryOptOut(false);
            // this will ensure that the kids settings are synchronized with the parent's
            userService.savePrivacyPreference(u.getPrivacyPreference(PrivacyPreferenceType.FAMILY),
                    new Callback<PrivacyPreference>() {
                        @Override
                        protected void doOnSuccess(PrivacyPreference result) {
                        }
                    });
            userService.save(u, new Callback<ServerResponseData<User>>() {
                @Override
                protected void doOnSuccess(ServerResponseData<User> result) {
                }
            });

        }
    });
    bp.addCenterButton(settings);

    scb.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            settings.setEnabled(event.getValue());
        }
    });

    vp.add(bp);

    UserAgreementDialog.super.show();
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            UserAgreementDialog.super.center();
        }
    });

}

From source file:com.audata.client.authentication.LoginDialog.java

License:Open Source License

public LoginDialog(AuDoc parent) {
    this.parent = parent;
    setText(CONSTANTS.welcome_Text());

    // Create a DockPanel to contain the 'about' label and the 'OK' button.
    DockPanel outer = new DockPanel();
    outer.setSpacing(4);/*from   w ww .ja va2s  . c o m*/

    outer.add(new Image("images/48x48/security.gif"), DockPanel.WEST);

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.setSpacing(1);

    HorizontalPanel userPanel = new HorizontalPanel();
    this.username = new TextBox();
    Label l = new Label(CONSTANTS.username_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    userPanel.add(l);
    userPanel.add(this.username);
    formPanel.add(userPanel);

    HorizontalPanel passPanel = new HorizontalPanel();
    this.password = new PasswordTextBox();
    l = new Label(CONSTANTS.password_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    passPanel.add(l);
    passPanel.add(this.password);
    formPanel.add(passPanel);

    HorizontalPanel langPanel = new HorizontalPanel();
    l = new Label(CONSTANTS.lang_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    langPanel.add(l);
    formPanel.add(langPanel);

    this.languages = new ListBox();
    this.populateLocales();
    this.languages.setWidth("146px");

    langPanel.add(this.languages);

    this.languages.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            //refreshes the browser in the selected locale
            Location loc = WindowUtils.getLocation();
            String path = loc.getProtocol() + "//" + loc.getHost() + loc.getPath();
            String locale = languages.getValue(languages.getSelectedIndex());
            Window.open(path + "?locale=" + locale, "_self", "");
        }
    });

    this.loginButton = new Button(CONSTANTS.login_Text(), this);
    formPanel.add(loginButton);
    formPanel.setCellHorizontalAlignment(this.loginButton, HasAlignment.ALIGN_RIGHT);
    outer.add(formPanel, DockPanel.SOUTH);

    HTML text = new HTML(CONSTANTS.message_Text());
    text.setStyleName("audoc-LoginDialogText");
    outer.add(text, DockPanel.CENTER);

    // Add a bit of spacing and margin to the dock to keep the components from
    // being placed too closely together.
    outer.setSpacing(8);
    this.setWidget(outer);
}

From source file:com.audata.client.HomePanel.java

License:Open Source License

/**
 * Public contructor. Builds the HomePanel
 *//*from  w w w  .  j a v  a  2s.  c  o m*/
public HomePanel() {

    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);
    verticalPanel.setSize("100%", "100%");

    final Image image = new Image();
    verticalPanel.add(image);
    verticalPanel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);
    image.setUrl("images/title/welcome.jpg");

    final HTML html = new HTML(LANG.homepage_Text());
    html.setWidth("100%");
    verticalPanel.add(html);
    html.setStyleName("audoc-welcomeText");
    setSize("100%", "100%");
    verticalPanel.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_BOTTOM);
}

From source file:com.audata.client.reporting.ReportDialog.java

License:Open Source License

public ReportDialog(String report) {
    this.setText(LANG.report_Text());
    this.setSize("600px", "400px");
    this.main = new VerticalPanel();
    this.main.setSize("100%", "100%");
    this.main.setSpacing(5);
    ScrollPanel sp = new ScrollPanel();
    sp.setStyleName("audoc-report");
    this.report = new HTML(report);
    this.report.addStyleName("audoc-report-content");
    sp.add(this.report);
    sp.setWidth("586px");
    sp.setHeight("300px");

    this.main.add(sp);

    HorizontalPanel butPanel = new HorizontalPanel();
    butPanel.setSpacing(5);/*from  ww  w.jav  a  2s . c o  m*/
    this.print = new Button(LANG.print_Text());
    this.print.addClickListener(this);
    this.close = new Button(LANG.close_Text());
    this.close.addClickListener(this);
    butPanel.add(this.print);
    butPanel.add(this.close);
    this.main.add(butPanel);

    this.setWidget(this.main);
}

From source file:com.audata.client.widgets.CaptionButton.java

License:Open Source License

public CaptionButton() {
    main = new DockPanel();
    initWidget(main);//from w  w w. j  a  va2  s .  c  om
    main.setSpacing(4);
    main.setStyleName("captionButton");

    image = new Image();
    main.add(image, DockPanel.WEST);
    main.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    image.setStyleName("captionButton-Icon");
    image.setUrl("images/48x48/admin.gif");

    caption = new HTML("New Label");
    main.add(caption, DockPanel.EAST);
    main.setCellHorizontalAlignment(caption, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(caption, HasVerticalAlignment.ALIGN_MIDDLE);
    caption.setStyleName("captionButton-caption");
    //setWidth("100%");
}