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.gdata.sample.hellogdata.client.BloggerRetrieveBlogsDemo.java

License:Apache License

/**
* Displays a set of Blogger blog entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Updated are displayed./*from www  . ja va2  s  .  co  m*/
* 
* @param entries The Blogger blog entries to display.
*/
private void showData(BlogEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "Updated" };
    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++) {
        BlogEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        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.getUpdated().getValue().getDate().toString()));
    }
}

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

License:Apache License

/**
* Displays a Blogger post entry in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, 
* Author, Published and Contents are displayed.
* 
* @param entry The Blogger post entry to display.
*///from  w w w. jav  a  2s .com
private void showData(PostEntry entry) {
    mainPanel.clear();
    mainPanel.insertRow(0);
    mainPanel.addCell(0);
    mainPanel.setWidget(0, 0, new HTML("<h2>" + entry.getTitle().getText() + "</h2>"));
    mainPanel.insertRow(1);
    mainPanel.addCell(1);
    mainPanel.setWidget(1, 0, new HTML("<i>By " + entry.getAuthors()[0].getName().getValue() + " on "
            + entry.getPublished().getValue().getDate().toString() + "</i>"));
    mainPanel.insertRow(2);
    mainPanel.addCell(2);
    mainPanel.setWidget(2, 0, new Label(entry.getContent().getText()));
}

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

License:Apache License

/**
* Displays a set of Calendar event entries in a tabular fashion with
* the help of a GWT FlexTable widget. The data fields Title, URL 
* and Updated are displayed.// w w w .ja v  a  2 s  .  c o m
* 
* @param entries The Calendar event entries to display.
*/
private void showData(CalendarEventEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "URL", "Updated" };
    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++) {
        CalendarEventEntry entry = entries[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(entry.getTitle().getText()));
        mainPanel.addCell(row);
        String link = entry.getHtmlLink().getHref();
        mainPanel.setWidget(row, 1, new HTML("<a href=\"" + link + "\">" + link + "</a>"));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(entry.getUpdated().getValue().getDate().toString()));
    }
}

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

License:Apache License

/**
 * Display the GData package statuses in a
 * tabular fashion with the help of a GWT FlexTable widget.
 * We initialize an array containing the name, icon
 * and url for each of the supported GData packages.
 * For each package a table row is added displaying the name,
 * page, link and icon, in addition to the load status.
 * The GData class contains the isLoaded method which is used
 * to retrieve the load status for a given package.
 *///from   w w  w  .j  a  v  a  2s . c  o m
private void showPackageStatus() {
    String[][] systems = new String[][] {
            new String[] { "Google Analytics", "ANALYTICS", "gdata-analytics.png",
                    "http://code.google.com/apis/analytics/" },
            new String[] { "Google Base", "GBASE", "gdata-base.png", "http://code.google.com/apis/base/" },
            new String[] { "Google Blogger", "BLOGGER", "gdata-blogger.png",
                    "http://code.google.com/apis/blogger/" },
            new String[] { "Google Calendar", "CALENDAR", "gdata-calendar.png",
                    "http://code.google.com/apis/calendar/" },
            new String[] { "Google Contacts", "CONTACTS", "gdata-contacts.png",
                    "http://code.google.com/apis/contacts/" },
            new String[] { "Google Finance", "FINANCE", "gdata-finance.png",
                    "http://code.google.com/apis/finance/" },
            new String[] { "Google Maps", "MAPS", "gdata-maps.png",
                    "http://code.google.com/apis/maps/documentation/mapsdata/" },
            new String[] { "Google Sidewiki", "SIDEWIKI", "gdata-sidewiki.png",
                    "http://code.google.com/apis/sidewiki/" } };
    for (int i = 0; i < systems.length; i++) {
        String[] sys = systems[i];
        final String identifier = 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();
        if (GData.isLoaded(GDataSystemPackage.valueOf(identifier))) {
            statusLabel.setText("Loaded");
        } else {
            statusLabel.setText("Not loaded");
            actionLink.setText("Load");
            actionLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    GData.loadGDataApi(GDATA_API_KEY, new Runnable() {
                        public void run() {
                            refreshDemo();
                        }
                    }, GDataSystemPackage.valueOf(identifier));
                }
            });
        }
        mainPanel.setWidget(i, 2, statusLabel);
        mainPanel.setWidget(i, 3, actionLink);
    }
}

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

License:Apache License

/**
* Displays a set of Google Base snippet entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Name, Url and Value are displayed./*from   w w w  .ja  va2 s .  c o m*/
* 
* @param entries The Google Base snippet entries to display.
*/
private void showData(SnippetsEntry[] snippets) {
    mainPanel.clear();
    String[] labels = new String[] { "Name", "Url", "Value" };
    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 < snippets.length; i++) {
        SnippetsEntry snippet = snippets[i];
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new Label(snippet.getTitle().getText()));
        mainPanel.addCell(row);
        if (snippet.getHtmlLink() == null) {
            mainPanel.setWidget(row, 1, new Label("Not available"));
        } else {
            String link = snippet.getHtmlLink().getHref();
            mainPanel.setWidget(row, 1,
                    new HTML("<a href=\"" + link + "\" target=\"_blank\">" + link + "</a>"));
        }
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 2, new Label(snippet.getPublished().getValue().getDate().toString()));
    }
}

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

License:Apache License

/**
* Displays a set of Google Base item entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Title, URL and Published are displayed.
* 
* @param entries The Google Base item entries to display.
*///from  w ww.j  av a 2s.  c o m
private void showData(ItemsEntry[] 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++) {
        ItemsEntry 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.GoogleBaseRetrieveMediaDemo.java

License:Apache License

/**
* Displays a set of Google Base media entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields
* Title and Type, along with a thumbnail preview (if available),
* are displayed.//from   w w  w .  ja  v  a  2 s . c  o m
* 
* @param entries The Google Base media entries to display.
*/
private void showData(MediaEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Title", "Type", "Thumbnail" };
    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++) {
        MediaEntry entry = entries[i];
        MediaContent media = entry.getMediaContent();
        String fileType = media.getType();
        String fileUrl = media.getUrl();
        MediaThumbnail[] thumbs = media.getThumbnails();
        int row = mainPanel.insertRow(i + 1);
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 0, new HTML(
                "<a href=\"" + fileUrl + "\" target=\"_blank\">" + entry.getTitle().getText() + "</a>"));
        mainPanel.addCell(row);
        mainPanel.setWidget(row, 1, new Label(fileType));
        mainPanel.addCell(row);
        if (thumbs.length > 0) {
            MediaThumbnail thumb = thumbs[0];
            String thumbSource = thumb.getUrl();
            double thumbWidth = thumb.getWidth();
            double thumbHeight = thumb.getHeight();
            mainPanel.setWidget(row, 2, new HTML("<img src=\"" + thumbSource + " width=\"" + thumbWidth
                    + "px\" height=\"" + thumbHeight + "px\" border=\"0px\" />"));
        } else {
            mainPanel.setWidget(row, 2, new Label("Not Available"));
        }
    }
}

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

License:Apache License

/**
 * Invoked when GData has loaded. Build the UI and display the default demo.
 *///from   ww w .  j  a  va 2 s  . c  om
public void onGDataLoad() {
    if (User.getStatus() == AuthSubStatus.LOGGING_IN) {
        /*
         * AuthSub causes a refresh of the browser, so if status is LOGGING_IN
         * don't render anything. An empty page refresh is friendlier.
         */
        return;
    }

    DecoratorPanel decorator = new DecoratorPanel();
    decorator.add(outerPanel);

    RootPanel.get().setStylePrimaryName("hm-body");
    RootPanel.get().add(new HTML("<img src='logo-small.png' alt='gwt logo' "
            + "align='absmiddle'><span class='hm-title'>Google GData API Library " + "for GWT Demo</span>"));
    RootPanel.get().add(decorator);

    innerPanel.setStylePrimaryName("hm-innerpanel");
    innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    innerPanel.setSpacing(10);

    outerPanel.setStylePrimaryName("hm-outerpanel");
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);
    outerPanel.insertRow(0);

    outerPanel.addCell(0);
    outerPanel.addCell(1);
    outerPanel.addCell(2);
    outerPanel.addCell(3);

    outerPanel.setWidget(0, 0,
            new HTML("This GData-enabled application was built using the GData " + "API Library for GWT, "
                    + "<a href=\"http://code.google.com/p/gwt-gdata/\">"
                    + "http://code.google.com/p/gwt-gdata/</a>. "
                    + "The drop down list below allows you to select a scenario that "
                    + "demonstrates a particular capability of the GData support."));

    outerPanel.setWidget(1, 0, innerPanel);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    list.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            GDataDemoInfo info = list.getGDataDemoSelection();
            if (info == null) {
                showInfo();
            } else {
                show(info);
            }
        }
    });
    description.setStylePrimaryName("hm-description");
    innerPanel.clear();
    innerPanel.add(horizPanel);
    innerPanel.add(description);
    horizPanel.add(new Label("Select Demo: "));
    horizPanel.add(list);
    loadGDataDemos();
    showInfo();
}

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

License:Apache License

/**
 * Instantiates and runs a given GData demo.
 * @param info An instance of an info object describing the demo
 *///  ww  w .  j  a va2 s. c  om
public void show(GDataDemoInfo info) {
    // Don't bother re-displaying the existing GDataDemo.
    if (info == curInfo) {
        return;
    }
    curInfo = info;

    // Remove the old GDataDemo from the display area.
    if (curGDataDemo != null) {
        innerPanel.remove(curGDataDemo);
    }

    // Get the new GDataDemo instance, and display its description in the
    // MapsDemo list.
    curGDataDemo = info.getInstance();
    list.setGDataDemoSelection(info.getName());

    // Display the new GDataDemo and update the description panel.
    innerPanel.add(curGDataDemo);
    description.setHTML(info.getDescription());

    // info is an inner class of the class we want to display. Strip off the
    // generated anonymous class name.
    String strippedClassName = info.getClass().getName();
    int lastIndex = strippedClassName.lastIndexOf('$');
    if (lastIndex > 0) {
        strippedClassName = strippedClassName.substring(0, lastIndex);
    }

    outerPanel.setWidget(3, 0, new HTML("<h5> See source in " + strippedClassName
            + "</h5><h5>GData API version: " + GData.getVersion() + "</h5>"));

    curGDataDemo.onShow();
}

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

License:Apache License

/**
* Displays a set of Sidewiki entries in a tabular 
* fashion with the help of a GWT FlexTable widget. The data fields 
* Name and Url are displayed./*from  w  w  w.  j  a va 2 s  . c o m*/
* 
* @param entries The Sidewiki entries to display.
*/
private void showData(SidewikiEntry[] entries) {
    mainPanel.clear();
    String[] labels = new String[] { "Name", "Url" };
    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++) {
        SidewikiEntry 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>"));
        }
    }
}