Example usage for com.vaadin.ui VerticalLayout addComponent

List of usage examples for com.vaadin.ui VerticalLayout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout addComponent.

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVCommentLayout.java

License:Apache License

@Override
public void fillMenu(VerticalLayout root) {
    root.addComponent(getViewCommentsButton(true));
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVStageLayout.java

License:Apache License

@Override
public void fillMenu(VerticalLayout root) {
    setRootVerticalLayout(root);/*  w  ww.j a v a 2s  .c  o m*/

    if (isObjectNeedsSignatureFromThisUser()) {
        PopupLinkButton button = getSignButton(true);
        if (button != null) {
            root.addComponent(button);
        }

        button = getCancelPreviousSignatureButton(true);
        if (button != null) {
            root.addComponent(button);
        }
    }

    if (getFocObject() != null && getFocObject().workflow_IsLastSignatureDoneByThisUser(true)) {
        PopupLinkButton button = getUndoSignatureButton(true);
        root.addComponent(button);
    }
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVStatusLayout.java

License:Apache License

@Override
public void fillMenu(VerticalLayout root) {
    setRootVerticalLayout(root);/*from  w w  w  .  jav  a2s. co  m*/
    FProperty property = (FProperty) getFocObject().iFocData_getDataByPath(StatusHolderDesc.FNAME_STATUS);
    int status = property.getInteger();

    WFTransactionConfig transConfig = getFocObject().workflow_getTransactionConfig();
    boolean hasMapForSignatures = transConfig != null ? transConfig.isApproveByMapSignature() : false;

    if (status == StatusHolderDesc.STATUS_PROPOSAL) {
        if (getFocObject().workflow_IsAllowApprove() /*&& !hasMapForSignatures*/) {
            root.addComponent(getApproveButton(true));
        }
        if (getFocObject().workflow_IsAllowCancel()) {
            root.addComponent(getCancelButton(true));
        }
    } else if (status == StatusHolderDesc.STATUS_APPROVED) {
        if (getFocObject().workflow_IsAllowCancel()) {
            root.addComponent(getCancelButton(true));
        }
        if (getFocObject().workflow_IsAllowClose()) {
            root.addComponent(getCloseButton(true));
        }
    }

    if (getFocObject().workflow_IsAllowResetToProposal()) {
        if (status != StatusHolderDesc.STATUS_PROPOSAL)
            root.addComponent(getResetStatusButton(true));
    }
}

From source file:com.foc.vaadin.gui.layouts.validationLayout.FVViewSelector.java

License:Apache License

@Override
public void fillMenu(VerticalLayout root) {
    // Globals.getApp().getUser_ForThisSession().allowViewModification(xmlViewKey)
    PopupLinkButton modifyButton = new PopupLinkButton("Modify", new ClickListener() {
        @Override/*from   ww w .j a v a  2s.  co  m*/
        public void buttonClick(ClickEvent event) {
            if (getCentralPanel().getXMLView().isSystemView() && !ConfigInfo.isForDevelopment()) {
                Globals.showNotification("Cannot modify system view.", "You can duplicate it.",
                        FocWebEnvironment.TYPE_HUMANIZED_MESSAGE);
            } else {
                if (centralPanel != null) {
                    INavigationWindow window = centralPanel.getMainWindow();
                    if (window != null) {
                        RightPanel rightPanel = (RightPanel) centralPanel.getRightPanel(true);// new
                                                                                              // RightPanel(centralPanel,
                                                                                              // focDesc);
                        window.addUtilityPanel(rightPanel);
                    }
                }
            }
        }
    });
    root.addComponent(modifyButton);

    PopupLinkButton duplicateButton = new PopupLinkButton("Duplicate", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            OptionSelectorWindow displayWindow = new OptionSelectorWindow(FVViewSelector.this);
            displayWindow.duplicate();
            FocWebApplication.getInstanceForThread().addWindow(displayWindow);
        }
    });
    root.addComponent(duplicateButton);

    PopupLinkButton addButton = new PopupLinkButton("New", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            OptionSelectorWindow displayWindow = new OptionSelectorWindow(FVViewSelector.this);
            displayWindow.newViewWindow();
            FocWebApplication.getInstanceForThread().addWindow(displayWindow);
        }
    });
    root.addComponent(addButton);

    PopupLinkButton delButton = new PopupLinkButton("Delete", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            if (getCentralPanel().getXMLView().isSystemView()) {
                Globals.showNotification("Cannot delete system views", "",
                        FocWebEnvironment.TYPE_HUMANIZED_MESSAGE);
            } else {
                OptionSelectorWindow displayWindow = new OptionSelectorWindow(FVViewSelector.this);
                displayWindow.deleteView(comboBox.getValue().toString());
                FocWebApplication.getInstanceForThread().addWindow(displayWindow);
            }
        }
    });
    root.addComponent(delButton);

    PopupLinkButton showIncludesButton = new PopupLinkButton("Show included views", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // if(getCentralPanel().getXMLView().isSystemView()){
            // Globals.showNotification("Cannot delete system views", "",
            // FocWebEnvironment.TYPE_HUMANIZED_MESSAGE);
            // }else{

            ICentralPanel centralPanel = getCentralPanel();
            if (centralPanel instanceof FocXMLLayout) {
                FocXMLLayout lay = (FocXMLLayout) centralPanel;
                lay.scanLayoutsAndShowViewValidationLayouts();
            }

        }
    });
    root.addComponent(showIncludesButton);

    PopupLinkButton setForPrintingButton = new PopupLinkButton("Set as default printing view",
            new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    XMLView xmlView = getCentralPanel() != null ? getCentralPanel().getXMLView() : null;
                    if (xmlView != null) {
                        XMLViewKey xmlViewKey = xmlView.getXmlViewKey();
                        if (xmlViewKey != null) {
                            XMLViewDictionary xmlViewDictionary = XMLViewDictionary.getInstance();
                            xmlViewDictionary.userViewSelected_saveViewForUserPrintingView(
                                    FocWebApplication.getFocUser(), xmlViewKey);
                            Globals.showNotification("Printing view has been updated.", "",
                                    IFocEnvironment.TYPE_HUMANIZED_MESSAGE);
                        }
                    }
                }
            });
    root.addComponent(setForPrintingButton);
}

From source file:com.foo01.components.ReservationComponent.java

public static Component build(final Reservation r) {
    final HorizontalLayout reservationComponentLayout = new HorizontalLayout();

    final VerticalLayout datesLayout = new VerticalLayout();
    Label beginningDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getBeginning().getTime()));
    Label endingDate = new Label(
            (new SimpleDateFormat("E dd.MM.", Locale.getDefault())).format(r.getEnding().getTime()));
    beginningDate.addStyleName("datelabel");
    endingDate.addStyleName("datelabel");
    datesLayout.addComponent(beginningDate);
    datesLayout.addComponent(endingDate);
    datesLayout.setSpacing(true);//from www . j a v  a  2  s . c o m
    reservationComponentLayout.addComponent(datesLayout);

    Label reservationInfoLabel = new Label(r.getUser() + "</br></br>" + r.getDescription(), ContentMode.HTML);
    reservationInfoLabel.addStyleName("informationlabel");
    reservationComponentLayout.addComponent(reservationInfoLabel);

    Label rightArrowIconLabel = new Label("</br>" + FontAwesome.CHEVRON_RIGHT.getHtml(), ContentMode.HTML);
    rightArrowIconLabel.addStyleName("rightArrowIconLabel");
    reservationComponentLayout.addComponent(rightArrowIconLabel);

    reservationComponentLayout.setSpacing(true);
    reservationComponentLayout.setWidth("100%");
    datesLayout.setWidth("85px");
    reservationInfoLabel.setSizeFull();
    rightArrowIconLabel.setHeight("100%");
    rightArrowIconLabel.setWidth("20px");
    reservationComponentLayout.setExpandRatio(reservationInfoLabel, 1.0f);

    reservationComponentLayout.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            //System.out.println(event.getClickedComponent().getParent().getId());
            ((foo01TouchKitUI) UI.getCurrent()).NAVIGATIONMANAGER.navigateTo(new ReservationView(r));
        }
    });

    return reservationComponentLayout;
}

From source file:com.foo01.ui.ReservationDetailView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setStyleName("buttonToolBarLayout");
    buttonsLayout.setWidth("100%");

    Button deleteButton = new Button();
    deleteButton.setCaption("SMAZAT");
    deleteButton.setWidth(null);//w w w  . j av a  2 s. c o m
    buttonsLayout.addComponent(deleteButton);

    Label plug = new Label();
    buttonsLayout.addComponent(plug);

    Button saveButton = new Button();
    saveButton.setCaption("ULOIT");
    saveButton.setWidth(null);
    buttonsLayout.addComponent(saveButton);
    buttonsLayout.setExpandRatio(plug, 1.0f);
    List<Source> sourcesList = MockSource.mockSources();

    //combobox na zdroje a jmeno uzivatele
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.setStyleName(width);
    content.addComponent(buttonsLayout);
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.foo01.ui.ReservationView.java

@Override
protected final void onBecomingVisible() {
    getNavigationBar().setCaption("Detail Rezervace");

    //buttony pod navbarem
    //        HorizontalLayout buttonsLayout = new HorizontalLayout();
    //        buttonsLayout.setStyleName("buttonToolBarLayout");
    //        buttonsLayout.setWidth("100%");
    ///* w w  w . ja va 2s. c o  m*/
    //        Button deleteButton = new Button();
    //        deleteButton.setCaption("SMAZAT");
    //        deleteButton.setWidth(null);
    //        buttonsLayout.addComponent(deleteButton);
    //
    //        Label plug = new Label();
    //        buttonsLayout.addComponent(plug);
    //
    //        Button saveButton = new Button();
    //        saveButton.setCaption("ULOIT");
    //        saveButton.setWidth(null);
    //        buttonsLayout.addComponent(saveButton);
    //        buttonsLayout.setExpandRatio(plug, 1.0f);  

    //combobox na zdroje a jmeno uzivatele
    List<Source> sourcesList = MockSource.mockSources();
    HorizontalLayout sourceAndNameLayout = new HorizontalLayout();
    sourceAndNameLayout.setWidth("100%");
    sourceAndNameLayout.setStyleName("sourceAndNameLayout");

    NativeSelect select = new NativeSelect();
    select.setNullSelectionAllowed(false);
    System.out.println(Page.getCurrent().getBrowserWindowWidth());
    String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px";
    select.setWidth(width);
    select.addItems(sourcesList);
    for (Source s : sourcesList) {
        if (reservation.getSource().equals(s)) {
            select.select(s);
            break;
        }
    }
    sourceAndNameLayout.addComponent(select);

    Label plug2 = new Label();
    sourceAndNameLayout.addComponent(plug2);

    Label name = new Label(reservation.getUser());
    name.setWidth(null);
    sourceAndNameLayout.addComponent(name);
    sourceAndNameLayout.setExpandRatio(plug2, 1.0f);

    //datepickery
    DatePicker dateFrom = new DatePicker();
    dateFrom.setStyleName("datePickerDetailView");
    dateFrom.setValue(reservation.getBeginning());
    dateFrom.setUseNative(true);
    dateFrom.setResolution(Resolution.TIME);
    dateFrom.setWidth("100%");

    DatePicker dateTo = new DatePicker();
    dateTo.setStyleName("datePickerDetailView");
    dateTo.setValue(reservation.getEnding());
    dateTo.setUseNative(true);
    dateTo.setResolution(Resolution.TIME);
    dateTo.setWidth("100%");

    //layout pro slider a popisky
    HorizontalLayout sliderLayout = new HorizontalLayout();
    sliderLayout.setStyleName("sliderLayout");
    sliderLayout.setWidth("100%");
    sliderLayout.setSpacing(true);

    Label sliderCaption = new Label("Po?et: ");
    sliderCaption.addStyleName("sliderCaption");
    sliderCaption.setWidth(null);
    sliderLayout.addComponent(sliderCaption);

    final Label horvalue = new Label();
    horvalue.setWidth("45px");
    horvalue.setStyleName("value");
    sliderLayout.addComponent(horvalue);

    final Slider horslider = new Slider(1, 10);
    horslider.setOrientation(SliderOrientation.HORIZONTAL);
    horslider.setValue(Double.valueOf(1));
    horslider.getState();
    horslider.getValue();
    horslider.setImmediate(true);
    horslider.setWidth("100%");
    sliderLayout.addComponent(horslider);
    sliderLayout.setExpandRatio(horslider, 1.0f);

    horvalue.setValue(String.valueOf(horslider.getValue().intValue()));

    horslider.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            int value = horslider.getValue().intValue();

            horvalue.setValue(String.valueOf(value));
        }
    });

    //switch schvaleno
    HorizontalLayout switchLayout = new HorizontalLayout();
    switchLayout.setStyleName("switchLayout");
    switchLayout.addComponent(new Label("Schvleno:"));
    switchLayout.setSpacing(true);
    Switch checkbox = new Switch(null, true);
    switchLayout.addComponent(checkbox);

    //popis rezervace
    TextArea description = new TextArea();
    description.setStyleName("descriptionDetailView");

    description.setWidth("100%");
    description.setImmediate(false);
    description.setCaption("Popis:");
    description.setValue(reservation.getDescription());
    //description.setRequired(true);
    description.setRequiredError("Popis mus bt zadn!");
    description.setNullRepresentation("");
    description.setReadOnly(true);
    //description.setRows(0);

    final VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSpacing(true);
    content.addComponent(new ButtonToolBarLayout(this));
    content.addComponent(sourceAndNameLayout);
    content.addComponent(dateFrom);
    content.addComponent(dateTo);

    content.addComponent(sliderLayout);
    content.addComponent(switchLayout);
    content.addComponent(description);

    setContent(content);
}

From source file:com.freebox.engeneering.application.web.common.ApplicationLayout.java

License:Apache License

/**
  * Initializes view layout when system enters 'initView' action state.
  *//from  ww w . jav a2s . co m
  * @param event -  state event.
  */
public void initView(@SuppressWarnings("rawtypes") StateEvent event) {
    final HorizontalLayout content = new HorizontalLayout();
    content.setSizeFull();
    content.setStyleName("main-view");

    final HorizontalSplitPanel leftSplitPanel = new HorizontalSplitPanel();
    leftSplitPanel.setSplitPosition(20, Sizeable.Unit.PERCENTAGE);

    final ComponentContainer leftSideBar = createPlaceholder(StateLayout.LEFT_SIDE_BAR);
    leftSideBar.setSizeFull();
    content.addComponent(leftSideBar, 0);

    final VerticalLayout verticalLayoutContent = new VerticalLayout();
    verticalLayoutContent.setStyleName("freebox-view");
    verticalLayoutContent.addComponent(createPlaceholder(StateLayout.HEADER));
    verticalLayoutContent.setSpacing(true);
    final ComponentContainer layoutContent = createPlaceholder(StateLayout.CONTENT);
    layoutContent.setSizeFull();
    verticalLayoutContent.addComponent(layoutContent);
    verticalLayoutContent.setSizeFull();
    //verticalLayoutContent.addComponent(createPlaceholder(StateLayout.FOOTER));

    verticalLayoutContent.setExpandRatio(layoutContent, 8f);

    content.addComponent(verticalLayoutContent, 1);
    content.setExpandRatio(leftSideBar, 1.0f);
    content.setExpandRatio(verticalLayoutContent, 9f);

    setView(content);
}

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  .  j a v  a 2 s .  com
 */
@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.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();//from   ww w.ja v  a2s .c om
    sideBarHeader.addComponent(logo);

    verticalLayout.addComponent(sideBarHeader);

}