Example usage for com.vaadin.ui Label setWidthUndefined

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

Introduction

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

Prototype

@Override
    public void setWidthUndefined() 

Source Link

Usage

From source file:ch.bfh.ti.soed.hs16.srs.white.view.subviews.CustomMenuItem.java

License:Open Source License

public CustomMenuItem(String caption, String icon) {
    this.setStyleName("menu-item");

    if (icon == null || icon.isEmpty()) {
        icon = "no-icon";
    }/*w  w w.j  a va2  s .c om*/

    StringBuilder iconStyle = new StringBuilder("menu-item-icon").append("-").append(icon);
    Label imageIcon = new Label();
    imageIcon.setStyleName(iconStyle.toString());

    Label itemCaption = new Label(caption);
    itemCaption.setStyleName("menu-item-caption");
    itemCaption.setWidthUndefined();

    this.addComponents(imageIcon, itemCaption);
}

From source file:com.esofthead.mycollab.mobile.module.project.ui.TimeLogComp.java

License:Open Source License

public void displayTime(final V bean) {
    this.removeAllComponents();

    HorizontalLayout header = new HorizontalLayout();
    header.setSpacing(true);/*from w  w  w.  ja  v  a2 s . c  o  m*/
    header.setStyleName("info-hdr");
    header.addStyleName("timelog-comp-hdr");
    header.setWidth("100%");
    Label dateInfoHeader = new Label(AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME));
    dateInfoHeader.setWidthUndefined();
    header.addComponent(dateInfoHeader);
    header.setExpandRatio(dateInfoHeader, 1.0f);

    if (hasEditPermission()) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        showEditTimeView(bean);

                    }
                });
        editBtn.setStyleName("link");
        editBtn.setHtmlContentAllowed(true);
        header.addComponent(editBtn);
        header.setComponentAlignment(editBtn, Alignment.BOTTOM_LEFT);
    }

    this.addComponent(header);

    GridFormLayoutHelper layout = new GridFormLayoutHelper(1, 3, "100%", "150px", Alignment.TOP_RIGHT);
    layout.getLayout().setWidth("100%");
    layout.getLayout().setMargin(false);

    double billableHours = getTotalBillableHours(bean);
    double nonBillableHours = getTotalNonBillableHours(bean);
    double remainHours = getRemainedHours(bean);
    layout.addComponent(new Label(billableHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_BILLABLE_HOURS), 0, 0);
    layout.addComponent(new Label(nonBillableHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_NON_BILLABLE_HOURS), 0, 1);
    layout.addComponent(new Label(remainHours + ""),
            AppContext.getMessage(TimeTrackingI18nEnum.M_FORM_REMAIN_HOURS), 0, 2);
    this.addComponent(layout.getLayout());
}

From source file:com.esofthead.mycollab.mobile.module.project.view.message.MessageReadViewImpl.java

License:Open Source License

@Override
public void previewItem(SimpleMessage message) {
    this.bean = message;
    mainLayout.removeAllComponents();//from   w  ww .  java  2 s.  co  m

    HorizontalLayout messageBlock = new HorizontalLayout();
    messageBlock.setStyleName("message-block");
    Image userAvatarImg = UserAvatarControlFactory
            .createUserAvatarEmbeddedComponent(message.getPostedUserAvatarId(), 32);
    userAvatarImg.setStyleName("user-avatar");
    messageBlock.addComponent(userAvatarImg);

    CssLayout rightCol = new CssLayout();
    rightCol.setWidth("100%");

    HorizontalLayout metadataRow = new HorizontalLayout();
    metadataRow.setWidth("100%");
    metadataRow.setStyleName("metadata-row");
    Label userNameLbl = new Label(message.getFullPostedUserName());
    userNameLbl.setStyleName("user-name");
    metadataRow.addComponent(userNameLbl);
    metadataRow.setExpandRatio(userNameLbl, 1.0f);

    Label messageTimePost = new Label(
            DateTimeUtils.getPrettyDateValue(message.getPosteddate(), AppContext.getUserLocale()));
    messageTimePost.setStyleName("time-post");
    messageTimePost.setWidthUndefined();
    metadataRow.addComponent(messageTimePost);
    rightCol.addComponent(metadataRow);

    HorizontalLayout titleRow = new HorizontalLayout();
    titleRow.setWidth("100%");
    titleRow.setStyleName("title-row");
    Label messageTitle = new Label(message.getTitle());
    messageTitle.setStyleName("message-title");
    titleRow.addComponent(messageTitle);
    titleRow.setExpandRatio(messageTitle, 1.0f);

    if (message.getCommentsCount() > 0) {
        Label msgCommentCount = new Label(String.valueOf(message.getCommentsCount()));
        msgCommentCount.setStyleName("comment-count");
        msgCommentCount.setWidthUndefined();
        titleRow.addComponent(msgCommentCount);
        titleRow.addStyleName("has-comment");
        titleRow.setComponentAlignment(messageTitle, Alignment.MIDDLE_LEFT);
    }
    rightCol.addComponent(titleRow);

    Label messageContent = new Label(
            StringUtils.trim(StringUtils.trimHtmlTags(message.getMessage()), 150, true));
    messageContent.setStyleName("message-content");
    rightCol.addComponent(messageContent);

    ResourceService attachmentService = ApplicationContextUtil.getSpringBean(ResourceService.class);
    List<Content> attachments = attachmentService
            .getContents(AttachmentUtils.getProjectEntityAttachmentPath(AppContext.getAccountId(),
                    message.getProjectid(), AttachmentType.PROJECT_MESSAGE, message.getId()));
    if (attachments != null && !attachments.isEmpty()) {
        CssLayout attachmentPanel = new CssLayout();
        attachmentPanel.setStyleName("attachment-panel");
        attachmentPanel.setWidth("100%");

        for (Content attachment : attachments) {
            attachmentPanel.addComponent(MobileAttachmentUtils.renderAttachmentRow(attachment));
        }
        rightCol.addComponent(attachmentPanel);
    }

    messageBlock.addComponent(rightCol);
    messageBlock.setExpandRatio(rightCol, 1.0f);
    messageBlock.setWidth("100%");

    mainLayout.addComponent(messageBlock);

    MessageCommentListDisplay commentDisplay = new MessageCommentListDisplay(CommentType.PRJ_MESSAGE,
            CurrentProjectVariables.getProjectId(), true, true, MessageRelayEmailNotificationAction.class);
    commentDisplay.loadComments("" + message.getId());

    this.setToolbar(commentDisplay.getCommentBox());
    mainLayout.addComponent(commentDisplay);
}

From source file:com.esofthead.mycollab.mobile.module.project.view.ProjectDashboardViewImpl.java

License:Open Source License

@Override
public void displayDashboard() {
    mainLayout.removeAllComponents();/*  w  ww  . j a v  a  2s .  co m*/
    SimpleProject currentProject = CurrentProjectVariables.getProject();
    VerticalLayout projectInfo = new VerticalLayout();
    projectInfo.setStyleName("project-info-layout");
    projectInfo.setWidth("100%");
    projectInfo.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    Label projectIcon = new Label("<span aria-hidden=\"true\" data-icon=\"&#xe614\"></span>");
    projectIcon.setStyleName("project-icon");
    projectIcon.setContentMode(ContentMode.HTML);
    projectIcon.setWidthUndefined();
    projectInfo.addComponent(projectIcon);

    Label projectName = new Label(StringUtils.trim(currentProject.getName(), 50, true));
    projectName.setWidth("100%");
    projectName.setStyleName("project-name");
    projectInfo.addComponent(projectName);

    GridLayout projectModulesList = new GridLayout(2, 3);
    projectModulesList.setStyleName("project-modules-layout");
    projectModulesList.setWidth("100%");
    projectModulesList.setSpacing(true);
    projectModulesList.setDefaultComponentAlignment(Alignment.TOP_CENTER);

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_MESSAGE), "&#xf04f;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_MILESTONE), "&#xf075;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_TASK), "&#xe60f;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_BUG), "&#xf188;"));

    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_FILE), "&#xf017;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_RISK), "&#xf02d;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_PROBLEM), "&#xf0d2;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_TIME), "&#xe612;"));
    //
    // projectModulesList.addComponent(new ProjectModuleButton(AppContext
    // .getMessage(ProjectCommonI18nEnum.VIEW_STANDAUP), "&#xf0c0;"));

    projectModulesList.addComponent(
            new ProjectModuleButton(AppContext.getMessage(ProjectCommonI18nEnum.VIEW_USERS), "&#xe601;"), 0, 2,
            1, 2);

    mainLayout.addComponent(projectInfo);
    mainLayout.addComponent(projectModulesList);
}

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();// ww  w.  ja v  a 2 s .  co  m
    layout.with(image).withAlign(image, Alignment.TOP_CENTER);

    Label title = new Label(titleMessage());
    title.addStyleName("h2");
    title.setWidthUndefined();
    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.view.account.AccountListNoItemView.java

License:Open Source License

public AccountListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//w  w w  .  j  av  a2s  .com
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/account.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(AccountI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createAccountBtn = new Button(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new AccountEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

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

    /*
     * Label or = new Label("Or"); or.setStyleName("h2");
     * links.addComponent(or);
     * 
     * Button btImportContact = new Button("Import Accounts", 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);
     */
    links.setSpacing(true);

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

From source file:com.esofthead.mycollab.module.crm.view.campaign.CampaignListNoItemView.java

License:Open Source License

public CampaignListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);//from w  ww .j a v  a2  s . c  om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/campaign.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(CampaignI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(CampaignI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CampaignEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    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 Campaigns", 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);
     */
    links.setSpacing(true);

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

From source file:com.esofthead.mycollab.module.crm.view.cases.CaseListNoItemView.java

License:Open Source License

public CaseListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/* w w  w.j a v a2s . co m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/case.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(CaseI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new CaseEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    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);
     */
    links.setSpacing(true);

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

From source file:com.esofthead.mycollab.module.crm.view.contact.ContactListNoItemView.java

License:Open Source License

public ContactListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);// ww w  . j  a  v  a2s  .  c  om
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/contact.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label contact = new Label(AppContext.getMessage(ContactI18nEnum.VIEW_NO_ITEM_HINT));
    contact.setWidthUndefined();
    layout.addComponent(contact);

    Button btCreateContact = new Button(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new ContactEvent.GotoAdd(this, null));
                }
            });

    HorizontalLayout links = new HorizontalLayout();

    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 Contacts", 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);
     */
    links.setSpacing(true);

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

From source file:com.esofthead.mycollab.module.crm.view.lead.LeadListNoItemView.java

License:Open Source License

public LeadListNoItemView() {

    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("case-noitem");
    layout.setWidth("800px");
    layout.setSpacing(true);/*from   w  w w  .  j a va  2s.  c  o  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/crm/lead.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(LeadI18nEnum.VIEW_NO_ITEM_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button btCreateContact = new Button("New Lead", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null));
        }
    });

    HorizontalLayout links = new HorizontalLayout();

    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 Leads", 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);
     */
    links.setSpacing(true);

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