Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

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

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

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

License:Apache License

@Override
public void setAttributes(Attributes attributes) {
    if (attributes != null) {
        if (field != null)
            field.setAttributes(attributes);

        caption.setValue(attributes.getValue(FXML.ATT_CAPTION));
        //setSpacing(true);
        String captionWidth = attributes.getValue(FXML.ATT_CAPTION_WIDTH);
        if (captionWidth != null) {
            caption.setWidth(captionWidth);
        } else {/*from   w w  w  .ja v  a 2  s.  c  o  m*/
            caption.setWidth("75px");
        }

        String captionPosition = attributes.getValue(FXML.ATT_CAPTION_POSITION);
        if (captionPosition.equals(FXML.VAL_CAPTION_POS__RIGHT)) {
            removeAllComponents();
            addComponent((Component) field);
            setComponentAlignment((Component) field, Alignment.MIDDLE_LEFT);
            addComponent(this.caption);
            setComponentAlignment(this.caption, Alignment.MIDDLE_RIGHT);
            setSpacing(true);
            FocXMLGuiComponentStatic.applyStyle(this.caption, "f16,bold,text-left");
        } else if (captionPosition.equals(FXML.VAL_CAPTION_POS__LEFT)) {
            removeAllComponents();
            addComponent(this.caption);
            setComponentAlignment(this.caption, Alignment.MIDDLE_RIGHT);
            addComponent((Component) field);
            setComponentAlignment((Component) field, Alignment.MIDDLE_LEFT);
            setSpacing(true);
            FocXMLGuiComponentStatic.applyStyle(this.caption, "f12,bold,text-right");
        }
        FocXMLGuiComponentStatic.applyStyle(caption, attributes.getValue(FXML.ATT_CAPTION_STYLE));
    }
}

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

License:Apache License

public FVStatusLayout_MenuBar getStatusLayout(boolean createIfNeeded) {
    if (statusLayout_MenuBar == null && createIfNeeded && isWithStatus() && Globals.getApp() != null
            && Globals.getApp().getUser_ForThisSession() != null
            && !Globals.getApp().getUser_ForThisSession().isGuest()) {

        if (getCentralPanel() != null && getCentralPanel() instanceof FocXMLLayout) {
            FocXMLLayout xmlLayout = (FocXMLLayout) getCentralPanel();
            FocObject focObject = xmlLayout.getFocObject();
            if (focObject != null && focObject
                    .status_hasStatus() /*&& !((FocObject)getCentralPanel().getFocData()).isCreated()*/) {
                statusLayout_MenuBar = new FVStatusLayout_MenuBar(xmlLayout, focObject);

                if (statusLayout_MenuBar.getRootMenuItem() != null
                        && statusLayout_MenuBar.getRootMenuItem().getSize() > 0) {//If the status bar is empty then do not show it
                    mainHorizontalLayout.addComponent(statusLayout_MenuBar);
                    mainHorizontalLayout.setComponentAlignment(statusLayout_MenuBar, Alignment.MIDDLE_LEFT);
                }/*from   w w w .  j a  v a2 s  .  co m*/
            }
        }
    }
    return statusLayout_MenuBar;
}

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

License:Apache License

public FVStageLayout_Button getStageLayout(boolean createIfNeeded) {
    if (stageLayout_Button == null && createIfNeeded && isWithStage() && Globals.getApp() != null
            && Globals.getApp().getUser_ForThisSession() != null
            && !Globals.getApp().getUser_ForThisSession().isGuest()) {
        ICentralPanel centralPanel = getCentralPanel();
        if (centralPanel != null && centralPanel instanceof FocXMLLayout) {
            FocXMLLayout xmlLayout = (FocXMLLayout) centralPanel;
            FocObject focObject = xmlLayout.getFocObject();
            if (focObject != null) {
                if (focObject instanceof WFTransactionWrapper) {
                    focObject = ((WFTransactionWrapper) focObject).getFocObject();
                }/*from  ww w .ja v a  2 s  .c  o  m*/

                if (focObject.workflow_IsWorkflowSubject()) {
                    FocDesc focDesc = focObject.getThisFocDesc();
                    if (focDesc != null && focDesc instanceof IWorkflowDesc) {
                        IWorkflowDesc iWorkflowDesc = (IWorkflowDesc) focDesc;
                        WFMap map = WFTransactionConfigDesc
                                .getMap_ForTransaction(iWorkflowDesc.iWorkflow_getDBTitle());
                        if (map != null) {
                            stageLayout_Button = new FVStageLayout_Button(xmlLayout, focObject);
                            mainHorizontalLayout.addComponent(stageLayout_Button);
                            mainHorizontalLayout.setComponentAlignment(stageLayout_Button,
                                    Alignment.MIDDLE_LEFT);
                        }
                    }
                }
            }
        }
    }
    return stageLayout_Button;
}

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

License:Apache License

private void initButtonsLayout(boolean showBackButton) {
    if (validationSettings != null) {

        if (validationSettings.isWithPrint() && !FocWebApplication.getInstanceForThread().isMobile()) {

            if (Globals.isValo()) {
                mainHorizontalLayout.addComponent(valo_GetPrintEmbedded(true));
                PrintingAction printingAction = newPrintingAction();
                if (printingAction != null) {
                    printingAction.dispose();
                    mainHorizontalLayout.addComponent(valo_GetPDFPrintEmbedded(true));
                }//from w  w w  .j  a  v a 2  s  .c o m
                applyBrowserWindowOpenerToPrintButton(valo_GetPrintEmbedded(false));
                mainHorizontalLayout.setComponentAlignment(valo_GetPrintEmbedded(false), Alignment.BOTTOM_LEFT);
            } else {
                mainHorizontalLayout.addComponent(getPrintButton(true));
                applyBrowserWindowOpenerToPrintButton(getPrintButton(false));
                mainHorizontalLayout.setComponentAlignment(getPrintButton(false), Alignment.BOTTOM_LEFT);
            }

            if (getFocData() != null && getFocData() instanceof FocObject
                    && validationSettings.isWithPrintAndExit()) {
                if (Globals.isValo()) {
                    mainHorizontalLayout.addComponent(valo_GetPrintEmbedded(true));
                    applyBrowserWindowOpenerToPrintButton(valo_GetPrintEmbedded(false));
                    mainHorizontalLayout.setComponentAlignment(valo_GetPrintEmbedded(false),
                            Alignment.BOTTOM_LEFT);
                } else {
                    mainHorizontalLayout.addComponent(getPrintAndExitButton(true));
                    applyBrowserWindowOpenerToPrintButton(getPrintAndExitButton(false));
                    mainHorizontalLayout.setComponentAlignment(getPrintAndExitButton(false),
                            Alignment.BOTTOM_LEFT);
                }
            }
        }

        if (validationSettings.hasPDFGenerator()) {
            if (Globals.isValo()) {
                if (valo_GetPdfGeneratorEmbedded(true) != null) {
                    mainHorizontalLayout.addComponent(valo_GetPdfGeneratorEmbedded(false));
                    mainHorizontalLayout.setComponentAlignment(valo_GetPdfGeneratorEmbedded(false),
                            Alignment.BOTTOM_LEFT);
                }
            } else {
                if (getPdfGeneratorButton(true) != null) {
                    mainHorizontalLayout.addComponent(getPdfGeneratorButton(true));
                    mainHorizontalLayout.setComponentAlignment(getPdfGeneratorButton(true),
                            Alignment.BOTTOM_LEFT);
                }
            }
        }

        if (validationSettings.hasMSWordGenerator()) {
            if (valo_GetMSWordGeneratorEmbedded(true) != null) {
                mainHorizontalLayout.addComponent(valo_GetMSWordGeneratorEmbedded(false));
                mainHorizontalLayout.setComponentAlignment(valo_GetMSWordGeneratorEmbedded(false),
                        Alignment.BOTTOM_LEFT);
            }
        }

        if (validationSettings.isWithAttach() && isAttachementApplicable()) {
            if (Globals.isValo()) {
                mainHorizontalLayout.addComponent(valo_GetAttachEmbedded(true));
                mainHorizontalLayout.setComponentAlignment(valo_GetAttachEmbedded(false),
                        Alignment.BOTTOM_LEFT);
            } else {
                mainHorizontalLayout.addComponent(getAttachButton(true));
                mainHorizontalLayout.setComponentAlignment(getAttachButton(false), Alignment.BOTTOM_LEFT);
            }
        }

        if (validationSettings.isWithEmail() && !FocWebApplication.getInstanceForThread().isMobile()) {
            if (Globals.isValo()) {
                mainHorizontalLayout.addComponent(valo_GetEmailEmbedded(true));
                mainHorizontalLayout.setComponentAlignment(valo_GetEmailEmbedded(false), Alignment.BOTTOM_LEFT);
            } else {
                mainHorizontalLayout.addComponent(getEmailButton(true));
                mainHorizontalLayout.setComponentAlignment(getEmailButton(false), Alignment.BOTTOM_LEFT);
            }
        }

        //DO NOT DELETE THIS
        //UNDER DEVELOPMENT
        /*
        if (validationSettings.isWithInternalEmail() && !FocWebApplication.getInstanceForThread().isMobile()){
          addComponent(getInternalEmailButton(true));
          setComponentAlignment(getInternalEmailButton(false), Alignment.BOTTOM_LEFT);
        }
        */
    }

    if (Globals.isValo()) {
        Embedded embedded = valo_GetFullScreenEmbedded(true);
        if (embedded != null) {
            mainHorizontalLayout.addComponent(embedded);
            mainHorizontalLayout.setComponentAlignment(embedded, Alignment.BOTTOM_LEFT);
        }
    } else {
        Button fullScreenButton = getFullScreenButton(true);
        if (fullScreenButton != null) {
            mainHorizontalLayout.addComponent(fullScreenButton);
            mainHorizontalLayout.setComponentAlignment(fullScreenButton, Alignment.BOTTOM_LEFT);
        }
    }

    Component lastAdded = null;
    if (validationSettings.isWithViewSelector() && !FocWebApplication.getInstanceForThread().isMobile()
            && Globals.getApp() != null && Globals.getApp().getUser_ForThisSession() != null
            && Globals.getApp().getUser_ForThisSession().getGroup() != null && Globals.getApp()
                    .getUser_ForThisSession().getGroup().getViewsRight() < GroupXMLViewDesc.ALLOW_NOTHING) {

        mainHorizontalLayout.addComponent(getViewSelector(true));
        lastAdded = getViewSelector(false);
        mainHorizontalLayout.setComponentAlignment(getViewSelector(false), Alignment.MIDDLE_LEFT);
    }

    if (getStatusLayout(true) != null) {
        lastAdded = (Component) getStatusLayout(false);
    }

    if (getStageLayout(true) != null) {

        FocDesc focDesc = getFocObject().getThisFocDesc();
        if (focDesc instanceof IWorkflowDesc) {
            IWorkflowDesc iWorkflowDesc = (IWorkflowDesc) focDesc;
            WFMap map = WFTransactionConfigDesc.getMap_ForTransaction(iWorkflowDesc.iWorkflow_getDBTitle());
            if (map != null) {
                lastAdded = (Component) getStageLayout(false);
            }
        }
    }

    IValidationLayoutMoreMenuFiller filler = FVValidationMore.getInstance()
            .getIValidationLayoutMoreMenuFiller();
    if (filler != null
            && (FocWebApplication.getFocUser() == null || !FocWebApplication.getFocUser().isGuest())) {
        filler.addMenuItems(this);
        centralPanel.addMoreMenuItems(this);
    }

    MenuBar menuBar = getMenubar(false);
    if (menuBar != null && !FocWebApplication.getInstanceForThread().isMobile()) {
        mainHorizontalLayout.addComponent(menuBar);

        mainHorizontalLayout.setComponentAlignment(menuBar, Alignment.MIDDLE_LEFT);
        lastAdded = menuBar;
    }
    /*
      if(    getFocObject() != null 
    && getFocObject().workflow_IsWorkflowSubject()
    && FChatModule.userHasChat()
    && getCentralPanel() != null 
    && getCentralPanel() instanceof FocXMLLayout
    && getCentralPanel().getMainWindow() != null) {
         chatSlider = new FChatSlider((FocXMLLayout)getCentralPanel());
         chatSlider.build(FVValidationLayout.this);
    }
    */

    if (getLinkLayout(true) != null) {
        mainHorizontalLayout.addComponent(getLinkLayout(false));
        mainHorizontalLayout.setComponentAlignment(getLinkLayout(false), Alignment.BOTTOM_LEFT);
    }

    //    addHelpButtons();
    addTitle();

    addApplyDiscardButtons(showBackButton);
}

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

License:Apache License

public void addApplyDiscardButtons(boolean showBackButton) {
    boolean showValidationAndSave = validationSettings != null && validationSettings.isWithApply();
    boolean showSave = validationSettings != null && validationSettings.isWithSave();
    boolean showDiscard = validationSettings != null && validationSettings.isWithDiscard();
    boolean showGoBack = validationSettings == null && showBackButton;

    ICentralPanel centralPanel = getCentralPanel();
    if (centralPanel instanceof FocXMLLayout) {
        FocXMLLayout layout = (FocXMLLayout) centralPanel;

        if (Globals.isValo()) {
            Component comp = valo_GetNotCompletedYet(true);
            if (comp != null) {
                mainHorizontalLayout.addComponent(comp);
                mainHorizontalLayout.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT);
            }/*  w w w . ja v  a 2  s .  c  o  m*/
        }

        if (layout.getTableTreeThatOpenedThisForm() != null
                && layout.getTableTreeThatOpenedThisForm().getTableTreeDelegate() != null
                && layout.getTableTreeThatOpenedThisForm().getTableTreeDelegate().isDeleteEnabled()
                && getFocObject() != null) {
            if (Globals.isValo()) {
                AbstractComponent deleteButtton = valo_GetDeleteEmbedded(true);
                if (deleteButtton != null) {
                    mainHorizontalLayout.addComponent(deleteButtton);
                    mainHorizontalLayout.setComponentAlignment(deleteButtton, Alignment.BOTTOM_LEFT);
                }
            } else {
                Button deleteButtton = getDeleteButton(true);
                if (deleteButtton != null) {
                    mainHorizontalLayout.addComponentAsFirst(deleteButtton);
                    mainHorizontalLayout.setComponentAlignment(deleteButtton, Alignment.BOTTOM_LEFT);
                }
            }
        }
    }

    Component discardOrGoBackButton = null;

    if (showDiscard) {
        if (Globals.isValo()) {
            discardOrGoBackButton = valo_GetDiscardButton(true);
        } else {
            discardOrGoBackButton = getDiscardButton(true);
        }
    } else if (showGoBack) {
        if (Globals.isValo()) {
            discardOrGoBackButton = valo_GetGoBackEmbedded(true);
        } else {
            discardOrGoBackButton = getGoBackButton(true);
        }
    }

    if (discardOrGoBackButton != null) {
        mainHorizontalLayout.addComponent(discardOrGoBackButton);
        if (Globals.isValo()) {
            mainHorizontalLayout.setComponentAlignment(discardOrGoBackButton, Alignment.MIDDLE_RIGHT);
        } else {
            mainHorizontalLayout.setComponentAlignment(discardOrGoBackButton, Alignment.BOTTOM_RIGHT);
        }

        if (titleLabel == null) {
        }
    }

    if (showValidationAndSave) {
        if (showSave) {
            if (Globals.isValo()) {
                mainHorizontalLayout.addComponent(valo_GetSaveButton(true));
                mainHorizontalLayout.setComponentAlignment(valo_GetSaveButton(false), Alignment.MIDDLE_LEFT);
            } else {
                mainHorizontalLayout.addComponent(getSaveButton(true));
                mainHorizontalLayout.setComponentAlignment(getSaveButton(false), Alignment.BOTTOM_LEFT);
            }
        }

        if (Globals.isValo()) {
            mainHorizontalLayout.addComponent(valo_GetApplyButton(true));
            mainHorizontalLayout.setComponentAlignment(valo_GetApplyButton(false), Alignment.MIDDLE_LEFT);
        } else {
            mainHorizontalLayout.addComponent(getApplyButton(true));
            mainHorizontalLayout.setComponentAlignment(getApplyButton(false), Alignment.BOTTOM_LEFT);
        }
    }
}

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./*  w w  w  . j a v a  2s .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.garyclayburg.vconsole.VConsole.java

License:Open Source License

private HorizontalLayout createTop() {
    topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.setSpacing(true);/* www .  j  a  va  2 s  .  co m*/
    topLayout.addStyleName("toolbar");
    final Label title = new Label("Policy console");
    title.setSizeUndefined();
    title.addStyleName("h1");
    topLayout.addComponent(title);
    topLayout.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
    topLayout.setExpandRatio(title, 1);

    policyChangeStatus = new Label("");
    policyChangeStatus.setSizeUndefined();
    policyChangeStatus.addStyleName("policyNormal");
    topLayout.addComponent(policyChangeStatus);
    topLayout.setComponentAlignment(policyChangeStatus, Alignment.MIDDLE_LEFT);

    createNotifyButton();
    topLayout.addComponent(notify);
    topLayout.setComponentAlignment(notify, Alignment.MIDDLE_LEFT);
    return topLayout;
}

From source file:com.github.peholmst.mvp4vaadin.navigation.ui.Breadcrumbs.java

License:Apache License

protected void addBreadcrumbForView(final View view) {
    addSeparatorForView(view);/*from   ww w  .  j  a  v  a 2s . c  om*/
    final Button btn = getButtonFactory().createButton(view);
    final NavigationRequest navigationRequest = NavigationRequestBuilder.newInstance()
            .startWithPathToView(getController(), view).buildRequest();
    btn.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 5199653237630939848L;

        @Override
        public void buttonClick(ClickEvent event) {
            getController().navigate(navigationRequest);
        }
    });
    viewButtonMap.put(view, btn);
    view.addListener(this);
    addComponent(btn);
    setComponentAlignment(btn, Alignment.MIDDLE_LEFT);
}

From source file:com.github.peholmst.mvp4vaadin.navigation.ui.Breadcrumbs.java

License:Apache License

protected void addSeparatorForView(final View view) {
    if (getController().containsMoreThanOneElement()) {
        Component separator = getSeparatorFactory().createSeparator();
        addComponent(separator);/*from  ww  w. j a va2s .c o m*/
        setComponentAlignment(separator, Alignment.MIDDLE_LEFT);
    }
}

From source file:com.github.peholmst.springsecuritydemo.ui.MainView.java

License:Apache License

/**
 * TODO Document me!//from   w ww. j a va 2 s.  c  o  m
 * 
 * @return
 */
protected Component createTicketBrowser() {
    final HorizontalLayout toolbar = new HorizontalLayout();
    toolbar.setSpacing(true);
    toolbar.setWidth("100%");

    final Button refreshButton = new Button(getApplication().getMessage("tickets.refresh.caption"));
    refreshButton.setIcon(new ThemeResource("icons/16/refresh.png"));
    refreshButton.setStyleName("small");
    refreshButton.setDescription(getApplication().getMessage("tickets.refresh.descr"));
    toolbar.addComponent(refreshButton);
    toolbar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT);

    final Button addButton = new Button(getApplication().getMessage("tickets.add.caption"));
    addButton.setIcon(new ThemeResource("icons/16/add.png"));
    addButton.setStyleName("small");
    addButton.setDescription(getApplication().getMessage("tickets.add.descr"));
    toolbar.addComponent(addButton);
    toolbar.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);

    final SplitPanel splitPanel = new SplitPanel();
    splitPanel.setSizeFull();

    final Table ticketsTable = new Table();
    ticketsTable.setSizeFull();
    splitPanel.addComponent(ticketsTable);

    splitPanel.addComponent(new Label("The form for editing tickets will show up here"));

    final VerticalLayout browser = new VerticalLayout();
    browser.setSizeFull();
    browser.addComponent(toolbar);
    browser.addComponent(splitPanel);
    browser.setExpandRatio(splitPanel, 1.0f);

    return browser;
}