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.bradrydzewski.gwt.calendar.client.monthview.MonthView.java

License:Open Source License

/**
 * Configures a single day in the month grid of this <code>MonthView</code>.
 *
 * @param row/* w w w  .j  a va2s .  c o  m*/
 *            The row in the grid on which the day will be set
 * @param col
 *            The col in the grid on which the day will be set
 * @param date
 *            The Date in the grid
 * @param isToday
 *            Indicates whether the day corresponds to today in the month
 *            view
 * @param notInCurrentMonth
 *            Indicates whether the day is in the current visualized month
 *            or belongs to any of the two adjacent months of the current
 *            month
 * @param weekNumber
 *            The weekNumber to show in the cell, only appears in the first col.
 */
private void configureDayInGrid(int row, int col, Date date, boolean isToday, boolean notInCurrentMonth,
        int weekNumber) {
    HorizontalPanel panel = new HorizontalPanel();
    String text = String.valueOf(date.getDate());
    Label label = new Label(text);

    StringBuilder headerStyle = new StringBuilder(CELL_HEADER_STYLE);
    StringBuilder cellStyle = new StringBuilder(CELL_STYLE);
    boolean found = false;

    for (Date day : getSettings().getHolidays()) {
        if (DateUtils.areOnTheSameDay(day, date)) {
            headerStyle.append("-holiday");
            cellStyle.append("-holiday");
            found = true;
            break;
        }
    }

    if (isToday) {
        headerStyle.append("-today");
        cellStyle.append("-today");
    } else if (!found && DateUtils.isWeekend(date)) {
        headerStyle.append("-weekend");
        cellStyle.append("-weekend");
    }

    if (notInCurrentMonth) {
        headerStyle.append("-disabled");
    }

    label.setStyleName(headerStyle.toString());
    addDayClickHandler(label, (Date) date.clone());

    if (col == 0 && getSettings().isShowingWeekNumbers()) {
        Label weekLabel = new Label(String.valueOf(weekNumber));
        weekLabel.setStyleName(WEEKNUMBER_LABEL_STYLE);

        panel.add(weekLabel);
        panel.setCellWidth(weekLabel, "25px");
        DOM.setStyleAttribute(label.getElement(), "paddingLeft", "5px");
        addWeekClickHandler(weekLabel, (Date) date.clone());
    }
    panel.add(label);

    appointmentCanvas.add(panel);
    dayLabels.add(label);
    dayPanels.add(panel);

    //monthCalendarGrid.setWidget(row, col, panel);
    monthCalendarGrid.getCellFormatter().setVerticalAlignment(row, col, HasVerticalAlignment.ALIGN_TOP);
    monthCalendarGrid.getCellFormatter().setStyleName(row, col, cellStyle.toString());
}

From source file:com.calclab.emiteuimodule.client.chat.ChatUIPanel.java

License:Open Source License

public void addDelimiter(final String datetime) {
    final HorizontalPanel hp = new HorizontalPanel();
    final HorizontalLine hr = new HorizontalLine();
    hp.add(new Label(datetime));
    hp.add(hr);/* www  .  j  a v a 2  s  .c  o  m*/
    hp.setWidth("100%");
    hp.setCellWidth(hr, "100%");
    addWidget(hp);
    hp.setStyleName("emite-ChatPanel-HorizDelimiter");
}

From source file:com.dimdim.conference.ui.common.client.util.CommonModalDialog.java

License:Open Source License

public CommonModalDialog(String title) {
    this.title = title;

    HorizontalPanel caption = new HorizontalPanel();
    caption.setWidth("100%");
    captionText = new Label(title);
    //      captionText.setStyleName("common-table-header");
    caption.add(captionText);/*  ww  w.  jav  a 2s.  c  o m*/
    caption.setCellWidth(captionText, "100%");

    close = UIImages.getImageBundle(UIImages.defaultSkin).getCloseDialog();
    close.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            hide();
        }
    });
    caption.add(close);

    scrollPanel_H.add(caption);
    //      scrollPanel_H.setCellWidth(caption, "100%");
    //      scrollPanel_H.add(close);

    setCaption(scrollPanel_H);
    caption.addStyleName("draggable-panel-header");
    close.addStyleName("anchor-cursor");
}

From source file:com.dimdim.conference.ui.common.client.util.CommonModalDialog.java

License:Open Source License

public void drawDialog() {
    this.defaultCloseListener = new ClickListener() {
        public void onClick(Widget sender) {
            hide();//from  ww  w.  j ava 2  s.com
        }
    };
    closeButton = new Button(closeButtonText, this.defaultCloseListener);

    //      DomUtil.setId(this, "dialog-styled");
    vp = new VerticalPanel();
    //      setWidget(rp);

    vp.setStyleName("common-dialog-outer-panel");

    //       Window.alert("1");

    if (this.closeListener != null) {
        this.closeButton.addClickListener(this.closeListener);
    }
    closeButton.setStyleName("dm-popup-close-button");
    buttonPanel.add(closeButton, DockPanel.EAST);
    buttonPanel.setSpacing(0);
    HTML filler1 = new HTML("&nbsp;");
    buttonPanel.add(filler1, DockPanel.EAST);

    //       Window.alert("2");

    footerButtons = this.getFooterButtons();
    if (footerButtons != null) {
        int size = footerButtons.size();
        for (int i = 0; i < size; i++) {
            Button button = (Button) footerButtons.elementAt(i);
            buttonPanel.add(button, DockPanel.EAST);
            HTML filler2 = new HTML("&nbsp;");
            buttonPanel.add(filler2, DockPanel.EAST);
        }
    }

    //       Window.alert("3");

    this.messageLabel.setStyleName("common-text");
    this.messageLabel.addStyleName("dialog-message-label");
    buttonPanel.add(this.messageLabel, DockPanel.WEST);
    buttonPanel.setCellVerticalAlignment(this.messageLabel, VerticalPanel.ALIGN_MIDDLE);
    buttonPanel.setCellWidth(this.messageLabel, "100%");

    Widget c = getContent();

    if (this.dialogName != null) {
        //          Window.alert("4");

        //   Create a width adjustment panel.
        String widthStyle = this.dialogName + "-dialog-width";
        String heightStyle1 = this.dialogName + "-dialog-height-one";
        String heightStyle2 = this.dialogName + "-dialog-height-two";
        String contentWidthStyle = this.dialogName + "-dialog-content";

        c.addStyleName(contentWidthStyle);
        upperPanel = new HorizontalPanel();

        HTML upperLeftBar = new HTML("&nbsp;");
        upperLeftBar.setStyleName(heightStyle1);
        upperPanel.add(upperLeftBar);
        upperPanel.add(c);
        upperPanel.setCellWidth(c, "100%");
        upperPanel.setCellVerticalAlignment(c, VerticalPanel.ALIGN_MIDDLE);

        HorizontalPanel lowerPanel = new HorizontalPanel();
        lowerPanel.setStyleName(widthStyle);

        HTML lowerLeftBar = new HTML("&nbsp;");
        lowerLeftBar.setStyleName(heightStyle2);
        lowerPanel.add(lowerLeftBar);
        lowerPanel.add(buttonPanel);
        lowerPanel.setCellWidth(buttonPanel, "100%");
        lowerPanel.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
        lowerPanel.setCellVerticalAlignment(buttonPanel, VerticalPanel.ALIGN_MIDDLE);

        //          Window.alert("5");
        vp.add(upperPanel);
        vp.add(lowerPanel);
    } else {
        //          Window.alert("6");

        vp.add(c);
        vp.setCellWidth(c, "100%");

        vp.add(buttonPanel);
        vp.setCellWidth(buttonPanel, "100%");
        vp.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
        //          Window.alert("7");

    }
    //      RoundedPanel rp = new RoundedPanel(vp);
    //      rp.setStyleName("common-dialog-rounded-corner-panel");

    //      Window.alert("8");

    scrollPanel.add(vp);

    add(scrollPanel);

    /*
    FocusWidget fw = getFocusWidget();
    if (fw != null)
    {
       this.getFocusModel().add(fw);
    }
    else
    {
       Window.alert("No focus widget provided");
    }
    */
    this.setFocusModel(new FocusModel() {
        public HasFocus getFocusWidget() {
            return getDmFocusModel();
        }
    });

    DmGlassPanel dgp = new DmGlassPanel(this);
    dgp.show();
    //      show();
}

From source file:com.dimdim.conference.ui.envcheck.client.layout.CommonMessagePopup.java

License:Open Source License

protected void drawDialog() {
    vp = new VerticalPanel();
    RoundedPanel rp = new RoundedPanel(vp);

    vp.setStyleName("common-dialog-outer-panel");
    rp.setStyleName("common-dialog-rounded-corner-panel");

    DockPanel buttonPanel = new DockPanel();
    if (this.showCloseButton) {
        closeButton = new Button(closeButtonText, new ClickListener() {
            public void onClick(Widget sender) {
                hide();//www  .  ja  v a  2s  .co  m
                History.back(); //   TODO move out into a listener.
            }
        });
        closeButton.setStyleName("dm-popup-close-button");
        buttonPanel.add(closeButton, DockPanel.EAST);
        buttonPanel.setSpacing(0);
        HTML filler1 = new HTML("&nbsp;");
        buttonPanel.add(filler1, DockPanel.EAST);
    }
    if (this.dialogName != null) {
        //   Create a width adjustment panel.
        String widthStyle = this.dialogName + "-dialog-width";
        String heightStyle1 = this.dialogName + "-dialog-height-one";
        String heightStyle2 = this.dialogName + "-dialog-height-two";
        String contentWidthStyle = this.dialogName + "-dialog-content";

        content.addStyleName(contentWidthStyle);
        HorizontalPanel upperPanel = new HorizontalPanel();

        HTML upperLeftBar = new HTML("&nbsp;");
        upperLeftBar.setStyleName(heightStyle1);
        upperPanel.add(upperLeftBar);
        upperPanel.add(content);
        upperPanel.setCellWidth(content, "100%");
        upperPanel.setCellVerticalAlignment(content, VerticalPanel.ALIGN_MIDDLE);

        HorizontalPanel lowerPanel = new HorizontalPanel();
        lowerPanel.setStyleName(widthStyle);

        HTML lowerLeftBar = new HTML("&nbsp;");
        lowerLeftBar.setStyleName(heightStyle2);
        lowerPanel.add(lowerLeftBar);
        lowerPanel.add(buttonPanel);
        lowerPanel.setCellWidth(buttonPanel, "100%");
        lowerPanel.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
        lowerPanel.setCellVerticalAlignment(buttonPanel, VerticalPanel.ALIGN_MIDDLE);

        vp.add(upperPanel);
        vp.add(lowerPanel);
        this.addStyleName(this.dialogName + "-dialog-size");
    } else {
        vp.add(content);
        vp.setCellWidth(content, "100%");

        vp.add(buttonPanel);
        vp.setCellWidth(buttonPanel, "100%");
        vp.setCellHorizontalAlignment(buttonPanel, HorizontalPanel.ALIGN_RIGHT);
    }
    this.addPopupListener(this);

    this.add(vp);
}

From source file:com.dimdim.conference.ui.envcheck.client.main.EnvChecksSummaryPanel.java

License:Open Source License

private void prepareCheckResultPanel(HorizontalPanel row, PNGImage okImage, PNGImage errorImage,
        Label commentLabel, String comment) {
    row.add(okImage);//from  w  w  w  . jav  a  2  s. c  om
    row.setCellHorizontalAlignment(okImage, HorizontalPanel.ALIGN_LEFT);
    row.setCellVerticalAlignment(okImage, VerticalPanel.ALIGN_MIDDLE);

    row.add(errorImage);
    row.setCellHorizontalAlignment(errorImage, HorizontalPanel.ALIGN_LEFT);
    row.setCellVerticalAlignment(errorImage, VerticalPanel.ALIGN_MIDDLE);

    commentLabel.setText(comment);
    commentLabel.setStyleName("common-text");
    commentLabel.addStyleName("env-check-result-comment");
    row.add(commentLabel);
    row.setCellWidth(commentLabel, "100%");
    row.setCellHorizontalAlignment(commentLabel, HorizontalPanel.ALIGN_LEFT);
    row.setCellVerticalAlignment(commentLabel, VerticalPanel.ALIGN_MIDDLE);
    Window.alert("commentLabel = " + commentLabel);
    this.basePanel.add(row);
    row.setStyleName("env-check-result-row");
    row.setVisible(false);
}

From source file:com.dimdim.conference.ui.panels.client.ChatWidget.java

License:Open Source License

private void fillContent(WorkspacePanel workSpace) {
    chatWidget = new DiscussionWidget(ClientModel.getClientModel().getRosterModel().getCurrentUser(),
            workSpace);/*from  w ww  .  j  a  va 2 s  .c o  m*/
    chatWidget.setSize("100%", "100%");
    chatPanel.add(chatWidget);
    chatPanel.setCellHorizontalAlignment(chatWidget, HorizontalPanel.ALIGN_CENTER);
    FocusPanel otherLinksPanel = new FocusPanel();
    HorizontalPanel h1 = new HorizontalPanel();

    chatLink = new Label(ConferenceGlobals.getDisplayString("workspace.hide.chat.label", "Public Chat"));
    chatLink.setStyleName("common-text");
    chatLink.addStyleName("common-bold-text");

    h1.setWidth("100%");
    h1.add(chatLink);
    h1.setCellWidth(chatLink, "100%");
    h1.setCellHorizontalAlignment(chatLink, HorizontalPanel.ALIGN_CENTER);
    Image img = getPublicChatCloseImage();
    h1.add(img);
    Label l = new Label(" ");
    l.setWidth("10px");
    h1.add(l);

    otherLinksPanel.add(h1);
    otherLinksPanel
            .setTitle(ConferenceGlobals.getDisplayString("workspace.hide.chat.title", "Click to hide Chat"));

    verticalPanel.add(chatWidget);

    otherLinksPanel.setWidth("100%");
    otherLinksPanel.addStyleName("anchor-cursor");
    otherLinksPanel.addClickListener(this);

    workspaceLayout.addPanelToLayout("chat_pod_header", otherLinksPanel);
    workspaceLayout.addPanelToLayout("chat_pod_content", verticalPanel);

    addChatWidget();
}

From source file:com.dimdim.conference.ui.panels.client.StopRecordingFormWidget.java

License:Open Source License

private void addField(Widget w1, Widget w2, String w1Width, String w2Width) {
    HorizontalPanel hp1 = new HorizontalPanel();
    w1.setStyleName("common-text");
    hp1.add(w1);/*from  ww  w.j  a  v  a2 s.  c o  m*/
    hp1.setCellWidth(w1, w1Width);
    if (w2 != null) {
        w2.setStyleName("common-text");
        hp1.add(w2);
        hp1.setCellWidth(w2, w2Width);
    }
    this.add(hp1);
    this.setCellWidth(hp1, "100%");
}

From source file:com.dimdim.conference.ui.resources.client.ResourceTypeListEntryPopupPanel.java

License:Open Source License

private void writeListPanel(DockPanel outer) {
    Vector vec = new Vector();
    UIResourceObject currentActiveResource = ConferenceGlobals.getCurrentSharedResource();
    numberOfItems = 0;//from   w  w  w .j  a  v a2s  . co m

    int size = this.resourceList.getListSize();
    for (int i = 0; i < size; i++) {
        UIResourceObject res = ((ResourceListEntry) this.resourceList.getListEntryAt(i)).getResource();
        if (res.getResourceType().equals(this.typeName)) {
            Label resLabel = new FixedLengthLabel(res.getResourceName(), 26);
            //            resLabel.setStyleName("tool-entry");
            resLabel.setStyleName("resource-entry");
            resLabel.addStyleName("anchor-cursor");
            resLabel.addClickListener(this);
            resLabel.addClickListener(this.rtpcp.getNameLabelClickListener(res));

            HorizontalPanel h1 = new HorizontalPanel();
            Widget img = new HorizontalPanel();

            if (currentActiveResource != null
                    && currentActiveResource.getResourceId().equals(res.getResourceId())) {
                img = this.getSharingInProgressImageUrl();
                //               h2.add(img);
                //               h2.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
                //               h2.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_CENTER);
            } else {
                img = new Label(" ");
                img.setWidth("18px");
                //               h2.add(filler);
            }
            //            h2.setWidth("18px");
            h1.add(img);
            //            h1.setCellWidth(img, "100%");
            h1.setCellHeight(img, "100%");
            h1.setCellHorizontalAlignment(img, HorizontalPanel.ALIGN_LEFT);
            h1.setCellVerticalAlignment(img, VerticalPanel.ALIGN_MIDDLE);
            h1.add(resLabel);
            h1.setCellWidth(resLabel, "100%");
            h1.setCellHeight(resLabel, "100%");
            h1.setCellVerticalAlignment(resLabel, VerticalPanel.ALIGN_MIDDLE);
            h1.setStyleName("resource-entry-panel");
            if (numberOfItems == 0) {
                h1.addStyleName("first-resource-entry-panel");
            }
            resLabel.addMouseListener(new ResourceHoverStyler(h1));
            vec.add(h1);
            //            panel.add(h1);
            //            panel.setCellWidth(h1, "100%");
            //            panel.setCellHorizontalAlignment(h1, HorizontalPanel.ALIGN_LEFT);
            //            panel.setCellVerticalAlignment(h1, VerticalPanel.ALIGN_MIDDLE);
            numberOfItems++;
        }
    }

    if (numberOfItems != 0) {
        int scrollLimit = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_limit", 5);
        if (numberOfItems > scrollLimit) {
            ScrollPanel sp = new ScrollPanel();
            int width = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_width", 250);
            int barWidth = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_bar_width",
                    250);
            int height = UIParams.getUIParams().getBrowserParamIntValue("resource_popup_scroll_height", 150);
            sp.setSize(width + "px", height + "px");
            VerticalPanel panel = new VerticalPanel();
            panel.setSize((width - barWidth) + "px", height + "px");
            sp.add(panel);
            outer.add(sp, DockPanel.NORTH);
            outer.setCellHorizontalAlignment(sp, HorizontalPanel.ALIGN_LEFT);
            outer.setCellVerticalAlignment(sp, VerticalPanel.ALIGN_MIDDLE);
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                panel.add(h);
                panel.setCellWidth(h, "100%");
                panel.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                panel.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        } else {
            int size2 = vec.size();
            for (int i = 0; i < size2; i++) {
                HorizontalPanel h = (HorizontalPanel) vec.elementAt(i);
                outer.add(h, DockPanel.NORTH);
                outer.setCellWidth(h, "100%");
                outer.setCellHorizontalAlignment(h, HorizontalPanel.ALIGN_LEFT);
                outer.setCellVerticalAlignment(h, VerticalPanel.ALIGN_MIDDLE);
            }
        }
    } else {
    }
}

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

License:Open Source License

protected Widget getLinks() {
    HorizontalPanel panel = new HorizontalPanel();
    final UIRosterEntry otherUser = ((UserListEntry) userEntry).getUser();
    if (UIGlobals.isActivePresenter(me) && !me.getUserId().equals(otherUser.getUserId())) {
        Label removeLink = new Label(UIStrings.getRemoveLabel());
        removeLink.setStyleName("common-text");
        removeLink.addStyleName("common-anchor");
        removeLink.addStyleName("dm-hover-popup-link");
        removeLink.addStyleName("user-remove-control-link");
        removeLink.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                String userName = otherUser.getDisplayName();
                ConfirmationDialog cd = new ConfirmationDialog(
                        ConferenceGlobals.getDisplayString("remove.header", "Remove") + " " + userName,
                        ConferenceGlobals.getDisplayString("remove.desc", "Are you sure you want to remove ")
                                + userName,
                        "default-message", new ConfirmationListener() {
                            public void onOK() {
                                userManager.removeUser(otherUser);
                            }/*from   ww w .  j a  v  a  2s .  c om*/

                            public void onCancel() {

                            }
                        });
                cd.drawDialog();
                hide();
            }
        });
        panel.add(removeLink);
        panel.setCellHorizontalAlignment(removeLink, HorizontalPanel.ALIGN_LEFT);
    }
    if (me.getUserId().equals(otherUser.getUserId())) {
        Label changePictureLink = new Label(UIStrings.getChangePictureLabel());
        changePictureLink.setStyleName("common-text");
        changePictureLink.addStyleName("common-anchor");
        changePictureLink.addStyleName("dm-hover-popup-link");
        changePictureLink.addStyleName("user-change-picture-control-link");
        changePictureLink.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                ChangePictureDialog dlg = new ChangePictureDialog(userManager, me);
                dlg.drawDialog();
                hide();
            }
        });
        panel.add(changePictureLink);
        panel.setCellWidth(changePictureLink, "100%");
        panel.setCellHorizontalAlignment(changePictureLink, HorizontalPanel.ALIGN_RIGHT);
    }
    return panel;
}