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.cognitivemedicine.metricsdashboard.client.dashboard.DashboardSettingsPanel.java

License:Apache License

private void init() {

    periodSetting = new SettingsOption("Period");
    periodSetting.getElement().setId("periodSetting");
    periodSetting.getList().getElement().setId("periodSettingListBox");
    periodSetting.getCheckBox().getElement().setId("periodSettingCheckBox");
    ListBox box = periodSetting.getList();
    for (Period p : Period.values()) {
        box.addItem(p.getDisplayValue(), p.getSymbol());
    }/*  w w w . ja  v  a 2s  .c o m*/
    granularitySetting = new SettingsOption("Granularity");
    granularitySetting.getElement().setId("granularitySetting");
    granularitySetting.getList().getElement().setId("granularitySettingListBox");
    granularitySetting.getCheckBox().getElement().setId("granularitySettingCheckBox");
    box = granularitySetting.getList();
    box.addItem("", "");
    for (Granularity g : Granularity.values()) {
        box.addItem(g.getDisplayValue(), g.getSymbol());
    }

    VerticalPanel settingsPanel = new VerticalPanel();
    settingsPanel.setSpacing(8);
    settingsPanel.setWidth("290px");
    Image helpImage = new Image(MdConstants.IMG_QUESTION_MARK);
    helpImage.setSize("20px", "20px");
    helpImage.setTitle(
            "Dashboard level settings override individual chart settings for all charts in this dashboard.");
    HorizontalPanel labelPanel = new HorizontalPanel();

    datetimePicker = new CalendarPicker("dashboard", false);
    datetimePicker.addDashboardSettingsUpdatedHandler(new DashboardSettingsUpdatedHandler());

    labelPanel.add(new HTML("<b>Dashboard Settings</b>"));
    labelPanel.add(helpImage);
    labelPanel.add(new HTML("</br>"));

    settingsPanel.add(labelPanel);
    settingsPanel.add(new HTML("<hr>"));
    settingsPanel.add(periodSetting);
    settingsPanel.add(datetimePicker);
    settingsPanel.add(new HTML("<hr>"));
    settingsPanel.add(granularitySetting);
    // settingsPanel.add(new NumberSpinner(0));

    this.setWidget(settingsPanel);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.AuthenticationDialog.java

License:Apache License

public AuthenticationDialog(Md_sandbox application, List<Site> siteList) {
    this.application = application;

    mainPanel = new HorizontalPanel();
    mainPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E");

    warningPanel = new VerticalPanel();
    warningPanel.setWidth("450px");
    // warningPanel.setWidth("100%");
    warningPanel.setHeight("100%");
    warningPanel.setSpacing(20);// w w  w .  j  a  va  2  s .c  o  m
    warningPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E");

    loginPanel = new VerticalPanel();
    loginPanel.setWidth("450px");
    // loginPanel.setWidth("100%");
    loginPanel.setSpacing(4);
    loginPanel.getElement().getStyle().setProperty("backgroundColor", "#FFFFFF");

    warningMessage = new HTML(warningMessageText);
    warningMessage.getElement().getStyle().setProperty("color", "white");
    warningMessage.getElement().getStyle().setProperty("fontSize", "10px");
    warningMessage.setWordWrap(true);
    warningMessage.setHeight("100%");
    // warningMessage.setWidth("100%");

    titleLabel = new HTML("<h2>CDS METRICS DASHBOARD</h2>");

    vaLogo = new Image(MdConstants.IMG_VA_LOGO);
    vaLogo.setPixelSize(160, 160);
    vaLogo.getElement().getStyle().setProperty("marginTop", "20px");

    facilityListBox = new ListBox();
    facilityListBox.setVisibleItemCount(1);
    facilityListBox.getElement().setId("facilityListBox");
    for (Site s : siteList) {
        facilityListBox.addItem(s.getName(), s.getSiteCode());
    }
    // facilityListBox.setWidth("100%");

    accessCode = new PasswordTextBox();
    accessCode.getElement().setId("accessCode");
    accessCode.setMaxLength(80);
    // accessCode.setWidth("100%");

    verifyCode = new PasswordTextBox();
    verifyCode.getElement().setId("verifyCode");
    verifyCode.setMaxLength(80);
    // verifyCode.setWidth("100%");

    signInButton = new Button("Sign In");
    signInButton.getElement().getStyle().setProperty("background", "#477E7E");
    signInButton.getElement().getStyle().setProperty("color", "white");
    signInButton.getElement().getStyle().setProperty("fontSize", "10px");
    signInButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            signInButtonClicked();
        }
    });

    warningPanel.add(warningMessage);
    warningPanel.setCellVerticalAlignment(warningMessage, HasVerticalAlignment.ALIGN_MIDDLE);

    loginPanel.add(vaLogo);
    loginPanel.add(titleLabel);
    loginPanel.add(createFormPanel("Select a Facility", facilityListBox));
    loginPanel.add(createFormPanel("Access Code", accessCode));
    loginPanel.add(createFormPanel("Vefify Code", verifyCode));
    loginPanel.add(signInButton);

    loginPanel.setCellHorizontalAlignment(vaLogo, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(facilityListBox, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(accessCode, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(verifyCode, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(signInButton, HasHorizontalAlignment.ALIGN_RIGHT);

    mainPanel.add(warningPanel);
    mainPanel.add(loginPanel);

    mainPanel.setCellVerticalAlignment(warningPanel, HasVerticalAlignment.ALIGN_MIDDLE);

    this.setTitle("CDS DASHBOARD LOGIN");
    this.setWidget(mainPanel);
    this.setModal(true);
    this.setGlassEnabled(true);
    this.removeStyleName("gwt-DialogBox");
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.AuthenticationDialog.java

License:Apache License

/**
 * Creates a consistent sized panel for form elements
 * // ww  w.  ja  v a 2s.c o m
 * @param fieldName
 * @param widget
 * @return
 */
private HorizontalPanel createFormPanel(String fieldName, FocusWidget widget) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(4);
    HTML nameLabel = new HTML(fieldName + ": ");
    nameLabel.setWidth("115px");
    // Weird workaround - the PasswordTextBoxes render wider than the ListBoxes, even when set to
    // the same size
    if (widget instanceof ListBox) {
        widget.setWidth("325px");
    } else {
        widget.setWidth("315px");
    }

    panel.add(nameLabel);
    panel.add(widget);
    panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    return panel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.CreateDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("375px");
    this.setText("Create New Dashboard");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML("<b>Name:</b>"));
    nameBox = new TextBox();
    nameBox.getElement().setId("createDashboardNameTextBox");
    nameBox.setWidth("290px");
    nameBox.addKeyUpHandler(new KeyUpHandler() {
        @Override//from   w  w w  .  j ava2s.com
        public void onKeyUp(KeyUpEvent event) {
            createButton.setEnabled(nameBox.getValue().length() > 0);
        }
    });
    notesArea = new TextArea();
    notesArea.setWidth("290px");
    notesArea.getElement().setId("createDashboardNotesArea");
    dialogVPanel.add(nameBox);
    dialogVPanel.add(new HTML("<br><b>Dashboard Notes:</b>"));
    dialogVPanel.add(notesArea);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    // // Add a close button at the bottom of the dialog
    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton = new PushButton(image);
    createButton.setEnabled(false);
    createButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton.getElement().setId("createDashboardOkButton");
    createButton.setTitle("Create new dashboard");
    createButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createButtonClicked();
        }
    });
    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton = new PushButton(image);
    cancelButton.getElement().setId("createDashboardCancelButton");
    cancelButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton.setTitle("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CreateDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogButtonPanel.setSpacing(8);
    dialogButtonPanel.add(createButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    dialogVPanel.setSpacing(4);
    dialogVPanel.setCellHorizontalAlignment(dialogButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.setCellVerticalAlignment(dialogButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    this.setWidget(dialogVPanel);
    this.setGlassEnabled(true);
    this.setModal(true);
    this.center();
    nameBox.setFocus(true);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.DeleteDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("300px");
    this.setText("Delete Dashboard?");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("300px");
    dialogVPanel.setSpacing(8);/*from   ww  w.  j  ava 2s .com*/
    dialogVPanel.add(new HTML("Are you sure you'ld like to delete this Dashboard?</br></br><b>"
            + dashboardListBox.getItemText(dashboardListBox.getSelectedIndex()) + "</b>"));
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    PushButton okButton = new PushButton(image);
    okButton.getElement().setId("deleteDashboardOkButton");
    okButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String dashboardId = dashboardListBox.getValue(dashboardListBox.getSelectedIndex());
            parent.getController().deleteDashboard(dashboardId);
            DeleteDashboardDialog.this.hide();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    PushButton cancelButton = new PushButton(image);
    cancelButton.getElement().setId("deleteDashboardCancelButton");
    cancelButton.setTitle("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            DeleteDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogButtonPanel.setSpacing(4);
    dialogButtonPanel.add(okButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    this.setWidget(dialogVPanel);
    this.setModal(true);
    this.setGlassEnabled(true);
    this.center();
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.SaveAsDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("300px");
    // dialogBox.ensureDebugId("cwDialogBox");
    this.setText("Save As");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML("<b>Dashboard Name:</b>"));
    nameBox = new TextBox();
    nameBox.setWidth("265px");
    nameBox.setValue("Copy of " + existingTitle);
    nameBox.getElement().setId("saveAsNameBox");
    nameBox.addKeyUpHandler(new KeyUpHandler() {
        @Override/*from www  .ja v  a2s  . c  o  m*/
        public void onKeyUp(KeyUpEvent event) {
            createButton.setEnabled(nameBox.getValue().length() > 0);
        }
    });
    dialogVPanel.add(nameBox);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);

    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton = new PushButton(image);
    createButton.setTitle("Save Dashboard");
    createButton.getElement().setId("saveAsOkButton");
    createButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createButtonClicked();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton = new PushButton(image);
    cancelButton.setTitle("Cancel");
    cancelButton.getElement().setId("saveAsOkButton");
    cancelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            SaveAsDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogVPanel.setSpacing(4);
    dialogButtonPanel.add(createButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    this.setGlassEnabled(true);
    this.setWidget(dialogVPanel);
    this.setModal(true);
    this.center();
    nameBox.setFocus(true);
    nameBox.selectAll();
}

From source file:com.cognitivemedicine.metricsdashboard.client.widgets.CalendarPicker.java

License:Apache License

public Widget buildDatePickerPanel() {
    dateBox = new DateBox();
    if (isWide) {
        dateBox.setWidth("260px");
    } else {/*from w w  w .j  a  v  a2s .c  om*/
        dateBox.setWidth("140px");
    }
    dateBox.setHeight("13px");
    dateBox.getElement().setId(idPrefix + "DateBox");
    dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));

    // Date date = new Date();
    // date.setTime(System.currentTimeMillis() + (1000 * 60 * 60 * 24));
    // dateBox.getDatePicker().setTransientEnabledOnDates(true, date);
    // dateBox.setEnd
    // dateBox.getDatePicker().setYearArrowsVisible(true);
    // dateBox.getDatePicker().setYearAndMonthDropdownVisible(true);
    // dateBox.getDatePicker().setVisibleYearCount(51);

    datePanel = new HorizontalPanel();
    if (isWide) {
        datePanel.setWidth("280px");
    } else {
        datePanel.setWidth("230px");
    }

    datePanel.setSpacing(4);

    HTML label = new HTML("End Date:");
    if (isWide) {
        label.setWidth("115px");
    } else {
        label.setWidth("72px");
    }
    datePanel.add(label);
    datePanel.add(dateBox);

    datePanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_RIGHT);
    return datePanel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.widgets.CalendarPicker.java

License:Apache License

private HorizontalPanel buildTimePanel() {
    timePanel = new HorizontalPanel();
    if (isWide) {
        timePanel.setWidth("400px");
    } else {/*from   www.j av a 2  s. c  om*/
        timePanel.setWidth("230px");
    }
    // timePanel.setWidth("250px");
    timePanel.setSpacing(4);

    hourList = new ListBox();
    hourList.getElement().setId(idPrefix + "HourList");
    hourList.setVisibleItemCount(1);
    for (int i = 1; i <= 12; i++) {
        hourList.addItem(String.valueOf(i));
    }

    minuteBox = new TextBox();
    minuteBox.getElement().setId(idPrefix + "MinutesBox");
    minuteBox.setValue("00");
    minuteBox.setEnabled(false);
    minuteBox.setHeight("13px");

    amPmList = new ListBox();
    amPmList.getElement().setId(idPrefix + "AmPmList");
    amPmList.setVisibleItemCount(1);
    amPmList.addItem("AM");
    amPmList.addItem("PM");

    if (isWide) {
        minuteBox.setWidth("20px");
        amPmList.setWidth("50px");
        hourList.setWidth("45px");
    } else {
        minuteBox.setWidth("20px");
        amPmList.setWidth("50px");
        hourList.setWidth("45px");
    }

    // this.setCellVerticalAlignment(checkBox, HasVerticalAlignment.ALIGN_MIDDLE);
    HTML label = new HTML("End Time:");
    if (isWide) {
        label.setWidth("105px");
    } else {
        label.setWidth("70px");
    }
    timePanel.add(label);
    if (isWide) {
        Label spacer = new Label("");
        spacer.setWidth("20px");
        timePanel.add(spacer);
    }

    timePanel.add(hourList);
    timePanel.add(new HTML(":"));
    timePanel.add(minuteBox);
    timePanel.add(amPmList);

    timePanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_RIGHT);
    return timePanel;
}

From source file:com.connoisseur.menuapp.client.Authenticate.java

/** This is essentially the main method for the menu app. */
public static void go() {
    storage.clear(); // uncomment to completely reset app

    final DialogBox startupBox = new DialogBox(); // movable box that contains widgets
    startupBox.setAnimationEnabled(true);
    final VerticalPanel startupPanel = new VerticalPanel(); // can contain other widgets
    startupPanel.addStyleName("marginPanel"); // interacts with Menuapp.css
    startupPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    // check to see if storage is supported
    if (storage != null) {

        // load viewer if license key and restID have been submitted before
        if (storage.getLength() > 0) {
            Viewer.loadViewer();/*from www. j ava2s .  c  om*/
        }

        // otherwise load authentication UI in order to receive input
        else {
            final Button submitButton = new Button("Submit"); // "Submit" appears on button
            submitButton.addStyleName("myButton"); // interacts with Menuapp.css
            final HorizontalPanel buttonPanel = new HorizontalPanel(); // used to center button
            buttonPanel.addStyleName("marginlessPanel");

            // license widgets
            final Label licenseErrorLabel = new Label(); // dynamic text
            licenseErrorLabel.addStyleName("errorLabel"); // interacts with Menuapp.css
            final TextBox submitLicense = new TextBox(); // user can input text using this
            submitLicense.setText("license key..."); // default text to be seen on load

            // restaurant ID widgets
            final Label restErrorLabel = new Label();
            restErrorLabel.addStyleName("errorLabel");
            final TextBox submitRestID = new TextBox();
            submitRestID.setText("restaurant ID...");

            // organize UI
            startupPanel.add(new HTML("Please enter your license key:"));
            startupPanel.add(submitLicense);
            startupPanel.add(licenseErrorLabel);
            startupPanel.add(new HTML("<br>Please enter your restaurant ID:"));
            startupPanel.add(submitRestID);
            startupPanel.add(restErrorLabel);
            startupPanel.add(new HTML("<br>"));
            buttonPanel.add(submitButton);
            startupPanel.add(buttonPanel);

            // setup startupBox, which is what will be seen by the user
            startupBox.setWidget(startupPanel); // connects the two widgets
            startupBox.center(); // also shows the box

            // focus the cursor on submitLicense when startupBox appears
            submitLicense.setFocus(true);
            submitLicense.selectAll();

            // create a handler for submitButton, submitLicense and submitRestID
            class MyHandler implements ClickHandler, KeyUpHandler {
                /** Fired when the user clicks submit. */
                public void onClick(ClickEvent event) {
                    submit();
                }

                /** Fired when the user presses Enter in a submit field. */
                public void onKeyUp(KeyUpEvent event) {
                    if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
                        submit();
                }

                /** Checks the submitted license key and restaurant ID for validity. Loads Viewer if valid. */
                private void submit() {
                    String license = submitLicense.getText(); // unused for now
                    String restID = submitRestID.getText(); // not sure how to validate yet
                    int returnFlag = 0; // so that both tests can be done
                    licenseErrorLabel.setText("");
                    restErrorLabel.setText("");

                    // validate license
                    String result = FieldVerifier.isValidLicenseKey(license); // from FieldVerifier.java
                    if (!result.equals("")) { // error
                        licenseErrorLabel.setText("You submitted an invalid license key.");
                        submitLicense.selectAll();
                        returnFlag = 1;
                    }

                    // validate restID
                    result = FieldVerifier.isValidRestaurantID(restID);
                    if (!result.equals("")) { // error
                        restErrorLabel.setText("You submitted an invalid restaurant ID.");
                        submitRestID.selectAll();
                        returnFlag = 1;
                    }

                    // don't do anything until the errors are resolved
                    if (returnFlag == 1)
                        return;

                    // clean up
                    submitButton.setEnabled(false);
                    submitLicense.setEnabled(false);
                    submitRestID.setEnabled(false);
                    startupBox.hide();

                    // set up storage
                    storage.setItem("license", license); // secret key for security
                    storage.setItem("restID", restID); // used for almost every call to the backend

                    // show menu
                    Viewer.loadViewer();
                }
            } // MyHandler

            // attach the handler
            final MyHandler handler = new MyHandler();
            submitButton.addClickHandler(handler);
            submitLicense.addKeyUpHandler(handler);
            submitRestID.addKeyUpHandler(handler);
        } // else load authentication UI

    } // if storage supported

    // storage is not supported, so report error
    else {
        startupPanel.add(new HTML("<font color=red>The app will not function because local<br>"
                + "storage is not supported on this platform.</font>"));
        startupBox.setWidget(startupPanel);
        startupBox.center();
    }
}

From source file:com.controlj.addon.gwttree.client.Dialog.java

License:Open Source License

private static void showErrorDialog(String title, String html, String text) {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox(false, true);
    dialogBox.setText(title);/*w  w  w  . j a  v a  2s. c  om*/

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    // Add either HTML or Text
    Widget details = html != null ? new HTML(html) : new Label(text);
    dialogContents.add(details);
    dialogContents.setCellHorizontalAlignment(details, 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) {
            dialogBox.hide();
        }
    });
    dialogContents.add(closeButton);
    dialogContents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);

    // final configuration and show the dialog box
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);
    dialogBox.center();
    dialogBox.show();
}