Example usage for com.vaadin.ui HorizontalLayout setSizeUndefined

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

Introduction

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

Prototype

@Override
    public void setSizeUndefined() 

Source Link

Usage

From source file:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createBuildDateLayout() {
    HorizontalLayout buildDateLayout = new HorizontalLayout();
    Label labelBuildDate = new Label("Build date: " + getBuildDate());
    buildDateLayout.addComponent(labelBuildDate);
    labelBuildDate.setSizeUndefined();//from  w  ww  .ja v  a2s .c  o m
    buildDateLayout.setSizeUndefined();
    return buildDateLayout;
}

From source file:be.rvponp.build.CommitViewerUI.java

License:Apache License

private HorizontalLayout createFiltersLayout(Table table, VerticalLayout files, VerticalLayout filesLayout) {
    HorizontalLayout filtersLayout = new HorizontalLayout();

    FormLayout formReleaseLayout = new FormLayout();
    fromVersion = new ComboBox("From release");
    toVersion = new ComboBox("To release");
    filtersLayout.addComponent(formReleaseLayout);
    formReleaseLayout.setDescription("formReleaseLayout");

    formReleaseLayout.addComponent(fromVersion);
    formReleaseLayout.addComponent(toVersion);
    formReleaseLayout.setSizeUndefined();

    //        FormLayout jiraTreeLayout = new FormLayout();
    final Tree tree = createTreeComponent();
    //        jiraTreeLayout.addComponent(tree);
    filtersLayout.addComponent(tree);//from w  ww  . ja va 2  s  .  co  m

    CheckBox jiraParsing = new CheckBox("Jira Parsing");
    jiraParsing.setValue(true);
    //        filtersLayout.addComponent(jiraParsing);

    FormLayout buttonsLayout = new FormLayout();
    CompareButton compareButton = new CompareButton(fromVersion, toVersion, table, files, jiraParsing, tree,
            filesLayout);
    RefreshButton refreshButton = new RefreshButton(this, fromVersion, toVersion);
    //        refreshButton.buttonClick(null);
    //        compareButton.buttonClick(null);
    buttonsLayout.addComponent(refreshButton);
    buttonsLayout.addComponent(compareButton);
    buttonsLayout.setSizeUndefined();
    filtersLayout.addComponent(buttonsLayout);
    filtersLayout.setSizeUndefined();
    return filtersLayout;
}

From source file:biz.eelis.translation.EntriesFlowlet.java

License:Apache License

@Override
public void initialize() {
    final List<FieldDescriptor> fieldDescriptors = TranslationSiteFields.getFieldDescriptors(Entry.class);

    final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>();

    filterDefinitions.add(new FilterDescriptor("basename", "basename", "Basename", new TextField(), 200, "like",
            String.class, ""));

    filterDefinitions.add(new FilterDescriptor("language", "language", "Language", new TextField(), 30, "=",
            String.class, ""));

    filterDefinitions.add(/*ww  w . jav a2  s. co m*/
            new FilterDescriptor("country", "country", "Country", new TextField(), 30, "=", String.class, ""));

    filterDefinitions
            .add(new FilterDescriptor("key", "key", "Key", new TextField(), 200, "like", String.class, ""));

    final EntityManager entityManager = getSite().getSiteContext().getObject(EntityManager.class);
    container = new LazyEntityContainer<Entry>(entityManager, true, true, false, Entry.class, 1000,
            new String[] { "basename", "key", "language", "country" }, new boolean[] { true, true, true, true },
            "entryId");

    ContainerUtil.addContainerProperties(container, fieldDescriptors);

    final GridLayout gridLayout = new GridLayout(1, 2);
    gridLayout.setSizeFull();
    gridLayout.setMargin(false);
    gridLayout.setSpacing(true);
    gridLayout.setRowExpandRatio(1, 1f);
    setViewContent(gridLayout);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setSizeUndefined();
    gridLayout.addComponent(buttonLayout, 0, 0);

    final Table table = new FormattingTable();
    grid = new Grid(table, container);
    grid.setFields(fieldDescriptors);
    grid.setFilters(filterDefinitions);

    table.setColumnCollapsed("entryId", true);
    table.setColumnCollapsed("path", true);
    table.setColumnCollapsed("created", true);
    table.setColumnCollapsed("modified", true);
    gridLayout.addComponent(grid, 0, 1);

    final Button addButton = getSite().getButton("add");
    buttonLayout.addComponent(addButton);
    addButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Entry entry = new Entry();
            entry.setCreated(new Date());
            entry.setModified(entry.getCreated());
            entry.setOwner((Company) getSite().getSiteContext().getObject(Company.class));
            final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class);
            entryView.edit(entry, true);
        }
    });

    final Button editButton = getSite().getButton("edit");
    buttonLayout.addComponent(editButton);
    editButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            final Entry entity = container.getEntity(grid.getSelectedItemId());
            final EntryFlowlet entryView = getViewSheet().forward(EntryFlowlet.class);
            entryView.edit(entity, false);
        }
    });

    final Button removeButton = getSite().getButton("remove");
    buttonLayout.addComponent(removeButton);
    removeButton.addClickListener(new ClickListener() {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            container.removeItem(grid.getSelectedItemId());
            container.commit();
        }
    });

    final Company company = getSite().getSiteContext().getObject(Company.class);
    container.removeDefaultFilters();
    container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId()));
    grid.refresh();
}

From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java

License:Open Source License

@Override
protected final ComponentContainer createLegendBox() {
    final CustomLayout boxWrapper = CustomLayoutExt.createLayout("legendBox");
    final CssLayout mainLayout = new CssLayout();

    mainLayout.setSizeUndefined();//  www . j ava  2  s  . c  om
    final List keys = pieDataSet.getKeys();

    for (int i = 0; i < keys.size(); i++) {
        final HorizontalLayout layout = new HorizontalLayout();
        layout.setMargin(new MarginInfo(false, false, false, true));
        layout.addStyleName("inline-block");
        final Comparable key = (Comparable) keys.get(i);
        final String color = "<div style = \" width:8px;height:8px;border-radius:5px;background: #"
                + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length] + "\" />";
        final Label lblCircle = new Label(color);
        lblCircle.setContentMode(ContentMode.HTML);

        String btnCaption;
        if (enumKeyCls == null) {
            btnCaption = String.format("%s(%d)", key, pieDataSet.getValue(key).intValue());
        } else {
            btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()),
                    pieDataSet.getValue(key).intValue());
        }
        final Button btnLink = new Button(btnCaption, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                PieChartWrapper.this.onClickedDescription(key.toString());
            }
        });
        btnLink.addStyleName("link");
        layout.addComponent(lblCircle);
        layout.setComponentAlignment(lblCircle, Alignment.MIDDLE_CENTER);
        layout.addComponent(btnLink);
        layout.setComponentAlignment(btnLink, Alignment.MIDDLE_CENTER);
        layout.setSizeUndefined();
        mainLayout.addComponent(layout);
    }
    boxWrapper.setWidth("100%");
    boxWrapper.addComponent(mainLayout, "legendBoxContent");
    return boxWrapper;
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleBug> bugPreviewFormControls = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//  w w w .  j  a v  a  2 s  . c  om
    MButton linkBtn = new MButton("Link", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent clickEvent) {
            UI.getCurrent().addWindow(new LinkIssueWindow(beanItem));
        }
    }).withIcon(FontAwesome.LINK);
    linkBtn.addStyleName("black");
    bugPreviewFormControls.addOptionButton(linkBtn);

    final HorizontalLayout topPanel = bugPreviewFormControls.createButtonControls(
            ProjectPreviewFormControlsGenerator.ADD_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.EDIT_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED,
            ProjectRolePermissionCollections.BUGS);

    final Button assignBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ASSIGN),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    UI.getCurrent().addWindow(new AssignBugWindow(BugReadViewImpl.this, beanItem));
                }
            });
    assignBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    assignBtn.setIcon(FontAwesome.SHARE);

    assignBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    this.bugWorkflowControl = new HorizontalLayout();
    this.bugWorkflowControl.setMargin(false);
    this.bugWorkflowControl.addStyleName("workflow-controls");

    bugPreviewFormControls.insertToControlBlock(bugWorkflowControl);
    bugPreviewFormControls.insertToControlBlock(assignBtn);
    topPanel.setSizeUndefined();

    return topPanel;
}

From source file:com.esofthead.mycollab.vaadin.ui.EditFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(final boolean isSaveBtnVisible,
        final boolean isSaveAndNewBtnVisible, final boolean isCancelBtnVisible) {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);// www.  ja v a  2s.  c om
    layout.setSizeUndefined();
    layout.setStyleName("addNewControl");

    if (isSaveBtnVisible) {
        final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveForm();
                        }
                    }
                });
        saveBtn.setIcon(FontAwesome.SAVE);
        saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveBtn);
        layout.setComponentAlignment(saveBtn, Alignment.MIDDLE_CENTER);
    }

    if (isSaveAndNewBtnVisible) {
        final Button saveAndNewBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        if (EditFormControlsGenerator.this.editForm.validateForm()) {
                            EditFormControlsGenerator.this.editForm.fireSaveAndNewForm();
                        }
                    }
                });
        saveAndNewBtn.setIcon(FontAwesome.SHARE_ALT);
        saveAndNewBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        layout.addComponent(saveAndNewBtn);
        layout.setComponentAlignment(saveAndNewBtn, Alignment.MIDDLE_CENTER);
    }

    if (isCancelBtnVisible) {
        final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        EditFormControlsGenerator.this.editForm.fireCancelForm();
                    }
                });
        cancelBtn.setIcon(FontAwesome.MINUS);
        cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
        layout.addComponent(cancelBtn);
        layout.setComponentAlignment(cancelBtn, Alignment.MIDDLE_CENTER);
    }

    return layout;
}

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

License:Open Source License

@PostConstruct
@Override/*from   w  w w.ja  va  2  s.c  o m*/
public void postConstruct() {
    super.postConstruct();

    String typeName = domainMessageSource.getMessage(getType().getName(), getType().getSimpleName());
    labelRegistry.putTypeLabel(getType().getName(), typeName);

    List<ToManyRelationship> toManyRelationships = getViewableToManyRelationships();
    if (toManyRelationships.size() > 0) {
        toManyRelationshipTabs = new TabSheet();
        setDebugId(toManyRelationshipTabs, "toManyRelationshipTabs");
        toManyRelationshipTabs.setSizeUndefined();
        for (ToManyRelationship toManyRelationship : toManyRelationships) {
            toManyRelationshipTabs.addTab(toManyRelationship);
            toManyRelationship.getResultsTable().addExecuteQueryListener(this, "requestRepaintAll");
            labelRegistry.putFieldLabel(getType().getName(), toManyRelationship.getChildPropertyId(),
                    "Relationship", toManyRelationship.getTypeCaption());
        }

        HorizontalLayout toManyRelationshipLayout = new HorizontalLayout();
        setDebugId(toManyRelationshipLayout, "toManyRelationshipLayout");
        toManyRelationshipLayout.setSizeUndefined();
        Label label = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", Label.CONTENT_XHTML);
        toManyRelationshipLayout.addComponent(label);
        toManyRelationshipLayout.addComponent(toManyRelationshipTabs);
        addComponent(toManyRelationshipLayout);
    }

    addCodePopupButtonIfEnabled(Alignment.MIDDLE_RIGHT, EntityForm.class);
}

From source file:com.expressui.core.view.form.layout.LeftLabelGridLayout.java

License:Open Source License

private void addFieldImpl(FormField formField) {
    Label label = formField.getFieldLabel();

    HorizontalLayout fieldLayout = new HorizontalLayout();
    String id = StringUtil.generateDebugId("e", this, fieldLayout, "fieldLayout");
    fieldLayout.setDebugId(id);// www  . java 2  s.co m
    fieldLayout.setSizeUndefined();
    Field field = formField.getField();
    fieldLayout.addComponent(field);

    Label spacer = new Label();
    spacer.setWidth("1em");

    if (formField.getColumnEnd() != null && formField.getRowEnd() != null) {
        addComponent(label, getLabelColumn(formField), getRowStart(formField), getLabelColumn(formField),
                getRowEnd(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField), getColumnEnd(formField),
                getRowEnd(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField), getSpacerColumn(formField),
                getRowEnd(formField));
    } else {
        addComponent(label, getLabelColumn(formField), getRowStart(formField));

        addComponent(fieldLayout, getFieldColumn(formField), getRowStart(formField));

        addComponent(spacer, getSpacerColumn(formField), getRowStart(formField));
    }
    setComponentAlignment(fieldLayout, Alignment.TOP_LEFT);
    setComponentAlignment(label, Alignment.TOP_RIGHT);
    setComponentAlignment(spacer, Alignment.TOP_LEFT);
}

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();/* ww w. j  a  va2 s. c  o m*/
    previousButtonLayout.addComponent(spaceLabel);

    Button previousButton = new Button(null, this, "previousItem");
    previousButton.setDescription(entityForm.uiMessageSource.getToolTip("entityForm.previous.toolTip"));
    previousButton.setSizeUndefined();
    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

/**
 * 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   w  w  w  . jav  a2  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;
}