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.google.gwt.examples.DockLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Attach five widgets to a DockLayoutPanel, one in each direction. Lay
    // them out in 'em' units.
    DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
    p.addNorth(new HTML("north"), 2);
    p.addSouth(new HTML("south"), 2);
    p.addEast(new HTML("east"), 2);
    p.addWest(new HTML("west"), 2);
    p.add(new HTML("center"));

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);//from w ww . ja v  a2 s  .c o  m
}

From source file:com.google.gwt.examples.LayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Attach two child widgets to a LayoutPanel, laying them out horizontally,
    // splitting at 50%.
    Widget childOne = new HTML("left"), childTwo = new HTML("right");
    LayoutPanel p = new LayoutPanel();
    p.add(childOne);/*w  w w  .  ja  v a2s  . c  o m*/
    p.add(childTwo);

    p.setWidgetLeftWidth(childOne, 0, PCT, 50, PCT);
    p.setWidgetRightWidth(childTwo, 0, PCT, 50, PCT);

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);
}

From source file:com.google.gwt.examples.SplitLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-pane layout with splitters. 
    SplitLayoutPanel p = new SplitLayoutPanel();
    p.addWest(new HTML("navigation"), 128);
    p.addNorth(new HTML("list"), 384);
    p.add(new HTML("details"));

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);//ww  w. j  a  v a2 s.c  o m
}

From source file:com.google.gwt.examples.StackLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-item stack, with headers sized in EMs. 
    StackLayoutPanel p = new StackLayoutPanel(Unit.EM);
    p.add(new HTML("this"), new HTML("[this]"), 4);
    p.add(new HTML("that"), new HTML("[that]"), 4);
    p.add(new HTML("the other"), new HTML("[the other]"), 4);

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);/*w  w w .java2s .c  o m*/
}

From source file:com.google.gwt.examples.TabLayoutPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a three-item tab panel, with the tab area 1.5em tall.
    TabLayoutPanel p = new TabLayoutPanel(1.5, Unit.EM);
    p.add(new HTML("this"), "[this]");
    p.add(new HTML("that"), "[that]");
    p.add(new HTML("the other"), "[the other]");

    // Attach the LayoutPanel to the RootLayoutPanel. The latter will listen for
    // resize events on the window to ensure that its children are informed of
    // possible size changes.
    RootLayoutPanel rp = RootLayoutPanel.get();
    rp.add(p);//from ww w .j a  v a  2  s .com
}

From source file:com.google.gwt.examples.TabPanelExample.java

License:Apache License

public void onModuleLoad() {
    // Create a tab panel with three tabs, each of which displays a different
    // piece of text.
    TabPanel tp = new TabPanel();
    tp.add(new HTML("Foo"), "foo");
    tp.add(new HTML("Bar"), "bar");
    tp.add(new HTML("Baz"), "baz");

    // Show the 'bar' tab initially.
    tp.selectTab(1);/*from   www  .  j  ava2 s  .  c om*/

    // Add it to the root panel.
    RootPanel.get().add(tp);
}

From source file:com.google.gwt.gadgets.sample.traveler.client.TravelMap.java

License:Apache License

private InfoWindowContent newLocationCreateForm(final LatLng point, final LocationHandler handler,
        final InfoWindow info) {
    final TextBox titleBox = new TextBox();
    final TextArea descriptionBox = new TextArea();
    Button saveButton = new Button("Save");
    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            titleBox.setReadOnly(true);/*from  w ww.  ja va  2  s.  c o  m*/
            descriptionBox.setReadOnly(true);
            Location loc = Location.newInstance();
            loc.setTitle(titleBox.getText());
            loc.setDescription(descriptionBox.getText());
            loc.setLatitude(point.getLatitude());
            loc.setLongitude(point.getLongitude());
            loc.setMilis(Long.toString(new Date().getTime()));
            handler.handle(loc);
            info.close();
            map.addOverlay(createMarker(loc));
        }
    });

    VerticalPanel panel = new VerticalPanel();
    panel.add(new HTML("title:"));
    panel.add(titleBox);
    panel.add(new HTML("description"));
    panel.add(descriptionBox);
    panel.add(saveButton);
    panel.setCellHorizontalAlignment(saveButton, HasHorizontalAlignment.ALIGN_RIGHT);
    return new InfoWindowContent(panel);
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.AccountsAuthSubAuthenticationDemo.java

License:Apache License

/**
 * Display the AuthSub authentication statuses in a
 * tabular fashion with the help of a GWT FlexTable widget.
 * We initialize an array containing the name, scope, icon
 * and url for each of the supported GData systems.
 * For each system a table row is added displaying the name,
 * page, link and icon, in addition to the AuthSub status
 * and a hyperlink for logging in or logging, as appropriate.
 * The User class contains the getStatus method which is used
 * to retrieve the authentication status for the current user
 * and for a given system (scope)./*from   w ww.ja  va 2  s.c o m*/
 */
private void showAuthSubStatus() {
    String[][] systems = new String[][] {
            new String[] { "Google Analytics", "https://www.google.com/analytics/feeds/", "gdata-analytics.png",
                    "http://code.google.com/apis/analytics/" },
            new String[] { "Google Base", "http://www.google.com/base/feeds/", "gdata-base.png",
                    "http://code.google.com/apis/base/" },
            new String[] { "Google Blogger", "http://www.blogger.com/feeds/", "gdata-blogger.png",
                    "http://code.google.com/apis/blogger/" },
            new String[] { "Google Calendar", "http://www.google.com/calendar/feeds/", "gdata-calendar.png",
                    "http://code.google.com/apis/calendar/" },
            new String[] { "Google Contacts", "http://www.google.com/m8/feeds/", "gdata-contacts.png",
                    "http://code.google.com/apis/contacts/" },
            new String[] { "Google Finance", "http://finance.google.com/finance/feeds/", "gdata-finance.png",
                    "http://code.google.com/apis/finance/" },
            new String[] { "Google Maps", "http://maps.google.com/maps/feeds/", "gdata-maps.png",
                    "http://code.google.com/apis/maps/documentation/mapsdata/" },
            new String[] { "Google Sidewiki", "http://www.google.com/sidewiki/feeds/", "gdata-sidewiki.png",
                    "http://code.google.com/apis/sidewiki/" } };
    for (int i = 0; i < systems.length; i++) {
        String[] sys = systems[i];
        final String scope = sys[1];
        mainPanel.insertRow(i);
        mainPanel.addCell(i);
        mainPanel.addCell(i);
        mainPanel.addCell(i);
        mainPanel.addCell(i);
        Image icon = new Image(sys[2]);
        mainPanel.setWidget(i, 0, icon);
        Label name = new HTML("<a href=\"" + sys[3] + "\">" + sys[0] + "</a>");
        mainPanel.setWidget(i, 1, name);
        Label statusLabel = new Label();
        Anchor actionLink = new Anchor();
        AuthSubStatus status = User.getStatus(scope);
        if (status == AuthSubStatus.LOGGED_IN) {
            statusLabel.setText("Logged in");
            actionLink.setText("Log out");
            actionLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    User.logout(scope);
                    refreshDemo();
                }
            });
        } else if (status == AuthSubStatus.LOGGED_OUT) {
            statusLabel.setText("Logged out");
            actionLink.setText("Log in");
            actionLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    User.login(scope);
                }
            });
        }
        mainPanel.setWidget(i, 2, statusLabel);
        mainPanel.setWidget(i, 3, actionLink);
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerQueryBlogPostsDemo.java

License:Apache License

/**
* Displays a set of Blogger post entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Published are displayed./*from  w  w  w  . j  av  a 2  s  . c o  m*/
* 
* @param entries The Blogger post entries to display.
*/
private void showData(PostEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "Published" };
    mainPanel.insertRow(0);
    for (int i = 0; i < labels.length; i++) {
        mainPanel.addCell(0);
        mainPanel.setWidget(0, i, new Label(labels[i]));
        mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader");
    }
    for (int i = 0; i < entries.length; i++) {
        PostEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        if (entry.getHtmlLink() == null) {
            mainPanel.setWidget(row, 1, new Label("Not available"));
        } else {
            String link = entry.getHtmlLink().getHref();
            mainPanel.setWidget(row, 1,
                    new HTML("<a href=\"" + link + "\" target=\"_blank\">" + link + "</a>"));
        }
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(entry.getPublished().getValue().getDate().toString()));
    }
}

From source file:com.google.gwt.gdata.sample.hellogdata.client.BloggerRetrieveBlogPostCommentsDemo.java

License:Apache License

/**
* Displays a set of Blogger comment entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Published are displayed./*from   www .  jav  a  2 s  .  c o  m*/
* 
* @param entries The Blogger comment entries to display.
*/
private void showData(CommentEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "Published" };
    mainPanel.insertRow(0);
    for (int i = 0; i < labels.length; i++) {
        mainPanel.addCell(0);
        mainPanel.setWidget(0, i, new Label(labels[i]));
        mainPanel.getFlexCellFormatter().setStyleName(0, i, "hm-tableheader");
    }
    for (int i = 0; i < entries.length; i++) {
        CommentEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        if (entry.getHtmlLink() == null) {
            mainPanel.setWidget(row, 1, new Label("Not available"));
        } else {
            String link = entry.getHtmlLink().getHref();
            mainPanel.setWidget(row, 1,
                    new HTML("<a href=\"" + link + "\" target=\"_blank\">" + link + "</a>"));
        }
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(entry.getPublished().getValue().getDate().toString()));
    }
}