Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

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

Introduction

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

Prototype

Alignment MIDDLE_CENTER

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

Click Source Link

Usage

From source file:com.firstbanknigeria.ofsaaenhancers.UI.AdjustmentUI.java

public AdjustmentUI() {
    super("Load Adjustments");
    this.setWidth("1000px");
    this.setHeight("250px");

    objectContext = ObjectStore.getObjectContext(VaadinSession.getCurrent().getSession().getId());

    final VerticalLayout layout = new VerticalLayout();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    layout.setSpacing(true);/*w ww  .  jav a 2s  .co m*/

    AdjustmentFileProcessor adjFileProcessor = new AdjustmentFileProcessor();
    adjFileProcessor.setAdjustmentUI(this);

    Upload uploadComponent = new Upload("", adjFileProcessor);
    uploadComponent.addSucceededListener(adjFileProcessor);
    uploadComponent.setButtonCaption("Upload Adjustments");
    uploadComponent.setImmediate(true);

    Button runAdjustmenstButton = new Button("Run Adjustments");
    runAdjustmenstButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent e) {
            ProcedureQuery query = new ProcedureQuery("RUN_ADJUSTMENTS");
            QueryResponse response = objectContext.performGenericQuery(query);
        }
    });

    layout.addComponents(uploadComponent, runAdjustmenstButton);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

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

License:Apache License

@Override
public void fill() {
    setSizeFull();//from   w w  w  .j  a  v  a  2 s  .  c  om
    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.FocWebVaadinWindow.java

License:Apache License

private void add_NewUserMenuBar() {
    menuBar_User = new FVMenuBar(null);
    menuBar_User.setHeight("40px");
    menuBar_User.setStyleName("focBannerButton");
    centerHeaderLayout.addComponent(menuBar_User);
    centerHeaderLayout.setComponentAlignment(menuBar_User, Alignment.MIDDLE_CENTER);

    FocWebApplication focWebApplication = getFocWebApplication();
    if (focWebApplication == null)
        focWebApplication = FocWebApplication.getInstanceForThread();
    FocUser focUser = focWebApplication.getFocWebSession().getFocUser();
    if (focUser != null) {
        String userFullname = focUser.getFullName();
        if (userFullname.trim().isEmpty())
            userFullname = focUser.getName();

        MenuItem userMenuItem = null;
        if (Globals.isValo()) {
            userMenuItem = menuBar_User.addItem(userFullname, null);
        } else {//from  w  ww.j a  v  a  2 s.  c om
            userMenuItem = menuBar_User.addItem(userFullname,
                    FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_DOWN_1), null);
        }
        userMenuItem.setStyleName("userItemCaption");
        /*
        if(!isGuestUser() && (SaaSConfig.getInstance() == null || SaaSConfig.getInstance().getApplicationType() == SaaSConfigDesc.APPLICATION_TYPE_NONE)){
           newUserMenuItem(userMenuItem, "Company Configuration", new MenuBar.Command() {
                        
                @Override
                public void menuSelected(MenuItem selectedItem) {
               XMLViewKey xmlViewKey = new XMLViewKey(FocGroupDesc.getInstance().getStorageName(), XMLViewKey.TYPE_FORM, AdminWebModule.CONTEXT_COMPANY_CONFIGURATION, XMLViewKey.VIEW_DEFAULT);
        ICentralPanel centralPanel = XMLViewDictionary.getInstance().newCentralPanel(FocWebVaadinWindow.this, xmlViewKey, null);
        changeCentralPanelContent(centralPanel, true);
                }
             });
        }
        */

        newUserMenuItem(userMenuItem, "User account...", new MenuBar.Command() {

            @Override
            public void menuSelected(MenuItem selectedItem) {
                FocUser_HomePage_Form.popupUserCredintionals(FocWebVaadinWindow.this);
            }
        });

        if (Globals.getApp().getUser_ForThisSession().isSaasAdmin()) {
            newUserMenuItem(userMenuItem, "Manage Accounts...", new MenuBar.Command() {

                @Override
                public void menuSelected(MenuItem selectedItem) {
                    FocList userList = FocUserDesc.getInstance().getFocList(FocList.LOAD_IF_NEEDED);
                    XMLViewKey xmlViewKey = new XMLViewKey(AdminWebModule.STORAGE_NAME_MANAGE_ACCOUNT,
                            XMLViewKey.TYPE_FORM);
                    ICentralPanel centralPanel = XMLViewDictionary.getInstance()
                            .newCentralPanel(FocWebVaadinWindow.this, xmlViewKey, userList);
                    changeCentralPanelContent(centralPanel, true);
                }
            });
        }

        newUserMenuItem(userMenuItem, "About...", new MenuBar.Command() {
            @Override
            public void menuSelected(MenuItem selectedItem) {
                if (FocWebServer.getInstance() != null) {
                    OptionDialog dialog = new OptionDialog("Software Version",
                            FocWebServer.getInstance().getVersionTitle()) {
                        @Override
                        public boolean executeOption(String optionName) {
                            return false;
                        }
                    };
                    dialog.addOption("OK", "Ok");
                    dialog.setWidth("350px");
                    dialog.setHeight("150px");
                    OptionDialog_Form obtionForm = (OptionDialog_Form) Globals.popupDialog(dialog);

                    FVVerticalLayout verticalLayout = obtionForm.getComponentsLayout();
                    if (verticalLayout != null) {
                    }
                }
            }
        });

        logoutMenuItem = newUserMenuItem(userMenuItem, "Log out", new MenuBar.Command() {

            @Override
            public void menuSelected(MenuItem selectedItem) {
                FocUnitDictionary.getInstance().setExitTesting(true);
                logout();
            }
        });

        if (FocUnitRecorder.isAllowRecording()) {
            macroRecordingItem = newUserMenuItem(userMenuItem, "Recod Macro", new MenuBar.Command() {
                boolean recording = false;

                @Override
                public void menuSelected(MenuItem selectedItem) {
                    if (recording) {
                        recording = false;
                        macroRecordingItem.setText("Start Recoding Macro");
                        FocUnitRecorder.stopRecording();
                    } else {
                        recording = true;
                        macroRecordingItem.setText("Stop Recording Macro");
                        FocUnitRecorder.startRecording();
                    }
                }
            });
        }
    }
}

From source file:com.foc.vaadin.gui.components.multipleChoiceOptionGroupHorizontal.FVMultipleChoiceOptionGroupHorizontal.java

License:Apache License

public FVMultipleChoiceOptionGroupHorizontal(FProperty property, Attributes attributes) {
    //    super(property != null && property.getFocField() != null ? "" : "", new BeanItemContainer(FMultipleChoiceItem.class, ((FMultipleChoiceField)property.getFocField()).getChoicesCollection()));
    delegate = new FocXMLGuiComponentDelegate(this);
    if (property != null && property.getFocField() != null) {

        checkBoxArray = new ArrayList<OptionGroupHorizontalCheckBox>();

        Collection<FMultipleChoiceItemInterface> coll = ((FMultipleChoiceField) property.getFocField())
                .getChoicesCollection();
        Iterator iter = coll.iterator();
        while (iter != null && iter.hasNext()) {
            FMultipleChoiceItemInterface item = (FMultipleChoiceItemInterface) iter.next();

            OptionGroupHorizontalCheckBox cb = new OptionGroupHorizontalCheckBox(item);
            addComponent(cb);/*from   w  w  w .  jav  a  2s .  co  m*/
            setComponentAlignment(cb, Alignment.MIDDLE_CENTER);

            checkBoxArray.add(cb);
        }
    }

    setFocData(property);
    setAttributes(attributes);

    addStyleName("component-margin");
}

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

License:Apache License

private void init() {
    setModal(true);// w ww . jav  a  2  s .com
    setResizable(false);
    setWidth("400px");
    setHeight("200px");

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setSizeFull();
    verticalLayout.addComponent(getMainHorizontalLayout());
    verticalLayout.setComponentAlignment(getMainHorizontalLayout(), Alignment.MIDDLE_CENTER);
    setContent(verticalLayout);
}

From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java

License:Apache License

public static void applyAlignment(AbstractOrderedLayout layout, Component component, String alignment) {
    alignment = alignment.toLowerCase();
    if (alignment.equals("right") || alignment.equals("middle_right")) {
        layout.setComponentAlignment(component, Alignment.MIDDLE_RIGHT);
    } else if (alignment.equals("left") || alignment.equals("middle_left")) {
        layout.setComponentAlignment(component, Alignment.MIDDLE_LEFT);
    } else if (alignment.equals("center") || alignment.equals("middle_center")) {
        layout.setComponentAlignment(component, Alignment.MIDDLE_CENTER);
    } else if (alignment.equals("top_right")) {
        layout.setComponentAlignment(component, Alignment.TOP_RIGHT);
    } else if (alignment.equals("top_left")) {
        layout.setComponentAlignment(component, Alignment.TOP_LEFT);
    } else if (alignment.equals("top_center")) {
        layout.setComponentAlignment(component, Alignment.TOP_CENTER);
    } else if (alignment.equals("bottom_right")) {
        layout.setComponentAlignment(component, Alignment.BOTTOM_RIGHT);
    } else if (alignment.equals("bottom_left")) {
        layout.setComponentAlignment(component, Alignment.BOTTOM_LEFT);
    } else if (alignment.equals("bottom_center")) {
        layout.setComponentAlignment(component, Alignment.BOTTOM_CENTER);
    }/* w  w w  .  j a v a2s  .c o  m*/
}

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

License:Apache License

private void initButtonsLayout() {
    Button button_PreviousContextHelp = getPreviousContextHelpButton(true);
    addComponent(button_PreviousContextHelp);
    setComponentAlignment(button_PreviousContextHelp, Alignment.MIDDLE_CENTER);

    Button button_ExitContextHelp = getExitContextHelpButton(true);
    addComponent(button_ExitContextHelp);
    setComponentAlignment(button_ExitContextHelp, Alignment.MIDDLE_CENTER);
    setExpandRatio(button_ExitContextHelp, 1f);

    Button button_NextContextHelp = getNextContextHelpButton(true);
    addComponent(button_NextContextHelp);
    setComponentAlignment(button_NextContextHelp, Alignment.MIDDLE_CENTER);
}

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   w w w  .j  a va2 s . c om
    //     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.layouts.validationLayout.FVValidationLayout.java

License:Apache License

public FVLabel addTitle() {
    titleLabel = new FVLabel(validationSettings == null || validationSettings.getTitle() == null ? ""
            : validationSettings.getTitle());
    titleLabel.addStyleName("foc-f16");
    titleLabel.addStyleName("foc-bold");
    titleLabel.addStyleName("foc-text-center");
    titleLabel.addStyleName("noPrint");
    if (ConfigInfo.isGuiRTL()) {
        titleLabel.addStyleName("foc-floatNone");
    }/*from ww w .  jav a  2 s  .  c  o m*/
    titleLabel.setWidth("-1px");
    titleLabel.setHeight("-1px");
    mainHorizontalLayout.addComponent(titleLabel);
    mainHorizontalLayout.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);
    mainHorizontalLayout.setExpandRatio(titleLabel, 1f);
    return titleLabel;
}

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);//from   w w w. j av  a2s .  c o 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);
}