Example usage for com.vaadin.ui HorizontalLayout setWidthUndefined

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

Introduction

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

Prototype

@Override
    public void setWidthUndefined() 

Source Link

Usage

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

License:Open Source License

private ComponentContainer createButtonControls() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);/*from   w ww .ja  va  2 s . c om*/
    layout.setMargin(true);

    HorizontalLayout buttonWrapper = new HorizontalLayout();
    buttonWrapper.setWidthUndefined();
    buttonWrapper.setSpacing(true);

    Button updateBtn = new Button("Update", new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            updateContactRoles();
        }
    });
    updateBtn.setIcon(FontAwesome.SAVE);
    updateBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    buttonWrapper.addComponent(updateBtn);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    ViewState viewState = HistoryViewManager.back();

                    if (viewState instanceof NullViewState) {
                        EventBusFactory.getInstance().post(new ContactEvent.GotoList(this, null));
                    }

                }
            });
    cancelBtn.setIcon(FontAwesome.TIMES);
    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);
    buttonWrapper.addComponent(cancelBtn);

    layout.addComponent(buttonWrapper);
    layout.setComponentAlignment(buttonWrapper, Alignment.MIDDLE_CENTER);

    return layout;
}

From source file:com.etest.view.tq.charts.ItemAnalysisGraphicalViewAll.java

public ItemAnalysisGraphicalViewAll(int curriculumId) {
    this.curriculumId = curriculumId;

    setModal(true);/*w  w w. j  ava2  s  .  c  om*/
    setHeight("100%");

    VerticalLayout v = new VerticalLayout();
    v.setMargin(true);
    v.setSpacing(true);

    Label title = new Label();
    title.setCaption("Item Analysis of " + cs.getCurriculumById(getCurriculumId()).getSubject());
    title.setWidthUndefined();
    v.addComponent(title);
    v.setComponentAlignment(title, Alignment.TOP_CENTER);

    HorizontalLayout h = new HorizontalLayout();
    h.setSpacing(true);

    h.addComponent(getDiscriminationIndexChart());
    h.addComponent(getDifficultIndexChart());

    h.setWidthUndefined();
    h.setHeightUndefined();

    v.addComponent(h);
    v.setWidthUndefined();

    setContent(v);
    getContent().setWidthUndefined();
    //        getContent().setHeightUndefined();
    center();
}

From source file:com.fnc.view.ui.AlphaListMainUI.java

public AlphaListMainUI() {
    setSizeFull();/*from  w ww  .  j  a v a  2  s . co m*/
    setMargin(true);

    addComponent(buildForms());

    HorizontalLayout h = new HorizontalLayout();
    h.setWidthUndefined();
    h.setSpacing(true);

    progress.setWidth("150px");
    h.addComponent(progress);
    h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h.addComponent(status);

    addComponent(h);
    addComponent(grid);
}

From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java

public ThirteenthMonthUI() {
    setSizeFull();/*  w w w  . j a  va 2  s  .c om*/
    setMargin(true);

    addComponent(buildForms());

    HorizontalLayout h = new HorizontalLayout();
    h.setWidthUndefined();
    h.setSpacing(true);

    progress.setWidth("150px");
    h.addComponent(progress);
    h.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h.addComponent(status);

    addComponent(h);
}

From source file:com.haulmont.cuba.web.gui.components.presentations.PresentationEditor.java

License:Apache License

protected void initLayout() {
    ThemeConstants theme = App.getInstance().getThemeConstants();

    VerticalLayout root = new VerticalLayout();
    root.setWidthUndefined();/*from ww w .  j  av  a2  s.c  o m*/
    root.setSpacing(true);
    setContent(root);

    messages = AppBeans.get(Messages.class);

    nameField = new TextField(messages.getMainMessage("PresentationsEditor.name"));
    nameField.setWidth(theme.get("cuba.web.PresentationEditor.name.width"));
    nameField.setValue(getPresentationCaption());
    root.addComponent(nameField);

    autoSaveField = new CheckBox();
    autoSaveField.setCaption(messages.getMainMessage("PresentationsEditor.autoSave"));
    autoSaveField.setValue(BooleanUtils.isTrue(presentation.getAutoSave()));
    root.addComponent(autoSaveField);

    defaultField = new CheckBox();
    defaultField.setCaption(messages.getMainMessage("PresentationsEditor.default"));
    defaultField.setValue(presentation.getId().equals(component.getDefaultPresentationId()));
    root.addComponent(defaultField);

    if (allowGlobalPresentations) {
        globalField = new CheckBox();
        globalField.setCaption(messages.getMainMessage("PresentationsEditor.global"));
        globalField.setValue(!isNew && presentation.getUser() == null);
        root.addComponent(globalField);
    }

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setWidthUndefined();
    root.addComponent(buttons);
    root.setComponentAlignment(buttons, Alignment.MIDDLE_LEFT);

    Button commitButton = new CubaButton(messages.getMainMessage("PresentationsEditor.save"));
    commitButton.addClickListener(event -> {
        if (validate()) {
            commit();
            close();
        }
    });
    buttons.addComponent(commitButton);

    Button closeButton = new CubaButton(messages.getMainMessage("PresentationsEditor.close"));
    closeButton.addClickListener(event -> {
        close();
    });
    buttons.addComponent(closeButton);

    nameField.focus();
}

From source file:com.hris.payroll.alphalist.AlphaListMainUI.java

public AlphaListMainUI(int branchId) {
    this.branchId = branchId;

    setSizeFull();/*  w w w  . j a v  a 2s.  c o  m*/
    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(true);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setCaption("Year: ");
    h1.setWidthUndefined();
    h1.setSpacing(true);

    h1.addComponent(employmentStatus);
    h1.addComponent(selectYear());
    h1.addComponent(alphaListButton());
    h1.addComponent(exportToExcelButton());

    addComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidthUndefined();
    h2.setSpacing(true);

    progress.setWidth("410px");
    h2.addComponent(progress);
    h2.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h2.addComponent(status);

    processLabel.setValue("");
    h2.addComponent(processLabel);

    addComponent(h2);
    addComponent(grid);
    setExpandRatio(grid, 3);
}

From source file:com.hris.payroll.reports.ReportUI.java

public ReportUI(int branchId) {
    this.branchId = branchId;

    setSizeFull();//from   w ww  . java2s. com
    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(true);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidthUndefined();
    h1.setSpacing(true);

    h1.addComponent(reportType);
    h1.addComponent(payrollDateField());
    h1.addComponent(viewReportBtn());

    addComponent(h1);
    addComponent(grid);
    setExpandRatio(grid, 2);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidthUndefined();
    h2.setSpacing(true);
}

From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java

public ThirteenthMonth(int branchId) {
    this.branchId = branchId;

    setSizeFull();//from w  w w.j av  a2 s .com
    setMargin(new MarginInfo(true, true, false, true));
    setSpacing(true);

    HorizontalLayout h1 = new HorizontalLayout();
    h1.setWidthUndefined();
    h1.setSpacing(true);

    h1.addComponent(employmentStatus);
    h1.addComponent(selectYear());
    h1.addComponent(generate13thMonth());
    h1.addComponent(exportToExcelButton());

    addComponent(h1);

    HorizontalLayout h2 = new HorizontalLayout();
    h2.setWidthUndefined();
    h2.setSpacing(true);

    progress.setWidth("410px");
    h2.addComponent(progress);
    h2.setComponentAlignment(progress, Alignment.MIDDLE_LEFT);

    status.setValue("0%");
    h2.addComponent(status);

    grid = new ThirteenthMonthDataGridProperty();
    addComponent(h2);
    addComponent(grid);
    setExpandRatio(grid, 3);
}

From source file:de.symeda.sormas.ui.configuration.outbreak.OutbreakRegionConfigurationForm.java

License:Open Source License

private HorizontalLayout createHeader() {
    HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidth(100, Unit.PERCENTAGE);
    headerLayout.setSpacing(true);/*from  w ww  .  j  a  v a 2 s  .  com*/
    CssStyles.style(headerLayout, CssStyles.VSPACE_2);

    // Headline and info text
    Label infoTextLabel = new Label(I18nProperties.getString(Strings.headingDefineOutbreakDistricts));
    infoTextLabel.setWidthUndefined();
    CssStyles.style(infoTextLabel, CssStyles.VSPACE_TOP_4);
    headerLayout.addComponent(infoTextLabel);

    // Number of affected districts and options to toggle outbreak mode for all districts   
    HorizontalLayout allDistrictsLayout = new HorizontalLayout();
    allDistrictsLayout.setWidthUndefined();
    allDistrictsLayout.setSpacing(true);
    {
        Label allDistrictsLabel = new Label(I18nProperties.getString(Strings.headingSetOutbreakStatus));
        allDistrictsLabel.setWidthUndefined();
        CssStyles.style(allDistrictsLabel, CssStyles.VSPACE_TOP_4);
        allDistrictsLayout.addComponent(allDistrictsLabel);

        OptionGroup outbreakToggle = new OptionGroup();
        CssStyles.style(outbreakToggle, ValoTheme.OPTIONGROUP_HORIZONTAL,
                CssStyles.OPTIONGROUP_HORIZONTAL_SWITCH_CRITICAL);
        outbreakToggle.addItem(OUTBREAK);
        outbreakToggle.addItem(NORMAL);

        if (affectedDistricts.isEmpty()) {
            outbreakToggle.setValue(NORMAL);
        } else if (affectedDistricts.size() == totalDistricts) {
            outbreakToggle.setValue(OUTBREAK);
        }

        outbreakToggle.addValueChangeListener(e -> {
            for (OptionGroup districtOutbreakToggle : outbreakToggles) {
                districtOutbreakToggle.setValue(e.getProperty().getValue());
            }
        });

        outbreakToggle.setWidthUndefined();
        allDistrictsLayout.addComponent(outbreakToggle);

        affectedDistrictsNumberLabel = new Label();
        affectedDistrictsNumberLabel.setWidthUndefined();
        allDistrictsLayout.addComponent(affectedDistrictsNumberLabel);
    }
    headerLayout.addComponent(allDistrictsLayout);
    headerLayout.setComponentAlignment(allDistrictsLayout, Alignment.TOP_RIGHT);

    headerLayout.setExpandRatio(infoTextLabel, 1);

    return headerLayout;
}

From source file:fi.semantum.strategia.widget.Indicator.java

License:Open Source License

public static void manageIndicators(final Main main, final Base base) {

    String currentTime = main.getUIState().time;
    boolean showYears = currentTime.equals(Property.AIKAVALI_KAIKKI);

    final Database database = main.getDatabase();

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//from   w  ww. j  a  va  2  s  . c o  m
    content.setSpacing(true);

    final Table table = new Table();
    table.setSelectable(true);
    table.setMultiSelect(true);
    table.addStyleName(ValoTheme.TABLE_SMALL);
    table.addStyleName(ValoTheme.TABLE_COMPACT);

    table.addContainerProperty("Indikaattori", Label.class, null);
    if (showYears)
        table.addContainerProperty("Vuosi", String.class, null);

    table.setWidth("100%");
    table.setHeight("100%");
    table.setNullSelectionAllowed(true);

    table.setEditable(false);
    table.setColumnExpandRatio("Indikaattori", 2.0f);
    if (showYears)
        table.setColumnExpandRatio("Vuosi", 0.0f);

    makeIndicatorTable(main, base, table);

    content.addComponent(table);
    content.setExpandRatio(table, 1.0f);

    abstract class IndicatorButtonListener implements Button.ClickListener {

        private static final long serialVersionUID = -7551250112503063540L;

        protected Indicator getPossibleSelection() {
            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;
            if (selected.size() != 1)
                return null;
            return (Indicator) selected.iterator().next();
        }

        @SuppressWarnings("unchecked")
        protected Collection<Indicator> getSelection() {
            return (Collection<Indicator>) table.getValue();
        }

        protected Map<Base, List<Indicator>> getSelectionByParent(Database database) {
            return indicatorsByParent(database, getSelection());
        }

    }

    final Button removeIndicators = new Button("Poista", new IndicatorButtonListener() {

        private static final long serialVersionUID = -2538054127519468282L;

        public void buttonClick(ClickEvent event) {

            Collection<Indicator> selection = getSelection();
            for (Indicator i : selection) {
                Base owner = i.getOwner(database);
                if (owner == null)
                    continue;
                owner.removeIndicator(i);
            }

            final Set<Base> bases = new HashSet<Base>();
            final Strategiakartta map = database.getMap(base);
            bases.add(map);
            for (Tavoite t : map.tavoitteet) {
                bases.add(t);
                for (Painopiste p : t.painopisteet) {
                    bases.add(p);
                }
            }
            for (Base b : bases) {
                for (Meter meter : b.getMeters(database)) {
                    Indicator indicator = meter.getPossibleIndicator(database);
                    if (selection.contains(indicator)) {
                        b.removeMeter(meter);
                    }
                }
            }

            makeIndicatorTable(main, base, table);

            Updates.update(main, true);

        }

    });
    removeIndicators.addStyleName(ValoTheme.BUTTON_TINY);

    final Button moveUp = new Button("Siirr ylemms", new IndicatorButtonListener() {

        private static final long serialVersionUID = -635232943884881464L;

        public void buttonClick(ClickEvent event) {

            for (Map.Entry<Base, List<Indicator>> entry : getSelectionByParent(database).entrySet()) {
                entry.getKey().moveIndicatorsUp(entry.getValue());
            }

            makeIndicatorTable(main, base, table);
            Updates.update(main, true);

        }

    });
    moveUp.addStyleName(ValoTheme.BUTTON_TINY);

    final Button moveDown = new Button("Siirr alemmas", new IndicatorButtonListener() {

        private static final long serialVersionUID = 2779521990166604444L;

        public void buttonClick(ClickEvent event) {

            for (Map.Entry<Base, List<Indicator>> entry : getSelectionByParent(database).entrySet()) {
                entry.getKey().moveIndicatorsDown(entry.getValue());
            }

            makeIndicatorTable(main, base, table);
            Updates.update(main, true);

        }

    });
    moveDown.addStyleName(ValoTheme.BUTTON_TINY);

    final Button modify = new Button("Mrit");
    modify.addClickListener(new IndicatorButtonListener() {

        private static final long serialVersionUID = 5149432436059288486L;

        public void buttonClick(ClickEvent event) {

            Indicator indicator = getPossibleSelection();
            if (indicator == null)
                return;

            editIndicator(main, base, indicator);

        }

    });
    modify.addStyleName(ValoTheme.BUTTON_TINY);

    final TextField indicatorText = new TextField();
    indicatorText.setWidth("100%");
    indicatorText.addStyleName(ValoTheme.TEXTFIELD_TINY);
    indicatorText.setCaption("Tunniste");

    List<Datatype> types = Datatype.enumerate(database);

    final ComboBox datatypeSelect = new ComboBox();
    datatypeSelect.setWidth("100%");
    datatypeSelect.setNullSelectionAllowed(false);
    datatypeSelect.addStyleName(ValoTheme.COMBOBOX_TINY);
    datatypeSelect.setCaption("Tietotyyppi");
    for (Datatype dt : types)
        datatypeSelect.addItem(dt);

    final Button addIndicator = new Button("Lis ptasolle", new Button.ClickListener() {

        private static final long serialVersionUID = -2395147866745115337L;

        public void buttonClick(ClickEvent event) {

            String text = indicatorText.getValue();
            Object dt = datatypeSelect.getValue();
            if (text.isEmpty() || dt == null || dt.equals(datatypeSelect.getNullSelectionItemId()))
                return;

            base.addIndicator(Indicator.create(database, text, (Datatype) dt));
            makeIndicatorTable(main, base, table);
            Updates.update(main, true);

        }

    });
    addIndicator.addStyleName(ValoTheme.BUTTON_TINY);

    final Button addSubIndicator = new Button("Lis valitun alle", new IndicatorButtonListener() {

        private static final long serialVersionUID = -2395147866745115337L;

        public void buttonClick(ClickEvent event) {

            Indicator indicator = getPossibleSelection();
            if (indicator == null)
                return;

            String text = indicatorText.getValue();
            Object dt = datatypeSelect.getValue();
            if (text.isEmpty() || dt == null || dt.equals(datatypeSelect.getNullSelectionItemId()))
                return;

            indicator.addIndicator(Indicator.create(database, text, (Datatype) dt));
            makeIndicatorTable(main, base, table);

            Updates.update(main, true);

        }

    });
    addSubIndicator.addStyleName(ValoTheme.BUTTON_TINY);

    final Runnable setStates = new Runnable() {

        @Override
        public void run() {

            Object selection = table.getValue();
            Collection<?> selected = (Collection<?>) selection;
            if (!selected.isEmpty()) {
                removeIndicators.setEnabled(true);
                moveUp.setEnabled(true);
                moveDown.setEnabled(true);
                if (selected.size() == 1) {
                    modify.setEnabled(true);
                    addSubIndicator.setEnabled(true);
                } else {
                    addSubIndicator.setEnabled(false);
                    modify.setEnabled(false);
                }
            } else {
                moveUp.setEnabled(false);
                moveDown.setEnabled(false);
                removeIndicators.setEnabled(false);
                addSubIndicator.setEnabled(false);
                modify.setEnabled(false);
            }

        }

    };

    table.addValueChangeListener(new ValueChangeListener() {

        private static final long serialVersionUID = 1188285609779556446L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            setStates.run();
        }

    });

    setStates.run();

    HorizontalLayout hl2 = new HorizontalLayout();
    hl2.setSpacing(true);
    hl2.setWidthUndefined();

    hl2.addComponent(modify);
    hl2.setComponentAlignment(modify, Alignment.BOTTOM_LEFT);
    hl2.setExpandRatio(modify, 0.0f);

    hl2.addComponent(removeIndicators);
    hl2.setComponentAlignment(removeIndicators, Alignment.BOTTOM_LEFT);
    hl2.setExpandRatio(removeIndicators, 0.0f);

    hl2.addComponent(moveUp);
    hl2.setComponentAlignment(moveUp, Alignment.TOP_LEFT);
    hl2.setExpandRatio(moveUp, 0.0f);

    hl2.addComponent(moveDown);
    hl2.setComponentAlignment(moveDown, Alignment.TOP_LEFT);
    hl2.setExpandRatio(moveDown, 0.0f);

    HorizontalLayout hl3 = new HorizontalLayout();
    hl3.setSpacing(true);
    hl3.setWidth("100%");

    hl3.addComponent(addIndicator);
    hl3.setComponentAlignment(addIndicator, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(addIndicator, 0.0f);

    hl3.addComponent(addSubIndicator);
    hl3.setComponentAlignment(addSubIndicator, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(addSubIndicator, 0.0f);

    hl3.addComponent(indicatorText);
    hl3.setComponentAlignment(indicatorText, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(indicatorText, 1.0f);

    hl3.addComponent(datatypeSelect);
    hl3.setComponentAlignment(datatypeSelect, Alignment.BOTTOM_LEFT);
    hl3.setExpandRatio(datatypeSelect, 2.0f);

    content.addComponent(hl2);
    content.setComponentAlignment(hl2, Alignment.BOTTOM_LEFT);
    content.setExpandRatio(hl2, 0.0f);

    content.addComponent(hl3);
    content.setComponentAlignment(hl3, Alignment.BOTTOM_LEFT);
    content.setExpandRatio(hl3, 0.0f);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    buttons.setMargin(false);

    final Window dialog = Dialogs.makeDialog(main, "650px", "800px", "Hallitse indikaattoreita", "Sulje",
            content, buttons);

}