Example usage for com.vaadin.ui VerticalLayout VerticalLayout

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

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:br.gov.frameworkdemoiselle.vaadin.ui.StructuredView.java

License:Open Source License

@Override
public void init() {
    footer = new VerticalLayout();
    header = new VerticalLayout();
    content = new VerticalLayout();
    menuBar = new MenuBar();

    content.setHeight("600px");
    content.setWidth("100%");

    header.setHeight("80px");
    header.setWidth("100%");

    footer.setHeight("100px");
    footer.setWidth("100%");

    addComponent(header);//from   w w w.  ja  va 2  s . co  m
    addComponent(menuBar);
    addComponent(content);
    addComponent(footer);

    super.init();
}

From source file:by.bigvova.LoginUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    getPage().setTitle("Vaadin Shared Security Demo Login");

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();/*  ww  w  .  j a  va2 s .co  m*/

    userName = new TextField("Username");
    passwordField = new PasswordField("Password");
    rememberMe = new CheckBox("Remember me");
    login = new Button("Login");
    Label label = new Label("Name: User / Password: password");
    loginForm.addComponent(userName);
    loginForm.addComponent(passwordField);
    loginForm.addComponent(rememberMe);
    loginForm.addComponent(login);
    login.addStyleName(ValoTheme.BUTTON_PRIMARY);
    login.setDisableOnClick(true);
    login.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    login.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            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(label);
    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();
}

From source file:by.bigvova.ui.LoginUI.java

License:Apache License

private VerticalLayout root() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*  ww w  .j ava2 s  .  co m*/

    Component loginForm = buildLoginForm();
    layout.addComponent(loginForm);
    layout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER);
    return layout;
}

From source file:by.bigvova.ui.LoginUI.java

License:Apache License

private Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();// w  ww .jav a  2  s. co  m
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    return loginPanel;
}

From source file:by.bigvova.ui.LoginUI.java

License:Apache License

private Component buildFields() {
    final VerticalLayout layout = new VerticalLayout();
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);/*from   ww  w.  j  av a 2  s  .c o m*/
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    final CheckBox checkBox = new CheckBox("Remember me", true);

    signin.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            login(username.getValue(), password.getValue(), checkBox.getValue());
        }
    });

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    layout.setSpacing(true);
    layout.addComponent(fields);
    layout.addComponent(checkBox);
    return layout;
}

From source file:by.bigvova.views.HomeView.java

License:Apache License

public HomeView() {
    setSpacing(true);//from  w  w w  . j  av a  2 s.c  o m
    setMargin(true);
    setSizeFull();

    Label header = new Label("   -=FoodNote=-");
    header.addStyleName(ValoTheme.LABEL_H1);
    addComponent(header);
    Label body = new Label(
            "<h3> ?? ? ? <b>CRUD</b> ?  ? <b>enterprise</b> ."
                    + "   ?  ?? ,    ?  ? .</h3>"
                    + "? ?:" + "<ul>"
                    + "<li>?  ?  <b>Spring Boot</b>, ? ? - propertie .</li>"
                    + "<li>? ?  ?? ? ???   <b>Repository</b> - <b>Spring Data JPA</b>, <b>Hibernate</b> (<b>JdbcTemplate</b>  ?).</li>"
                    + "<li> ?? - ?? ,  :</li>"
                    + "<ul>" + "<li>  - <b>PostgreSQL</b></li>"
                    + "<li>connection pool - <b>HikariCP</b></li>" + "</ul>"
                    + "<li>? - <b>EhCache</b>.</li>"
                    + "<li> ? -  <b>EventBus</b>, ? <b>Google Guava</b>.</li>"
                    + "<li>?,  - <b>Spring Security</b>:</li>"
                    + "<ul>"
                    + "<li>    , ? <b>UserDetails</b></li>"
                    + "<li> ??   ? <b>BCrypt</b></li>"
                    + "<li>  <b>Remember Me</b> ??</li>"
                    + "</ul>" + "<li>? - <b>JUnit4</b></li>"
                    + "<li> - <b>slf4j</b>, <b>logback</b></li>"
                    + "<li>Front-end - <b>Vaadin framework</b>, <b>GWT</b></li>"
                    + "<li>   <b>Docker</b>      ? <b>Ubuntu Server 14.04</b></li>"
                    + "</ul>"
                    + "<p>? Spring Boot - Vaadin ?? : <a href=\"https://github.com/peholmst/vaadin4spring\">vaadin4spring</a></p>"
                    + "<p> ? <a href=\"https://github.com/BigVOVA/FoodNote\">github.com/BigVOVA/FoodNote</a></p>");
    body.setContentMode(ContentMode.HTML);
    VerticalLayout bodyLayout = new VerticalLayout();
    bodyLayout.setWidth(100, Unit.PERCENTAGE);
    bodyLayout.setMargin(new MarginInfo(false, true, false, true));
    bodyLayout.addComponent(body);
    Panel panel = new Panel();
    panel.setSizeFull();
    panel.setContent(bodyLayout);
    addComponent(panel);
    setExpandRatio(panel, 1);
}

From source file:by.bigvova.views.UserView.UserView.java

License:Apache License

@Override
public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {
    setSizeFull();/*from ww w  .ja  v a2  s  . c  om*/
    footerButtons.setSpacing(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();

    Label header = new Label("Meal table");
    header.addStyleName(ValoTheme.LABEL_H1);
    layout.addComponent(header);

    layout.addComponent(mainGrid);
    layout.addComponent(footerButtons);
    layout.setExpandRatio(mainGrid, 1);

    setCompositionRoot(layout);
}

From source file:cb_server.LogInWindow.java

License:Open Source License

private LogInWindow() {

    super("Get API Key"); // Set window caption

    this.setWidth(50, Unit.PERCENTAGE);
    this.setHeight(80, Unit.PERCENTAGE);

    center();/* w  w w  . j  a  va 2 s.  c om*/

    URL url;
    try {

        String oAuthUrl = CB_Api.getGcAuthUrl();

        url = new URL(oAuthUrl);

        ExternalResource extRes = new ExternalResource(url);

        extRes.getURL();

        BrowserFrame browser = new BrowserFrame("", extRes);

        browser.setWidth(100, Unit.PERCENTAGE);
        browser.setHeight(100, Unit.PERCENTAGE);

        content = new VerticalLayout();
        content.setWidth(100, Unit.PERCENTAGE);
        content.setHeight(100, Unit.PERCENTAGE);
        setContent(content);

        //         browser.addListener(eventType, target, method);

        content.addComponent(browser);
    } catch (MalformedURLException e) {

        e.printStackTrace();
    }
}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private SettingsWindow() {

    super("Server Settings"); // Set window caption

    this.setWidth(50, Unit.PERCENTAGE);
    this.setHeight(80, Unit.PERCENTAGE);

    center();/*w  ww. ja v a  2  s.  c om*/

    //save act settings for cancel restore
    Config.settings.SaveToLastValue();

    // Some basic content for the window
    content = new VerticalLayout();
    content.setMargin(true);
    setContent(content);

    addSaveCancelButtons();

    fillContent();

}

From source file:cb_server.SettingsWindow.java

License:Open Source License

private void fillContent() {

    if (Settingscontent != null) {
        content.removeComponent(Settingscontent);
        Settingscontent = null;//from  www  .j  a va 2 s.  c om
    }

    Settingscontent = new VerticalLayout();
    content.addComponent(Settingscontent);

    InetAddress addr;
    QRCode code = null;
    try {
        addr = InetAddress.getLocalHost();

        //Getting IPAddress of localhost - getHostAddress return IP Address
        // in textual format
        String ipAddress = addr.getHostAddress();

        ipAddress = "";
        // Network Interfaces nach IPv4 Adressen durchsuchen
        try {
            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
            for (NetworkInterface netint : Collections.list(nets)) {
                Enumeration<InetAddress> inetAddresses = netint.getInetAddresses();
                for (InetAddress inetAddress : Collections.list(inetAddresses)) {
                    if (inetAddress.isLoopbackAddress())
                        continue;
                    if (inetAddress instanceof Inet4Address) {
                        System.out.println("InetAddress: " + inetAddress);
                        if (ipAddress.length() > 0) {
                            ipAddress += ";";
                        }
                        ipAddress += inetAddress;
                    }
                }
            }

        } catch (SocketException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        code = new QRCode();
        code.setWidth(150, Unit.PIXELS);
        code.setHeight(150, Unit.PIXELS);
        code.setValue(ipAddress);

    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    TabSheet tabSheet = new TabSheet();
    tabSheet.setWidth(100, Unit.PERCENTAGE);
    tabSheet.setHeight(100, Unit.PERCENTAGE);
    Settingscontent.addComponent(tabSheet);

    VerticalLayout lay = new VerticalLayout();

    // add Lang Spinner

    langSpinner = new ComboBox();
    langSpinner.setCaption("select Lang");

    for (Lang lang : Translation.GetLangs(SettingsClass.LanguagePath.getValue())) {
        langSpinner.addItem(lang.Name);
        langSpinner.setItemCaption(lang.Name, lang.Name);
    }

    langSpinner.setValue(Translation.getLangId());
    langSpinner.setNullSelectionAllowed(false);
    lay.addComponent(langSpinner);

    lay.addComponent(code);
    SettingsLinearLayoutPanel info = new SettingsLinearLayoutPanel();

    info.setContent(lay, 400);

    tabSheet.addTab(info, "Info");

    // Categorie List zusammen stellen

    if (Categorys == null) {
        Categorys = new ArrayList<SettingCategory>();
    }

    Categorys.clear();
    SettingCategory[] tmp = SettingCategory.values();
    for (SettingCategory item : tmp) {
        if (item != SettingCategory.Button) {
            Categorys.add(item);
        }

    }

    Iterator<SettingCategory> iteratorCat = Categorys.iterator();
    if (iteratorCat != null && iteratorCat.hasNext()) {

        ArrayList<SettingBase<?>> SortedSettingList = new ArrayList<SettingBase<?>>();

        for (Iterator<SettingBase<?>> it = Config.settings.iterator(); it.hasNext();) {
            SettingBase<?> setting = it.next();

            if (setting.getModus() != SettingModus.Never
                    && (setting.getUsage() == SettingUsage.ALL || setting.getUsage() == SettingUsage.CBS)) {
                SortedSettingList.add(setting);
            }
        }

        do {
            int position = 0;

            SettingCategory cat = iteratorCat.next();

            // add Cat eintrge

            lay = new VerticalLayout();
            int entryCount = 0;

            if (cat == SettingCategory.Login) {
                final Component view = getLogInButton(position++);
                lay.addComponent(view);
            }

            // int layoutHeight = 0;
            for (Iterator<SettingBase<?>> it = SortedSettingList.iterator(); it.hasNext();) {
                SettingBase<?> settingItem = it.next();
                if (settingItem.getCategory().name().equals(cat.name())) {

                    if ((settingItem.getModus() == SettingModus.Normal)
                            && (settingItem.getModus() != SettingModus.Never)) {

                        final Component view = getView(settingItem, position++);

                        if (view == null)
                            continue;

                        lay.addComponent(view);
                        entryCount++;
                        Config.settings.indexOf(settingItem);

                    }

                }
            }

            if (entryCount > 0) {

                SettingsLinearLayoutPanel catPanel = new SettingsLinearLayoutPanel();

                catPanel.setContent(lay, 400);

                tabSheet.addTab(catPanel, cat.name());

                //               addControlToLinearLayout(lay, 100);

            }

        } while (iteratorCat.hasNext());

    }

}