Example usage for com.vaadin.ui VerticalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout useTokenLayout() {
    token.setInputPrompt("Token");
    token.setWidth(STANDARD_WIDTH, EM);//  w w w  .  j a  v a2 s  .  co  m
    useToken.setCaption("Next");
    backFromUseToken.setCaption("Back");

    HorizontalLayout buttons = new HorizontalLayout(useToken, backFromUseToken);
    buttons.setSpacing(true);

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(greeting, token, buttons);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

From source file:com.antonjohansson.lprs.view.ServiceView.java

License:Apache License

private Layout setPasswordLayout() {
    newPassword.setWidth(STANDARD_WIDTH, EM);
    newPassword.setCaption("Password");
    newPasswordRepeat.setWidth(STANDARD_WIDTH, EM);
    newPasswordRepeat.setCaption("Repeat password");
    setPassword.setCaption("Set password");
    backFromSetPassword.setCaption("Back");

    HorizontalLayout buttons = new HorizontalLayout(setPassword, backFromSetPassword);
    buttons.setSpacing(true);//from w w w .j  ava 2  s . c  o  m

    VerticalLayout layout = new VerticalLayout();
    layout.addComponents(newPassword, newPasswordRepeat, buttons);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setVisible(false);
    layout.setWidthUndefined();

    return layout;
}

From source file:com.arcusys.liferay.vaadinplugin.ui.AdditionalDependenciesWindow.java

License:Apache License

public AdditionalDependenciesWindow(List<File> files, List<File> includedDependencies) {
    setCaption("Additional dependencies (WEB-INF/lib)");
    setWidth("350px");
    setHeight("350px");

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*from   w  ww  .  j  a  v a2 s  . c  o m*/
    layout.setMargin(true);
    layout.setSpacing(true);
    setContent(layout);

    dependencyContainer.addContainerProperty("caption", String.class, null);

    filterTextField = createFilterTextField();
    layout.addComponent(filterTextField);

    dependenciesSelector = createDependenciesSelector();
    populateSelector(files, includedDependencies);
    layout.addComponent(dependenciesSelector);
    layout.setExpandRatio(dependenciesSelector, 1);

    layout.addComponent(createCloseButton());
}

From source file:com.arcusys.liferay.vaadinplugin.ui.DetailsWindow.java

License:Apache License

private Layout createVaadinDetails() {

    Layout vaadinDetailLayout = new VerticalLayout();
    vaadinDetailLayout.setWidth("900px");

    VerticalLayout vaadinDetails = new VerticalLayout();
    vaadinDetails.setMargin(new MarginInfo(true, true, false, true));

    Version currentVersion = ControlPanelPortletUtil.getPortalVaadinVersion();
    VaadinVersion currentVaadinInfo = VaadinVersion.getVaadinVersion(currentVersion);
    Collection<VaadinFileInfo> fileInfos = currentVaadinInfo.getVaadinFilesInfo();

    Collections.sort((List<VaadinFileInfo>) fileInfos, new Comparator<VaadinFileInfo>() {
        @Override/*  www . j  a v a 2s . c o m*/
        public int compare(VaadinFileInfo o1, VaadinFileInfo o2) {
            if (o1 == null)
                return -1;
            if (o2 == null)
                return 1;
            return o1.getOrderPriority().compareTo(o2.getOrderPriority());
        }
    });

    for (VaadinFileInfo info : fileInfos) {
        VerticalLayout infoLayout = new VerticalLayout();
        infoLayout.setCaption(info.getName());

        infoLayout.setMargin(new MarginInfo(false, true, true, false));

        Layout versionLayout = new HorizontalLayout();
        versionLayout.setSizeUndefined();
        versionLayout.addComponent(new Label("Version: "));
        String vaadinJarVersion;
        try {
            vaadinJarVersion = ControlPanelPortletUtil.getPortalVaadinJarVersion(
                    info.getPlace() + ControlPanelPortletUtil.FileSeparator + info.getName());
        } catch (Exception ex) {
            vaadinJarVersion = "";
            log.warn("Version for " + vaadinJarVersion + " couldn't be read.", ex);
        }

        versionLayout.addComponent(new Label(vaadinJarVersion));

        infoLayout.addComponent(versionLayout);

        Layout pathLayout = new HorizontalLayout();

        pathLayout.setSizeUndefined();
        pathLayout.addComponent(new Label("Path: "));
        String path = info.getPlace();
        pathLayout.addComponent(new Label(path));

        infoLayout.addComponent(pathLayout);

        vaadinDetails.addComponent(infoLayout);
    }

    vaadinDetailLayout.addComponent(vaadinDetails);
    return vaadinDetailLayout;
}

From source file:com.arcusys.liferay.vaadinplugin.ui.OutputConsole.java

License:Apache License

public OutputConsole(String caption) {
    Panel panel = new Panel();
    panel.setCaption(caption);/*w w w  .  j a va  2  s .co m*/
    panel.setSizeFull();
    setCompositionRoot(panel);

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeUndefined();
    panel.setContent(layout);

    VerticalLayout outputLabelLayout = new VerticalLayout();
    outputLabelLayout.setSizeUndefined();
    outputLabelLayout.setMargin(true);
    layout.addComponent(outputLabelLayout);

    outputLabel.setSizeUndefined();
    outputLabelLayout.addComponent(outputLabel);

    scrollToLabel.setWidth("0px");
    scrollToLabel.setHeight("0px");
    layout.addComponent(scrollToLabel);
}

From source file:com.bellkenz.modules.PersonalInformation.java

public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept,
        final TextField post) {
    VerticalLayout vlayout = new VerticalLayout();
    vlayout.setMargin(true);
    vlayout.setSpacing(true);/*from   w  ww.  ja  va2  s .co m*/

    final Window subWindow = new Window("Transfer Employee", vlayout);
    subWindow.setWidth("200px");

    final ComboBox division = new ComboBox("Division: ");
    division.setWidth("100%");
    dropDownBoxList.populateBranchComboBox(division);
    subWindow.addComponent(division);

    final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox());
    department.setWidth("100%");
    division.addListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            if (division.getValue() == null) {
            } else {
                divisionId = branchDAO.getBranchId(division.getValue().toString());
            }
        }

    });
    subWindow.addComponent(department);

    final TextField position = createTextField("Position: ");
    position.setWidth("100%");
    subWindow.addComponent(position);

    final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: ");
    subWindow.addComponent(entryDate);

    Button updateButton = new Button("UPDATE");
    updateButton.setWidth("100%");
    updateButton.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (division.getValue() == null) {
                getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (department.getValue() == null) {
                getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) {
                getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            if (entryDate.getValue() == null) {
                getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE);
                return;
            }

            List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>();
            EmployeePositionHistory eph = new EmployeePositionHistory();
            eph.setBranch(division.getValue().toString());
            eph.setDepartment(department.getValue().toString());
            eph.setPosition(position.getValue().toString().trim().toLowerCase());
            eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString()));
            ephList.add(eph);
            Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString());
            Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId);
            if (result) {
                Object divObjectId = div.addItem();
                div.setItemCaption(divObjectId, division.getValue().toString());
                div.setValue(divObjectId);

                Object deptObjectId = dept.addItem();
                dept.setItemCaption(deptObjectId, department.getValue().toString());
                dept.setValue(deptObjectId);

                post.setValue(position.getValue().toString().trim().toLowerCase());

                (subWindow.getParent()).removeWindow(subWindow);
            } else {
                getWindow().showNotification("Cannot Transfer employee",
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    subWindow.addComponent(updateButton);

    return subWindow;
}

From source file:com.blogspot.markogronroos.MainUI.java

License:GNU General Public License

@Override
protected void init(VaadinRequest request) {

    final VerticalLayout main = new VerticalLayout();
    main.setMargin(true);
    setContent(main);/*from  ww w .  j  a  va2  s  . c  o  m*/

    //Window main = new Window("Test Application");

    // Create a menu bar
    final MenuBar menubar = new MenuBar();
    main.addComponent(menubar);

    // A feedback component
    final Label selection = new Label("-");
    main.addComponent(selection);

    MenuBar.MenuItem menuitem1 = menubar.addItem("JPA Examples", null, null);

    MenuBar.MenuItem menuitem2 = menuitem1.addItem("Other Example", null, null);

    MenuBar.Command mycommand = new MenuBar.Command() {
        @Override
        public void menuSelected(MenuBar.MenuItem selectedItem) {
            selection.setValue("Ordered a " + selectedItem.getText() + " from menu.");
            String selectedText = selectedItem.getText();
            if (selectedText.contains("1.1"))
                jpaContTable(main);
            else if (selectedText.contains("1.2"))
                jpaContTable2(main);
            else if (selectedText.contains("1.3"))
                jpaContForm1(main);
            else if (selectedText.contains("1.4"))
                pureJPAExample(main);
            //selectedItem.
        }
    };

    menuitem1.addItem("1.1 demo JPAContainer Table component", null, mycommand);
    menuitem1.addItem("1.2 demo JPAContainer Table component, explicit EntityManager", null, mycommand);
    menuitem1.addItem("1.3 demo JPAContainer Form", null, mycommand);

    menuitem1.addItem("1.4 demo JPA batch", null, mycommand);
    //menuitem1.addItem(menuitem2);

    // Define a common menu command for all the menu items.

    //  initEx2(request);
}

From source file:com.bsb.common.vaadin.embed.component.ComponentWrapper.java

License:Apache License

/**
 * Wraps the specified {@link Component} into a Vaadin application.
 *
 * @param component the component to wrap
 * @return an application displaying that component
 * @see #wrapLayout(com.vaadin.ui.Layout)
 * @see #wrapWindow(com.vaadin.ui.Window)
 *//*from  ww w .j av a 2s. c  o  m*/
public Application wrap(Component component) {
    if (component instanceof Window) {
        return wrapWindow((Window) component);
    }
    if (component instanceof Layout) {
        return wrapLayout((Layout) component);
    }

    // Ok it's a component we cannot handle directly
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSizeFull();
    layout.addComponent(component);
    layout.setExpandRatio(component, 1);
    return wrapLayout(layout);
}

From source file:com.bsb.samples.vaadin.wizard.core.FinalStep.java

License:Apache License

public Component getContent() {
    final VerticalLayout content = new VerticalLayout();

    content.setMargin(true);

    final Label sorry = new Label(
            "We sincerely hope that you were not expecting a demo of a " + "kick-ass Wizard :)");
    content.addComponent(sorry);/* w  ww  .  j a va 2s .  c  o  m*/

    return content;
}

From source file:com.bsb.samples.vaadin.wizard.core.FirstStep.java

License:Apache License

public Component getContent() {
    final VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);//from ww w .  j  a  v a 2  s . c o  m
    content.setMargin(true);

    final Label intro = new Label("A trivial use of the Wizards for Vaadin add-on");
    content.addComponent(intro);

    final Label description = new Label(
            "This demonstrates an application where a custom widgetset has been compiled in a separate JAR "
                    + "project that is not bound to the standard build lifecycle of the project. By making this "
                    + "project optional, the lengthy compilation of the widgetset is only performed on demand. "
                    + "Besides, a full clean of your project in your IDE does not require you to rebuild the "
                    + "widgetset.");
    content.addComponent(description);

    return content;
}