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.example.EditingWindow.java

License:Apache License

protected HorizontalLayout makeFooter() {
    HorizontalLayout footer = new HorizontalLayout();
    footer.setWidth("100%");
    footer.setSpacing(true);/*ww  w  .  j a va  2 s .  c  o m*/
    footer.addStyleName("v-window-bottom-toolbar");

    Label footerText = new Label("Footer text");
    footerText.setSizeUndefined();

    btnOK.addStyleName(ValoTheme.BUTTON_PRIMARY);
    btnOK.setClickShortcut(ShortcutAction.KeyCode.ENTER);

    btnCancel.setClickShortcut(ShortcutAction.KeyCode.ESCAPE);

    footer.addComponents(footerText, btnOK, btnCancel);
    footer.setExpandRatio(footerText, 1);

    return footer;
}

From source file:com.expressui.core.view.form.ResultsConnectedEntityForm.java

License:Open Source License

private HorizontalLayout createNavigationFormLayout() {
    HorizontalLayout navigationFormLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, navigationFormLayout, "navigationFormLayout");
    navigationFormLayout.setDebugId(id);
    navigationFormLayout.setSizeUndefined();

    VerticalLayout previousButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, previousButtonLayout, "previousButtonLayout");
    previousButtonLayout.setDebugId(id);

    previousButtonLayout.setSizeUndefined();
    previousButtonLayout.setMargin(false);
    previousButtonLayout.setSpacing(false);
    Label spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();/*from   ww  w .  ja  v a  2  s  .c om*/
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));

    if (entityForm.getViewableToManyRelationships().size() == 0) {
        HorizontalLayout previousButtonHorizontalLayout = new HorizontalLayout();
        id = StringUtil.generateDebugId("e", this, previousButtonHorizontalLayout,
                "previousButtonHorizontalLayout");
        previousButtonHorizontalLayout.setDebugId(id);
        previousButtonHorizontalLayout.setSizeUndefined();
        Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        horizontalSpaceLabel.setSizeUndefined();
        previousButtonHorizontalLayout.addComponent(previousButton);
        previousButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
        previousButtonLayout.addComponent(previousButtonHorizontalLayout);
    } else {
        previousButtonLayout.addComponent(previousButton);
    }

    navigationFormLayout.addComponent(previousButtonLayout);
    navigationFormLayout.setComponentAlignment(previousButtonLayout, Alignment.TOP_LEFT);

    navigationFormLayout.addComponent(entityForm);

    VerticalLayout nextButtonLayout = new VerticalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonLayout, "nextButtonLayout");
    nextButtonLayout.setDebugId(id);
    nextButtonLayout.setSizeUndefined();
    nextButtonLayout.setMargin(false);
    nextButtonLayout.setSpacing(false);
    spaceLabel = new Label("</br></br></br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    previousButtonLayout.addComponent(spaceLabel);
    nextButtonLayout.addComponent(spaceLabel);

    Button nextButton = new Button(null, this, "nextItem");
    nextButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));

    HorizontalLayout nextButtonHorizontalLayout = new HorizontalLayout();
    id = StringUtil.generateDebugId("e", this, nextButtonHorizontalLayout, "nextButtonHorizontalLayout");
    nextButtonHorizontalLayout.setDebugId(id);
    nextButtonHorizontalLayout.setSizeUndefined();
    Label horizontalSpaceLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
    horizontalSpaceLabel.setSizeUndefined();
    nextButtonHorizontalLayout.addComponent(horizontalSpaceLabel);
    nextButtonHorizontalLayout.addComponent(nextButton);

    nextButtonLayout.addComponent(nextButtonHorizontalLayout);
    navigationFormLayout.addComponent(nextButtonLayout);
    navigationFormLayout.setComponentAlignment(nextButtonLayout, Alignment.TOP_RIGHT);

    navigationFormLayout.setSpacing(false);
    navigationFormLayout.setMargin(false);

    return navigationFormLayout;
}

From source file:com.expressui.core.view.form.TypedForm.java

License:Open Source License

@PostConstruct
@Override//from www .j  ava2s . c o m
public void postConstruct() {
    super.postConstruct();

    form = new ConfigurableForm();
    form.setSizeUndefined();

    form.setWriteThrough(true);
    form.setInvalidCommitted(true);
    form.setImmediate(true);
    form.setValidationVisibleOnCommit(true);

    formFieldSet.setForm(this);
    init(formFieldSet);
    formFieldSet.assertValid();
    form.setFormFieldFactory(new TypedFormFieldFactory(getFormFieldSet()));

    final Layout gridLayout = getFormFieldSet().createGridLayout();
    form.setLayout(gridLayout);

    form.getFooter().addStyleName("e-typed-form-footer");
    createFooterButtons((HorizontalLayout) form.getFooter());

    VerticalLayout tabsAndForm = new VerticalLayout();
    setDebugId(tabsAndForm, "tabsAndForm");
    tabsAndForm.setSizeUndefined();
    if (getFormFieldSet().hasTabs()) {
        initializeTabs(tabsAndForm);
        if (getFormFieldSet().hasOptionalTabs()) {
            initializeOptionalTabs(tabsAndForm);
        }
    }
    tabsAndForm.addComponent(form);

    Label spaceLabel = new Label("</br>", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    tabsAndForm.addComponent(spaceLabel);

    addComponent(makeCollapsible(getTypeCaption(), tabsAndForm));
    labelRegistry.registerLabels(getFormFieldSet());
}

From source file:com.expressui.core.view.form.TypedForm.java

License:Open Source License

private void initializeTabs(VerticalLayout layout) {
    final Set<String> tabNames = getFormFieldSet().getTabNames();

    formTabSheet = new TabSheet();
    setDebugId(formTabSheet, "formTabSheet");
    formTabSheet.addStyleName("borderless");
    formTabSheet.setSizeUndefined();//w w w . j  a v  a 2 s.  c o m
    int tabPosition = 0;
    for (String tabName : tabNames) {
        Assert.PROGRAMMING.isTrue(!tabName.isEmpty(), "Tab name may not be empty string");
        Label emptyLabel = new Label();
        emptyLabel.setSizeUndefined();
        formTabSheet.addTab(emptyLabel, tabName, null);
        tabPositions.put(tabName, tabPosition++);
    }

    layout.addComponent(formTabSheet);

    formTabSheet.addListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            String tabName = getCurrentlySelectedTabName();
            form.getLayout().removeAllComponents();
            FormGridLayout gridLayout = (FormGridLayout) form.getLayout();
            gridLayout.setFormColumns(getFormFieldSet().getColumns(tabName));
            gridLayout.setRows(getFormFieldSet().getRows(tabName));
            Set<FormField> formFields = getFormFieldSet().getFormFields(tabName);
            for (FormField formField : formFields) {
                String propertyId = formField.getPropertyId();
                Field field = formField.getField();
                form.attachField(propertyId, field);
            }
            gridLayout.requestRepaint();
        }
    });
}

From source file:com.expressui.core.view.form.TypedForm.java

License:Open Source License

/**
 * Makes the component collapsible by wrapping it with a layout and button for toggling
 * the component's visibility. This allows the user to expand/collapse the given component in order
 * to free space for viewing other components.
 *
 * @param component         component to show/hide
 * @param useVerticalLayout true if toggle button should be laid out vertically next to animated component
 * @return the newly created layout that contains the toggle button and animated component
 *///from   ww  w. ja  v a 2  s.  c  o  m
protected Component makeCollapsible(String caption, Component component, boolean useVerticalLayout) {
    formAnimator = new Animator(component);
    formAnimator.setSizeUndefined();

    AbstractOrderedLayout animatorLayout;
    if (useVerticalLayout) {
        animatorLayout = new VerticalLayout();
    } else {
        animatorLayout = new HorizontalLayout();
    }
    setDebugId(animatorLayout, "animatorLayout");

    animatorLayout.setMargin(false, false, false, false);
    animatorLayout.setSpacing(false);

    toggleFormCollapseButton = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            setFormVisible(!isFormVisible());
        }
    });
    toggleFormCollapseButton.setDescription(uiMessageSource.getToolTip("typedForm.toggleSearchForm.toolTip"));
    toggleFormCollapseButton.setIcon(new ThemeResource("../expressui/icons/collapse-icon.png"));
    toggleFormCollapseButton.addStyleName("borderless");

    if (useVerticalLayout) {
        HorizontalLayout toggleFormButtonAndCaption = new HorizontalLayout();
        setDebugId(toggleFormButtonAndCaption, "toggleFormButtonAndCaption");
        toggleFormButtonAndCaption.setSizeUndefined();
        toggleFormButtonAndCaption.addComponent(toggleFormCollapseButton);
        Label label = new Label(caption);
        label.setSizeUndefined();
        toggleFormButtonAndCaption.addComponent(label);
        animatorLayout.addComponent(toggleFormButtonAndCaption);
        animatorLayout.addComponent(formAnimator);
    } else {
        animatorLayout.addComponent(toggleFormCollapseButton);
        animatorLayout.addComponent(formAnimator);
    }

    return animatorLayout;
}

From source file:com.expressui.core.view.results.Results.java

License:Open Source License

private HorizontalLayout createNavigationLine() {

    HorizontalLayout resultCountDisplay = new HorizontalLayout();
    setDebugId(resultCountDisplay, "resultCountDisplay");
    firstResultTextField = createFirstResultTextField();
    firstResultTextField.addStyleName("small");
    firstResultTextField.setSizeUndefined();
    resultCountDisplay.addComponent(firstResultTextField);
    resultCountLabel = new Label("", Label.CONTENT_XHTML);
    resultCountLabel.setSizeUndefined();
    resultCountLabel.addStyleName("small");
    resultCountDisplay.addComponent(resultCountLabel);

    Label spaceLabel = new Label(" &nbsp; ", Label.CONTENT_XHTML);
    spaceLabel.setSizeUndefined();
    resultCountDisplay.addComponent(spaceLabel);

    Button refreshButton = new Button(null, getResultsTable(), "refresh");
    refreshButton.setDescription(uiMessageSource.getToolTip("results.refresh.toolTip"));
    refreshButton.setSizeUndefined();//from  w ww. j  a  v a  2  s .  c o m
    refreshButton.addStyleName("borderless");
    refreshButton.setIcon(new ThemeResource("../expressui/icons/16/refresh-blue.png"));
    resultCountDisplay.addComponent(refreshButton);

    HorizontalLayout navigationButtons = new HorizontalLayout();
    setDebugId(navigationButtons, "navigationButtons");
    navigationButtons.setMargin(false, true, false, false);
    navigationButtons.setSpacing(true);

    String perPageText = uiMessageSource.getMessage("results.pageSize");
    pageSizeMenu = new Select();
    pageSizeMenu.addStyleName("small");
    List<Integer> pageSizeOptions = applicationProperties.getPageSizeOptions();
    for (Integer pageSizeOption : pageSizeOptions) {
        pageSizeMenu.addItem(pageSizeOption);
        pageSizeMenu.setItemCaption(pageSizeOption, pageSizeOption + " " + perPageText);
    }
    pageSizeMenu.setFilteringMode(Select.FILTERINGMODE_OFF);
    pageSizeMenu.setNewItemsAllowed(false);
    pageSizeMenu.setNullSelectionAllowed(false);
    pageSizeMenu.setImmediate(true);
    pageSizeMenu.setWidth(8, UNITS_EM);
    navigationButtons.addComponent(pageSizeMenu);

    firstButton = new Button(null, getResultsTable(), "firstPage");
    firstButton.setDescription(uiMessageSource.getToolTip("results.first.toolTip"));
    firstButton.setSizeUndefined();
    firstButton.addStyleName("borderless");
    firstButton.setIcon(new ThemeResource("../expressui/icons/16/first.png"));
    navigationButtons.addComponent(firstButton);

    previousButton = new Button(null, getResultsTable(), "previousPage");
    previousButton.setDescription(uiMessageSource.getToolTip("results.previous.toolTip"));
    previousButton.setSizeUndefined();
    previousButton.addStyleName("borderless");
    previousButton.setIcon(new ThemeResource("../expressui/icons/16/previous.png"));
    navigationButtons.addComponent(previousButton);

    nextButton = new Button(null, getResultsTable(), "nextPage");
    nextButton.setDescription(uiMessageSource.getToolTip("results.next.toolTip"));
    nextButton.setSizeUndefined();
    nextButton.addStyleName("borderless");
    nextButton.setIcon(new ThemeResource("../expressui/icons/16/next.png"));
    navigationButtons.addComponent(nextButton);

    lastButton = new Button(null, getResultsTable(), "lastPage");
    lastButton.setDescription(uiMessageSource.getToolTip("results.last.toolTip"));
    lastButton.setSizeUndefined();
    lastButton.addStyleName("borderless");
    lastButton.setIcon(new ThemeResource("../expressui/icons/16/last.png"));
    navigationButtons.addComponent(lastButton);

    excelButton = new Button(null, this, "openExportForm");
    excelButton.setDescription(uiMessageSource.getToolTip("results.excel.toolTip"));
    excelButton.setSizeUndefined();
    excelButton.addStyleName("borderless");
    excelButton.setIcon(new ThemeResource("../expressui/icons/16/excel.bmp"));
    navigationButtons.addComponent(excelButton);
    exportForm.setExportButtonListener(this, "exportToExcel");

    HorizontalLayout navigationLine = new HorizontalLayout();
    setDebugId(navigationLine, "navigationLine");
    navigationLine.setSizeUndefined();
    navigationLine.setMargin(true, false, true, false);

    navigationLine.addComponent(resultCountDisplay);
    navigationLine.setComponentAlignment(resultCountDisplay, Alignment.BOTTOM_LEFT);

    spaceLabel = new Label("", Label.CONTENT_XHTML);
    spaceLabel.setWidth(2, Sizeable.UNITS_EM);
    navigationLine.addComponent(spaceLabel);

    navigationLine.addComponent(navigationButtons);
    navigationLine.setComponentAlignment(navigationButtons, Alignment.BOTTOM_RIGHT);

    return navigationLine;
}

From source file:com.freebox.engeneering.application.web.layout.FooterController.java

License:Apache License

/**
 * Loads data into the form while entering 'loadData' state.
 *
 * @param stateEvent the state event./*w  ww.ja  v  a2  s  . c o m*/
 */
@OnEnterState(EventConstants.LOAD_DATA)
public void buildFooterView(StateEvent stateEvent) {
    clearView(stateEvent);
    final Label htmlLabel = new Label(
            "&copy; " + Calendar.getInstance().get(Calendar.YEAR) + " Lexaden.com  All rights reserved",
            ContentMode.HTML);
    htmlLabel.setStyleName(Reindeer.LABEL_SMALL);
    htmlLabel.setSizeUndefined();
    final VerticalLayout view = getView();
    view.addComponent(htmlLabel);
    view.setComponentAlignment(htmlLabel, Alignment.MIDDLE_CENTER);
    view.setMargin(new MarginInfo(false, false, true, false));
}

From source file:com.freebox.engeneering.application.web.layout.HeaderController.java

License:Apache License

/**
 * Loads data into the form when system enters 'loadData' state.
 *
 * @param event -  the state event./*from w  w w  . jav a 2 s  .  c o m*/
 */
@SuppressWarnings("rawtypes")
@OnEnterState(StateConstants.PROFILE)
public void buildHeader(StateEvent event) {
    clearView(event);
    HorizontalLayout top = super.getView();
    final Label title = new Label("My Freebox Manager");
    title.setSizeUndefined();
    title.addStyleName("h1");
    top.addComponent(title);
    top.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    top.setExpandRatio(title, 1);

    Button notify = new Button();
    notify.setDescription("Notifications");
    notify.addStyleName("notifications");
    notify.addStyleName("unread");
    notify.addStyleName("icon-only");
    notify.addStyleName("icon-bell");
    top.addComponent(notify);
    top.setComponentAlignment(notify, Alignment.MIDDLE_LEFT);

    Button edit = new Button();
    edit.addStyleName("icon-edit");
    edit.addStyleName("icon-only");
    edit.setDescription("Edit Dashboard");
    top.addComponent(edit);
    top.setComponentAlignment(edit, Alignment.MIDDLE_LEFT);

    Button downloadB = new Button();
    downloadB.addStyleName("icon-edit");
    downloadB.addStyleName("icon-only");
    downloadB.setDescription("Tlcharger un fichier");
    top.addComponent(downloadB);
    top.setComponentAlignment(downloadB, Alignment.MIDDLE_LEFT);

}

From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java

License:Apache License

private void createHeaderSideBar() {

    VerticalLayout verticalLayout = super.getView();

    sideBarHeader.addStyleName("branding");
    Label logo = new Label("<span>Freebox Dashboard</span> Manager", ContentMode.HTML);
    logo.setSizeUndefined();
    sideBarHeader.addComponent(logo);//from w ww. j  av a2 s . c  o m

    verticalLayout.addComponent(sideBarHeader);

}

From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java

License:Apache License

private void createFooterSideBar() {
    VerticalLayout verticalLayout = super.getView();

    sideBarFooter.setSizeUndefined();//  ww w  .  j  a v a 2s.co  m
    sideBarFooter.addStyleName("user");
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic.png"));
    profilePic.setWidth("34px");
    sideBarFooter.addComponent(profilePic);
    Label userName = new Label("MOHELLEBI ATAF");
    userName.setSizeUndefined();
    sideBarFooter.addComponent(userName);

    Command cmd = new Command() {
        @Override
        public void menuSelected(MenuItem selectedItem) {
            Notification.show("Not implemented in this demo");
        }
    };
    MenuBar settings = new MenuBar();
    MenuItem settingsMenu = settings.addItem("", null);
    settingsMenu.setStyleName("icon-cog");
    settingsMenu.addItem("Settings", cmd);
    settingsMenu.addItem("Preferences", cmd);
    settingsMenu.addSeparator();
    settingsMenu.addItem("My Account", cmd);
    sideBarFooter.addComponent(settings);

    Button exit = new NativeButton("Exit");
    exit.addStyleName("icon-cancel");
    exit.setDescription("Sign Out");
    sideBarFooter.addComponent(exit);
    exit.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
        }
    });

    verticalLayout.addComponent(sideBarFooter);
}