Example usage for com.vaadin.ui HorizontalLayout setSizeFull

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

Introduction

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

Prototype

@Override
    public void setSizeFull() 

Source Link

Usage

From source file:module.contents.presentationTier.component.ProgressFactory.java

License:Open Source License

public static AbstractComponentContainer createCenteredProgressIndicator() {
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSizeFull();

    final ProgressIndicator progressIndicator = new ProgressIndicator();
    progressIndicator.setIndeterminate(true);
    progressIndicator.setPollingInterval(3000);
    progressIndicator.setEnabled(true);/*from   w  w w.jav  a 2s  . c  om*/

    layout.addComponent(progressIndicator);
    layout.setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER);

    return layout;
}

From source file:my.vaadin.app.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    filterText.setPlaceholder("filter by name...");
    filterText.addValueChangeListener(e -> updateList());
    filterText.setValueChangeMode(ValueChangeMode.LAZY);

    Button clearFilterTextBtn = new Button(FontAwesome.TIMES);
    clearFilterTextBtn.setDescription("Clear the current filter");
    clearFilterTextBtn.addClickListener(e -> filterText.clear());

    CssLayout filtering = new CssLayout();
    filtering.addComponents(filterText, clearFilterTextBtn);
    filtering.setStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

    Button addCustomerBtn = new Button("Add new customer");
    addCustomerBtn.addClickListener(e -> {
        grid.asSingleSelect().clear();//from w ww. j av  a 2  s.  c  o m
        form.setCustomer(new Customer());
    });

    HorizontalLayout toolbar = new HorizontalLayout(filtering, addCustomerBtn);

    grid.setColumns("firstName", "lastName", "email");

    HorizontalLayout main = new HorizontalLayout(grid, form);
    main.setSizeFull();
    grid.setSizeFull();
    main.setExpandRatio(grid, 1);

    layout.addComponents(toolbar, main);

    // fetch list of Customers from service and assign it to Grid
    updateList();

    setContent(layout);

    form.setVisible(false);

    grid.asSingleSelect().addValueChangeListener(event -> {
        if (event.getValue() == null) {
            form.setVisible(false);
        } else {
            form.setCustomer(event.getValue());
        }
    });
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWindow.java

License:Apache License

private void init(List<TestCaseExecutionServer> executions, int tcID) {
    HorizontalLayout layout = new HorizontalLayout();
    Wizard execution = new Wizard();
    TreeMap<Integer, TreeMap<Integer, ExecutionWizardStep>> sorted = new TreeMap<>();
    executions.forEach((tce) -> {//  w w w  .j  a  v  a 2 s  . c  om
        tce.getExecutionStepList().forEach(es -> {
            if (tcID < 0 || es.getExecutionStepPK().getStepTestCaseId() == tcID) {
                if (!sorted.containsKey(es.getExecutionStepPK().getStepTestCaseId())) {
                    sorted.put(es.getExecutionStepPK().getStepTestCaseId(), new TreeMap<>());
                }
                sorted.get(es.getExecutionStepPK().getStepTestCaseId()).put(es.getStep().getStepSequence(),
                        new ExecutionWizardStep(execution, es, reviewer));
            }
        });
    });
    sorted.values().forEach(tm -> {
        tm.values().forEach(ew -> {
            execution.addStep(ew);
        });
    });
    execution.setDisplayedMaxTitles(3);
    execution.addListener(new WizardProgressListener() {
        @Override
        public void activeStepChanged(WizardStepActivationEvent event) {
            //Do nothing
        }

        @Override
        public void stepSetChanged(WizardStepSetChangedEvent event) {
            //Do nothing
        }

        @Override
        public void wizardCompleted(WizardCompletedEvent event) {
            if (reviewer) {
                MessageBox prompt = MessageBox.createQuestion()
                        .withCaption(TRANSLATOR.translate("release.test.case.title"))
                        .withMessage(TRANSLATOR.translate("release.test.case.message")).withYesButton(() -> {
                            execution.getSteps().stream().map((step) -> (ExecutionWizardStep) step)
                                    .map((s) -> s.getExecutionStep())
                                    .filter((ess) -> (!ess.getLocked() && ess.getResultId() != null))
                                    .forEachOrdered((ess) -> {
                                        try {
                                            if (ess.getReviewResultId().getId() == 2) {
                                                //TODO: Failed, send back to retest?
                                                ess.setLocked(false);
                                            }
                                            ess.setReviewed(true);
                                            save(ess);
                                            new ActivityServer(4, new Date(),
                                                    TRANSLATOR.translate("test.review.desc")
                                                            .replaceAll("%u",
                                                                    ((VMUI) UI.getCurrent()).getUser()
                                                                            .toString())
                                                            .replaceAll("%i",
                                                                    TRANSLATOR.translate("general.test.case")),
                                                    ((VMUI) UI.getCurrent()).getUser().getEntity()).write2DB();
                                            Lookup.getDefault().lookup(NotificationManager.class)
                                                    .addNotification(TRANSLATOR
                                                            .translate("notification.review.complete")
                                                            .replaceAll("%r",
                                                                    TRANSLATOR.translate(ess.getReviewResultId()
                                                                            .getReviewName()))
                                                            .replaceAll("%i",
                                                                    ess.getTestCaseExecution().getName()),
                                                            NotificationTypes.REVIEW, ess.getAssignee(),
                                                            ((VMUI) UI.getCurrent()).getUser().getEntity());
                                            ValidationManagerUI.getInstance().updateScreen();
                                        } catch (VMException ex) {
                                            LOG.log(Level.SEVERE, null, ex);
                                        } catch (Exception ex) {
                                            LOG.log(Level.SEVERE, null, ex);
                                        }
                                    });
                        }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK))
                        .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE));
                prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
                prompt.open();
            } else {
                MessageBox prompt = MessageBox.createQuestion()
                        .withCaption(TRANSLATOR.translate("lock.test.case.title"))
                        .withMessage(TRANSLATOR.translate("lock.test.case.message")).withYesButton(() -> {
                            for (WizardStep step : execution.getSteps()) {
                                ExecutionWizardStep s = (ExecutionWizardStep) step;
                                ExecutionStepServer ess = s.getExecutionStep();
                                if (!ess.getLocked() && ess.getResultId() != null) {
                                    try {
                                        ess.setLocked(true);
                                        save(ess);
                                        new ActivityServer(3, new Date(),
                                                TRANSLATOR.translate("test.execution.desc")
                                                        .replaceAll("%u",
                                                                ((VMUI) UI.getCurrent()).getUser().toString())
                                                        .replaceAll("%i", s.getCaption()),
                                                ((VMUI) UI.getCurrent()).getUser().getEntity()).write2DB();
                                        ValidationManagerUI.getInstance().updateScreen();
                                    } catch (VMException ex) {
                                        LOG.log(Level.SEVERE, null, ex);
                                    } catch (Exception ex) {
                                        LOG.log(Level.SEVERE, null, ex);
                                    }
                                }
                            }
                        }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK))
                        .withNoButton(ButtonOption.icon(VaadinIcons.CLOSE));
                prompt.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON);
                prompt.open();
            }
            ValidationManagerUI.getInstance().removeWindow(ExecutionWindow.this);
        }

        @Override
        public void wizardCancelled(WizardCancelledEvent event) {
            ValidationManagerUI.getInstance().removeWindow(ExecutionWindow.this);
        }
    });
    layout.addComponent(execution);
    layout.setSizeFull();
    setContent(layout);
}

From source file:org.activiti.explorer.ui.task.TaskRelatedContentComponent.java

License:Apache License

protected void initActions() {
    HorizontalLayout actionsContainer = new HorizontalLayout();
    actionsContainer.setSizeFull();

    // Title//from  w  w w  .j a  v a2  s.  co m
    Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processTitle.setSizeFull();
    actionsContainer.addComponent(processTitle);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT);
    actionsContainer.setExpandRatio(processTitle, 1.0f);

    // Add content button
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    addRelatedContentButton.addListener(new com.vaadin.ui.Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow();

            if (task.getProcessInstanceId() != null) {
                popup.setProcessInstanceId(task.getProcessInstanceId());
            } else {
                popup.setTaskId(task.getId());
            }

            // Add listener to update attachments when added
            popup.addListener(new SubmitEventListener() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {
                    taskDetailPanel.notifyRelatedContentChanged();
                }

                @Override
                protected void cancelled(SubmitEvent event) {
                    // No attachment was added so updating UI isn't needed.
                }
            });

            ExplorerApp.get().getViewManager().showPopupWindow(popup);
        }
    });

    actionsContainer.addComponent(addRelatedContentButton);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT);

    addComponent(actionsContainer);
}

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

License:Apache License

/**
 * Default constructor./*from   w  w  w  . ja va 2 s  . co  m*/
 */
public BuildingSelectPanel() {
    site = ((AgoControlSiteUI) UI.getCurrent()).getSite();
    siteContext = site.getSiteContext();
    entityManager = siteContext.getObject(EntityManager.class);
    buildingIcon = site.getIcon("building");

    layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setStyleName(Reindeer.LAYOUT_WHITE);

    final Label title = new Label("Select Building");
    //title.setIcon(getSite().getIcon("inventory"));
    title.setStyleName(Reindeer.LABEL_H2);
    layout.addComponent(title);
    layout.setExpandRatio(title, 0);

    final HorizontalLayout titleLayout = new HorizontalLayout();
    layout.addComponent(titleLayout);
    titleLayout.setSpacing(true);
    titleLayout.setSizeFull();

    final Embedded embedded = new Embedded(null, buildingIcon);
    titleLayout.addComponent(embedded);
    titleLayout.setExpandRatio(embedded, 0.1f);
    embedded.setWidth(32, Unit.PIXELS);
    embedded.setHeight(32, Unit.PIXELS);

    buildingComboBox = new ComboBox();
    titleLayout.addComponent(buildingComboBox);
    titleLayout.setComponentAlignment(buildingComboBox, Alignment.MIDDLE_LEFT);
    titleLayout.setExpandRatio(buildingComboBox, 0.9f);
    //buildingComboBox.setWidth(100, Unit.PERCENTAGE);
    buildingComboBox.setNullSelectionAllowed(false);
    buildingComboBox.setNewItemsAllowed(false);
    buildingComboBox.setTextInputAllowed(false);
    buildingComboBox.setImmediate(true);
    buildingComboBox.setBuffered(false);

    buildingComboBox.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(final Property.ValueChangeEvent event) {
            final Element building = (Element) buildingComboBox.getValue();
            if (building != null && !building.getElementId().equals(selectedBuildingId)) {
                UI.getCurrent().getNavigator().navigateTo("default/" + building.getElementId());
            }
        }
    });

    setCompositionRoot(layout);
}

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

License:Apache License

/**
 * Creates a new {@link UserAdminWindow} instance.
 *///w  w w.  j a  v  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.casbah.ui.IssuedCertificateList.java

License:Open Source License

public void init() throws CAProviderException {

    VerticalLayout layout = new VerticalLayout();

    table = new Table();
    table.addContainerProperty("Serial Number", String.class, null);
    table.addContainerProperty("Distinguished Name", String.class, null);
    table.addContainerProperty("Expiration Date", Date.class, null);

    refreshTable();/*from w  w  w.j  a v a 2s. c  om*/

    layout.addComponent(table);
    table.setSizeFull();

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(new Button("Create Key/Certificate Pair", new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            try {
                collectKeyCertificateInfo();
            } catch (CasbahException e) {
                parentApplication.getMainWindow().showNotification(
                        "An error prevents the creation of the certificate", Notification.TYPE_ERROR_MESSAGE);
            }
        }

    }));

    buttons.setSizeFull();
    layout.addComponent(buttons);

    layout.setSizeFull();
    setSizeFull();

    setCompositionRoot(layout);
}

From source file:org.eclipse.hawkbit.ui.AbstractHawkbitUI.java

License:Open Source License

@Override
protected void init(final VaadinRequest vaadinRequest) {
    LOG.info("ManagementUI init starts uiid - {}", getUI().getUIId());
    if (pushStrategy != null) {
        pushStrategy.init(getUI());//from  w w w  .j a v  a2 s  . c  om
    }
    addDetachListener(this);
    SpringContextHelper.setContext(context);

    Responsive.makeResponsive(this);
    addStyleName(ValoTheme.UI_WITH_MENU);
    setResponsive(Boolean.TRUE);

    final HorizontalLayout rootLayout = new HorizontalLayout();
    rootLayout.setSizeFull();

    HawkbitCommonUtil.initLocalization(this, uiProperties.getLocalization(), i18n);

    dashboardMenu.init();
    dashboardMenu.setResponsive(true);

    final VerticalLayout contentVerticalLayout = new VerticalLayout();
    contentVerticalLayout.setSizeFull();
    contentVerticalLayout.setStyleName("main-content");
    contentVerticalLayout.addComponent(buildHeader());
    contentVerticalLayout.addComponent(buildViewTitle());

    final Panel content = buildContent();
    contentVerticalLayout.addComponent(content);
    contentVerticalLayout.setExpandRatio(content, 1);

    rootLayout.addComponent(dashboardMenu);
    rootLayout.addComponent(contentVerticalLayout);
    rootLayout.setExpandRatio(contentVerticalLayout, 1);
    setContent(rootLayout);

    final Navigator navigator = new Navigator(this, content);
    navigator.addViewChangeListener(new ViewChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean beforeViewChange(final ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(final ViewChangeEvent event) {
            final DashboardMenuItem view = dashboardMenu.getByViewName(event.getViewName());
            dashboardMenu.postViewChange(new PostViewChangeEvent(view));
            if (view == null) {
                viewTitle.setCaption(null);
                return;
            }
            viewTitle.setCaption(view.getDashboardCaptionLong());
            notificationUnreadButton.setCurrentView(event.getNewView());
        }
    });

    navigator.setErrorView(errorview);
    navigator.addProvider(new ManagementViewProvider());
    setNavigator(navigator);
    navigator.addView(EMPTY_VIEW, new Navigator.EmptyView());

    if (UI.getCurrent().getErrorHandler() == null) {
        UI.getCurrent().setErrorHandler(new HawkbitUIErrorHandler());
    }

    LOG.info("Current locale of the application is : {}", getLocale());
}

From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout.java

License:Open Source License

private void buildLayout() {
    final HorizontalLayout header = new HorizontalLayout();
    header.addStyleName("artifact-details-header");
    header.addStyleName("bordered-layout");
    header.addStyleName("no-border-bottom");
    header.setSpacing(false);/*  w w w.  j a  v a 2s .  co m*/
    header.setMargin(false);
    header.setSizeFull();
    header.setHeightUndefined();
    header.setImmediate(true);
    header.addComponents(titleOfArtifactDetails, maxMinButton);
    header.setComponentAlignment(titleOfArtifactDetails, Alignment.TOP_LEFT);
    header.setComponentAlignment(maxMinButton, Alignment.TOP_RIGHT);
    header.setExpandRatio(titleOfArtifactDetails, 1.0F);

    setSizeFull();
    setImmediate(true);
    addStyleName("artifact-table");
    addStyleName("table-layout");
    addComponent(header);
    setComponentAlignment(header, Alignment.MIDDLE_CENTER);
    addComponent(artifactDetailsTable);
    setComponentAlignment(artifactDetailsTable, Alignment.MIDDLE_CENTER);
    setExpandRatio(artifactDetailsTable, 1.0F);
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadProgressInfoWindow.java

License:Open Source License

private HorizontalLayout getCaptionLayout() {
    final HorizontalLayout captionLayout = new HorizontalLayout();
    captionLayout.setSizeFull();
    captionLayout.setHeight("36px");
    captionLayout.addComponents(windowCaption, closeButton);
    captionLayout.setExpandRatio(windowCaption, 1.0F);
    captionLayout.addStyleName("v-window-header");
    return captionLayout;
}