Example usage for com.vaadin.ui Alignment TOP_CENTER

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

Introduction

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

Prototype

Alignment TOP_CENTER

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

Click Source Link

Usage

From source file:com.esofthead.mycollab.web.AdWindow.java

License:Open Source License

public AdWindow() {
    super("Buy MyCollab Pro edition");
    this.setWidth("700px");
    this.setModal(true);
    this.setResizable(false);
    RestTemplate restTemplate = new RestTemplate();
    MVerticalLayout content = new MVerticalLayout();
    try {/*from  w  ww  .ja v  a2s .c  o  m*/
        String result = restTemplate.getForObject("https://api.mycollab.com/api/storeweb", String.class);
        Label webPage = new Label(result, ContentMode.HTML);
        webPage.setHeight("600px");
        this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER));
    } catch (Exception e) {
        Div informDiv = new Div()
                .appendText("Can not load the store page. You can check the online edition at ")
                .appendChild(new A("https://www.mycollab.com/pricing/download/", "_blank").appendText("here"));
        Label webPage = new Label(informDiv.write(), ContentMode.HTML);
        this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER));
    }
    LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class);
    if (licenseResolver != null) {
        Button editLicenseBtn = new Button("Enter license code", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class);
                UI.getCurrent().addWindow(activateWindow);
                close();
            }
        });
        editLicenseBtn.addStyleName(UIConstants.BUTTON_ACTION);
        content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER);
    }
}

From source file:com.esofthead.mycollab.web.BuyPremiumSoftwareWindow.java

License:Open Source License

public BuyPremiumSoftwareWindow() {
    super("Buy MyCollab Pro edition");
    this.setWidth("700px");
    this.setModal(true);
    this.setResizable(false);
    RestTemplate restTemplate = new RestTemplate();
    MVerticalLayout content = new MVerticalLayout();
    try {/*  w  w w  .j  a  va 2 s.  c  o m*/
        String result = restTemplate.getForObject("https://api.mycollab.com/api/linktobuy", String.class);
        Label webPage = new Label(result, ContentMode.HTML);
        webPage.setHeight("600px");
        this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER));
    } catch (Exception e) {
        String result = FileUtils.readFileAsPlainString("buying.html");
        Label webPage = new Label(result, ContentMode.HTML);
        this.setContent(content.with(webPage).withAlign(webPage, Alignment.TOP_CENTER));
    }
    LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class);
    if (licenseResolver != null) {
        Button editLicenseBtn = new Button("Enter license code", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                Window activateWindow = ViewManager.getCacheComponent(AbstractLicenseActivationWindow.class);
                UI.getCurrent().addWindow(activateWindow);
                close();
            }
        });
        editLicenseBtn.addStyleName(UIConstants.BUTTON_ACTION);
        content.with(editLicenseBtn).withAlign(editLicenseBtn, Alignment.MIDDLE_CENTER);
    }
}

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

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

    setModal(true);/*from   w  w w.  j  av  a 2  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.expressui.core.MainApplication.java

License:Open Source License

@Override
public void init() {
    currentInstance.set(this);

    setTheme(getCustomTheme());/*from  w  w  w  .  jav  a2 s .co m*/
    customizeConfirmDialogStyle();

    Window mainWindow = new Window();
    setMainWindow(mainWindow);
    mainWindow.addStyleName("e-main-window");
    mainWindow.setCaption(getTypeCaption());

    VerticalLayout mainLayout = new VerticalLayout();
    String id = StringUtil.generateDebugId("e", this, mainLayout, "mainLayout");
    mainLayout.setDebugId(id);

    mainWindow.setSizeFull();
    mainLayout.setSizeFull();
    mainWindow.setContent(mainLayout);

    setLogoutURL(getApplicationProperties().getRestartApplicationUrl());

    configureLeftMenuBar(mainMenuBar.getLeftMenuBarRoot());
    configureRightMenuBar(mainMenuBar.getRightMenuBarRoot());
    mainLayout.addComponent(mainMenuBar);

    pageLayoutTabSheet = new TabSheet();
    id = StringUtil.generateDebugId("e", this, pageLayoutTabSheet, "pageLayoutTabSheet");
    pageLayoutTabSheet.setDebugId(id);

    pageLayoutTabSheet.addStyleName("e-main-page-layout");
    pageLayoutTabSheet.setSizeFull();
    mainLayout.addComponent(pageLayoutTabSheet);
    mainLayout.setExpandRatio(pageLayoutTabSheet, 1.0f);

    Link expressUILink = new Link(uiMessageSource.getMessage("mainApplication.footerMessage"),
            new ExternalResource(uiMessageSource.getMessage("mainApplication.footerLink")));
    expressUILink.setTargetName("_blank");
    expressUILink.setIcon(new ThemeResource("../expressui/favicon.png"));
    expressUILink.setSizeUndefined();
    mainLayout.addComponent(expressUILink);
    mainLayout.setComponentAlignment(expressUILink, Alignment.TOP_CENTER);

    configureSessionTimeout(mainWindow);
    postWire();
    onDisplay();
}

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 ww  .j  a  va 2 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();// w w w. j a  v  a2 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.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);
    }//from w w w.  ja  va 2  s. co m
}

From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java

License:Apache License

private FVLayout addComponentToStack(Component component, String name, FocXMLAttributes attributes) {
    Component parent = null;//from  w ww  . j a va  2 s.  co  m
    if (component != null) {
        if (!getStack().empty()) {
            parent = (Component) getStack().peek();
        } else {
            addComponent(component);// In this case this component is the root
            if (attributes != null && attributes.getValue(FXML.ATT_ALIGNMENT) != null
                    && !attributes.getValue(FXML.ATT_ALIGNMENT).isEmpty()) {
                String value = attributes.getValue(FXML.ATT_ALIGNMENT);
                FocXMLGuiComponentStatic.applyAlignment(this, component, value);
            } else {
                setComponentAlignment(component, Alignment.TOP_CENTER);
            }
        }
    }

    getStack().push(component);
    return (FVLayout) parent;
}

From source file:com.foc.vaadin.xmleditor.XMLEditor.java

License:Apache License

public XMLEditor(XMLView xmlView, String title, String xml) {
    setXMLView(xmlView);/*from w w w . j  ava 2s.  co m*/
    layout = new FVVerticalLayout();
    buttonLayout = new FVHorizontalLayout(null);
    //    buttonLayout.setMargin(true, false, false, false);
    buttonLayout.setSpacing(true);

    setCaption(title);

    editor = new FVTextArea(null, null);
    //    editor.setRows(40);
    //    editor.setColumns(80);
    editor.setWidth("100%");
    editor.setHeight("100%");
    Globals.logString("XML before editor.setValue()=" + xml);
    editor.setValue(xml);
    editor.addStyleName("focXMLEditor");

    save = new Button("save");
    cancel = new Button("cancel");

    addListenersToButtons();

    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setSpacing(false);
    layout.addComponent(editor);
    layout.setComponentAlignment(editor, Alignment.TOP_CENTER);
    layout.setExpandRatio(editor, 1);

    buttonLayout.addComponent(save);
    buttonLayout.setComponentAlignment(save, Alignment.MIDDLE_CENTER);
    buttonLayout.addComponent(cancel);
    buttonLayout.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER);

    layout.addComponent(buttonLayout);
    layout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER);

    setWidth("100%");
    setHeight("100%");
    setModal(true);

    setContent(layout);
}

From source file:com.gmail.volodymyrdotsenko.cms.fe.vaadin.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    langRepo.findAll().forEach(e -> {
        langSet.add(e.getCode());//from   w w w . j a  v a 2 s  .co  m
    });

    lang = new ComboBox("Language", langSet);

    getPage().setTitle("CMS");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    loginForm.addComponent(userName = new TextField("Username"));
    userName.setRequired(true);
    loginForm.addComponent(passwordField = new PasswordField("Password"));
    passwordField.setRequired(true);
    loginForm.addComponent(rememberMe = new CheckBox("Remember me"));
    loginForm.addComponent(lang);
    lang.setRequired(true);
    lang.setNullSelectionAllowed(false);
    loginForm.addComponent(login = new Button("Login"));
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(e -> {
        login();
    });

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    if (request.getParameter("logout") != null) {
        loggedOutLabel = new Label("You have been logged out!");
        loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS);
        loggedOutLabel.setSizeUndefined();
        loginLayout.addComponent(loggedOutLabel);
        loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER);
    }

    loginLayout.addComponent(loginFailedLabel = new Label());
    loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER);
    loginFailedLabel.setSizeUndefined();
    loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE);
    loginFailedLabel.setVisible(false);

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();

    String currentLang = getLocale().getLanguage();
    if (langSet.contains(currentLang))
        lang.select(currentLang);
    else
        lang.select("en");
}