Example usage for com.vaadin.ui VerticalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:org.abstractform.vaadin.VaadinFormToolkit.java

License:Apache License

@Override
public VaadinFormInstance buildForm(Form form, Map<String, Object> extraObjects) {
    VerticalLayout layout = new VerticalLayout();
    Map<String, AbstractComponent> mapComponents = new HashMap<String, AbstractComponent>();
    List<String> fieldIdList = new ArrayList<String>();
    layout.setSpacing(true);/*from  www .  j a va  2s.  c  o  m*/
    layout.setSizeFull();
    for (Component part : form.getChildList()) {
        ComponentContainer container = buildComponent(part, mapComponents, fieldIdList, extraObjects);
        if (container != null) {
            layout.addComponent(container);
        }
    }
    addComponent(mapComponents, form, layout);
    VaadinFormInstance formInstance = new VaadinFormInstanceImpl(layout,
            Collections.unmodifiableMap(mapComponents), Collections.unmodifiableList(fieldIdList));

    //build SelectorProviders
    buildSelectorProviders(mapComponents, formInstance);
    return formInstance;
}

From source file:org.accelerators.activiti.admin.ui.GroupTab.java

License:Open Source License

public GroupTab(AdminApp application) {

    // Set application reference
    this.app = application;

    // Set tab name
    setCaption(app.getMessage(Messages.Groups));

    // Add main layout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//www.  j  a  v  a2s  .co  m
    layout.setSpacing(true);
    layout.setSizeFull();

    // Add toolbar layout
    GridLayout toolbar = new GridLayout(2, 1);
    toolbar.setWidth("100%");
    layout.addComponent(toolbar);

    // Add create button
    create = new Button(app.getMessage(Messages.Create), (ClickListener) this);
    create.setDescription(app.getMessage(Messages.CreateGroup));
    create.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    toolbar.addComponent(create, 0, 0);
    toolbar.setComponentAlignment(create, Alignment.TOP_LEFT);

    // Add refresh button
    refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this);
    refresh.setDescription(app.getMessage(Messages.RefreshTable));
    refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png"));
    toolbar.addComponent(refresh, 1, 0);
    toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT);

    // Add table
    table = new GroupTable(app);
    table.setSizeFull();
    layout.addComponent(table);

    // Set table to expand
    layout.setExpandRatio(table, 1.0f);

    // Root
    setCompositionRoot(layout);
}

From source file:org.accelerators.activiti.admin.ui.LoginView.java

License:Open Source License

@SuppressWarnings("serial")
public LoginView(AdminApp application) {

    // Set application reference
    this.app = application;

    // Init window caption
    app.getMainWindow().setCaption(app.getMessage(Messages.Title));

    // Set layout to full size
    setSizeFull();/*  w  w  w . j a  va2 s . c o  m*/

    // Set style
    this.setStyleName("login-background");

    // Add header bar
    final HorizontalLayout header = new HorizontalLayout();
    header.setHeight("50px");
    header.setWidth("100%");
    addComponent(header);
    setComponentAlignment(header, Alignment.MIDDLE_CENTER);

    // Setup grid
    GridLayout loginGrid = new GridLayout(1, 2);
    loginGrid.setWidth("250px");
    addComponent(loginGrid);
    setComponentAlignment(loginGrid, Alignment.MIDDLE_CENTER);

    // Add title to header
    GridLayout logoGrid = new GridLayout(1, 1);
    loginGrid.addComponent(logoGrid, 0, 0);
    loginGrid.setComponentAlignment(logoGrid, Alignment.MIDDLE_CENTER);

    Embedded logoImage = new Embedded(null, new ThemeResource("img/login-logo.png"));
    logoImage.setType(Embedded.TYPE_IMAGE);
    logoImage.addStyleName("login-image");
    logoGrid.addComponent(logoImage, 0, 0);
    logoGrid.setComponentAlignment(logoImage, Alignment.MIDDLE_CENTER);

    // Add field and button layout
    VerticalLayout buttonLayout = new VerticalLayout();
    buttonLayout.setSizeFull();
    buttonLayout.setSpacing(true);
    buttonLayout.setMargin(false);
    buttonLayout.setStyleName("login-form");
    loginGrid.addComponent(buttonLayout, 0, 1);
    loginGrid.setComponentAlignment(buttonLayout, Alignment.MIDDLE_CENTER);

    // Add username field
    username = new TextField(app.getMessage(Messages.Username));
    username.setWidth("100%");
    buttonLayout.addComponent(username);

    // Add password field
    password = new PasswordField(app.getMessage(Messages.Password));
    password.setWidth("100%");
    buttonLayout.addComponent(password);

    // Add Login button
    buttonLayout.addComponent(login);
    buttonLayout.setComponentAlignment(login, Alignment.BOTTOM_RIGHT);

    // Set focus to this component
    username.focus();

    // Add shortcut to login button
    login.setClickShortcut(KeyCode.ENTER);

    login.addListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            try {

                // Athenticate the user
                authenticate((String) username.getValue(), (String) password.getValue());

                // Switch to the main view
                app.getViewManager().switchScreen(MainView.class.getName(), new MainView(app));

            } catch (Exception e) {
                getWindow().showNotification(e.toString());
            }
        }
    });

    HorizontalLayout footer = new HorizontalLayout();
    footer.setHeight("50px");
    footer.setWidth("100%");
    addComponent(footer);

}

From source file:org.accelerators.activiti.admin.ui.UserTab.java

License:Open Source License

public UserTab(AdminApp application) {

    // Set application reference
    this.app = application;

    // Set tab name
    setCaption(app.getMessage(Messages.Users));

    // Add main layout
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);//from   w ww . j a v  a 2 s.c o m
    layout.setSpacing(true);
    layout.setSizeFull();

    // Add toolbar layout
    GridLayout toolbar = new GridLayout(2, 1);
    toolbar.setWidth("100%");
    layout.addComponent(toolbar);

    // Add create button
    create = new Button(app.getMessage(Messages.Create), (ClickListener) this);
    create.setDescription(app.getMessage(Messages.CreateUser));
    create.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
    toolbar.addComponent(create, 0, 0);
    toolbar.setComponentAlignment(create, Alignment.TOP_LEFT);

    // Add refresh button
    refresh = new Button(app.getMessage(Messages.Refresh), (ClickListener) this);
    refresh.setDescription(app.getMessage(Messages.RefreshTable));
    refresh.setIcon(new ThemeResource("../runo/icons/16/reload.png"));
    toolbar.addComponent(refresh, 1, 0);
    toolbar.setComponentAlignment(refresh, Alignment.TOP_RIGHT);

    // Add table
    table = new UserTable(app);
    table.setSizeFull();
    layout.addComponent(table);

    // Set table to expand
    layout.setExpandRatio(table, 1.0f);

    // Root
    setCompositionRoot(layout);
}

From source file:org.activiti.explorer.ui.management.job.JobDetailPanel.java

License:Apache License

protected void addJobState() {
    Label processDefinitionHeader = new Label(i18nManager.getMessage(Messages.JOB_HEADER_EXECUTION));
    processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_H3);
    processDefinitionHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    processDefinitionHeader.setWidth(100, UNITS_PERCENTAGE);
    addComponent(processDefinitionHeader);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);// ww w. j  a va  2 s. c  o m
    layout.setSizeFull();
    layout.setMargin(true, false, true, false);

    addDetailComponent(layout);
    setDetailExpandRatio(layout, 1.0f);

    // Exceptions
    if (job.getExceptionMessage() != null) {
        // Number of retries
        Label retrieslabel = new Label(getRetriesLabel(job));
        layout.addComponent(retrieslabel);

        // Exception
        Label exceptionMessageLabel = new Label(
                i18nManager.getMessage(Messages.JOB_ERROR) + ": " + job.getExceptionMessage());
        exceptionMessageLabel.addStyleName(ExplorerLayout.STYLE_JOB_EXCEPTION_MESSAGE);
        layout.addComponent(exceptionMessageLabel);

        // Add Exception stacktrace
        String stack = managementService.getJobExceptionStacktrace(job.getId());

        Label stackTraceLabel = new Label(stack);
        stackTraceLabel.setContentMode(Label.CONTENT_PREFORMATTED);
        stackTraceLabel.addStyleName(ExplorerLayout.STYLE_JOB_EXCEPTION_TRACE);
        stackTraceLabel.setSizeFull();

        Panel stackPanel = new Panel();
        stackPanel.setWidth(100, UNITS_PERCENTAGE);
        stackPanel.setSizeFull();
        stackPanel.setScrollable(true);
        stackPanel.addComponent(stackTraceLabel);

        layout.addComponent(stackPanel);
        layout.setExpandRatio(stackPanel, 1.0f);
    } else {

        if (job.getProcessDefinitionId() != null) {

            // This is a hack .. need to cleanify this in the engine
            JobEntity jobEntity = (JobEntity) job;
            if (jobEntity.getJobHandlerType().equals(TimerSuspendProcessDefinitionHandler.TYPE)) {
                addLinkToProcessDefinition(layout,
                        i18nManager.getMessage(Messages.JOB_SUSPEND_PROCESSDEFINITION), false);
            } else if (jobEntity.getJobHandlerType().equals(TimerActivateProcessDefinitionHandler.TYPE)) {
                addLinkToProcessDefinition(layout,
                        i18nManager.getMessage(Messages.JOB_ACTIVATE_PROCESSDEFINITION), true);
            } else {
                addNotYetExecutedLabel(layout);
            }

        } else {

            addNotYetExecutedLabel(layout);

        }
    }
}

From source file:org.adho.dhconvalidator.ui.AboutWindow.java

private void initComponents() {
    setModal(true);//from  w  ww .ja v a  2  s. c om
    setHeight("100px");
    setWidth("300px");
    center();
    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSizeFull();
    Label aboutLabel = new Label(Messages.getString("AboutWindow.info", PropertyKey.version.getValue()),
            ContentMode.HTML);
    content.addComponent(aboutLabel);
    content.setComponentAlignment(aboutLabel, Alignment.MIDDLE_CENTER);

    setContent(content);
}

From source file:org.agocontrol.site.viewlet.dashboard.EventPanel.java

License:Apache License

/**
 * Default constructor which constructs components.
 *///from w  w w  . j  a v  a2s .  c o m
public EventPanel() {
    final VerticalLayout layout = new VerticalLayout();
    setCompositionRoot(layout);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    layout.setStyleName(Reindeer.LAYOUT_WHITE);

    final Label title = new Label("Events");
    title.setIcon(getSite().getIcon("event"));
    title.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(title);
    layout.setExpandRatio(title, 0);

    final List<FieldDescriptor> fieldDescriptors = AgoControlSiteFields
            .getFieldDescriptors(org.agocontrol.model.Event.class);
    final List<FilterDescriptor> filterDefinitions = new ArrayList<FilterDescriptor>();

    final Site site = ((AgoControlSiteUI) UI.getCurrent()).getSite();
    final EntityManager entityManager = site.getSiteContext().getObject(EntityManager.class);
    container = new LazyEntityContainer<org.agocontrol.model.Event>(entityManager, true, false, false,
            org.agocontrol.model.Event.class, 50, new String[] { "created" }, new boolean[] { false },
            "eventId");

    ContainerUtil.addContainerProperties(container, fieldDescriptors);

    final Table table = new FormattingTable();
    grid = new Grid(table, container, false);
    layout.addComponent(grid);
    layout.setExpandRatio(grid, 1);

    grid.setFields(fieldDescriptors);
    grid.setFilters(filterDefinitions);
    //grid.setSizeUndefined();
    //grid.setSizeUndefined();

    table.setColumnCollapsed("eventId", true);
    table.setColumnCollapsed("modified", true);
    table.setColumnCollapsed("processed", true);
    table.setColumnCollapsed("processingError", true);

    final Company company = site.getSiteContext().getObject(Company.class);
    container.removeDefaultFilters();
    container.addDefaultFilter(new Compare.Equal("owner.companyId", company.getCompanyId()));
}

From source file:org.apache.ace.useradmin.ui.vaadin.UserAdminWindow.java

License:Apache License

/**
 * Creates a new {@link UserAdminWindow} instance.
 *///from  w w  w. jav  a 2  s.c  om
public UserAdminWindow() {
    setCaption("Manage users");
    setWidth("30%");

    m_userTable = new Table();
    m_userTable.setSizeFull();
    m_userTable.setImmediate(true);
    m_userTable.setSelectable(true);
    m_userTable.setSortDisabled(false);
    m_userTable.addContainerProperty("User", UserDTO.class, null);
    m_userTable.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            selectUser((UserDTO) m_userTable.getValue());
        }
    });

    VerticalLayout usersList = new VerticalLayout();
    usersList.setSizeFull();
    usersList.addComponent(m_userTable);

    Button addUserButton = new Button("+");
    addUserButton.setStyleName(Reindeer.BUTTON_SMALL);
    addUserButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            prepareForNewUser();
        }
    });

    m_removeUserButton = new Button();
    m_removeUserButton.setStyleName(Reindeer.BUTTON_SMALL);
    m_removeUserButton.setCaption("-");
    m_removeUserButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            removeSelectedUser((UserDTO) m_userTable.getValue());
        }
    });

    HorizontalLayout addRemoveUserButtons = new HorizontalLayout();
    addRemoveUserButtons.setMargin(true, false, false, false);
    addRemoveUserButtons.setSpacing(true);
    addRemoveUserButtons.addComponent(addUserButton);
    addRemoveUserButtons.addComponent(m_removeUserButton);
    usersList.addComponent(addRemoveUserButtons);

    usersList.setExpandRatio(m_userTable, 1.0f);
    usersList.setExpandRatio(addRemoveUserButtons, 0.0f);

    ValueChangeListener changeListener = new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            m_applyButton.setEnabled(isCurrentFormValid());
            m_cancelButton.setEnabled(true);
        }
    };

    m_usernameTextField = new TextField();
    m_usernameTextField.setCaption("Username");
    m_usernameTextField.setImmediate(true);
    m_usernameTextField.setRequired(true);
    m_usernameTextField.addListener(changeListener);

    m_passwordTextField = new PasswordField();
    m_passwordTextField.setCaption("Password");
    m_passwordTextField.setImmediate(true);
    m_passwordTextField.setRequired(true);
    m_passwordTextField.addListener(changeListener);

    m_groupSelect = new Select();
    m_groupSelect.setCaption("Role");
    m_groupSelect.setImmediate(true);
    m_groupSelect.setNullSelectionAllowed(false);
    m_groupSelect.setRequired(true);
    m_groupSelect.addListener(changeListener);

    FormLayout formLayout = new FormLayout();
    formLayout.addComponent(m_usernameTextField);
    formLayout.addComponent(m_passwordTextField);
    formLayout.addComponent(m_groupSelect);

    m_applyButton = new Button();
    m_applyButton.setCaption("Apply changes");
    m_applyButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            storeUserInfo();
        }
    });

    m_cancelButton = new Button();
    m_cancelButton.setEnabled(false);
    m_cancelButton.setCaption("Cancel");
    m_cancelButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            selectUser((UserDTO) m_userTable.getValue());
        }
    });

    HorizontalLayout addUserButtons = new HorizontalLayout();
    addUserButtons.setMargin(true, false, false, false);
    addUserButtons.setSpacing(true);
    addUserButtons.addComponent(m_applyButton);
    addUserButtons.addComponent(m_cancelButton);

    formLayout.addComponent(addUserButtons);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSizeFull();
    horizontalLayout.setSpacing(true);
    horizontalLayout.addComponent(usersList);
    horizontalLayout.addComponent(formLayout);

    horizontalLayout.setExpandRatio(usersList, 0.35f);
    horizontalLayout.setExpandRatio(formLayout, 0.65f);

    addComponent(horizontalLayout);

    updateState(null, false /* editAllowed */);
}

From source file:org.apache.ace.webui.vaadin.LoginWindow.java

License:Apache License

/**
 * Creates a new {@link LoginWindow} instance.
 * //from  ww w  . j  a  va2  s.c om
 * @param log
 *            the log service to use;
 * @param loginFunction
 *            the login callback to use.
 */
public LoginWindow(LogService log, LoginFunction loginFunction) {
    super("Apache ACE Login");

    m_log = log;
    m_loginFunction = loginFunction;

    setResizable(false);
    setClosable(false);
    setModal(true);
    setWidth("20em");

    m_additionalInfo = new Label("");
    m_additionalInfo.setImmediate(true);
    m_additionalInfo.setStyleName("alert");
    m_additionalInfo.setHeight("1.2em");
    // Ensures the information message disappears when starting typing...
    FieldEvents.TextChangeListener changeListener = new FieldEvents.TextChangeListener() {
        @Override
        public void textChange(TextChangeEvent event) {
            m_additionalInfo.setValue("");
        }
    };

    final TextField nameField = new TextField("Name", "");
    nameField.addListener(changeListener);
    nameField.setImmediate(true);
    nameField.setWidth("100%");

    final PasswordField passwordField = new PasswordField("Password", "");
    passwordField.addListener(changeListener);
    passwordField.setImmediate(true);
    passwordField.setWidth("100%");

    Button loginButton = new Button("Login");
    loginButton.setImmediate(true);
    // Allow enter to be used to login directly...
    loginButton.setClickShortcut(KeyCode.ENTER);
    // Highlight this button as the default one...
    loginButton.addStyleName(Reindeer.BUTTON_DEFAULT);

    loginButton.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Button button = event.getButton();
            button.setEnabled(false);

            try {
                String username = (String) nameField.getValue();
                String password = (String) passwordField.getValue();

                if (m_loginFunction.login(username, password)) {
                    m_log.log(LogService.LOG_INFO, "Apache Ace WebUI succesfull login by user: " + username);

                    closeWindow();
                } else {
                    m_log.log(LogService.LOG_WARNING, "Apache Ace WebUI invalid username or password entered.");

                    m_additionalInfo.setValue("Invalid username or password!");

                    nameField.focus();
                    nameField.selectAll();
                }
            } finally {
                button.setEnabled(true);
            }
        }
    });

    final VerticalLayout content = (VerticalLayout) getContent();
    content.setSpacing(true);
    content.setMargin(true);
    content.setSizeFull();

    content.addComponent(nameField);
    content.addComponent(passwordField);
    content.addComponent(m_additionalInfo);
    content.addComponent(loginButton);

    content.setComponentAlignment(loginButton, Alignment.BOTTOM_CENTER);

    nameField.focus();
}

From source file:org.apache.usergrid.chop.webapp.view.main.MainView.java

License:Apache License

MainView() {
    this.setHeight("100%");

    VerticalLayout verticalLayoutForButtons = new VerticalLayout();
    verticalLayoutForButtons.setSizeFull();

    buttons = addButtons();//from  ww w .  j a  v  a2 s.  c  o  m
    this.addComponent(buttons);
    setComponentAlignment(buttons, Alignment.TOP_CENTER);

    tabSheet = addTabSheet();
    tabSheet.setSizeFull();
    this.addComponent(tabSheet);
    this.setComponentAlignment(tabSheet, Alignment.TOP_CENTER);

    this.setExpandRatio(buttons, 0.04f);
    this.setExpandRatio(tabSheet, 0.96f);
}