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

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

Introduction

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

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

From source file:org.spiffyui.hellospiffyauth.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*//w w  w  . j  av  a 2  s  .com
    This is where we load our module and create our dynamic controls.  The MainHeader
    displays our title bar at the top of our page.
     */
    final MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy Auth!");
    Anchor logout = new Anchor("Logout", "#");
    logout.getElement().setId("header_logout");
    header.setLogout(logout);
    if (!Index.userLoggedIn()) {
        logout.setVisible(false);
        header.setWelcomeString("");
    } else {
        /*
         * The SampleAuthServer combines the username and a UUID as the token
         */
        String token = RESTility.getUserToken();
        JSUtil.println(RESTility.getUsername());
        String name = token.substring(0, token.indexOf('-'));

        header.setWelcomeString("Welcome " + name);
    }
    logout.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            event.preventDefault();
            doLogout();
        }
    });
    /*
    The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "HelloSpiffyAuth was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
    This HTMLPanel holds most of our content.
    MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
    without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
            Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
    These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

    RESTility.addLoginListener(new RESTLoginCallBack() {

        @Override
        public void onLoginSuccess() {
            if (RESTility.getUserToken() == null) {
                return;
            }
            header.setWelcomeString("Welcome " + RESTility.getUsername());
            JSUtil.bounce("#" + MainHeader.HEADER_ACTIONS_BLOCK, 5, 500, 30);
            JSUtil.show("#header_logout", "fast");
        }

        @Override
        public void loginPrompt() {
            //do nothing
        }
    });
}

From source file:org.spiffyui.hellospiffygradle.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*// ww w  . ja  va2  s  .c  o  m
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy Gradle!");

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "Hello Spiffy Gradle was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    m_text.getElement().setAttribute("autoFocus", "");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}

From source file:org.spiffyui.hellospiffylocalization.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*//w ww .j ava2 s.com
     We need to set the title from a localized string
     */
    Window.setTitle(PROJ_STRINGS.hello());

    /*
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle(PROJ_STRINGS.hello());

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(PROJ_STRINGS.footer());

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button(PROJ_STRINGS.submit());
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}

From source file:org.spiffyui.hellospiffymavenplugin.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*/* w  ww  .ja  v a 2  s  .  com*/
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy HelloSpiffyMavenPlugin!");

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "HelloSpiffyMavenPlugin was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

}

From source file:org.spiffyui.hellospiffyoauth.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*/* w ww  .j a  v  a  2s.co  m*/
    This is where we load our module and create our dynamic controls.  The MainHeader
    displays our title bar at the top of our page.
     */
    final MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy OAuth!");
    /*
    The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "HelloSpiffyOAuth was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html());

    RootPanel.get("mainContent").add(panel);

    /*
    Add the auth and contact buttons
     */

    panel.add(m_accessButton, "AuthButton");
    m_accessButton.addClickHandler(new ClickHandler() {

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

    panel.add(m_contactsButton, "GetButton");
    m_contactsButton.addClickHandler(new ClickHandler() {

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

    if (!userLoggedIn()) {
        header.setWelcomeString("");
        m_accessButton.setFocus(true);
        m_contactsButton.setEnabled(false);
    } else {
        header.setWelcomeString("You have a token!");
        m_contactsButton.setEnabled(true);
        m_contactsButton.setFocus(true);
    }

}

From source file:org.spiffyui.mvsb.samples.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*//from  w  ww .jav a  2s.c o m
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy MvsbSamples!");

    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "MvsbSamples was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html());

    RootPanel.get("mainContent").add(panel);

    /*
     * so that spellcheck is not done on a selected crayon color of "Screamin' Green"
     */
    Element panelEle = panel.getElement();
    panelEle.setAttribute("spellcheck", "false");

    addSingleValued(panel);
    addMultiValued(panel);
    addMultiValuedFancy(panel);
    addLocalValues(panel);
    addValuesAsString(panel);
    addFancier(panel);

    m_valueMapDlg = new ConfirmDialog("mvsb-results-dialog", "Value Map");
    m_valueMapDlg.setAutoHideEnabled(true);
    m_valueMapDlg.setModal(false);
    m_valueMapDlg.addButton("mvsb-dialog-ok", "Close", "OK");

}

From source file:org.spiffyui.spiffyauthnode.client.Index.java

License:Apache License

@Override
public void onModuleLoad() {
    /*/*from w  w  w.j  a  v a  2s  . c  o m*/
     This is where we load our module and create our dynamic controls.  The MainHeader
     displays our title bar at the top of our page.
     */
    final MainHeader header = new MainHeader();
    header.setHeaderTitle("Hello Spiffy Auth Node!");
    Anchor logout = new Anchor("Logout", "#");
    logout.getElement().setId("header_logout");
    header.setLogout(logout);
    if (!Index.userLoggedIn()) {
        logout.setVisible(false);
        header.setWelcomeString("");
    } else {
        header.setWelcomeString("You are logged in!");
    }
    logout.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            event.preventDefault();
            doLogout();
        }
    });
    /*
     The main footer shows our message at the bottom of the page.
     */
    MainFooter footer = new MainFooter();
    footer.setFooterString(
            "SpiffyAuthNode was built with the <a href=\"http://www.spiffyui.org\">Spiffy UI Framework</a>");

    /*
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    HTMLPanel panel = new HTMLPanel(STRINGS.MainPanel_html()) {
        @Override
        public void onLoad() {
            super.onLoad();
            /*
             Let's set focus into the text field when the page first loads
             */
            m_text.setFocus(true);
        }
    };

    RootPanel.get("mainContent").add(panel);

    /*
     These dynamic controls add interactivity to our page.
     */
    panel.add(m_longMessage, "longMsg");
    panel.add(m_text, "nameField");
    final Button button = new Button("Submit");
    panel.add(button, "submitButton");

    button.addClickHandler(this);
    m_text.addKeyPressHandler(this);

    RESTility.addLoginListener(new RESTLoginCallBack() {

        @Override
        public void onLoginSuccess() {
            if (RESTility.getUserToken() == null) {
                return;
            }
            header.setWelcomeString("Welcome " + RESTility.getUsername());
            JSUtil.bounce("#" + MainHeader.HEADER_ACTIONS_BLOCK, 5, 500, 30);
            JSUtil.show("#header_logout", "fast");
        }

        @Override
        public void loginPrompt() {
            //do nothing
        }
    });
}

From source file:org.spiffyui.spiffyforms.client.Index.java

License:Apache License

private void buildFormUI() {
    /*/* w  w w .  j av a  2  s  . c o m*/
     This HTMLPanel holds most of our content.
     MainPanel_html was built in the HTMLProps task from MainPanel.html, which allows you to use large passages of html
     without having to string escape them.
     */
    m_panel = new HTMLPanel(STRINGS.MainPanel_html());
    RootPanel.get("mainContent").add(m_panel);

    /*
     User ID
     */
    m_userId = new TextBox();
    m_userId.addKeyUpHandler(this);
    m_userId.getElement().setId("userIdTxt");
    m_userId.getElement().addClassName(WIDE_TEXT_FIELD);
    m_panel.add(m_userId, "userId");

    m_userIdFeedback = new FormFeedback();
    m_feedbacks.add(m_userIdFeedback);
    m_panel.add(m_userIdFeedback, "userIdRow");

    /*
     First name
     */
    m_firstName = new TextBox();
    m_firstName.addKeyUpHandler(this);
    m_firstName.getElement().setId("firstNameTxt");
    m_firstName.getElement().addClassName(WIDE_TEXT_FIELD);
    m_firstName.getElement().setAttribute("autofocus", "true");
    m_panel.add(m_firstName, "firstName");

    m_firstNameFeedback = new FormFeedback();
    m_feedbacks.add(m_firstNameFeedback);
    m_panel.add(m_firstNameFeedback, "firstNameRow");

    /*
     Last name
     */
    m_lastName = new TextBox();
    m_lastName.addKeyUpHandler(this);
    m_lastName.getElement().setId("lastNameTxt");
    m_lastName.getElement().addClassName(WIDE_TEXT_FIELD);
    m_panel.add(m_lastName, "lastName");

    m_lastNameFeedback = new FormFeedback();
    m_feedbacks.add(m_lastNameFeedback);
    m_panel.add(m_lastNameFeedback, "lastNameRow");

    /*
     email
     */
    m_email = new TextBox();
    m_email.addKeyUpHandler(this);
    m_email.getElement().setId("emailTxt");
    m_email.getElement().addClassName(WIDE_TEXT_FIELD);
    m_panel.add(m_email, "email");

    m_emailFeedback = new FormFeedback();
    m_feedbacks.add(m_emailFeedback);
    m_panel.add(m_emailFeedback, "emailRow");

    /*
     User's birthdate
     */
    m_bDay = new DatePickerTextBox("userBdayTxt");
    m_bDay.setMaximumDate(new Date()); //user cannot be born tomorrow
    m_bDay.addKeyUpHandler(this);
    m_bDay.getElement().addClassName("slimTextField");
    m_panel.add(m_bDay, "userBday");

    m_bDayFeedback = new FormFeedback();
    m_panel.add(m_bDayFeedback, "userBdayRow");

    /*
     User's gender
     */
    m_female = new RadioButton("userGender", "Female");
    m_panel.add(m_female, "userGender");

    m_male = new RadioButton("userGender", "Male");
    m_male.addStyleName("radioOption");
    m_male.setValue(true);
    m_male.getElement().setId("userMale");
    m_panel.add(m_male, "userGender");

    /*
     User description
     */
    m_userDesc = new TextArea();
    m_userDesc.addKeyUpHandler(this);
    m_userDesc.getElement().setId("userDescTxt");
    m_userDesc.getElement().addClassName(WIDE_TEXT_FIELD);
    m_userDesc.getElement().setAttribute("placeholder", "Tell us a little about yourself.");
    m_panel.add(m_userDesc, "userDesc");

    m_userDescFeedback = new FormFeedback();
    m_feedbacks.add(m_userDescFeedback);
    m_panel.add(m_userDescFeedback, "userDescRow");

    /*
     Password
     */
    m_password = new PasswordTextBox();
    m_password.addKeyUpHandler(this);
    m_password.getElement().setId("passwordTxt");
    m_password.getElement().addClassName("slimTextField");
    m_panel.add(m_password, "password");

    m_passwordFeedback = new FormFeedback();
    m_feedbacks.add(m_passwordFeedback);
    m_panel.add(m_passwordFeedback, "passwordRow");

    /*
     Password repeat
     */
    m_passwordRepeat = new PasswordTextBox();
    m_passwordRepeat.addKeyUpHandler(this);
    m_passwordRepeat.getElement().setId("passwordRepeatTxt");
    m_passwordRepeat.getElement().addClassName("slimTextField");
    m_panel.add(m_passwordRepeat, "passwordRepeat");

    m_passwordRepeatFeedback = new FormFeedback();
    m_feedbacks.add(m_passwordRepeatFeedback);
    m_panel.add(m_passwordRepeatFeedback, "passwordRepeatRow");

    /*
     The big save button
     */
    m_save = new FancySaveButton("Save");
    m_save.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            save();
        }
    });

    m_panel.add(m_save, "buttons");

    /*
     The delete button
     */
    m_del = new DeleteButton("Delete");
    m_del.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            delete();
        }
    });

    m_panel.add(m_del, "buttons");

    updateFormStatus(null);
}

From source file:org.switchyard.console.client.ui.metrics.MetricsView.java

License:Apache License

@Override
public Widget createWidget() {
    final Button resetButton = new Button(Singleton.MESSAGES.label_resetAllMetrics(), new ClickHandler() {
        @Override//from   w  ww .  j a  v  a  2 s . co  m
        public void onClick(ClickEvent event) {
            _presenter.resetSystemMetrics();
        }
    });
    SimpleLayout layout = new SimpleLayout().setTitle(Singleton.MESSAGES.label_switchYardMessageMetrics())
            .setHeadline(Singleton.MESSAGES.label_system())
            .setDescription(Singleton.MESSAGES.description_systemMetrics())
            .addContent(Singleton.MESSAGES.label_systemMessageMetrics(), _systemMetricsViewer.asWidget())
            .addContent("reset", resetButton) //$NON-NLS-1$
            .addContent("spacer", new HTMLPanel("&nbsp;")) //$NON-NLS-1$ //$NON-NLS-2$
            .addContent(Singleton.MESSAGES.label_serviceMessageMetrics(), _servicesList.asWidget())
            .addContent(Singleton.MESSAGES.label_referenceMessageMetrics(), _referencesList.asWidget());

    final Widget result = layout.build();
    // hackery, prevent button from filling the row
    resetButton.getElement().removeClassName("fill-layout-width"); //$NON-NLS-1$
    return result;
}

From source file:org.talend.mdm.webapp.stagingarea.control.client.view.StagingContainerSummaryView.java

License:Open Source License

@Override
protected void initComponents() {
    detailPanel = new HTMLPanel(
            ("<div style='margin-bottom:10px; font-weight: bold;' id='" + STAGING_AREA_TITLE + "'></div>")
                    + "<div style='margin-left:20px; color:#0000ff; margin-bottom:5px;' id='"
                    + STAGING_AREA_WAITING + "'></div>"
                    + "<div style='margin-left:20px; color:#ff0000; margin-bottom:5px;' id='"
                    + STAGING_AREA_INVALID + "'></div>"
                    + "<div style='margin-left:20px; color:#00aa00; margin-bottom:5px;' id='"
                    + STAGING_AREA_VALID + "'></div>");
    detailPanel.setSize("400px", "90px"); //$NON-NLS-1$//$NON-NLS-2$
    gaugeBar = new ProgressBar();
    startValidate = new Button(messages.start_validation());
    startValidate.setSize(200, 30);//www  .  j  av a 2  s .  co  m
    startValidate.setEnabled(false);
    startValidate.setIconAlign(IconAlign.TOP);
    withFiltering = new CheckBox(messages.with_filtering());
    provider = StorageProvider.newInstanceIfSupported();
    if (provider == null) {
        provider = new CookieProvider("/", null, null, //$NON-NLS-1$
                Window.Location.getProtocol().toLowerCase().startsWith("https")); //$NON-NLS-1$
    }
    withFiltering.setValue(provider.getBoolean(StagingContainerSummaryView.class.getName() + "_withFiltering")); //$NON-NLS-1$
    mainPanel.setAutoHeight(true);
    mainPanel.setBodyBorder(false);
}