Example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth.

Prototype

public void setCellWidth(IsWidget w, String width) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:com.dimdim.conference.ui.user.client.UserListEntryHoverPopup.java

License:Open Source License

/**
 * This will create a menu item with one label
 * @param panel/* w w w. j  a  va2s  .co m*/
 * @param labelText
 * @param clickListener
 * @param hideOnClick
 */
private void addMoodControl(VerticalPanel panel, String labelText, ClickListener clickListener,
        boolean hideOnClick) {
    HorizontalPanel imageNText = new HorizontalPanel();
    //      FocusPanel   focusPanel = new FocusPanel();
    Label lbl = new Label(labelText);
    lbl.setStyleName("user-menu-entry");
    imageNText.add(lbl);
    imageNText.setCellHorizontalAlignment(lbl, HorizontalPanel.ALIGN_LEFT);

    HTML lbl2 = new HTML("»");
    //lbl2.setStyleName("user-menu-item");
    imageNText.add(lbl2);
    imageNText.setCellHorizontalAlignment(lbl2, HorizontalPanel.ALIGN_RIGHT);
    imageNText.setCellWidth(lbl, "100%");
    imageNText.setCellHeight(lbl2, "100%");
    imageNText.setWidth("100%");
    //imageNText.setBorderWidth(1);
    //      focusPanel.add(imageNText);

    if (null != clickListener) {
        HoverStyler hs = new HoverStyler(moodListener, imageNText, null);
        lbl.addMouseListener(hs);
        lbl.addStyleName("user-menu-entry-enabled");
        lbl.addClickListener(clickListener);
        lbl2.addMouseListener(hs);
        lbl2.addClickListener(clickListener);
    } else {
        lbl.addStyleName("user-menu-entry-disabled");
    }
    if (hideOnClick) {
        ClickListener clickListener2 = new ClickListener() {
            public void onClick(Widget w) {
                //Window.alert(" clicked on an item now hiding menu");
                hide();
            }
        };
        lbl.addClickListener(clickListener2);
    }

    panel.add(imageNText);
    panel.setCellWidth(imageNText, "100%");
}

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

License:Open Source License

public PlainEditor(final Editor editor) {
    textArea.addKeyPressHandler(new ContentChangeListener());
    textArea.addKeyDownHandler(new ContentChangeListener());
    textArea.addKeyPressHandler(new QuickHelpKeyListener());

    HorizontalPanel funcPanel = new HorizontalPanel();
    if (Editor.RICH_ENABLE) {
        switchLink.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                switchBusy.setVisible(true);
                switchLink.setVisible(false);
                editor.toRichEditor();//from   w  w w .  ja  v  a2s.c  o  m
            }
        });
        HorizontalPanel switchPanel = new HorizontalPanel();
        switchPanel.add(switchBusy);
        switchPanel.add(switchLink);
        switchLink.addStyleName(Css.RIGHT);
        switchBusy.addStyleName(Css.RIGHT);
        switchPanel.setCellWidth(switchLink, "100");
        switchBusy.setVisible(false);
        funcPanel.add(switchPanel);
    }

    //      HelpButton helpLink = new HelpButton(true);
    //      funcPanel.add(helpLink);

    topPanel.add(quickHelpBar);
    topPanel.add(funcPanel);

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // main
    VerticalPanel panel = new VerticalPanel();
    panel.add(topPanel);
    panel.add(textArea);
    panel.setWidth("100%");

    funcPanel.addStyleName(Css.RIGHT);
    topPanel.setStyleName(Css.EDIT_TOOLBAR);
    quickHelpBar.setStyleName(Css.QUICK_HELP);
    textArea.setStyleName(Css.MARKUP_TEXTAREA);
    //this is require of TinyMCE richeditor - to auto resize according to browser window. The class attribute link outter style is not working
    textArea.setWidth("100%");
    DOM.setElementAttribute(textArea.getElement(), "id", id);

    this.setWidget(panel);
}

From source file:com.edgenius.wiki.gwt.client.home.porlet.MessagePortlet.java

License:Open Source License

/**
 * A common callback success, as this portlet can accept response from Portlet invoke 
 * or from a message send refresh callback.
 *///from  w ww.ja v a 2 s  .  c  o  m
private void callback(GeneralModel model, MessageListModel msgs) {
    busy(false);
    messagePanel.clear();
    if (!GwtClientUtils.preSuccessCheck(model, null)) {
        //show error message on item part rather than general error message on HTML page above
        messagePanel.add(ErrorCode.getMessage(model.errorCode, model.errorMsg));
        return;
    }

    if (msgs.list.size() == 0) {
        none.setStyleName(Css.PORTLET_WEAK_TEXT);
        messagePanel.add(none);
        return;
    }

    for (Iterator<MessageModel> iter = msgs.list.iterator(); iter.hasNext();) {
        final MessageModel msg = iter.next();
        String puid = HTMLPanel.createUniqueId();
        String puid1 = HTMLPanel.createUniqueId();
        String puid2 = HTMLPanel.createUniqueId();
        String puid3 = HTMLPanel.createUniqueId();
        HTMLPanel msgPanel = new HTMLPanel("<div style=\"display:inline;font-weight:bold;\" id=\"" + puid1
                + "\"></div>" + "<div style=\"display:inline\" id=\"" + puid2
                + "\"></div> <div class=\"weaktext\">" + Msg.consts.by() + "</div><div class=\"weaklink\" id=\""
                + puid + "\"></div><div class=\"weaktext\">" + Msg.consts.on() + " "
                + GwtClientUtils.toDisplayDate(msg.date) + "</div>" + "<div style=\"display:inline\" id=\""
                + puid3 + "\"></div>");

        if ((msg.targetType == SharedConstants.MSG_TARGET_USER
                //TODO: how to distinguish the contributor and admin?
                || msg.targetType == SharedConstants.MSG_TARGET_SPACE_CONTRIBUTE_USERS
                || msg.targetType == SharedConstants.MSG_TARGET_SPACE_ADMIN_ONLY)
                && !StringUtil.isBlank(msg.target)) {
            msgPanel.add(new Label(
                    (msg.targetType == SharedConstants.MSG_TARGET_USER ? "@" : "@@") + msg.target + " "),
                    puid1);
        }
        if (msg.targetType == SharedConstants.MSG_TARGET_INSTANCE_ADMIN_ONLY
                && StringUtil.isBlank(msg.target)) {
            //message to system admin
            Image msgAdmin = new Image(IconBundle.I.get().error());
            msgAdmin.setTitle(Msg.consts.msg_to_admin());
            msgPanel.add(msgAdmin, puid1);
        }

        //don't use UserProfileLink - click user link will invoke reply message, rather than jump to user profile
        //UserProfileLink authorPop = new UserProfileLink(msg.author, null,msg.author,msg.authorPortrait);
        ClickLink authorPop = new ClickLink(msg.authorUsername);
        //auto popup for user profile
        new UserPopup(authorPop, null, msg.authorUsername, msg.authorPortrait);
        authorPop.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent evt) {
                if (msg.authorUid != -1) {
                    postPanel.fillTarget(SharedConstants.MSG_TARGET_USER, msg.authorUsername);
                } else {
                    //reply anonymous means to all 
                    postPanel.fillTarget(null, null);
                }
                postPanel.focusToEnd(true);
            }
        });

        msgPanel.add(new Label(msg.text), puid2);
        msgPanel.add(authorPop, puid);
        if (msg.removable) {
            Image bin = new Image(IconBundle.I.get().bin_close());
            bin.setTitle(Msg.consts.delete());
            bin.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    if (Window.confirm(Msg.consts.confirm_delete_message())) {
                        NotificationControllerAsync notifyController = ControllerFactory
                                .getNotificationController();
                        notifyController.deleteMessage(currentPage, msg.uid, new NotificationCallback());
                    }
                }
            });
            msgPanel.add(bin, puid3);
        }

        DOM.setStyleAttribute(msgPanel.getElement(), "display", "inline");

        HorizontalPanel itemPanel = new HorizontalPanel();
        Widget portrait = GwtClientUtils.createUserSmallPortrait(msg.authorPortrait,
                SharedConstants.PORTRAIT_SIZE_SMALL);
        itemPanel.add(portrait);
        itemPanel.setCellWidth(portrait, "50px");
        itemPanel.add(msgPanel);
        messagePanel.add(itemPanel);
    }

    clearControl();

    controlBar.setPaginationInfo(msgs.hasPre, msgs.hasNxt, msgs.currentPage);
    addControl(controlBar);
}

From source file:com.edgenius.wiki.gwt.client.home.porlet.PageListPortlet.java

License:Open Source License

protected void fillList(List<PageItemModel> pages, int fillType, int style) {
    container.clear();/*from  w  w  w  .ja  va2  s .c  o  m*/
    //show page items one by one on fragment panel
    if (pages != null && pages.size() > 0) {
        for (Iterator<PageItemModel> iter = pages.iterator(); iter.hasNext();) {
            final PageItemModel item = iter.next();
            FlowPanel itemPanel = new FlowPanel();

            if (fillType == FILL_TYPE_DRAFT) {
                //append delete image to allow delete draft from portlet
                Image dot;
                if (item.type == PageType.MANUAL_DRAFT) {
                    dot = new Image(IconBundle.I.get().bullet_green());
                    dot.setTitle(Msg.consts.manual_draft());
                } else if (item.type == PageType.AUTO_DRAFT) {
                    dot = new Image(IconBundle.I.get().bullet_yellow());
                    dot.setTitle(Msg.consts.auto_draft());
                } else {
                    dot = new Image(IconBundle.I.get().bullet_red());
                    dot.setTitle(Msg.consts.conflict_draft());
                }
                itemPanel.add(dot);
            }
            Hyperlink title;
            if (fillType == FILL_TYPE_DRAFT) {
                title = getDraftLink(item);
            } else {
                //default Page Link
                title = getPageLink(item);
            }
            Label date = new Label(GwtClientUtils.toDisplayDate(item.modifiedDate));
            date.setStyleName(Css.PORTLET_WEAK_TEXT);

            //add key of this item
            itemPanel.add(new Hidden(item.uuid, item.uuid + item.type));

            if (item.pinTop) {
                itemPanel.add(new Image(IconBundle.I.get().pin_small()));
            }

            itemPanel.add(title);
            if (fillType == FILL_TYPE_DRAFT || fillType == FILL_TYPE_MYPAGE) {
                //append spaceUname
                Label spaceLabel = new Label("(" + item.spaceUname + ")");
                spaceLabel.setStyleName(Css.PORTLET_WEAK_TEXT);
                itemPanel.add(spaceLabel);
            }
            itemPanel.add(date);
            if (fillType == FILL_TYPE_DRAFT) {
                //append delete image to allow delete draft from portlet
                Image bin = new Image(IconBundle.I.get().bin_close());
                bin.addClickHandler(new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        if (Window.confirm(Msg.params.confirm_delete_draft(item.title))) {
                            //put enable busy before async call as offline call immediately return and busy icon won't disappear if 
                            //enable after async call
                            busy(true);
                            PageControllerAsync pageController = ControllerFactory.getPageController();
                            pageController.removeDraft(item.spaceUname, item.uuid, item.type,
                                    new RefreshDraftAsync());
                        }
                    }
                });
                bin.setTitle(Msg.consts.delete_draft());
                itemPanel.add(bin);
            }

            if ((style & STYLE_SHOW_CREATED_BY) > 0 || (style & STYLE_SHOW_MODIFIED_BY) > 0) {
                //please be aware of, the PageItem has only modifier info - this will be filled to creator info when 
                //widget style is WIDGET_STYLE_ITEM_SHORT_BY_CREATE_DATE
                UserProfileLink modifier = new UserProfileLink(item.modifier, item.spaceUname,
                        item.modifierUsername, item.modifierPortrait);
                Label mL;
                if ((style & STYLE_SHOW_CREATED_BY) > 0)
                    mL = new Label(Msg.consts.created_by());
                else
                    mL = new Label(Msg.consts.modified_by());

                mL.setStyleName(Css.PORTLET_WEAK_TEXT);
                modifier.setStyleName(Css.WEAK_LINK);
                itemPanel.add(mL);
                itemPanel.add(modifier);
            }
            if ((style & STYLE_SHOW_PORTRAIT) > 0) {
                HorizontalPanel panel = new HorizontalPanel();
                Widget portrait = GwtClientUtils.createUserSmallPortrait(item.modifierPortrait,
                        SharedConstants.PORTRAIT_SIZE_SMALL);
                panel.add(portrait);
                panel.setCellWidth(portrait, "50px");
                panel.add(itemPanel);
                container.add(panel);
                panel.setStyleName(Css.ITEM);
            } else {
                itemPanel.setStyleName(Css.ITEM);
                container.add(itemPanel);
            }
        }
    } else {
        empty();
    }
}

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  va  2 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.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 av  a2 s  . c  om*/

    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.user.UserInfoPanel.java

License:Open Source License

public UserInfoPanel(final Widget parent, String spaceUname, final String username, String portrait,
        boolean showPortrait) {
    this.parent = parent;
    this.username = username;

    VerticalPanel main = new VerticalPanel();
    HorizontalPanel center = new HorizontalPanel();
    FlowPanel profile = new FlowPanel();
    this.showPortrait = showPortrait;
    if (showPortrait && !StringUtil.isBlank(portrait)) {
        portraitPanel.add(GwtClientUtils.createUserPortrait(portrait));
    }/*from  ww  w .j  a va 2s.c  om*/
    center.add(portraitPanel);
    center.add(profile);

    status.setStyleName(Css.STATUS_SNAP);

    Label lb = new Label(Msg.consts.recent_update_pages());
    lb.setStyleName(Css.HEADING3);
    lb.addStyleName(Css.UNDERLINE);

    profile.add(status);
    profile.add(lb);
    profile.add(pagesPanel);
    profile.add(loadingImg);

    main.add(message);
    main.add(center);
    if (!AbstractEntryPoint.isOffline()) {
        func.setWidth("100%");
        func.setStyleName(Css.ACTION_TABS);
        main.add(func);
    }

    center.setCellWidth(profile, "100%");
    center.setSpacing(2);
    profile.setSize("100%", "100%");
    center.setSize("100%", "100%");
    main.setSize("100%", "100%");
    center.setStyleName(Css.PROFILE);

    this.setWidget(main);
    loadingImg.setVisible(true);
    PageControllerAsync pageController = ControllerFactory.getPageController();
    //get user recent updated pages for this space
    pageController.getUserPagesInSpace(spaceUname, username, 5, this);

}

From source file:com.ephesoft.dcma.gwt.home.client.view.LandingView.java

License:Open Source License

/**
 * To build the Landing Page.//from w w  w .ja  va  2  s.c  o  m
 * 
 * @return FocusPanel
 */
public FocusPanel buildLandingPage() {
    focusPanel = new FocusPanel();
    flowpanel = new DockLayoutPanel(Unit.PCT);
    flowpanel.setHeight(HUNDRED_PERCENT);
    flowpanel.addStyleName(CoreCommonConstants.MAIN_CONTAINER_CSS);
    HorizontalPanel horCapPanel = new HorizontalPanel();
    VerticalPanel innerVerPanel = new VerticalPanel();
    innerVerPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    VerticalPanel capPanel = new VerticalPanel();
    capPanel.setStyleName(CoreCommonConstants.TOP_PANEL_CSS);
    HorizontalPanel title = new HorizontalPanel();
    title.setBorderWidth(0);
    title.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT);
    Label titleLabel = new Label(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_BATCH_ALERTS));
    title.add(titleLabel);
    titleLabel.addStyleName(CoreCommonConstants.HEADER_BOLD_TEXT_CSS);
    capPanel.add(titleLabel);
    HorizontalPanel simPanel = new HorizontalPanel();

    simPanel.setSize(HUNDRED_PERCENT, HUNDRED_PERCENT);

    Label pendingForReviewLabel = new Label(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_REVIEW) + ": ");
    pendingForReviewLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS);
    pendingForReviewLabelValue = new Label("");
    Label pendingForValidationLabel = new Label(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PEND_FOR_VALIDATION) + ": ");
    pendingForValidationLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS);
    pendingForValidationLabelValue = new Label("");
    Label totalBatchCount = new Label(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_TOTAL_BATCHES) + ": ");
    totalBatchCount.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS);
    totalBatchValue = new Label(BatchListConstants.EMPTY_STRING);
    Label pipe = new Label(BatchListConstants.EMPTY_STRING);
    pipe.setStyleName("pipe");

    simPanel.add(totalBatchCount);
    simPanel.add(totalBatchValue);
    simPanel.add(pipe);
    simPanel.add(pendingForReviewLabel);
    simPanel.add(pendingForReviewLabelValue);
    simPanel.add(pendingForValidationLabel);
    simPanel.add(pendingForValidationLabelValue);

    simPanel.setCellWidth(pendingForReviewLabel, "7%");
    simPanel.setCellWidth(pendingForReviewLabelValue, "2%");
    simPanel.setCellWidth(pendingForValidationLabel, "7%");
    simPanel.setCellWidth(pendingForValidationLabelValue, "20%");
    simPanel.setCellWidth(totalBatchCount, "5%");
    simPanel.setCellWidth(totalBatchValue, "2%");
    simPanel.setCellWidth(pipe, "1%");

    capPanel.add(simPanel);
    capPanel.setWidth(HUNDRED_PERCENT);
    innerVerPanel.add(capPanel);
    Label dummyLabel = new Label();
    dummyLabel.setHeight("40px");
    innerVerPanel.add(dummyLabel);
    HorizontalPanel buttonTextPanel = new HorizontalPanel();
    buttonTextPanel.add(dummyLabel);
    buttonTextPanel.setCellWidth(dummyLabel, "20%");
    innerVerPanel.add(buttonTextPanel);
    horCapPanel.add(innerVerPanel);
    horCapPanel.setCellHorizontalAlignment(innerVerPanel, HasAlignment.ALIGN_LEFT);
    horCapPanel.setWidth(HUNDRED_PERCENT);
    flowpanel.addNorth(horCapPanel, BatchListConstants.FIFTEEN);
    reviewTable = new ReviewValidateTable(true);
    reviewValidateTabLayoutPanel = new TabLayoutPanel(BatchListConstants.FIVE, Unit.PCT);
    reviewValidateTabLayoutPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    reviewValidateTabLayoutPanel.add(reviewTable.getMainPanel());
    validateTable = new ReviewValidateTable(false);
    reviewValidateTabLayoutPanel.add(validateTable.getMainPanel(), "");
    flowpanel.add(reviewValidateTabLayoutPanel);
    focusPanel.add(flowpanel);
    focusPanel.addKeyDownHandler(new KeyDownHandler() {

        @Override
        public void onKeyDown(KeyDownEvent arg0) {
            presenter.getController().getEventBus().fireEvent(new BatchListKeyDownEvent(arg0));
        }
    });

    return focusPanel;
}

From source file:com.google.appinventor.client.DesignToolbar.java

License:Open Source License

/**
 * Initializes and assembles all commands into buttons in the toolbar.
 *//*from  w w w. ja  v  a  2s  .  co m*/
public DesignToolbar() {
    super();

    isReadOnly = Ode.getInstance().isReadOnly();

    projectNameLabel = new Label();
    projectNameLabel.setStyleName("ya-ProjectName");
    HorizontalPanel toolbar = (HorizontalPanel) getWidget();
    toolbar.insert(projectNameLabel, 0);

    // width of palette minus cellspacing/border of buttons
    toolbar.setCellWidth(projectNameLabel, "222px");

    List<DropDownItem> screenItems = Lists.newArrayList();
    addDropDownButton(WIDGET_NAME_SCREENS_DROPDOWN, MESSAGES.screensButton(), screenItems);

    if (AppInventorFeatures.allowMultiScreenApplications() && !isReadOnly) {
        addButton(new ToolbarItem(WIDGET_NAME_ADDFORM, MESSAGES.addFormButton(), new AddFormAction()));
        addButton(new ToolbarItem(WIDGET_NAME_REMOVEFORM, MESSAGES.removeFormButton(), new RemoveFormAction()));
    }

    addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_FORM_EDITOR, MESSAGES.switchToFormEditorButton(),
            new SwitchToFormEditorAction()), true);
    addButton(new ToolbarItem(WIDGET_NAME_SWITCH_TO_BLOCKS_EDITOR, MESSAGES.switchToBlocksEditorButton(),
            new SwitchToBlocksEditorAction()), true);

    // Gray out the Designer button and enable the blocks button
    toggleEditor(false);
    Ode.getInstance().getTopToolbar().updateFileMenuButtons(0);
}

From source file:com.google.appinventor.client.editor.simple.palette.SimplePaletteItem.java

License:Open Source License

/**
 * Creates a new palette item./*from ww w  .  j  av a 2s  .  co m*/
 *
 * @param scd  component descriptor for palette item
 * @param dropTargetProvider  provider of targets that palette items can be dropped on
 */
public SimplePaletteItem(SimpleComponentDescriptor scd, DropTargetProvider dropTargetProvider) {
    this.dropTargetProvider = dropTargetProvider;
    this.scd = scd;

    componentPrototype = null;

    // Initialize palette item UI
    HorizontalPanel panel = new HorizontalPanel();
    panel.setStylePrimaryName("ode-SimplePaletteItem");

    Image image = scd.getImage();
    image.setStylePrimaryName("ode-SimplePaletteItem-icon");
    panel.add(image);
    panel.setCellHorizontalAlignment(image, HorizontalPanel.ALIGN_LEFT);
    panel.setCellWidth(image, "30px");

    Label label = new Label(TranslationDesignerPallete.getCorrespondingString(scd.getName()));
    label.setHorizontalAlignment(Label.ALIGN_LEFT);
    label.addStyleName("ode-SimplePaletteItem-caption");
    panel.add(label);

    HorizontalPanel optPanel = new HorizontalPanel();

    ComponentHelpWidget helpImage = new ComponentHelpWidget(scd);
    helpImage.addStyleName("ode-SimplePalleteItem-button");
    optPanel.add(helpImage);
    optPanel.setCellHorizontalAlignment(helpImage, HorizontalPanel.ALIGN_LEFT);

    if (scd.getExternal()) {
        ComponentRemoveWidget deleteImage = new ComponentRemoveWidget(scd);
        deleteImage.addStyleName("ode-SimplePalleteItem-button");
        optPanel.add(deleteImage);
        optPanel.setCellHorizontalAlignment(deleteImage, HorizontalPanel.ALIGN_RIGHT);
    }

    panel.add(optPanel);
    panel.setCellHorizontalAlignment(optPanel, HorizontalPanel.ALIGN_RIGHT);

    panel.setWidth("100%");
    add(panel);
    setWidth("100%");
}