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.klwork.explorer.ui.user.UserEventsPanel.java

License:Apache License

protected void addTaskEventText(final org.activiti.engine.task.Event taskEvent, final GridLayout eventGrid) {
    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName(ExplorerLayout.STYLE_TASK_EVENT);
    layout.setWidth("100%");
    eventGrid.addComponent(layout);//from   w w  w.j  ava 2 s .c o  m

    // Actual text
    Label text = taskEventTextResolver.resolveText(taskEvent);
    text.setWidth("100%");
    layout.addComponent(text);

    // Time
    String humFormat = new HumanTime(i18nManager).format(taskEvent.getTime());
    Label time = new Label(humFormat + " (" + StringDateUtil.dateToString(taskEvent.getTime(), 4) + ")");
    time.setSizeUndefined();
    time.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_TIME);
    layout.addComponent(time);

}

From source file:com.kpg.diary.ui.MenuLayout.java

License:Apache License

/**
 * Builds the menu.//from   w w w . j a  v  a 2 s  . c om
 *
 * @param navigator
 *            the navigator
 * @return the css layout
 */
private CssLayout buildMenu(Navigator navigator) {
    // Add items
    menuItemsMap();
    HorizontalLayout top = new HorizontalLayout();
    top.setWidth("100%");
    top.addStyleName(ValoTheme.MENU_TITLE);

    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    menu.addComponent(top);
    // menu.addComponent(createThemeSelect());
    menu.addComponent(top);
    Button showMenu = new Button("Menu", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (menu.getStyleName().contains("valo-menu-visible")) {
                menu.removeStyleName("valo-menu-visible");
            } else {
                menu.addStyleName("valo-menu-visible");
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName("valo-menu-toggle");
    showMenu.setIcon(FontAwesome.LIST);
    menu.addComponent(showMenu);

    Label title = new Label("<h2>Diary</h2>", ContentMode.HTML);
    title.setSizeUndefined();
    top.addComponent(title);
    top.setExpandRatio(title, 1);
    menuItemsLayout.setPrimaryStyleName("valo-menuitems");
    menu.addComponent(menuItemsLayout);
    for (final Entry<String, String> item : menuItems.entrySet()) {
        Button b = new Button(item.getValue(), new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                navigator.navigateTo(item.getKey());
            }
        });
        b.setHtmlContentAllowed(true);
        b.setPrimaryStyleName(ValoTheme.MENU_ITEM);
        if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.BOOK);
        } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) {
            b.setIcon(FontAwesome.USER);
        } else {
            b.setIcon(FontAwesome.APPLE);
        }
        menuItemsLayout.addComponent(b);
    }
    return menu;
}

From source file:com.liferay.mail.vaadin.Composer.java

License:Open Source License

private HorizontalLayout buildFromLayout() {

    // common part: create layout
    fromLayout = new HorizontalLayout();
    fromLayout.setSpacing(true);//from w  w w . jav a2 s. c  o m

    Label fromLabel = new Label(Lang.get("from"));
    fromLabel.setSizeUndefined();
    fromLayout.addComponent(fromLabel);

    // from
    from = new ComboBox();
    from.setDescription(Lang.get("the-account-to-send-the-message-from"));
    from.setImmediate(true);
    from.setHeight("-1px");
    from.setWidth("100.0%");
    fromLayout.addComponent(from);
    fromLayout.setExpandRatio(from, 1.0f);

    return fromLayout;
}

From source file:com.m4gik.views.component.LibraryScreen.java

/**
 * @param audioFile// ww w. j  av  a  2 s  .  com
 * @return
 */
private CssLayout addDetails(AudioFile audioFile) {
    CssLayout details = new CssLayout();
    details.setWidth("100%");

    Label title = new Label("<h3>" + audioFile.getArtist() + "&ndash;" + audioFile.getTitle() + "</h3>",
            ContentMode.HTML);
    details.addComponent(title);
    title.setSizeUndefined();

    TabSheet tabs = new TabSheet();
    tabs.addStyleName(Runo.TABSHEET_SMALL);
    tabs.setWidth("100%");
    tabs.setHeight("180px");
    details.addComponent(tabs);

    FormLayout formLayout = new FormLayout();
    tabs.addTab(formLayout, "Info");

    Label text = new Label(audioFile.getTitle());
    text.setCaption("Title:");
    formLayout.addComponent(text);

    text = new Label(audioFile.getArtist());
    text.setCaption("Artist:");
    formLayout.addComponent(text);

    text = new Label(audioFile.getAlbum());
    text.setCaption("Album:");
    formLayout.addComponent(text);

    text = new Label(audioFile.getGenre());
    text.setCaption("Genre:");
    formLayout.addComponent(text);

    text = new Label(audioFile.getPrice() + "$");
    text.setCaption("Price");
    formLayout.addComponent(text);

    formLayout = new FormLayout();
    tabs.addTab(formLayout, "Decription");
    text = new Label(audioFile.getAbout());
    formLayout.addComponent(text);

    formLayout = new FormLayout();
    tabs.addTab(formLayout, "Lyrics");
    text = new Label(audioFile.getLyrics());
    formLayout.addComponent(text);

    return details;
}

From source file:com.m4gik.views.MainView.java

/**
 * @param root/*from   w  w  w .  j a  v a  2 s. com*/
 */
private void addSlogan(VerticalLayout root) {
    Label slogan = new Label("All music now without limits");
    slogan.addStyleName(Runo.LABEL_SMALL);
    slogan.setSizeUndefined();
    root.addComponent(slogan);
    root.setComponentAlignment(slogan, Alignment.TOP_CENTER);
}

From source file:com.m4gik.views.MainView.java

/**
 * @param root/*from   w w  w . j a  va 2s. c o  m*/
 */
private void addTitle(VerticalLayout root) {
    Label title = new Label("Music Player");
    title.addStyleName(Runo.LABEL_H1);
    title.setSizeUndefined();
    root.addComponent(title);
    root.setComponentAlignment(title, Alignment.TOP_CENTER);

    addSlogan(root);
}

From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java

License:Apache License

public Menu(Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);/*from w w  w . j a  v  a2  s .c  om*/
    Label title = new Label("My CRUD");
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() {

        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void menuSelected(MenuItem selectedItem) {
            VaadinSession.getCurrent().getSession().invalidate();
            Page.getCurrent().reload();
        }
    });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button("Menu", new ClickListener() {
        /**
         * The serialVersionUID.
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

From source file:com.mechanicshop.components.TableLayout.java

private void buildLayout() {
    HorizontalLayout layoutTitle = new HorizontalLayout();
    layoutTitle.setSizeUndefined();//from   w  ww .  j ava  2 s.  co m
    layoutTitle.setWidth("100%");
    layoutTitle.setSpacing(false);
    layoutTitle.setMargin(false);
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    titleLabel.addStyleName(ValoTheme.LABEL_COLORED);
    titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    titleLabel.setSizeUndefined();

    layoutTitle.addComponent(titleLabel);
    layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout layoutTable = new VerticalLayout();

    layoutTable.addComponent(table);
    layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER);
    layoutTable.setSizeFull();

    layoutTable.setSpacing(true);
    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    layoutButtons.setSpacing(true);
    layoutButtons.setSizeUndefined();
    layoutButtons.setWidth("100%");
    Button addBtn = new Button("Add new Car");
    addBtn.addClickListener(addBtnListener);
    addBtn.setImmediate(true);
    addBtn.setStyleName(ValoTheme.BUTTON_TINY);
    addBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    Button deleteBtn = new Button("Delete Selected");
    deleteBtn.setStyleName(ValoTheme.BUTTON_TINY);
    deleteBtn.addStyleName(ValoTheme.BUTTON_DANGER);
    deleteBtn.setImmediate(true);
    deleteBtn.addClickListener(removeListener);

    btnSendSMS.setStyleName(ValoTheme.BUTTON_TINY);
    btnSendSMS.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    btnSendSMS.setImmediate(true);
    btnSendSMS.addClickListener(sendSMSBtnListener);

    searchTextField.setImmediate(true);
    searchTextField.addStyleName(ValoTheme.TEXTFIELD_TINY);
    searchTextField.addTextChangeListener(filterChangeListener);
    Label lbSearch = new Label("Search");
    lbSearch.addStyleName(ValoTheme.LABEL_TINY);
    lbSearch.setSizeUndefined();
    layoutButtons.addComponents(lbSearch, searchTextField, addBtn, deleteBtn, btnSendSMS);

    layoutButtons.setComponentAlignment(lbSearch, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(searchTextField, Alignment.BOTTOM_LEFT);
    layoutButtons.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(deleteBtn, Alignment.BOTTOM_RIGHT);
    layoutButtons.setComponentAlignment(btnSendSMS, Alignment.BOTTOM_RIGHT);
    layoutButtons.setExpandRatio(addBtn, 3);
    addComponent(layoutTitle);
    addComponent(layoutTable);
    layoutTable.addComponent(layoutButtons);
    layoutTable.setExpandRatio(table, 3);
    setComponentAlignment(layoutTitle, Alignment.TOP_CENTER);
    setComponentAlignment(layoutTable, Alignment.TOP_CENTER);
    setExpandRatio(layoutTable, 3);
    setSpacing(true);
    setMargin(true);

}

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

License:Open Source License

public void displayEntryPeople(ValuedBean bean) {
    this.removeAllComponents();
    this.withMargin(false);

    Label peopleInfoHeader = new Label(
            FontAwesome.USER.getHtml() + " " + UserUIContext.getMessage(CrmCommonI18nEnum.SUB_INFO_PEOPLE),
            ContentMode.HTML);/*from w  w w.  ja  va2  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(UserUIContext.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(UserUIContext.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.mycollab.module.crm.view.account.AccountCaseListComp.java

License:Open Source License

@Override
protected Component generateTopControls() {
    MHorizontalLayout controlsBtnWrap = new MHorizontalLayout().withFullWidth();

    MHorizontalLayout notesWrap = new MHorizontalLayout().withFullWidth();
    Label noteLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE));
    noteLbl.setSizeUndefined();
    noteLbl.setStyleName("list-note-lbl");
    notesWrap.addComponent(noteLbl);/*from   w  ww  .  java  2s .com*/

    CssLayout noteBlock = new CssLayout();
    noteBlock.setWidth("100%");
    noteBlock.setStyleName("list-note-block");
    for (CaseStatus status : CrmDataTypeFactory.getCasesStatusList()) {
        ELabel note = new ELabel(UserUIContext.getMessage(status))
                .withStyleName("note-label", colorsMap.get(status.name())).withWidthUndefined();
        noteBlock.addComponent(note);
    }
    notesWrap.with(noteBlock).expand(noteBlock);
    controlsBtnWrap.addComponent(notesWrap);

    if (UserUIContext.canWrite(RolePermissionCollections.CRM_CASE)) {
        MButton createBtn = new MButton(UserUIContext.getMessage(CaseI18nEnum.NEW),
                clickEvent -> fireNewRelatedItem("")).withIcon(FontAwesome.PLUS)
                        .withStyleName(WebThemes.BUTTON_ACTION);
        controlsBtnWrap.with(createBtn).withAlign(createBtn, Alignment.TOP_RIGHT);
    }

    return controlsBtnWrap;
}