Example usage for com.vaadin.ui Label setSizeUndefined

List of usage examples for com.vaadin.ui Label setSizeUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui Label setSizeUndefined.

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java

License:Open Source License

public Component addComponent(final Component field, final String caption, final int columns, final int rows,
        final int colspan, final String width, final String height, final Alignment alignment) {
    final Label l = new Label(caption);
    l.setSizeUndefined();
    this.layout.addComponent(l, 2 * columns, rows);
    this.layout.setComponentAlignment(l, alignment);

    this.layout.addComponent(field, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows);
    this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f);
    if (!(field instanceof Button))
        field.setCaption(null);//from   w w  w  . j  ava 2s  .co  m
    field.setWidth(width);
    return field;
}

From source file:com.esofthead.mycollab.module.crm.ui.components.CrmListNoItemView.java

License:Open Source License

public CrmListNoItemView() {
    MVerticalLayout layout = new MVerticalLayout().withWidth("800px");
    layout.addStyleName("case-noitem");
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label image = new Label(titleIcon().getHtml(), ContentMode.HTML);
    image.setSizeUndefined();
    layout.with(image).withAlign(image, Alignment.TOP_CENTER);

    Label title = new Label(titleMessage());
    title.addStyleName("h2");
    title.setWidthUndefined();//from w w  w  .  j a v  a2 s.com
    layout.addComponent(title);

    Label hintLabel = new Label(hintMessage());
    hintLabel.setWidthUndefined();
    layout.addComponent(hintLabel);

    Button btCreateContact = new Button(actionMessage(), actionListener());
    btCreateContact.setEnabled(hasPermission());

    MHorizontalLayout links = new MHorizontalLayout();

    links.addComponent(btCreateContact);
    btCreateContact.addStyleName(UIConstants.THEME_GREEN_LINK);

    /*
       * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     *
     * Button btImportContact = new Button("Import Cases", new
     * Button.ClickListener() { private static final long serialVersionUID =
     * 1L;
     *
     * @Override public void buttonClick(ClickEvent arg0) {
     * UI.getCurrent().addWindow(new CaseImportWindow()); } });
     *
     * btImportContact.addStyleName(UIConstants.THEME_GRAY_LINK);
     *
     *
     * links.addComponent(btImportContact);
     */

    layout.addComponent(links);
    this.with(layout).withAlign(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.crm.ui.components.PeopleInfoComp.java

License:Open Source License

public void displayEntryPeople(ValuedBean bean) {
    this.removeAllComponents();
    this.withMargin(new MarginInfo(true, false, true, true));

    Label peopleInfoHeader = new Label(
            FontAwesome.USER.getHtml() + " " + AppContext.getMessage(CrmCommonI18nEnum.SUB_INFO_PEOPLE),
            ContentMode.HTML);//www  .ja  v  a  2 s . c o m
    peopleInfoHeader.setStyleName("info-hdr");
    this.addComponent(peopleInfoHeader);

    GridLayout layout = new GridLayout(2, 2);
    layout.setSpacing(true);
    layout.setWidth("100%");
    layout.setMargin(new MarginInfo(false, false, false, true));
    try {
        Label createdLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_CREATED_PEOPLE));
        createdLbl.setSizeUndefined();
        layout.addComponent(createdLbl, 0, 0);

        String createdUserName = (String) PropertyUtils.getProperty(bean, "createduser");
        String createdUserAvatarId = (String) PropertyUtils.getProperty(bean, "createdUserAvatarId");
        String createdUserDisplayName = (String) PropertyUtils.getProperty(bean, "createdUserFullName");

        UserLink createdUserLink = new UserLink(createdUserName, createdUserAvatarId, createdUserDisplayName);
        layout.addComponent(createdUserLink, 1, 0);
        layout.setColumnExpandRatio(1, 1.0f);

        Label assigneeLbl = new Label(AppContext.getMessage(CrmCommonI18nEnum.ITEM_ASSIGN_PEOPLE));
        assigneeLbl.setSizeUndefined();
        layout.addComponent(assigneeLbl, 0, 1);
        String assignUserName = (String) PropertyUtils.getProperty(bean, "assignuser");
        String assignUserAvatarId = (String) PropertyUtils.getProperty(bean, "assignUserAvatarId");
        String assignUserDisplayName = (String) PropertyUtils.getProperty(bean, "assignUserFullName");

        UserLink assignUserLink = new UserLink(assignUserName, assignUserAvatarId, assignUserDisplayName);
        layout.addComponent(assignUserLink, 1, 1);
    } catch (Exception e) {
        LOG.error("Can not build user link {} ", BeanUtility.printBeanObj(bean));
    }

    this.addComponent(layout);

}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountCaseListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    HorizontalLayout controlsBtnWrap = new HorizontalLayout();
    controlsBtnWrap.setWidth("100%");

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);//from  w  w w .j  a  v  a 2  s . co  m
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getCasesStatusList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getCasesStatusList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colorsMap.get(CrmDataTypeFactory.getCasesStatusList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    controlsBtnWrap.setWidth("100%");
    final Button createBtn = new Button();
    createBtn.setSizeUndefined();
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE));
    createBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setCaption(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE));
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = -8725970955325733072L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            fireNewRelatedItem("");
        }
    });

    controlsBtnWrap.addComponent(createBtn);
    controlsBtnWrap.setComponentAlignment(createBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.account.AccountOpportunityListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    HorizontalLayout controlsBtnWrap = new HorizontalLayout();
    controlsBtnWrap.setWidth("100%");

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);//from  w  ww.  java 2 s  . c o  m
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getOpportunitySalesStageList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunitySalesStageList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunitySalesStageList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    controlsBtnWrap.setWidth("100%");
    final Button createBtn = new Button(AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY),
            new Button.ClickListener() {
                private static final long serialVersionUID = -8101659779838108951L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    fireNewRelatedItem("");
                }
            });
    createBtn.setSizeUndefined();
    createBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY));
    createBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);

    controlsBtnWrap.addComponent(createBtn);
    controlsBtnWrap.setComponentAlignment(createBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    HorizontalLayout controlsBtnWrap = new HorizontalLayout();
    controlsBtnWrap.setWidth("100%");

    HorizontalLayout notesWrap = new HorizontalLayout();
    notesWrap.setWidth("100%");
    notesWrap.setSpacing(true);/*w  w w  .ja  v  a2s . c  om*/
    Label noteLbl = new Label("Note: ");
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) {
        Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]);
        note.setStyleName("note-label");
        note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i]));
        note.setSizeUndefined();

        noteBlock.addComponent(note);
    }
    notesWrap.addComponent(noteBlock);
    notesWrap.setExpandRatio(noteBlock, 1.0f);

    controlsBtnWrap.addComponent(notesWrap);

    final SplitButton controlsBtn = new SplitButton();
    controlsBtn.setSizeUndefined();
    controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT));
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setCaption("Add/Edit Contacts' Role");
    controlsBtn.setIcon(FontAwesome.PLUS);
    controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) {
            EventBusFactory.getInstance().post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity));
        }
    });
    final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow(
                    OpportunityContactListComp.this);
            final ContactSearchCriteria criteria = new ContactSearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId()));
            UI.getCurrent().addWindow(contactsWindow);
            contactsWindow.setSearchCriteria(criteria);
            controlsBtn.setPopupVisible(false);
        }
    });
    selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select));
    selectBtn.setStyleName("link");
    VerticalLayout buttonControlLayout = new VerticalLayout();
    buttonControlLayout.addComponent(selectBtn);
    controlsBtn.setContent(buttonControlLayout);

    controlsBtnWrap.addComponent(controlsBtn);
    controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT);
    return controlsBtnWrap;
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp.java

License:Open Source License

public AbstractPreviewItemComp(String headerText, Resource iconResource, ReadViewLayout layout) {
    Label headerLbl = new Label("", ContentMode.HTML);
    headerLbl.setSizeUndefined();
    headerLbl.setStyleName("hdr-text");

    this.previewLayout = layout;

    header = new MHorizontalLayout();

    if (iconResource != null) {
        if (iconResource instanceof FontAwesome) {
            String title = ((FontAwesome) iconResource).getHtml() + " " + headerText;
            headerLbl.setValue(title);// w w w .  jav  a  2  s. c o  m
        } else {
            Image titleIcon = new Image(null, iconResource);
            ((MHorizontalLayout) header).with(titleIcon).withAlign(titleIcon, Alignment.MIDDLE_LEFT);
            headerLbl.setValue(headerText);
        }
    } else {
        headerLbl.setValue(headerText);
    }

    ((MHorizontalLayout) header).with(headerLbl).withAlign(headerLbl, Alignment.MIDDLE_LEFT).expand(headerLbl)
            .withStyleName("hdr-view").withWidth("100%").withSpacing(true).withMargin(true);

    this.addComponent(header);
    initContent();
}

From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp2.java

License:Open Source License

protected ComponentContainer constructHeader(String headerText) {
    Label headerLbl = new Label(headerText);
    headerLbl.setSizeUndefined();
    header = new HorizontalLayout();
    headerLbl.setStyleName("hdr-text");

    if (titleIcon != null)
        UiUtils.addComponent(header, titleIcon, Alignment.MIDDLE_LEFT);

    UiUtils.addComponent(header, headerLbl, Alignment.MIDDLE_LEFT);
    header.setExpandRatio(headerLbl, 1.0f);

    header.setStyleName("hdr-view");
    header.setWidth("100%");
    header.setSpacing(true);//from   w ww. j a v a2  s .  c  o m
    header.setMargin(true);

    return header;
}

From source file:com.esofthead.mycollab.module.project.ui.components.ProjectListNoItemView.java

License:Open Source License

public ProjectListNoItemView() {
    MVerticalLayout layout = new MVerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label image = new Label(viewIcon().getHtml(), ContentMode.HTML);
    image.setSizeUndefined();
    layout.with(image).withAlign(image, Alignment.TOP_CENTER);

    Label title = new Label(viewTitle());
    title.addStyleName("h2");
    title.setSizeUndefined();//  www.j  a v  a 2s. co  m
    layout.with(title).withAlign(title, Alignment.TOP_CENTER);

    Label body = new Label(viewHint());
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createBugBtn = new Button(actionMessage(), actionListener());
    createBugBtn.setEnabled(hasPermission());

    MHorizontalLayout links = new MHorizontalLayout();

    links.addComponent(createBugBtn);
    createBugBtn.addStyleName(UIConstants.THEME_GREEN_LINK);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

private void constructBody() {
    this.bodyContent = CustomLayoutExt.createLayout("milestoneView");

    bodyContent.setWidth("100%");
    bodyContent.setStyleName("milestone-view");

    final MHorizontalLayout closedHeaderLayout = new MHorizontalLayout();

    final Label closedHeader = new Label(FontAwesome.MINUS.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_TITLE), ContentMode.HTML);
    closedHeader.setSizeUndefined();
    closedHeaderLayout.addComponent(closedHeader);
    closedHeaderLayout.setComponentAlignment(closedHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(closedHeaderLayout, "closed-header");
    closeContainer = new CssLayout();
    closeContainer.setStyleName("milestone-col");
    closeContainer.setWidth("100%");
    bodyContent.addComponent(this.closeContainer, "closed-milestones");

    final MHorizontalLayout inProgressHeaderLayout = new MHorizontalLayout();
    final Label inProgressHeader = new Label(FontAwesome.SPINNER.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_TITLE), ContentMode.HTML);
    inProgressHeader.setSizeUndefined();
    inProgressHeaderLayout.addComponent(inProgressHeader);
    inProgressHeaderLayout.setComponentAlignment(inProgressHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(inProgressHeaderLayout, "in-progress-header");
    inProgressContainer = new CssLayout();
    inProgressContainer.setStyleName("milestone-col");
    inProgressContainer.setWidth("100%");
    bodyContent.addComponent(this.inProgressContainer, "in-progress-milestones");

    final MHorizontalLayout futureHeaderLayout = new MHorizontalLayout();
    final Label futureHeader = new Label(FontAwesome.CLOCK_O.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_TITLE), ContentMode.HTML);
    futureHeader.setSizeUndefined();/*from w  ww.  j  av a  2  s  . c om*/
    futureHeaderLayout.addComponent(futureHeader);
    futureHeaderLayout.setComponentAlignment(futureHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(futureHeaderLayout, "future-header");
    futureContainer = new CssLayout();
    futureContainer.setStyleName("milestone-col");
    futureContainer.setWidth("100%");
    bodyContent.addComponent(this.futureContainer, "future-milestones");

    this.addComponent(bodyContent);
}