Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

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

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

From source file:com.foc.vaadin.FocCentralPanel.java

License:Apache License

protected void adjustToFullScreen(ICentralPanel newCentralPanel, boolean fullScreen) {
    //Panel-Vertical

    if (newCentralPanel != null && newCentralPanel instanceof Component) {
        if (fullScreen) {
            centralPanel.setContent((Component) newCentralPanel);
            centralPanel.markAsDirty();/*from   w w  w .j  a v  a2 s.co  m*/
            ((Component) newCentralPanel).setWidth("100%");
            //getCentralPanelWrapper().setWidth("100%");
        } else {
            Component newCentralPanleComponent = (Component) newCentralPanel;

            HorizontalLayout wrapperOfCentralLayout = new HorizontalLayout();
            wrapperOfCentralLayout.addComponent(newCentralPanleComponent);
            wrapperOfCentralLayout.setComponentAlignment(newCentralPanleComponent, Alignment.TOP_CENTER);
            centralPanel.setContent(wrapperOfCentralLayout);
            centralPanel.markAsDirty();
            newCentralPanleComponent.setWidth(WIDTH_PORTRAIT);
            wrapperOfCentralLayout.setWidth("100%");

            //Apply same style to the wrapper
            if (newCentralPanleComponent instanceof FocXMLLayout) {
                Component firstComp = ((FocXMLLayout) newCentralPanleComponent).getFirstRootComponent();
                if (firstComp != null && firstComp instanceof FocXMLGuiComponent) {
                    Attributes attrib = ((FocXMLGuiComponent) firstComp).getAttributes();

                    String style = attrib != null ? attrib.getValue(FXML.ATT_STYLE) : null;
                    if (style != null) {
                        FocXMLGuiComponentStatic.applyStyle(wrapperOfCentralLayout, style);
                    }
                }
            }

            //            centralPanel.setContent((Component) newCentralPanel);
            //            centralPanel.markAsDirty();
            //            ((Component)newCentralPanel).setWidth(WIDTH_PORTRAIT);
        }
    }
}

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

@Override
public void fill() {
    setSizeFull();/*from  w  w  w .  j  a  va2 s .  co m*/
    setSizeFull();
    setSpacing(false);
    setMargin(false);

    //Adding the Header
    //-----------------
    headerMenuBar = new HorizontalLayout();
    headerMenuBar.setMargin(false);
    headerMenuBar.setSpacing(false);
    headerMenuBar.setStyleName("focBanner");

    centerHeaderLayout = new HorizontalLayout();
    centerHeaderLayout.setMargin(false);
    centerHeaderLayout.setSpacing(false);
    centerHeaderLayout.setStyleName("focBanner");

    if (!isCropMarginPanelsInHeaderBanner()) {// The condition should be about mobile not crop
        centerHeaderLayout.setWidth(WIDTH_PORTRAIT);
    }
    headerMenuBar.addComponent(centerHeaderLayout);
    headerMenuBar.setComponentAlignment(centerHeaderLayout, Alignment.MIDDLE_CENTER);

    headerMenuBar.setWidth("100%");
    headerMenuBar.setHeight("-1px");
    addComponent(headerMenuBar);
    setComponentAlignment(headerMenuBar, Alignment.TOP_LEFT);
    //-----------------

    //Adding the Header
    //-----------------
    headerMenuLayout = new HorizontalLayout();
    headerMenuLayout.setMargin(false);
    headerMenuLayout.setSpacing(false);
    headerMenuLayout.setStyleName("foc-menuLayout");
    headerMenuLayout.setHeight("-1px");
    FocXMLGuiComponentStatic.setCaptionMargin_Zero(headerMenuLayout);

    centerHeaderMenuLayout = new HorizontalLayout();
    centerHeaderMenuLayout.setMargin(false);
    centerHeaderMenuLayout.setSpacing(false);
    centerHeaderMenuLayout.setStyleName("foc-menuLayout");
    centerHeaderMenuLayout.setCaption(null);
    centerHeaderMenuLayout.setHeight("-1px");
    FocXMLGuiComponentStatic.setCaptionMargin_Zero(centerHeaderMenuLayout);

    if (!isCropMarginPanelsInHeaderBanner()) {// The condition should be about mobile not crop
        centerHeaderMenuLayout.setWidth(WIDTH_PORTRAIT);
    }
    centerHeaderMenuLayout.addStyleName("foc-red");
    headerMenuLayout.addComponent(centerHeaderMenuLayout);
    headerMenuLayout.setComponentAlignment(centerHeaderMenuLayout, Alignment.MIDDLE_CENTER);

    headerMenuLayout.setWidth("100%");
    headerMenuLayout.setHeight("-1px");
    addComponent(headerMenuLayout);
    setComponentAlignment(headerMenuLayout, Alignment.TOP_CENTER);
    //-----------------

    // Central Layout
    // --------------
    hMainLayout = new HorizontalLayout();
    hMainLayout.setSizeFull();
    hMainLayout.addStyleName("focMainHorizontal");
    hMainLayout.setMargin(false);
    hMainLayout.setSpacing(false);
    addComponent(hMainLayout);
    setExpandRatio(hMainLayout, 1.0f);

    hMainLayout.addComponent(getCentralPanelWrapper());
    hMainLayout.setComponentAlignment(getCentralPanelWrapper(), Alignment.TOP_CENTER);
    getCentralPanelWrapper().setWidth("100%");
    // --------------      
}

From source file:com.foc.vaadin.gui.components.FVBlobDisplay.java

License:Apache License

private void init() {
    settingsLayout = new HorizontalLayout();
    settingsLayout.setSpacing(true);/* w w w .ja v a  2 s .  c o m*/
    delegate = new FocXMLGuiComponentDelegate(this);

    downloadDocButton = new Button("Download Attachment");
    downloadDocButton.setStyleName(Reindeer.BUTTON_LINK);

    downloadDocButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            downloadAttachedFile();
        }
    });
    settingsLayout.addComponent(downloadDocButton);
    addComponent(getImageField());
    addComponent(settingsLayout);
    displayDocuments();
    String value = getAttributes().getValue(FXML.ATT_WITH_UPLOAD_BUTTON);
    if (value != null && value.equals("true") && getDelegate() != null && getDelegate().isEditable()) {
        addComponent(getFvUpload_Image());
        //         FVImageReceiver imageReceiver = new FVImageReceiver() {
        //            
        //            @Override
        //            public void imageReceived(SucceededEvent event, final InputStream image) {
        //               StreamSource streamSource = new StreamSource() {
        //                  
        //                  @Override
        //                  public InputStream getStream() {
        //                     return image;
        //                  }
        //               };
        //               StreamResource resource = new StreamResource(streamSource, event.getFilename());
        //               getImageField().setSource(resource);
        //            }
        //         };
        //         
        //         FocObject focObject = getFocData();
        //         FVImageField imageField = new FVImageField(property, null);
        //         getFvUpload_Image().setImageReceiver(imageReceiver);
    }
}

From source file:com.foc.vaadin.gui.components.FVImageField.java

License:Apache License

public void reactToEditable() {
    if (isEditable()) {
        if (imageControlLayout != null) {
            imageControlLayout.setVisible(true);
        } else {/*from  w ww .j  av  a 2s  . c om*/
            imageControlLayout = new HorizontalLayout();
            imageControlLayout.setSpacing(true);
            imageControlLayout.setWidth("100%");
            imageControlLayout.setHeight("-1px");
            addComponent(imageControlLayout);
            setComponentAlignment(imageControlLayout, Alignment.TOP_RIGHT);

            if (isEditable()) {
                FVUpload_Image uploader = new FVUpload_Image();
                uploader.setWidth("100px");
                imageControlLayout.addComponent(uploader);
                imageControlLayout.setComponentAlignment(uploader, Alignment.TOP_RIGHT);

                uploader.setImageReceiver(this);

                downloadButton = new Button("Download");//, FVIconFactory.getInstance().getFVIcon_24(FVIconFactory.ICON_DOWNLOAD));
                if (ConfigInfo.isArabic()) {
                    downloadButton.setCaption("");//To hide the default ugly button we should set this to null
                }
                //               downloadButton.setIcon(FontAwesome.DOWNLOAD);
                downloadButton.setWidth("100px");
                //             downloadButton.setCaption(null);
                //             downloadButton.setStyleName(BaseTheme.BUTTON_LINK);
                downloadButton.addStyleName(FocXMLGuiComponentStatic.STYLE_NO_PRINT);
                downloadButton.addStyleName(FocXMLGuiComponentStatic.STYLE_HAND_POINTER_ON_HOVER);
                imageControlLayout.addComponent(downloadButton);
                imageControlLayout.setComponentAlignment(downloadButton, Alignment.TOP_LEFT);

                resource = new GenericFileResource(getFocData());
                FileDownloader downloader = new FileDownloader(resource);
                downloader.extend(downloadButton);
            }
        }
    } else {
        if (imageControlLayout != null)
            imageControlLayout.setVisible(false);
    }
}

From source file:com.foc.vaadin.gui.components.FVUploadLayout_Form.java

License:Apache License

private HorizontalLayout newHorizontalLayout(String title, String explanation, String sample, boolean isTitle) {
    HorizontalLayout colLay = new HorizontalLayout();

    FVLabel titleLbl = new FVLabel(title);
    if (isTitle)// w w  w. j a  v a  2 s . com
        titleLbl.addStyleName("f14");
    else
        titleLbl.addStyleName("f12");
    titleLbl.addStyleName("b");
    titleLbl.setWidth("200px");
    colLay.addComponent(titleLbl);

    FVLabel explanationLbl = new FVLabel(explanation);
    if (isTitle) {
        explanationLbl.addStyleName("f14");
        titleLbl.addStyleName("b");
    } else {
        explanationLbl.addStyleName("f12");
    }
    explanationLbl.setWidth("400px");
    colLay.addComponent(explanationLbl);

    FVLabel sampleLbl = new FVLabel(sample);
    if (isTitle) {
        sampleLbl.addStyleName("f14");
        sampleLbl.addStyleName("b");
    } else {
        sampleLbl.addStyleName("f12");
    }
    sampleLbl.setWidth("200px");
    colLay.addComponent(sampleLbl);

    return colLay;
}

From source file:com.foc.vaadin.gui.components.objectSelectorPopupView.FVObjectSelectorWindow.java

License:Apache License

private HorizontalLayout getMainHorizontalLayout() {
    if (mainHorizontalLayout == null) {
        mainHorizontalLayout = new HorizontalLayout();
        mainHorizontalLayout.setSizeUndefined();
        mainHorizontalLayout.addComponent(getNewValueTextField());
        mainHorizontalLayout.addComponent(getAddNewValueButton());
        mainHorizontalLayout.setComponentAlignment(getAddNewValueButton(), Alignment.BOTTOM_LEFT);
        mainHorizontalLayout.addComponent(getCancelButton());
        mainHorizontalLayout.setComponentAlignment(getCancelButton(), Alignment.BOTTOM_LEFT);
    }/* www. ja  v  a2 s  .  c om*/
    return mainHorizontalLayout;
}

From source file:com.foc.vaadin.gui.layouts.FVMenuLayout.java

License:Apache License

public FVMenuLayout(Attributes attributes) {
    delegate = new FocXMLGuiComponentDelegate(this);
    setAttributes(attributes);//from w w  w.jav  a2  s.  c  o m

    addStyleName(FVLayout.DEFAULT_STYLE);

    buttonsLayout = new HorizontalLayout();
    buttonsLayout.setStyleName("foc-menuLayout");
    //    addComponent(buttonsLayout);

    tabList = new LinkedList<FVMenuLayout.MenuLayoutItem>();
}

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

License:Apache License

public FVValidationLayout(INavigationWindow focVaadinMainWindow, ICentralPanel centralPanel,
        FValidationSettings validationSettings, boolean showBackButton) {
    super();//from ww w.j av  a 2  s . co  m
    //     addStyleName("noPrint");
    this.validationSettings = validationSettings;
    this.focVaadinMainWindow = focVaadinMainWindow;
    this.centralPanel = centralPanel;

    setMargin(false);
    setSpacing(false);
    setCaption(null);
    setWidth("100%");
    setHeight("-1px");

    mainHorizontalLayout = new HorizontalLayout();
    addComponent(mainHorizontalLayout);
    setComponentAlignment(mainHorizontalLayout, Alignment.MIDDLE_CENTER);

    mainHorizontalLayout.setMargin(false);
    mainHorizontalLayout.setSpacing(true);
    mainHorizontalLayout.setCaption(null);
    mainHorizontalLayout.setStyleName("foc-validation");
    mainHorizontalLayout.addStyleName("foc-footerLayout");
    mainHorizontalLayout.addStyleName("noPrint");
    if (centralPanel != null && !centralPanel.isFullScreen()) {
        mainHorizontalLayout.setWidth(FocCentralPanel.WIDTH_PORTRAIT);
        mainHorizontalLayout.addStyleName("foc-footerMargin");
    } else {
        mainHorizontalLayout.setWidth("100%");
    }
    mainHorizontalLayout.setHeight("-1px");

    addStyleName("noPrint");
    addStyleName("foc-validation");
    addStyleName("foc-footerLayout");

    initButtonsLayout(showBackButton);
    validationListeners = new ArrayList<IValidationListener>();
    addTransactionToRecentVisited();
}

From source file:com.foc.vaadin.gui.windows.AddTabWindow.java

License:Apache License

public AddTabWindow(final TabSheet tabSheet, final VerticalLayout addTabLayout) {
    super("Add New Tab");
    setModal(true);/* w  w  w .  j ava2  s. co m*/
    setWidth("264px");
    setHeight("272px");

    layout = new VerticalLayout();
    buttonsLayout = new HorizontalLayout();
    optionsLayout = new VerticalLayout();
    seperateLayout = new VerticalLayout();

    tabName = new TextField();
    tabNameWrapper = new FVWrapperLayout(tabName, "Tab Name:", width);
    layoutHeight = new TextField();
    heightWrapper = new FVWrapperLayout(layoutHeight, "Height:", width);
    layoutWidth = new TextField();
    widthWrapper = new FVWrapperLayout(layoutWidth, "Width:", width);
    innerLayout = new ComboBox();
    innerLayoutWrapper = new FVWrapperLayout(innerLayout, "Layout Type:", width);

    for (int i = 0; i < layoutTypes.length; i++) {
        innerLayout.addItem(layoutTypes[i]);
    }

    innerLayout.setImmediate(true);
    innerLayout.setNullSelectionAllowed(false);
    innerLayout.setValue(layoutTypes[0]);

    innerLayout.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String layoutType = event.getProperty().toString();

            if (layoutType.equals(FXML.TAG_GRID_LAYOUT)) {
                layoutCols = new TextField();
                colsWrapper = new FVWrapperLayout(layoutCols, "Columns:", width);
                layoutRows = new TextField();
                rowsWrapper = new FVWrapperLayout(layoutRows, "Rows:", width);

                optionsLayout.addComponent(colsWrapper);
                optionsLayout.addComponent(rowsWrapper);

                setHeight("350px");

            } else {

                if (layoutCols != null) {
                    optionsLayout.removeComponent(colsWrapper);
                    layoutCols = null;
                    colsWrapper = null;
                }

                if (layoutRows != null) {
                    optionsLayout.removeComponent(rowsWrapper);
                    layoutRows = null;
                    rowsWrapper = null;
                }

                setHeight("272px");
            }
        }
    });

    create = new Button("Create");
    cancel = new Button("Cancel");

    cancel.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    create.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            String layoutType = innerLayout.getValue().toString();

            AttributesImpl attributes = new AttributesImpl();

            attributes.addAttribute("", "name", "name", "CDATA", "null");
            attributes.addAttribute("", "height", "height", "CDATA",
                    layoutHeight.getValue().toString().isEmpty() ? "-1px"
                            : layoutHeight.getValue().toString() + "px");
            attributes.addAttribute("", "width", "width", "CDATA",
                    layoutWidth.getValue().toString().isEmpty() ? "-1px"
                            : layoutWidth.getValue().toString() + "px");

            if (layoutType.equals(FXML.TAG_ABSOLUTE_LAYOUT)) {
                selectedLayout = new FVAbsoluteLayout(attributes);
            } else if (layoutType.equals(FXML.TAG_VERTICAL_LAYOUT)) {
                selectedLayout = new FVVerticalLayout(attributes);
            } else if (layoutType.equals(FXML.TAG_HORIZONTAL_LAYOUT)) {
                selectedLayout = new FVHorizontalLayout(attributes);
            } else {

                attributes.addAttribute("", "rows", "rows", "CDATA", layoutRows.getValue().toString());
                attributes.addAttribute("", "cols", "cols", "CDATA", layoutCols.getValue().toString());

                selectedLayout = new FVGridLayout(attributes);
            }

            tabSheet.removeTab(tabSheet.getTab(addTabLayout));
            tabSheet.addTab((Component) selectedLayout, tabName.getValue().toString());
            tabSheet.addTab(addTabLayout, "+");
            close();
        }
    });

    optionsLayout.setSpacing(true);
    optionsLayout.addComponent(widthWrapper);
    optionsLayout.addComponent(heightWrapper);

    seperateLayout.setHeight("25px");

    buttonsLayout.setSpacing(true);
    buttonsLayout.addComponent(create);
    buttonsLayout.addComponent(cancel);

    layout.setSpacing(true);
    layout.addComponent(tabNameWrapper);
    layout.addComponent(innerLayoutWrapper);
    layout.addComponent(optionsLayout);
    layout.addComponent(seperateLayout);
    layout.addComponent(buttonsLayout);

    layout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);

    setContent(layout);
}

From source file:com.foc.vaadin.gui.windows.CreateLayoutWindow.java

License:Apache License

public CreateLayoutWindow(final FVLayout layout) {
    setModal(true);/*from  www .  j av a2  s .co m*/
    setWidth("250px");
    setHeight("250px");

    mainLayout = new VerticalLayout();
    buttonsLayout = new HorizontalLayout();

    width = new TextField("Width:");
    height = new TextField("Height:");
    border = new CheckBox("Border:");

    if (layout instanceof FVGridLayout) {
        rows = new TextField("Rows:");
        cols = new TextField("Columns:");
    }

    create = new Button("Create");
    cancel = new Button("Cancel");

    cancel.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });

    create.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            layout.setHeight(height.getValue().toString());
            layout.setWidth(width.getValue().toString());

            AttributesImpl attributesImpl = new AttributesImpl(layout.getAttributes());
            attributesImpl.addAttribute("", "name", "name", "CDATA", "null");
            attributesImpl.addAttribute("", "width", "width", "CDATA", width.getValue() + "px");
            attributesImpl.addAttribute("", "height", "height", "CDATA", height.getValue() + "px");

            if (rows != null) {
                ((FVGridLayout) layout).setRows(Integer.parseInt(rows.getValue().toString()));
                ((FVGridLayout) layout).setColumns(Integer.parseInt(cols.getValue().toString()));

                attributesImpl.addAttribute("", "cols", "cols", "CDATA", cols.getValue() + "");
                attributesImpl.addAttribute("", "rows", "rows", "CDATA", rows.getValue() + "");
            }

            layout.setAttributes(attributesImpl);

            if (border.booleanValue()) {
                layout.addStyleName("border");
            }

            close();
        }
    });

    buttonsLayout.setMargin(true);
    buttonsLayout.setSpacing(true);
    buttonsLayout.addComponent(create);
    buttonsLayout.addComponent(cancel);
    mainLayout.addComponent(width);
    mainLayout.addComponent(height);
    if (rows != null) {
        mainLayout.addComponent(rows);
        mainLayout.addComponent(cols);
        mainLayout.setComponentAlignment(rows, Alignment.MIDDLE_CENTER);
        mainLayout.setComponentAlignment(cols, Alignment.MIDDLE_CENTER);
    }
    mainLayout.addComponent(border);
    mainLayout.addComponent(buttonsLayout);
    mainLayout.setComponentAlignment(width, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(height, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(border, Alignment.MIDDLE_CENTER);
    mainLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER);
    setContent(mainLayout);
}