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.page.widgets.PageTreeWidget.java

License:Open Source License

public PageTreeWidget(TreeItem root) {
    request.addCallback(this);
    tree.addCloseHandler(this);
    tree.addOpenHandler(this);
    tree.addSelectionHandler(this);

    this.rootItem = root;

    ScrollPanel pagePanel = new ScrollPanel();
    pagePanel.add(tree);//from w  w w .  ja  v  a2 s  . c  o m

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(pagePanel);
    //this is just left one empty line between the tree and down border
    panel.add(new HTML(" "));
    this.setWidget(panel);

}

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

License:Open Source License

public TagPopup(UIObject target, String spaceUname, String tagname) {
    super(target, true, true, true);
    this.spaceUname = spaceUname;
    this.tagname = tagname;

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);/*from  w ww . jav  a 2s . c o  m*/
    panel.add(new HTML("<b>" + tagname + "</b>"));
    panel.add(new Hr());
    panel.add(pagesPanel);
    if (!AbstractEntryPoint.isOffline()) {
        //so far, have to block tag cloud in offline model as the macro render logic is on MacroHandler side, it is not easy to do in 
        //offline model.
        Hyperlink tagCloud = new Hyperlink(Msg.consts.goto_tagcloud(),
                GwtUtils.buildToken(GwtUtils.getCPageToken(SharedConstants.CPAGE_TAG_CLOUD), spaceUname));
        tagCloud.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                TagPopup.this.hide();
            }
        });
        panel.add(tagCloud);
        panel.setCellHorizontalAlignment(tagCloud, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    panel.setSize("100%", "100%");
    this.setWidget(panel);

}

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

License:Open Source License

public TagsPanel() {
    this.initWidget(tagsDeck);

    FlowPanel tagEditPanel = new FlowPanel();
    doneTags.addClickHandler(this);
    cancelTags.addClickHandler(this);
    tagEditPanel.add(tagsEditBox);// ww  w .  j  a  v  a2s.  co  m
    tagEditPanel.add(new HTML("&nbsp;"));
    tagEditPanel.add(doneTags);
    tagEditPanel.add(new HTML("|"));
    tagEditPanel.add(cancelTags);
    tagsEditBox.setHint(Msg.consts.tags() + "...");

    tagsDeck.add(tags);
    tagsDeck.add(tagEditPanel);
    tagsDeck.showWidget(TAG_TEXT);

    editTagsLink.addClickHandler(this);

    tagsEditBox.addFocusHandler(this);
    tagsEditBox.addBlurHandler(this);

    //style
    DOM.setStyleAttribute(tagsEditBox.getElement(), "display", "inline");
    editTagsLink.setStyleName(Css.EDIT_TAGS_LINK);
    cancelTags.setStyleName(Css.EDIT_TAGS_LINK);
    doneTags.setStyleName(Css.EDIT_TAGS_LINK);
    tags.setStyleName(Css.RENDER_TAG);

}

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

License:Open Source License

public void display(String spaceUname, String tagsStr, boolean allowEdit) {
    tagsEditBox.setSpaceUname(spaceUname);

    tagsEditBox.setText("");
    tags.clear();//from   w  w  w  .  j ava  2s . com

    Image img = new Image(TypeImageBundle.I.get().ptag());
    img.setTitle(Msg.consts.tags());
    tags.add(img);

    if (tagsStr != null && tagsStr.trim().length() > 0) {
        String[] tagTxts = tagsStr.split(",");
        for (int idx = 0; idx < tagTxts.length; idx++) {
            final String tagname = tagTxts[idx];
            if (tagname.trim().length() > 0) {
                EventfulHyperLink tagLink = new EventfulHyperLink(tagname, GwtUtils.buildToken(
                        GwtUtils.getCPageToken(SharedConstants.CPAGE_TAG_CLOUD), PageMain.getSpaceUname()));
                new TagPopup(tagLink, PageMain.getSpaceUname(), tagname);
                tagLink.setTitle(Msg.consts.goto_tagcloud());
                tagLink.setStyleName(Css.ITEM);
                tags.add(tagLink);
            }
        }
    } else {
        //show none
        tags.add(new HTML(" (" + Msg.consts.none() + ")"));
    }

    //offline, disable edit tag
    if (allowEdit && !AbstractEntryPoint.isOffline()) {
        //view
        tags.add(new HTML("&nbsp;"));
        tags.add(editTagsLink);
        //edit box
        tagsEditBox.setText(StringUtil.trimStartSpace(tagsStr));
    }

    tagsDeck.showWidget(TAG_TEXT);
}

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

License:Open Source License

public TemplatesPanel(PageMain main, EditPanel editPanel) {
    this.editPanel = editPanel;

    closeBtn.addClickHandler(this);
    HorizontalPanel header = new HorizontalPanel();
    header.add(new HTML("<b>" + Msg.consts.templates() + "</b>"));
    header.add(message);/*from  w ww.  ja va  2  s.  com*/
    header.add(closeBtn);
    header.setCellHorizontalAlignment(closeBtn, HasHorizontalAlignment.ALIGN_RIGHT);

    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");
    content.setWidth("100%");
    header.setWidth("100%");
    panel.add(header);
    panel.add(content);
    this.setWidget(panel);
    this.setStyleName(Css.ATTACHMNET_PANEL);
}

From source file:com.edgenius.wiki.gwt.client.portal.PortletCreateDialog.java

License:Open Source License

public PortletCreateDialog(final String key) {
    if (key == null) {
        this.setText(Msg.consts.create_widget());
    } else {/*ww  w  .j a  va2 s . c o  m*/
        this.setText(Msg.consts.edit_widget());
    }
    this.setIcon(new Image(IconBundle.I.get().star()));

    FlexTable plinkerPanel = new FlexTable();

    pTitle.addFocusHandler(new FocusHandler() {
        public void onFocus(FocusEvent event) {
            String spaceUname = StringUtil.trim(pSpace.getText());
            if (!StringUtil.isBlank(spaceUname) && !StringUtil.equalsIgnoreCase(currSpaceUname, spaceUname)) {
                pTitle.request(spaceUname);
                currSpaceUname = spaceUname;
            }
        }

    });
    Label l1 = new Label(Msg.consts.space_uname());
    plinkerPanel.setWidget(0, 0, l1);
    plinkerPanel.setWidget(0, 1, pSpace);
    Label l2 = new Label(Msg.consts.page_title());
    plinkerPanel.setWidget(1, 0, l2);
    plinkerPanel.setWidget(1, 1, pTitle);

    FlexTable markupPanel = new FlexTable();
    Label l3 = new Label(Msg.consts.title());
    markupPanel.setWidget(0, 0, l3);
    markupPanel.setWidget(0, 1, title);
    title.setStyleName(Css.LONG_INPUT);

    Label l4 = new Label(Msg.consts.content());
    markupPanel.setWidget(1, 0, l4);
    markupPanel.setWidget(1, 1, markup);
    markup.setStyleName(Css.LONG_TEXTBOX);

    okBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            WidgetModel widget = new WidgetModel();
            widget.key = key;
            widget.description = desc.getText();
            widget.shared = !keepPrivate.getValue();

            String error = null;
            String spaceUname = null;
            if (typeMarkup.getValue()) {
                widget.type = WidgetModel.TYPE_MARKUP_RENDER;
                widget.title = title.getText();
                widget.content = markup.getText();
                if (StringUtil.isBlank(widget.title)) {
                    error = "Title ";
                }
                if (StringUtil.isBlank(widget.content)) {
                    if (error != null)
                        error += " or Content";
                    else
                        error = "Content ";
                }
            } else {
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                //page link widget
                widget.type = WidgetModel.TYPE_PAGE_LINKER;
                spaceUname = StringUtil.trimToEmpty(pSpace.getText());
                widget.title = StringUtil.trimToEmpty(pTitle.getText());
                //build content - whatever spaceUname or title is correct as this widget object is saved into ValidPageAsync() and save immediately if no errors. 
                widget.content = "{include:src=" + EscapeUtil.escapeMacroParam(widget.title) + "@"
                        + EscapeUtil.escapeMacroParam(spaceUname) + "}";
                //it is bad idea if title is blank, then point to home page: it need lots hack to get back Home title etc. and in exception case, widget even can be blank title
                //this cause user have no chance to delete it anymore --- left rubbish widget on DB. 
                if (StringUtil.isBlank(widget.title)) {
                    error = "Title ";
                }
                if (StringUtil.isBlank(spaceUname)) {
                    if (error != null)
                        error += " or Space";
                    else
                        error = "Space ";
                }
            }

            if (error != null) {
                error += " can not be blank.";
                message.error(error);
                return;
            }

            okBtn.setEnabled(false);
            if (typeMarkup.getValue()) {
                //for markup content widget, create immediately
                PortalControllerAsync portalController = ControllerFactory.getPortalController();
                portalController.saveOrUpdateWidget(widget, PortletCreateDialog.this);
            } else {
                //for pagelink widget, valid from server side first, then save
                //valid if page exist or not? Valid from server side rather than just use suggest box, this is more exactly
                PageControllerAsync pageController = ControllerFactory.getPageController();
                pageController.exist(spaceUname, widget.title, new ValidPageAsync(widget));
            }

        }
    });
    Button cancelBtn = new Button(Msg.consts.cancel(), ButtonIconBundle.crossImage());
    cancelBtn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hidebox();
        }
    });
    typePageLinker.addClickHandler(typeChangeListener);
    typeMarkup.addClickHandler(typeChangeListener);

    getButtonBar().add(cancelBtn);
    getButtonBar().add(okBtn);

    deck.insert(plinkerPanel, PAGE_LINER_INDEX);
    deck.insert(markupPanel, MARKUP_RENDER_INDEX);

    fillPanel();

    int row = 0;
    FlexTable main = new FlexTable();
    main.getColumnFormatter().setWidth(0, "120px");

    main.setWidget(row, 0, message);
    main.getFlexCellFormatter().setColSpan(row, 0, 4);
    row++;

    Label l6 = new Label(Msg.consts.introduction());
    main.setWidget(row, 0, l6);
    main.setWidget(row, 1, desc);
    desc.setMaxLength(250);
    desc.setStyleName(Css.LONG_INPUT);
    Label l5 = new Label(Msg.consts.keep_private());
    main.setWidget(row, 2, l5);
    main.getFlexCellFormatter().setAlignment(row, 2, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);
    main.setWidget(row, 3, keepPrivate);
    row++;

    HorizontalPanel chooser = new HorizontalPanel();
    Label l7 = new Label(Msg.consts.page_linker());
    Label l8 = new Label(Msg.consts.markup_render());
    chooser.add(typePageLinker);
    chooser.add(l7);
    chooser.add(new HTML("&nbsp;&nbsp;&nbsp;"));
    chooser.add(typeMarkup);
    chooser.add(l8);
    chooser.setCellWidth(typePageLinker, "20px");
    chooser.setCellWidth(typeMarkup, "20px");
    main.setWidget(row, 0, chooser);
    main.getFlexCellFormatter().setColSpan(row, 0, 4);
    main.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);
    row++;
    main.getFlexCellFormatter().setColSpan(row, 0, 4);
    main.getFlexCellFormatter().setHeight(row, 0, "3px");
    row++;

    main.setWidget(row, 0, deck);
    main.getFlexCellFormatter().setColSpan(row, 0, 4);
    row++;

    main.setStyleName(Css.FORM);
    title.setStyleName(Css.FORM_INPUT);
    desc.setStyleName(Css.FORM_INPUT);
    pTitle.setStyleName(Css.FORM_INPUT);
    pSpace.setStyleName(Css.FORM_INPUT);

    l1.setStyleName(Css.FORM_LABEL);
    l2.setStyleName(Css.FORM_LABEL);
    l3.setStyleName(Css.FORM_LABEL);
    l4.setStyleName(Css.FORM_LABEL);
    //      l5.setStyleName(Css.FORM_LABEL);

    l6.setStyleName(Css.FORM_LABEL);
    l7.setStyleName(Css.FORM_LABEL);
    DOM.setElementAttribute(l7.getElement(), "style", "text-align:left");
    l8.setStyleName(Css.FORM_LABEL);
    DOM.setElementAttribute(l8.getElement(), "style", "text-align:left");

    main.setSize("100%", "100%");
    deck.setSize("100%", "100%");

    VerticalPanel busyPanel = new VerticalPanel();
    busyPanel.add(busyMessage);
    busyPanel.add(busyImg);

    mainDeck.insert(main, DECK_MAIN);
    mainDeck.insert(busyPanel, DECK_BUSY);
    if (key == null)
        mainDeck.showWidget(DECK_MAIN);
    else {
        //edit, loading widget info
        mainDeck.showWidget(DECK_BUSY);
        PortalControllerAsync portalController = ControllerFactory.getPortalController();
        portalController.getWidget(key, new LoadingAsync());
    }

    this.setWidget(mainDeck);

}

From source file:com.edgenius.wiki.gwt.client.portal.PortletListDialogue.java

License:Open Source License

private void fillListTable(ZebraTable table, List<PortletModel> portletList, boolean showLogo) {

    int row = rebuildTable(table, showLogo);

    int col;/*from   ww  w . j ava2 s. c om*/

    for (Iterator<PortletModel> iter = portletList.iterator(); iter.hasNext();) {
        final PortletModel sModel = iter.next();
        col = 0;
        if (showLogo) {
            Image logo;
            if (sModel.type == PortletModel.SPACE) {
                logo = new Image(TypeImageBundle.I.get().space());
                logo.setTitle(Msg.consts.space());
            } else {
                logo = new Image(TypeImageBundle.I.get().widget());
                logo.setTitle(Msg.consts.widget());
            }
            table.setWidget(row, col++, logo);
        }
        //spaceTitle or widget Title
        table.setWidget(row, col++, new Label(sModel.title));

        ClickLink add = new ClickLink(Msg.consts.add());
        add.setTitle(Msg.params.add_widget_title(sModel.title));
        add.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                addCandidate(sModel);
            }
        });
        table.setWidget(row, col++, new HTML(sModel.description));
        table.setWidget(row, col++, add);
        row++;
    }

    initTable(table, showLogo);

}

From source file:com.edgenius.wiki.gwt.client.render.PageRender.java

License:Open Source License

/**
 * @param spaceUname /*from   w  w w. ja  v a2 s  . c  om*/
 * @param panel
 * @param model
 * @param pieces: could be pageContent, or side bar content 
 * @param isPreivew: if this render is for preview window
 */
public void renderContent(final String spaceUname, PageModel page, List<RenderPiece> pieces,
        boolean isPreivew) {
    //most stuff only need renderPiece, except PageAuthorPanel at moment
    widgetRenderContent = new StringBuffer();
    widgetCounter.clear();
    widgetContainer.clear();

    panel.clear();

    if (pieces != null) {
        int size = pieces.size();
        for (int idx = 0; idx < size; idx++) {
            Object piece = pieces.get(idx);
            if (piece instanceof LinkModel) {
                LinkModel ln = (LinkModel) piece;
                if (listeners != null) {
                    fireRenderEvent(ln.getView());
                }
                final String anchorTxt = StringUtil.isBlank(ln.getAnchor()) ? ""
                        : (EscapeUtil.escapeToken(ln.getAnchor().trim()));
                if (anchorTxt.length() != 0 && StringUtil.isBlank(ln.getLink())) {
                    //[view>#anchor] style: will only redirect to anchor in same page
                    ClickLink link = new ClickLink(ln.getView(), true);
                    link.addClickHandler(new ClickHandler() {
                        public void onClick(ClickEvent event) {
                            GwtClientUtils.gotoAnchor(anchorTxt);
                        }
                    });
                    panel.add(link);
                } else if (ln.getType() == LinkModel.LINK_TO_CLIENT_CLICK_LINK) {
                    final String[] token = LinkUtil.parseCLinkParamters(ln.getLink());
                    if (token != null && token.length > 0) {
                        //If it has anchor field, it will be treated as hyper link.Otherwise, ClickLink
                        if (!StringUtil.isEmpty(ln.getAnchor())) {
                            //now it only support user popup - so need to consolidate if want to more functions 
                            EventfulHyperLink link = new EventfulHyperLink(ln.getView(), ln.getAnchor());
                            String method = token[0];
                            String[] params = null;
                            if (token.length > 1) {
                                params = new String[token.length - 1];
                                for (int idx1 = 1; idx1 < token.length; idx1++) {
                                    params[idx1 - 1] = token[idx1];
                                }
                            }
                            JavascriptExposer.run(method, params, link);
                            panel.add(link);
                        } else {
                            //click link
                            ClickLink link = new ClickLink(ln.getView(), true);
                            link.addClickHandler(new ClickHandler() {
                                public void onClick(ClickEvent event) {
                                    String method = token[0];
                                    String[] params = null;
                                    if (token.length > 1) {
                                        params = new String[token.length - 1];
                                        for (int idx = 1; idx < token.length; idx++) {
                                            params[idx - 1] = token[idx];
                                        }
                                    }
                                    JavascriptExposer.run(method, params, (Widget) event.getSource());
                                }
                            });
                            panel.add(link);
                        }
                    } else {
                        panel.add(new HTML(ln.getView()));
                        Log.error("Unable pasre link with type 'client click link':" + ln.getLink());
                    }
                } else if (ln.getType() == LinkModel.LINK_TO_SERVER_CLICK_LINK) {

                } else {
                    if (isPreivew) {
                        ClickLink link = new ClickLink(ln.getView(), true);
                        link.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                Window.alert(Msg.consts.preview_disable_link());
                            }
                        });
                        panel.add(link);
                    } else {
                        String tokenName = ln.getLink();

                        String linkSpaceUname = ln.getSpaceUname();
                        //extspace or current space,  if null(failure tolerance) use current spaceUname as value
                        linkSpaceUname = (linkSpaceUname == null || linkSpaceUname.trim().length() == 0)
                                ? spaceUname
                                : linkSpaceUname;
                        if (ln.getType() == LinkModel.LINK_TO_CREATE_FLAG) {
                            //$CREATE ,for link to non-exist page, or for "PAGE_NOT_FOUND" case
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_CREATE, linkSpaceUname, tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_CREATE_HOME_FLAG) {
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_CREATE_HOME, linkSpaceUname,
                                    tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_OPEN_NEW_WIN) {
                            //no use so far
                            tokenName = GwtUtils.buildToken(PageMain.TOKEN_OPEN_NEW_WINDOW, linkSpaceUname,
                                    tokenName);
                        } else if (ln.getType() == LinkModel.LINK_TO_HYPER_TOKEN) {
                            //keep token unchanged - nothing to do here.
                        } else
                            tokenName = GwtUtils.getSpacePageToken(linkSpaceUname, tokenName);

                        tokenName += (anchorTxt == "" ? "" : "#" + anchorTxt);
                        Hyperlink link = new Hyperlink(ln.getView(), true, tokenName);
                        panel.add(link);
                    }
                }
            } else if (piece instanceof MacroModel) {
                MacroModel rs = (MacroModel) piece;
                if (rs != null) {

                    if (rs.macroName.equalsIgnoreCase(SharedConstants.MACRO_SPACE_ADMIN)) {
                        SpaceAdminRenderWidget adminPanel = new SpaceAdminRenderWidget(spaceUname);
                        panel.add(adminPanel);
                        widgetContainer.add(adminPanel);
                        adminPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equalsIgnoreCase(SharedConstants.MACRO_NOTIFY_SYSADMIN)) {
                        SendingNotifyRenderWidget adminPanel = new SendingNotifyRenderWidget();
                        panel.add(adminPanel);
                        widgetContainer.add(adminPanel);
                        adminPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_TAG_CLOUD)) {
                        TagCloudRenderWidget macroPanel = new TagCloudRenderWidget(spaceUname);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_TEMPLATE_LIST)) {
                        TemplateListRenderWidget macroPanel = new TemplateListRenderWidget(spaceUname);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_SEARCH)) {
                        String keyword = (String) rs.values.get(NameConstants.KEYWORD);
                        SearchRenderWidget macroPanel = new SearchRenderWidget(keyword);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_USER_PROFILE)) {
                        String username = rs.values.get(NameConstants.USERNAME);
                        UserProfileRenderWidget macroPanel = new UserProfileRenderWidget(username);
                        panel.add(macroPanel);
                        widgetContainer.add(macroPanel);
                        macroPanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equals(SharedConstants.MACRO_INCLUDE)) {
                        String src = rs.values.get(NameConstants.SRC);

                        LinkModel link = LinkUtil.parseMarkup(src);
                        if (StringUtil.isBlank(link.getSpaceUname())) {
                            //if @space is blank, treat as current space 
                            link.setSpaceUname(spaceUname);
                        }
                        IncludeRenderWidget includePanel = new IncludeRenderWidget(link);
                        panel.add(includePanel);
                        widgetContainer.add(includePanel);
                        includePanel.onLoad(HTMLPanel.createUniqueId(), currentUser, this);

                    } else if (rs.macroName.equals(SharedConstants.MACRO_COMMENT)) {
                        String title = (String) rs.values.get(NameConstants.TITLE);
                        ClickLink comment = new ClickLink(title);
                        comment.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                if (BaseEntryPoint.I != null && BaseEntryPoint.I instanceof PageMain) {
                                    PageMain main = ((PageMain) BaseEntryPoint.I);
                                    if (main.getVisiblePanelIndex() == PageMain.VIEW_PANEL) {
                                        main.viewPanel.tabPanel.newComment();
                                        return;
                                    }
                                }
                                Window.alert(Msg.consts.not_available_mode());
                            }
                        });
                        widgetRenderContent.append(title);
                        panel.add(comment);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_PORTAL)) {
                        boolean show = BooleanUtil.toBooleanTrue(rs.values.get(NameConstants.SHOWLOGO));
                        int column = NumberUtil.toInt(rs.values.get(NameConstants.COLUMNS), -1);
                        if (column == -1) {
                            //this is just for makes this macro can tolerance spell error - colunm or columns
                            column = NumberUtil.toInt(rs.values.get(NameConstants.COLUMN), -1);
                        }
                        if (column == -1) {
                            column = SharedConstants.DEFAULT_PORTAL_COLUMNS;
                        }
                        if (visitor == null) {
                            //default portal visitor - don't use InstancePortalVisitor as it is dangerous to change default dashboard
                            visitor = new HomePortalVisitor();
                        }
                        Portal portal = new Portal(visitor, column, show);
                        panel.add(portal);
                        widgetContainer.add(portal);
                        portal.onLoad(HTMLPanel.createUniqueId(), currentUser, this);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_FEEDBACK)) {
                        String imgOn = rs.values.get(NameConstants.IMAGE);
                        HasClickHandlers btn;
                        if (StringUtil.isBlank(imgOn)) {
                            //text base link
                            String title = (String) rs.values.get(NameConstants.TITLE);
                            btn = new ClickLink(title);
                        } else {
                            btn = new Image(imgOn);
                        }
                        btn.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                FeedbackDialog dialog = new FeedbackDialog();
                                dialog.showbox();
                            }
                        });

                        //for hide welcome message
                        widgetRenderContent.append("feedback");//NON-I18N
                        panel.add((Widget) btn);
                    } else if (rs.macroName.equals(SharedConstants.MACRO_SIGNUP)) {
                        String imgOn = rs.values.get(NameConstants.IMAGE);
                        HasClickHandlers btn;
                        if (StringUtil.isBlank(imgOn)) {
                            //text base link
                            String title = (String) rs.values.get(NameConstants.TITLE);
                            btn = new ClickLink(title);
                        } else {
                            btn = new Image(imgOn);
                        }
                        btn.addClickHandler(new ClickHandler() {
                            public void onClick(ClickEvent event) {
                                LoginDialog dialogue = new LoginDialog(LoginDialog.SINGUP);
                                dialogue.showbox();
                            }
                        });

                        //for hide welcome message
                        widgetRenderContent.append("signup");//NON-I18N
                        panel.add((Widget) btn);
                    }
                }
            } else if (piece instanceof TextModel) {
                String text = ((TextModel) piece).toString();
                panel.add(text);
                if (listeners != null) {
                    fireRenderEvent(text);
                }
            }
        }
    }

    panel.submit();

    if (listeners != null) {
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
            public void execute() {
                attemptFireRenderEnd();
            }

        });
    }
}

From source file:com.edgenius.wiki.gwt.client.render.SearchRenderWidget.java

License:Open Source License

public void initContentPanel() {

    pagination.addPaginationListener(this);
    pagination.setPageSize(SharedConstants.PAGE_SIZE);
    deck.insert(loadingPanel, LOADING_PANEL);
    deck.insert(resultPanel, RESULT_PANEL);
    deck.showWidget(LOADING_PANEL);/*from  w  w  w .j a  v  a 2s.  co m*/

    HorizontalPanel sumPanel = new HorizontalPanel();
    sumPanel.add(pagination);
    sumPanel.add(summary);

    VerticalPanel leftPanel = new VerticalPanel();
    leftPanel.add(message);
    leftPanel.add(deck);
    leftPanel.add(new HTML("<br>"));
    leftPanel.add(sumPanel);

    FlowPanel rightPanel = new FlowPanel();
    rightPanel.add(advSearchPanel);
    HorizontalPanel mainPanel = new HorizontalPanel();
    mainPanel.add(leftPanel);
    mainPanel.add(rightPanel);

    mainPanel.setCellWidth(rightPanel, AdvSearchPanel.WIDTH);
    mainPanel.setWidth("100%");
    sumPanel.setWidth("100%");
    leftPanel.setWidth("100%");
    deck.setWidth("98%");
    sumPanel.setWidth("98%");
    sumPanel.setCellHorizontalAlignment(summary, HasHorizontalAlignment.ALIGN_RIGHT);
    sumPanel.setCellVerticalAlignment(summary, HasVerticalAlignment.ALIGN_MIDDLE);
    sumPanel.setCellVerticalAlignment(pagination, HasVerticalAlignment.ALIGN_MIDDLE);

    sumPanel.setStyleName(Css.SUMMARY);
    mainPanel.setStyleName(Css.SEARCH_RESULT);

    advSearchPanel.setKeyword(this.keyword);

    this.setWidget(mainPanel);
}

From source file:com.edgenius.wiki.gwt.client.render.TagCloudRenderWidget.java

License:Open Source License

public TagCloudRenderWidget(final String spaceUname) {
    this.spaceUname = spaceUname;

    FlexTable panel = new FlexTable();
    panel.setWidget(0, 0, message);//from w w w .  j  av  a2 s  . c  om
    panel.getFlexCellFormatter().setColSpan(0, 0, 3);

    panel.setWidget(1, 0, cloudPanel);
    //just separator between tag cloud and its list.
    panel.setWidget(1, 1, new HTML("&nbsp;"));
    panel.setWidget(1, 2, listsPanel);

    panel.getCellFormatter().setWidth(1, 0, "30%");
    panel.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
    panel.getCellFormatter().setWidth(1, 1, "20px");
    panel.getCellFormatter().setWidth(1, 2, "70%");
    panel.getCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);

    panel.setSize("100%", "100%");
    this.setWidget(panel);
    cloudPanel.setStyleName(Css.TAGCLOUD);

}