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.edgenius.wiki.gwt.client.widgets.CaptchaWidget.java

License:Open Source License

/**
 * //from   w  w w .  j  a v a  2s  .  c o m
 */
public void enable() {
    //DONOT user visible or invisible to switch enable/disable
    panel.clear();
    Date now = new Date();
    //must give a parameter name "refresh=", otherwise, ognl throw NumberFormatExcetpion!
    final HTML captcha = new HTML("<image id='captchaImg" + uid + "' src='" + GwtClientUtils.getBaseUrl()
            + "captcha.do?refresh=" + now.getTime() + "'>");
    ClickLink refreshCaptcha = new ClickLink(Msg.consts.refresh_image());
    refreshCaptcha.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            refresh();
        }
    });

    captchaInput.setName("j_captcha_response");
    //      Label desc = new Label("input are lower case");
    panel.add(captcha);
    panel.add(refreshCaptcha);
    panel.add(captchaInput);
    //      panel.add(desc);
    panel.setCellHorizontalAlignment(captcha, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellHorizontalAlignment(refreshCaptcha, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellHorizontalAlignment(captchaInput, HasHorizontalAlignment.ALIGN_CENTER);
    //      panel.setCellHorizontalAlignment(desc, HasHorizontalAlignment.ALIGN_CENTER);
}

From source file:com.edgenius.wiki.gwt.client.widgets.DialogBox.java

License:Open Source License

public DialogBox(UIObject parent, boolean autoHide, boolean withBackground, boolean modal) {
    super(autoHide, modal);
    if (modal && withBackground)
        lightbox = new Lightbox(parent, this);

    closeBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hidebox();/*from  w  ww.j  a  v a  2  s  .  com*/
        }
    });

    VerticalPanel panel = new VerticalPanel();
    //caption part: caption focus panel(drag/drop handler) and close button
    captionTable.setWidget(0, 0, icon);
    captionTable.setWidget(0, 1, caption);
    captionTable.setWidget(0, 2, closeBtn);

    captionTable.getCellFormatter().setWidth(0, 0, "42px");
    captionTable.getCellFormatter().setWidth(0, 2, "42px");
    captionTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_BOTTOM);
    captionTable.getFlexCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    captionTable.getFlexCellFormatter().setVerticalAlignment(0, 2, HasVerticalAlignment.ALIGN_BOTTOM);
    captionTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-top-left");
    captionTable.getFlexCellFormatter().setStyleName(0, 1, "dlg-border-top");
    captionTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-top-right");
    captionTable.setCellPadding(0);
    captionTable.setCellSpacing(0);

    FlexTable bodyTable = new FlexTable();
    bodyTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-border-left");
    bodyTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-border-right");
    bodyTable.setWidget(0, 1, body);
    bodyTable.setWidget(1, 0, buttonBar);
    bodyTable.setCellPadding(0);
    bodyTable.setCellSpacing(0);

    bodyTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);
    bodyTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_BOTTOM);
    bodyTable.getFlexCellFormatter().setStyleName(0, 1, Css.MAIN_BODY);
    bodyTable.getFlexCellFormatter().setStyleName(1, 0, Css.BUTTONS_BAR);
    bodyTable.getFlexCellFormatter().setRowSpan(0, 0, 2);
    bodyTable.getFlexCellFormatter().setRowSpan(0, 2, 2);
    bodyTable.getCellFormatter().setWidth(0, 0, "17px");
    bodyTable.getCellFormatter().setWidth(0, 2, "17px");

    FlexTable bottomTable = new FlexTable();
    bottomTable.setWidget(0, 0, new HTML("&nbsp;")); //just a placeholder
    bottomTable.setWidget(0, 1, new HTML("&nbsp;")); //just a placeholder
    bottomTable.setWidget(0, 2, new HTML("&nbsp;")); //just a placeholder
    bottomTable.getFlexCellFormatter().setStyleName(0, 0, "dlg-bottom-left");
    bottomTable.getFlexCellFormatter().setStyleName(0, 1, "dlg-border-bottom");
    bottomTable.getFlexCellFormatter().setStyleName(0, 2, "dlg-bottom-right");
    bottomTable.getCellFormatter().setWidth(1, 0, "34px");
    bottomTable.getCellFormatter().setWidth(1, 2, "34px");
    bottomTable.setCellPadding(0);
    bottomTable.setCellSpacing(0);

    panel.add(captionTable);
    panel.add(bodyTable);
    panel.add(bottomTable);

    //style
    captionTable.setWidth("100%");
    bodyTable.setWidth("100%");
    bottomTable.setWidth("100%");

    body.setSize("100%", "100%");
    caption.setWidth("100%");

    panel.setStyleName(Css.DIALOG_BOX_TABLE);
    panel.setBorderWidth(0);
    caption.addMouseOutHandler(this);
    caption.addMouseOverHandler(this);
    caption.addMouseDownHandler(this);
    caption.addMouseUpHandler(this);
    caption.addMouseMoveHandler(this);
    //      icon.addMouseOutHandler(this);
    //      icon.addMouseOverHandler(this);
    //      icon.addMouseDownHandler(this);
    //      icon.addMouseUpHandler(this);
    //      icon.addMouseMoveHandler(this);

    captionTable.setStyleName(Css.CAPTION);
    setStyleName(Css.DIALOG_BOX);

    windowWidth = Window.getClientWidth();
    clientLeft = Document.get().getBodyOffsetLeft();
    clientTop = Document.get().getBodyOffsetTop();

    super.setWidget(panel);

}

From source file:com.edgenius.wiki.gwt.client.widgets.DialogBox.java

License:Open Source License

public void setHTML(String captionTitle) {
    caption.clear();
    caption.add(new HTML(captionTitle));
    this.text = captionTitle;
}

From source file:com.edgenius.wiki.gwt.client.widgets.HelpDialog.java

License:Open Source License

public HelpDialog() {
    this.setText(Msg.consts.help() + " - " + Msg.consts.press() + " F1");
    this.setIcon(new Image(IconBundle.I.get().help()));
    Frame syntax = new Frame(showHtmlPage("static/syntax.html"));
    Frame key = new Frame(showHtmlPage("static/keys.html"));

    DOM.setElementAttribute(syntax.getElement(), "frameborder", "0");
    DOM.setElementAttribute(key.getElement(), "frameborder", "0");

    FlowPanel sbar = new FlowPanel();
    Image sImg1 = new Image(IconBundle.I.get().home_link());
    sbar.add(sImg1);//from   w  ww . j  a  v a  2 s.  co  m
    HTML sHome = new HTML(
            "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> "
                    + Msg.consts.online_help() + "</a>");
    sbar.add(sHome);
    //the latter one display first!
    sbar.add(sPop);
    sbar.add(sImg);

    sbar.setWidth("100%");
    sImg1.setStyleName(Css.LEFT);
    sHome.setStyleName(Css.LEFT);
    sImg.setStyleName(Css.RIGHT);
    sPop.setStyleName(Css.RIGHT);
    sImg.addClickHandler(this);
    sPop.addClickHandler(this);

    FlowPanel kbar = new FlowPanel();
    Image kImg1 = new Image(IconBundle.I.get().home_link());
    HTML kHome = new HTML(
            "<a href='http://geniuswiki.com/page/GeniusWiki+document/GeniusWiki+document' target='_blank'> "
                    + Msg.consts.online_help() + "</a>");
    kbar.add(kImg1);
    kbar.add(kHome);

    //the latter one display first!
    kbar.add(kPop);
    kbar.add(kImg);
    kbar.setWidth("100%");

    kImg1.setStyleName(Css.LEFT);
    kHome.setStyleName(Css.LEFT);
    kImg.setStyleName(Css.RIGHT);
    kPop.setStyleName(Css.RIGHT);
    kImg.addClickHandler(this);
    kPop.addClickHandler(this);

    VerticalPanel syntaxPanel = new VerticalPanel();
    syntaxPanel.add(sbar);
    syntaxPanel.add(syntax);
    syntaxPanel.setCellHeight(sbar, "30px");
    syntaxPanel.setCellHeight(syntax, "100%");

    VerticalPanel keyPanel = new VerticalPanel();
    keyPanel.add(kbar);
    keyPanel.add(key);
    keyPanel.setCellHeight(kbar, "30px");
    keyPanel.setCellHeight(key, "100%");

    DecoratedTabPanel deck = new DecoratedTabPanel();
    deck.add(syntaxPanel, Msg.consts.markup());
    deck.add(keyPanel, Msg.consts.keyboard());

    //show markup panel
    deck.selectTab(0);
    this.setWidget(deck);

    syntax.setSize("100%", "100%");
    key.setSize("100%", "100%");
    deck.addStyleName(Css.DECK);
    this.addStyleName(Css.HELP_DIALOG_BOX);

}

From source file:com.edgenius.wiki.gwt.client.widgets.HelpPopup.java

License:Open Source License

public HelpPopup(UIObject target, int helpID) {
    super(target, true, true, true);

    if (helpID == SPACE_PRIVATE) {
        info.add(new HTML(Msg.consts.help_pop_private_space()));
    } else if (helpID == BULK_ATTACHMENT_UPLOAD) {
        info.add(new HTML(Msg.consts.help_pop_bulk_upload()));
    } else if (helpID == LINK_BLOG) {
        info.add(new HTML(Msg.consts.help_pop_link_blog()));
    }//from  www  .  j  a va2 s . c  om
    VerticalPanel panel = new VerticalPanel();
    panel.add(info);
    panel.add(new Label(Msg.consts.help_pop_general()));
    this.setStyleName(Css.TIP_POPUP);
    this.setWidget(panel);
}

From source file:com.edgenius.wiki.gwt.client.widgets.InviteDialog.java

License:Open Source License

public void onSuccess(InvitationModel model) {
    if (!GwtClientUtils.preSuccessCheck(model, null)) {
        return;//from w  ww.  java  2 s.  c om
    }

    //remove input fields...
    panel.clear();
    getButtonBar().clear();

    Button close = new Button(Msg.consts.close());
    close.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            InviteDialog.this.hidebox();
        }
    });
    getButtonBar().add(close);
    panel.add(message);

    //after server side handle only valid email return and only separator by ","
    String[] emails = model.emailGroup == null ? null : model.emailGroup.split(",");
    StringBuffer list = new StringBuffer("<br>");
    if (emails != null && emails.length > 0) {
        message.info(Msg.consts.invite_success());
        for (int idx = 0; idx < emails.length; idx++) {
            String email = emails[idx];
            if (email != null && email.trim().length() > 0)
                list.append(email).append("<br><br>");
        }
        panel.add(new HTML(list.toString()));
    } else {
        message.info(Msg.consts.invite_email_failed());
    }

}

From source file:com.education.lessons.ui.client.login.utils.UIHelper.java

License:Open Source License

public static void alert(String title, String message) {
    final WebDialog dialog = new WebDialog();
    dialog.addStyleName("alert-box");
    dialog.setAnimationEnabled(true);/*from ww w.  jav a2s.c  om*/
    dialog.setClosable(true);
    dialog.setModal(true);
    dialog.setText(title);

    HTML messageLabel = new HTML(message);
    messageLabel.addStyleName("content");

    dialog.setWidget(messageLabel);
    dialog.center();
    dialog.show();
}

From source file:com.education.lessons.ui.client.login.utils.UIHelper.java

License:Open Source License

public static void tip(String message, UIObject target) {
    HTML messageLabel = new HTML(message);
    messageLabel.addStyleName("content");

    PopupPanel tip = new DecoratedPopupPanel(true);
    tip.addStyleName("tip-box");
    tip.setWidget(messageLabel);//  w  w  w .  j av  a 2 s. c  o m
    tip.showRelativeTo(target);
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

public static void setTemplate(String rawHeader, String rawFooter, String rPanelName) {
    body.getElement().setId("flowContainer");
    clearContents();/*from w  w w. j  av a  2s.  c o m*/
    RootPanel.get(CONTENT_HEADER).add(new HTML(rawHeader));
    RootPanel.get(CONTENT_FOOTER).add(new HTML(rawFooter));
    rootPanelName = rPanelName;

    RootPanel.get(rootPanelName).add(body);
}

From source file:com.eduworks.russel.ds.client.handler.ESBSearchHandler.java

License:Apache License

/**
 * buildTile0 Initiates a tile in the Alfresco results panel.
 * @param searchTermPacket ESBPacket Alfresco search results
 * @param index int Index in the search results for the tile to be created
 * @param objPanel String Name of target panel for the tile
 * @param td Element Container for the tile
 *//*from  w ww .  j a v  a  2s . c  om*/
protected void buildTile0(Record r, int index, int screenPosition, String objPanel, Element td) {
    FileRecord fr = (FileRecord) r;
    Vector<String> iDs = null;

    if ((td != null) && (searchType.equals(RECENT_TYPE)))
        iDs = PageAssembler.inject(td.getId(), "x", new HTML(templates.getObjectPanelWidget().getText()),
                false);
    else if (searchType.equals(COLLECTION_TYPE) || searchType.equals(FLR_TYPE)
            || searchType.equals(SEARCH_TYPE))
        iDs = PageAssembler.inject(objPanel, "x", new HTML(templates.getSearchPanelWidget().getText()), false);
    else if (searchType.equals(PROJECT_TYPE))
        iDs = PageAssembler.inject(objPanel, "x",
                new HTML(templates.getEPSSProjectObjectPanelWidget().getText()), false);
    else if ((td != null) && (searchType.equals(ASSET_TYPE)))
        iDs = PageAssembler.inject(td.getId(), "x",
                new HTML(templates.getEPSSAssetObjectPanelWidget().getText()), false);
    else if ((td != null) && (searchType.equals(NOTES_TYPE)))
        iDs = PageAssembler.inject(td.getId(), "x",
                new HTML(templates.getEPSSNoteAssetObjectWidget().getText()), false);
    else if ((td != null) && (searchType.equals(STRATEGY_TYPE))) {
        Window.alert("handling a strategy search");
        iDs = PageAssembler.inject(td.getId(), "x",
                new HTML(templates.getEPSSAssetObjectPanelWidget().getText()), false);
    }
    String idPrefix = iDs.firstElement().substring(0, iDs.firstElement().indexOf("-"));
    tileHandlers.add(new TileHandler(this, idPrefix, searchType, fr));
}