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:de.akquinet.engineering.vaadin.javascriptplus.demo.JavaScriptPlusDemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {
    TimeBox timeBox = new TimeBox();
    timeBox.addValueChangeListener(//w ww.j a v a2 s .  co  m
            (source, from, to) -> Notification.show("Value Changed: from=" + from + ", to=" + to));

    Button button = new Button("Apply");

    VerticalLayout layoutContent = new VerticalLayout();
    layoutContent.setMargin(true);
    layoutContent.setSpacing(true);
    layoutContent.addComponent(timeBox);
    layoutContent.addComponent(button);

    setContent(layoutContent);
}

From source file:de.akquinet.engineering.vaadin.vaangular.demo.VaangularUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    try {/*  ww  w  . j  a  v a 2  s. c o m*/

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setMargin(true);
        mainLayout.setSpacing(true);
        Accordion accordion = new Accordion();

        weatherInfo = new Weather();
        final int[] times = new int[] { 10, 12, 14, 16 };
        final String[] entries = new String[] { "<strong>10</strong> sunny", "<strong>12</strong> windy",
                "<strong>14</strong> cold", "<strong>20</strong> superb" };
        weatherInfo.setDaten(times, entries);
        weatherInfo.addClickListener(new WeatherClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void click(int time, String entry) {
                showPopup(entry);
            }
        });
        weatherInfo.setButtonCaption("E-Mail (from angular)");
        accordion.addTab(weatherInfo, "Weather-Demo");
        mainLayout.addComponent(accordion);

        javaSend = new Button();
        javaSend.setCaption("E-Mail (from Java)");
        javaSend.addClickListener(new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                int index = weatherInfo.getSliderPos();
                System.out.println("Button from w/in Java - value: " + index);
                showPopup(entries[index]);
            }
        });
        mainLayout.addComponent(javaSend);

        setContent(mainLayout);
    } catch (Exception e) {
        throw new RuntimeException("some stupid error occured!", e);
    }
}

From source file:de.catma.ui.analyzer.AnalyzerView.java

License:Open Source License

private void initComponents() {
    setSizeFull();/*from ww  w.ja v a 2 s .c o  m*/

    Component searchPanel = createSearchPanel();

    Component convenienceButtonPanel = createConvenienceButtonPanel();

    VerticalLayout searchAndConveniencePanel = new VerticalLayout();
    searchAndConveniencePanel.setSpacing(true);
    searchAndConveniencePanel.setMargin(true);
    searchAndConveniencePanel.addComponent(searchPanel);
    searchAndConveniencePanel.addComponent(convenienceButtonPanel);

    Component documentsPanel = createDocumentsPanel();

    HorizontalSplitPanel topPanel = new HorizontalSplitPanel();
    topPanel.setSplitPosition(70);
    topPanel.addComponent(searchAndConveniencePanel);
    topPanel.addComponent(documentsPanel);
    addComponent(topPanel);

    setExpandRatio(topPanel, 0.25f);

    Component resultPanel = createResultPanel();
    resultPanel.setSizeFull();

    addComponent(resultPanel);
    setExpandRatio(resultPanel, 0.75f);
}

From source file:de.catma.ui.tagger.PropertyEditDialog.java

License:Open Source License

private void initComponents() {
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);//from  w  w  w . j ava2 s.c  o  m
    mainLayout.setSizeFull();

    hintText = new Label("Please use the check boxes to set or unset values.");
    mainLayout.addComponent(hintText);

    propertyTree = new TreeTable();
    propertyTree.setSelectable(true);

    propertyTree.setSizeFull();
    propertyTree.setPageLength(10);
    propertyTree.setImmediate(true);

    propertyTree.focus();
    propertyTree.addShortcutListener(
            new AbstractField.FocusShortcut(propertyTree, KeyCode.ARROW_UP, ModifierKey.CTRL));

    propertyTree.addContainerProperty(TreePropertyName.property, String.class, "");
    propertyTree.setColumnHeader(TreePropertyName.property, "Property");

    propertyTree.addContainerProperty(TreePropertyName.icon, Resource.class, "");

    propertyTree.addContainerProperty(TreePropertyName.value, String.class, "");
    propertyTree.setColumnHeader(TreePropertyName.value, "Value");

    propertyTree.addContainerProperty(TreePropertyName.assigned, CheckBox.class, "");
    propertyTree.setColumnHeader(TreePropertyName.assigned, "Assigned");

    propertyTree.setItemCaptionPropertyId(TreePropertyName.property);
    propertyTree.setItemIconPropertyId(TreePropertyName.icon);

    propertyTree.setVisibleColumns(
            new Object[] { TreePropertyName.property, TreePropertyName.value, TreePropertyName.assigned });

    mainLayout.addComponent(propertyTree);
    mainLayout.setExpandRatio(propertyTree, 1.0f);
    HorizontalLayout comboBox = new HorizontalLayout();
    comboBox.setSpacing(true);

    newValueInput = new FilterExposingComboBox("Add ad hoc value");
    newValueInput.setTextInputAllowed(true);
    newValueInput.setNewItemsAllowed(true);

    newValueInput.setImmediate(true);
    newValueInput.addShortcutListener(
            new AbstractField.FocusShortcut(newValueInput, KeyCode.ARROW_DOWN, ModifierKey.CTRL));

    comboBox.addComponent(newValueInput);

    btAdd = new Button("+");
    btAdd.setClickShortcut(KeyCode.INSERT);
    comboBox.addComponent(btAdd);
    comboBox.setComponentAlignment(btAdd, Alignment.BOTTOM_RIGHT);

    mainLayout.addComponent(comboBox);

    hintText = new Label("New property values, that are created ad hoc, exist only for this tag instance! "
            + "For the creation of new systematic values use the Tag Type Manager.");
    mainLayout.addComponent(hintText);

    HorizontalLayout buttonPanel = new HorizontalLayout();
    buttonPanel.setSpacing(true);

    btSave = new Button("Save");
    btSave.setClickShortcut(KeyCode.ENTER, ModifierKey.ALT);
    buttonPanel.addComponent(btSave);
    buttonPanel.setComponentAlignment(btSave, Alignment.MIDDLE_RIGHT);

    btCancel = new Button("Cancel");
    btCancel.setClickShortcut(KeyCode.ESCAPE);
    buttonPanel.addComponent(btCancel);
    buttonPanel.setComponentAlignment(btCancel, Alignment.MIDDLE_RIGHT);

    mainLayout.addComponent(buttonPanel);
    mainLayout.setComponentAlignment(buttonPanel, Alignment.MIDDLE_RIGHT);

    setContent(mainLayout);
    setWidth("40%");
    setHeight("80%");
    setModal(true);
    center();
}

From source file:de.decidr.ui.view.windows.StartConfigurationWindow.java

License:Apache License

private void init() {
    VerticalLayout mainVerticalLayout = new VerticalLayout();
    HorizontalLayout buttonHorizontalLayout = new HorizontalLayout();
    checkBox = new CheckBox();

    this.setContent(mainVerticalLayout);

    this.setCaption("Start configuration window");
    this.setModal(true);
    this.setWidth("800px");
    this.setHeight("500px");
    this.setResizable(false);

    mainVerticalLayout.setSpacing(true);
    mainVerticalLayout.setMargin(true);

    if (workflow.getVariables() != null && workflow.getVariables().getVariable().size() > 0) {
        configVariableForm = new ConfigVariableForm(workflow.getVariables());
        configVariableForm.setCaption("Configuration variables");
        configVariableForm.setWriteThrough(false);
        configVariableForm.setInvalidCommitted(false);
    }//from   w  w w  . j  av  a  2s . c  om

    if (workflow.getRoles() != null) {
        configRoles = new ConfigRoles(workflow.getRoles());
    }

    if (configRoles != null && configVariableForm != null) {
        // Set up split panel.
        SplitPanel splitPanel = new SplitPanel();
        splitPanel.setOrientation(SplitPanel.ORIENTATION_HORIZONTAL);
        splitPanel.setSplitPosition(450, Sizeable.UNITS_PIXELS);
        splitPanel.setHeight("400px");
        splitPanel.setLocked(true);

        splitPanel.setFirstComponent(configRoles);
        splitPanel.setSecondComponent(configVariableForm);

        mainVerticalLayout.addComponent(splitPanel);
    } else {
        // At least one of the components is unneeded, so no split panel
        this.setWidth("600px");
        if (configRoles != null) {
            mainVerticalLayout.addComponent(configRoles);
        } else if (configVariableForm != null) {
            mainVerticalLayout.addComponent(configVariableForm);
        }
    }

    okButton = new Button("OK", new SaveStartConfigurationAction(configRoles, configVariableForm,
            tConfiguration, workflowModelId, checkBox.booleanValue()));
    cancelButton = new Button("Cancel", new HideDialogWindowAction());
    mainVerticalLayout.addComponent(buttonHorizontalLayout);

    buttonHorizontalLayout.setSpacing(true);
    buttonHorizontalLayout.addComponent(checkBox);
    checkBox.setCaption("Start Immediately");
    buttonHorizontalLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_RIGHT);
    buttonHorizontalLayout.addComponent(okButton);
    buttonHorizontalLayout.addComponent(cancelButton);
}

From source file:de.fatalix.bookery.AppHeader.java

License:Open Source License

private MHorizontalLayout createSmallNavBar() {
    Button homeButton = new Button("Home", new Button.ClickListener() {
        @Override// www.  j a  v a2s.  c  o m
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(HomeView.id);
            //bookMenuLayout.setLayoutVisible(true);
        }
    });
    homeButton.addStyleName(ValoTheme.BUTTON_TINY);
    Button plainSearchButton = new Button("einfach stbern", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/author");
        }
    });
    plainSearchButton.addStyleName(ValoTheme.BUTTON_TINY);
    Button newBooks = new Button("neue Bcher", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/author/true");
        }
    });
    newBooks.addStyleName(ValoTheme.BUTTON_TINY);
    Button bestBooks = new Button("Die besten Bcher", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).getNavigator().navigateTo(SearchView.id + "/likes");
        }
    });
    bestBooks.addStyleName(ValoTheme.BUTTON_TINY);

    logoutButton = new Button("Hallo", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            ((App) UI.getCurrent()).logout();
        }
    });
    logoutButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    logoutButton.addStyleName(ValoTheme.BUTTON_SMALL);

    VerticalLayout buttonLayout = new VerticalLayout(logoutButton);
    buttonLayout.setMargin(false);
    buttonLayout.setSpacing(false);
    buttonLayout.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

    MHorizontalLayout layout = new MHorizontalLayout(homeButton, plainSearchButton, newBooks, bestBooks,
            buttonLayout);
    layout.expand(buttonLayout);

    return layout;
}

From source file:de.fatalix.bookery.view.admin.AdminView.java

License:Open Source License

public VerticalLayout createServerSettings() {
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    Label titleLabel = new Label("General Settings");
    titleLabel.addStyleName(ValoTheme.LABEL_H2);

    //layout.addComponent(titleLabel);
    layout.addComponent(serverSettingsLayout);
    Button resetIndex = new Button("reset Index", new Button.ClickListener() {

        @Override//from w ww . j  a  va  2  s.  c  o m
        public void buttonClick(Button.ClickEvent event) {

            try {
                presenter.resetIndex();
                Notification.show("Succesfully reset Index", Notification.Type.HUMANIZED_MESSAGE);
            } catch (IOException | SolrServerException ex) {
                Notification.show(ex.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    resetIndex.addStyleName(ValoTheme.BUTTON_DANGER);

    final TextField eMailAdress = new TextField(null, "felix.husse@medavis.de");
    eMailAdress.setColumns(35);
    Button testMail = new Button("Test Mail", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                presenter.sendEmail(eMailAdress.getValue());
                Notification.show("Mail succesfully sent!", Notification.Type.HUMANIZED_MESSAGE);
            } catch (MessagingException ex) {
                Notification.show("Mail failed!" + ex.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    testMail.setEnabled(true);

    Button resetBatchJobs = new Button("reset BatchJobs", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            presenter.resetBatchJobs();
            Notification.show("Succesfully reset Batchjobs", Notification.Type.HUMANIZED_MESSAGE);

        }
    });
    resetBatchJobs.addStyleName(ValoTheme.BUTTON_DANGER);

    HorizontalLayout mailLayout = new HorizontalLayout(eMailAdress, testMail, resetBatchJobs);
    layout.addComponents(resetIndex, mailLayout);

    return layout;
}

From source file:de.fatalix.bookery.view.common.BookSearchLayout.java

License:Open Source License

private VerticalLayout createSearchResultLayout() {
    resultText = new Label(" 0 Ergebnisse gefunden");
    resultText.addStyleName(ValoTheme.LABEL_BOLD);
    resultLayout = new HorizontalLayout();
    resultLayout.setSpacing(true);/*from w w  w. j a v  a 2 s . c  o  m*/
    resultLayout.addStyleName("wrapping");
    showMore = new Button("show more", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            searchBooks(query, false);

        }
    });
    showMore.setWidth(100, Unit.PERCENTAGE);
    showMore.addStyleName(ValoTheme.BUTTON_HUGE);
    showMore.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    VerticalLayout root = new VerticalLayout();
    root.addStyleName("bookery-view");
    root.setSpacing(true);
    root.setMargin(true);
    root.addComponents(resultText, resultLayout, showMore);
    return root;
}

From source file:de.fatalix.bookery.view.home.HomeView.java

License:Open Source License

@PostConstruct
private void postInit() {

    VerticalLayout root = new VerticalLayout();
    root.setSpacing(true);/*from  w  w  w. ja  va2s  .  c om*/
    root.setMargin(true);
    root.addComponents(bookCount, watchListLane, newBooksLane, mostLikedLane, mostLoadedLane);
    root.addStyleName("bookery-view");
    bookCount.addStyleName(ValoTheme.LABEL_BOLD);
    this.setCompositionRoot(root);
}

From source file:de.fatalix.lighty.web.ui.configuration.ConfigurationViewImpl.java

@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();/*ww w. j  av  a2  s .c om*/
    mainLayout.setMargin(new MarginInfo(true, true, true, true));
    final InlineEditField lightBridgeURL = new InlineEditField("LightBridge URL", "", true);
    lightBridgeURL.setId(SettingKey.SVNURL.getKey());
    lightBridgeURL.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            saveEvent.select(new AnnotationLiteral<ConfigurationPresenter.Save>() {
            }).fire(new ConfigurationPresenter.SaveConfiguration() {

                @Override
                public String getValue() {
                    return lightBridgeURL.getValue();
                }

                @Override
                public String getKey() {
                    return SettingKey.SVNURL.getKey();
                }

                @Override
                public void showStatus(String message) {
                    notificationEvent.select(new AnnotationLiteral<LightyNotificationBar.ShowNotification>() {
                    }).fire(message);
                }
            });
        }
    });

    final InlineEditField lightBridgeUser = new InlineEditField("User", "", true);
    lightBridgeUser.setId(SettingKey.SVNUSER.getKey());
    lightBridgeUser.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {

            saveEvent.select(new AnnotationLiteral<ConfigurationPresenter.Save>() {
            }).fire(new ConfigurationPresenter.SaveConfiguration() {

                @Override
                public String getValue() {
                    return lightBridgeUser.getValue();
                }

                @Override
                public String getKey() {
                    return SettingKey.SVNUSER.getKey();
                }

                @Override
                public void showStatus(String message) {
                    notificationEvent.select(new AnnotationLiteral<LightyNotificationBar.ShowNotification>() {
                    }).fire(message);
                }
            });
        }
    });

    Button checkConfiguration = new Button("check", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            testConnectEvent.select(new AnnotationLiteral<ConfigurationPresenter.TestConfig>() {
            }).fire(new ConfigurationPresenter.TestConfiguration() {

                @Override
                public void showStatus(String message) {
                    notificationEvent.select(new AnnotationLiteral<LightyNotificationBar.ShowNotification>() {
                    }).fire(message);
                }
            });
        }
    });

    configurationFields.put(SettingKey.SVNURL.getKey(), lightBridgeURL);
    configurationFields.put(SettingKey.SVNUSER.getKey(), lightBridgeUser);

    mainLayout.addComponents(lightBridgeURL, lightBridgeUser, checkConfiguration);
    setCompositionRoot(mainLayout);
    loadEvent.select(new AnnotationLiteral<ConfigurationPresenter.Load>() {
    }).fire(new ConfigurationPresenter.LoadConfiguration() {

        @Override
        public void loadConfiguration(List<LightyConfiguration> configuration) {
            for (LightyConfiguration configurationEntry : configuration) {
                configurationFields.get(configurationEntry.getConfigurationKey())
                        .setFieldValue(configurationEntry.getConfigurationValue());
            }
        }
    });
}