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.dingziran.effective.client.Showcase.java

License:Apache License

/**
 * Create a hidden site map for crawlability.
 * /*from  w w w  .j  a  v a  2  s .c o m*/
 * @param contentWidgets the {@link ContentWidget}s used in Showcase
 */
private void createSiteMap(Set<ContentWidget> contentWidgets) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    for (ContentWidget cw : contentWidgets) {
        String token = getContentWidgetToken(cw);
        sb.append(SafeHtmlUtils.fromTrustedString("<a href=\"#" + token + "\">" + token + "</a>"));
    }

    // Add the site map to the page.
    HTML siteMap = new HTML(sb.toSafeHtml());
    siteMap.setVisible(false);
    RootPanel.get().add(siteMap, 0, 0);
}

From source file:com.dotweblabs.friendscube.app.client.local.widgets.connections.ConnectionsWidget.java

License:Apache License

@PageShown
public void ready() {
    UserResourceProxy userResourceProxy = GWT.create(UserResourceProxy.class);
    Long userId = loggedInUser.getUser().getId();
    userResourceProxy.getClientResource().setReference(
            ClientProxyHelper.restRootPath() + UserResourceProxy.USERS_URI + "/" + userId + "/friends");
    userResourceProxy.listFriends(userId, new Result<Friends>() {
        @Override//from   w w w  .  j a  v  a2  s. c  o m
        public void onFailure(Throwable throwable) {
            Window.alert("Failed to get list of Friends");
        }

        @Override
        public void onSuccess(Friends friends) {
            if (friends == null || friends.getCount() == 0) {
                ButtonElement inviteButton = ButtonElement
                        .as(new HTML("<button class=\"uk-button uk-width-small-5-10\" >Invite Users</button>")
                                .getElement());
                DivElement inviteDiv = DivElement
                        .as(new HTML("<div class=\"uk-form-row\"></div>").getElement());
                inviteDiv.appendChild(inviteButton);
                connectionsPlaceHolder.getElement().appendChild(inviteDiv);
            } else {
                int cnt = friends.getFriends().size();
                ConnectionsRowWidget row = connectionsRowWidget.get();
                connectionsPlaceHolder.add(row);
                for (int i = 0; i < cnt; i++) {
                    //                        Window.alert("loop");
                    if (i % 4 == 0 && i > 0) {
                        row = connectionsRowWidget.get();
                        connectionsPlaceHolder.add(row);
                    }
                    loadUser(friends.getFriends().get(i).getUserId(), row);
                }
            }
        }
    });
    //        show(this.getElement());
}

From source file:com.eaw1805.www.client.widgets.RichTextToolbar.java

License:Open Source License

/**
 * Initialize the options on the toolbar *
 *//* ww  w  .  j a v  a 2 s.  c om*/
private void buildTools() {
    //Init the TOP Panel forst
    topPanel.add(bold = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 0, 20, 20, GUI_HOVERTEXT_BOLD));
    topPanel.add(italic = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 60, 20, 20, GUI_HOVERTEXT_ITALIC));
    topPanel.add(
            underline = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 140, 20, 20, GUI_HOVERTEXT_UNDERLINE));
    topPanel.add(stroke = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 120, 20, 20, GUI_HOVERTEXT_STROKE));
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(
            subscript = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 600, 20, 20, GUI_HOVERTEXT_SUBSCRIPT));
    topPanel.add(
            superscript = createToggleButton(HTTP_STATIC_ICONS_GIF, 0, 620, 20, 20, GUI_HOVERTEXT_SUPERSCRIPT));
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(alignleft = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 460, 20, 20, GUI_HOVERTEXT_ALIGNLEFT));
    topPanel.add(
            alignmiddle = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 420, 20, 20, GUI_HOVERTEXT_ALIGNCENTER));
    topPanel.add(
            alignright = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 480, 20, 20, GUI_HOVERTEXT_ALIGNRIGHT));
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(orderlist = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 80, 20, 20, GUI_HOVERTEXT_ORDERLIST));
    topPanel.add(
            unorderlist = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 20, 20, 20, GUI_HOVERTEXT_UNORDERLIST));
    topPanel.add(
            indentright = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 400, 20, 20, GUI_HOVERTEXT_IDENTRIGHT));
    topPanel.add(indentleft = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 540, 20, 20, GUI_HOVERTEXT_IDENTLEFT));
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(generatelink = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 500, 20, 20, GUI_HOVERTEXT_LINK));
    topPanel.add(breaklink = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 640, 20, 20, GUI_HOVERTEXT_BREAKLINK));

    //Init the middle panel
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(insertline = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 360, 20, 20, GUI_HOVERTEXT_HLINE));
    topPanel.add(insertimage = createPushButton(HTTP_STATIC_ICONS_GIF, 0, 380, 20, 20, GUI_HOVERTEXT_IMAGE));
    topPanel.add(new HTML("&nbsp;"));

    //Init the BOTTOM Panel
    topPanel.add(fontlist = createFontList());
    topPanel.add(new HTML("&nbsp;"));
    topPanel.add(colorlist = createColorList());
}

From source file:com.edgenius.wiki.gwt.client.BaseEntryPoint.java

License:Open Source License

public HTML addAfterLogin(Widget printBtn) {
    HTML sep = new HTML("|");
    tailLoginPanel.add(sep);// w ww .  j  a v  a 2  s  .c o  m
    tailLoginPanel.add(printBtn);
    return sep;
}

From source file:com.edgenius.wiki.gwt.client.BaseEntryPoint.java

License:Open Source License

public void cleanBeforeLogin() {
    headLoginPanel.clear();//ww w.j  a  v a2  s .  c o m

    headLoginPanel.setSpacing(2);
    headLoginPanel.add(new HelpButton(true));
    headLoginPanel.add(new HTML("|"));
    headLoginPanel.add(loginPanel);
    headLoginPanel.add(tailLoginPanel);

}

From source file:com.edgenius.wiki.gwt.client.BaseEntryPoint.java

License:Open Source License

public boolean isSessionExpired(String currUsername) {
    String username = (String) profile.getObject();
    if (StringUtil.equals(username, currUsername))
        //both null, maybe
        return false;

    if (username != null && !username.equalsIgnoreCase(currUsername)) {
        //user changed
        profile.setObject(currUsername);
        showLoginPanel();/*from w w w  . jav  a  2 s . c om*/
        //show a warning to user
        HorizontalPanel msg = new HorizontalPanel();
        HTML label = new HTML(Msg.consts.session_expired() + "&nbsp; ");
        ClickLink login = new ClickLink(Msg.consts.login());
        login.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                LoginDialog dialogue = new LoginDialog(LoginDialog.LOGIN);
                dialogue.showbox();
            }
        });
        msg.add(label);
        msg.add(login);
        globalMessage.error(msg);
        //session expired, logout, broadcast
        login(null);
        return true;
    }

    return false;
}

From source file:com.edgenius.wiki.gwt.client.BaseEntryPoint.java

License:Open Source License

/**
 * @param list The NavItem list/*from w  w  w  .  j av  a 2s.c  o  m*/
 */
protected void refreshNavbar(List<NavItem> linkList) {

    navbarPanel.clear();
    if (linkList != null && linkList.size() > 0) {
        //shorten a>b>c>d to a>b>...>d
        shrinkNavbar(linkList);

        //OK, length is short, then list all nav items normally.
        int size = linkList.size();
        for (int idx = 0; idx < size; idx++) {
            //this link may contain navMenu(ClickLink)
            Widget link = (Widget) linkList.get(idx);

            navbarPanel.add(link);

            //append >> sign
            if (idx != (size - 1))
                navbarPanel.add(new HTML(SharedConstants.NEXT_LINK));
        }
    }
}

From source file:com.edgenius.wiki.gwt.client.BaseEntryPoint.java

License:Open Source License

private void showLoginPanel() {
    loginPanel.clear();/*  ww w .  j ava 2  s .  com*/

    if (!isOffline() && AbstractEntryPoint.isAllowPublicSignup()) {
        ClickLink signup = new ClickLink(Msg.consts.signup());
        signup.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                LoginDialog dialogue = new LoginDialog(LoginDialog.SINGUP);
                dialogue.showbox();
            }
        });
        loginPanel.add(signup);
        loginPanel.add(new HTML("&nbsp;|&nbsp;"));
    }

    ClickLink login = new ClickLink(Msg.consts.login());
    login.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            LoginDialog dialogue = new LoginDialog(LoginDialog.LOGIN);
            dialogue.showbox();
        }
    });
    loginPanel.add(login);

    profile.setObject(null);

}

From source file:com.edgenius.wiki.gwt.client.editor.MCEMacroDialog.java

License:Open Source License

public MCEMacroDialog(TinyMCE tiny, String type, String... params) {
    super(tiny);/*from   w w  w.j a v a2  s  . c  om*/
    this.type = type;

    VerticalPanel main = new VerticalPanel();
    FlexTable layout = new FlexTable();
    main.add(message);
    main.add(layout);

    if (TYPE_USER.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " " + Msg.consts.user());
        Label l1 = new Label(Msg.consts.user());
        l1.setStyleName(Css.FORM_LABEL);
        layout.setWidget(0, 0, l1);
        layout.setWidget(0, 1, hbox);
        hbox.setHint(Msg.consts.user_name());
        focusHintBox();
    } else if (TYPE_GALLERY.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " Gallery");
        Label l1 = new Label(Msg.consts.filter());
        l1.setStyleName(Css.FORM_LABEL);
        layout.setWidget(0, 0, l1);
        layout.setWidget(0, 1, hbox);
        hbox.setHint(Msg.consts.gallery_hint());
        focusHintBox();
    } else if (TYPE_ATTACH.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " Attachment list");
        Label l1 = new Label(Msg.consts.filter());
        l1.setStyleName(Css.FORM_LABEL);
        layout.setWidget(0, 0, l1);
        layout.setWidget(0, 1, hbox);
        hbox.setHint(Msg.consts.attach_hint());
        focusHintBox();
    } else if (TYPE_HTML.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " HTML");
        layout.setWidget(0, 0, area);
        area.setStyleName(Css.LARGE);
        focusTextArea();
    } else if (TYPE_PANEL.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " Panel");
        Label l1 = new Label(Msg.consts.title());
        l1.setStyleName(Css.FORM_LABEL);
        layout.setWidget(0, 0, l1);
        layout.setWidget(0, 1, hbox);
        focusHintBox();
        //no hint text in hbox, so it can be put focus... need improve later...
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                hbox.setFocus(true);
            }
        });
    } else if (TYPE_TOC.equalsIgnoreCase(type)) {
        this.setText(Msg.consts.insert() + " Table of Contents");
        Label l1 = new Label(Msg.consts.levels());
        l1.setStyleName(Css.FORM_LABEL);
        layout.setWidget(0, 0, l1);
        layout.setWidget(0, 1, hbox);
        hbox.setHint("3");

        Label l2 = new Label(Msg.consts.type());
        l2.setStyleName(Css.FORM_LABEL);
        layout.setWidget(1, 0, l2);
        radio1.setText(Msg.consts.numbers());
        radio2.setText(Msg.consts.bullets());
        radio1.setChecked(true);
        FlowPanel pl = new FlowPanel();
        pl.add(radio1);
        pl.add(new HTML("&nbsp;&nbsp;&nbsp;"));
        pl.add(radio2);
        layout.setWidget(1, 1, pl);
        focusHintBox();
    }
    hbox.setStyleName(Css.FORM_INPUT);

    this.setWidget(main);
}

From source file:com.edgenius.wiki.gwt.client.GwtClientUtils.java

License:Open Source License

/**
 * Please don't use this method when you can use
 * <code>createUserPortrait</code> method. Because this method will force
 * refresh image from server every visit.
 * //from   w  w w  .j ava2  s  . c  o  m
 * @param username
 * @return
 */
public static Widget createUserPortraitByUsername(String username) {
    String imgUrl;
    if (username == null || username.trim().length() == 0) {
        // return default user portrait
        imgUrl = getBaseUrl() + "static/images/noportrait.jpg";
    } else {
        imgUrl = getBaseUrl() + "download?user=" + URL.encodeQueryString(username) + "&refresh="
                + System.currentTimeMillis();
    }

    return new HTML("<img src=\"" + imgUrl + "\"" + " title=\"portrait\">");
}