Example usage for com.vaadin.ui VerticalLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleAddViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createBottomPanel() {
    final VerticalLayout permissionsPanel = new VerticalLayout();
    final Label organizationHeader = new Label(AppContext.getMessage(ProjectRoleI18nEnum.SECTION_PERMISSIONS));
    organizationHeader.setStyleName("h2");
    permissionsPanel.addComponent(organizationHeader);

    PermissionMap perMap;//  ww w  .j a va  2s .  com
    if (beanItem instanceof SimpleProjectRole) {
        perMap = ((SimpleProjectRole) beanItem).getPermissionMap();
    } else {
        perMap = new PermissionMap();
    }

    final GridFormLayoutHelper permissionFormHelper = new GridFormLayoutHelper(2,
            ProjectRolePermissionCollections.PROJECT_PERMISSIONS.length, "100%", "167px", Alignment.TOP_LEFT);

    for (int i = 0; i < ProjectRolePermissionCollections.PROJECT_PERMISSIONS.length; i++) {
        final String permissionPath = ProjectRolePermissionCollections.PROJECT_PERMISSIONS[i];
        final AccessPermissionComboBox permissionBox = new AccessPermissionComboBox();

        final Integer flag = perMap.getPermissionFlag(permissionPath);
        permissionBox.setValue(flag);
        permissionControlsMap.put(permissionPath, permissionBox);
        permissionFormHelper.addComponent(permissionBox,
                AppContext.getMessage(RolePermissionI18nEnum.valueOf(permissionPath)), 0, i);
    }

    permissionFormHelper.getLayout().setWidth("100%");
    permissionFormHelper.getLayout().setMargin(false);
    permissionFormHelper.getLayout().addStyleName("colored-gridlayout");
    permissionsPanel.addComponent(permissionFormHelper.getLayout());

    return permissionsPanel;
}

From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleFormLayoutFactory.java

License:Open Source License

@Override
public ComponentContainer getLayout() {
    final VerticalLayout layout = new VerticalLayout();
    final Label organizationHeader = new Label("Role Information");
    organizationHeader.setStyleName("h2");
    layout.addComponent(organizationHeader);

    this.informationLayout = new GridFormLayoutHelper(2, 2, "100%", "167px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");

    layout.addComponent(this.informationLayout.getLayout());
    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.settings.ProjectRoleReadViewImpl.java

License:Open Source License

protected ComponentContainer createBottomPanel() {
    VerticalLayout permissionsPanel = new VerticalLayout();
    final Label organizationHeader = new Label(AppContext.getMessage(ProjectRoleI18nEnum.SECTION_PERMISSIONS));
    organizationHeader.setStyleName("h2");
    permissionsPanel.addComponent(organizationHeader);

    projectFormHelper = new GridFormLayoutHelper(2, ProjectRolePermissionCollections.PROJECT_PERMISSIONS.length,
            "100%", "167px", Alignment.TOP_LEFT);
    projectFormHelper.getLayout().setWidth("100%");
    projectFormHelper.getLayout().setMargin(false);
    projectFormHelper.getLayout().addStyleName("colored-gridlayout");

    permissionsPanel.addComponent(projectFormHelper.getLayout());

    return permissionsPanel;
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskAddPopup.java

License:Open Source License

public TaskAddPopup(final TaskDisplayComponent taskDisplayComp, final TaskList taskList) {

    final VerticalLayout taskLayout = new VerticalLayout();
    taskLayout.addStyleName("taskadd-popup");

    final VerticalLayout popupHeader = new VerticalLayout();
    popupHeader.setWidth("100%");
    popupHeader.setMargin(true);// w ww .j  av a 2s. c  om
    popupHeader.addStyleName("popup-header");

    final Label titleLbl = new Label(AppContext.getMessage(TaskI18nEnum.DIALOG_NEW_TASK_TITLE));
    titleLbl.addStyleName("bold");
    popupHeader.addComponent(titleLbl);
    taskLayout.addComponent(popupHeader);

    this.task = new SimpleTask();
    TabSheet taskContainer = new TabSheet();
    final TaskInputForm taskInputForm = new TaskInputForm();
    taskInputForm.setWidth("100%");
    taskContainer.addTab(taskInputForm, AppContext.getMessage(GenericI18Enum.WINDOW_INFORMATION_TITLE));

    this.taskNoteComponent = new TaskNoteLayout();
    taskContainer.addTab(this.taskNoteComponent, AppContext.getMessage(TaskI18nEnum.FORM_NOTES_ATTACHMENT));

    taskLayout.addComponent(taskContainer);

    final MHorizontalLayout controlsLayout = new MHorizontalLayout().withMargin(true);
    controlsLayout.addStyleName("popup-footer");

    final Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    taskDisplayComp.closeTaskAdd();
                }
            });

    cancelBtn.setStyleName(UIConstants.THEME_GRAY_LINK);

    final Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    if (taskInputForm.validateForm()) {
                        final ProjectTaskService taskService = ApplicationContextUtil
                                .getSpringBean(ProjectTaskService.class);

                        task.setTasklistid(taskList.getId());
                        task.setProjectid(CurrentProjectVariables.getProjectId());
                        task.setSaccountid(AppContext.getAccountId());
                        task.setNotes(taskNoteComponent.getNote());

                        taskService.saveWithSession(task, AppContext.getUsername());
                        taskNoteComponent.saveContentsToRepo(task.getId());
                        taskDisplayComp.saveTaskSuccess(task);
                        taskDisplayComp.closeTaskAdd();
                    }
                }
            });
    saveBtn.setIcon(FontAwesome.SAVE);
    saveBtn.setStyleName(UIConstants.THEME_GREEN_LINK);

    controlsLayout.with(saveBtn, cancelBtn).alignAll(Alignment.MIDDLE_CENTER);

    taskLayout.addComponent(controlsLayout);
    taskLayout.setComponentAlignment(controlsLayout, Alignment.MIDDLE_RIGHT);

    this.setCompositionRoot(taskLayout);
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java

License:Open Source License

private void showTaskGroupInfo() {
    if (this.isDisplayTaskListInfo) {
        AdvancedPreviewBeanForm<SimpleTaskList> previewForm = new AdvancedPreviewBeanForm<>();
        previewForm.setWidth("100%");
        previewForm.setFormLayoutFactory(new IFormLayoutFactory() {
            private static final long serialVersionUID = 1L;

            private GridFormLayoutHelper layoutHelper;

            @Override/*w  ww .  j  a  v  a 2 s  .  co m*/
            public ComponentContainer getLayout() {
                this.layoutHelper = new GridFormLayoutHelper(2, 3, "100%", "180px", Alignment.TOP_LEFT);
                this.layoutHelper.getLayout().setWidth("100%");
                this.layoutHelper.getLayout().addStyleName("colored-gridlayout");
                this.layoutHelper.getLayout().setMargin(false);
                return this.layoutHelper.getLayout();
            }

            @Override
            public void attachField(Object propertyId, Field<?> field) {
                if ("description".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0,
                            0, 2, "100%");
                } else if ("owner".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 1);
                } else if ("milestoneid".equals(propertyId)) {
                    layoutHelper.addComponent(field, AppContext.getMessage(TaskGroupI18nEnum.FORM_PHASE_FIELD),
                            1, 1);
                }
            }
        });
        previewForm.setBeanFormFieldFactory(
                new AbstractBeanFieldGroupViewFieldFactory<SimpleTaskList>(previewForm) {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected Field<?> onCreateField(Object propertyId) {
                        if ("description".equals(propertyId)) {
                            return new DefaultViewField(taskList.getDescription(), ContentMode.HTML);
                        } else if ("owner".equals(propertyId)) {
                            return new ProjectUserFormLinkField(taskList.getOwner(),
                                    taskList.getOwnerAvatarId(), taskList.getOwnerFullName());
                        } else if ("milestoneid".equals(propertyId)) {
                            return new LinkViewField(taskList.getMilestoneName(),
                                    ProjectLinkBuilder.generateMilestonePreviewFullLink(taskList.getProjectid(),
                                            taskList.getMilestoneid()),
                                    ProjectAssetsManager.getAsset(ProjectTypeConstants.MILESTONE));
                        }

                        return null;
                    }

                });
        this.addComponent(previewForm);

        previewForm.setBean(this.taskList);
    }

    this.taskDisplay = new TaskTableDisplay(TaskTableFieldDef.id,
            Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate,
                    TaskTableFieldDef.assignee, TaskTableFieldDef.percentagecomplete));
    this.addComponent(this.taskDisplay);

    this.taskDisplay.addTableListener(new TableClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void itemClick(final TableClickEvent event) {
            final SimpleTask task = (SimpleTask) event.getData();
            if ("taskname".equals(event.getFieldName())) {
                EventBusFactory.getInstance()
                        .post(new TaskEvent.GotoRead(TaskDisplayComponent.this, task.getId()));
            } else if ("closeTask".equals(event.getFieldName()) || "reopenTask".equals(event.getFieldName())
                    || "pendingTask".equals(event.getFieldName())
                    || "deleteTask".equals(event.getFieldName())) {
                TaskDisplayComponent.this.removeAllComponents();
                final ProjectTaskListService taskListService = ApplicationContextUtil
                        .getSpringBean(ProjectTaskListService.class);
                TaskDisplayComponent.this.taskList = taskListService
                        .findById(TaskDisplayComponent.this.taskList.getId(), AppContext.getAccountId());
                TaskDisplayComponent.this.showTaskGroupInfo();
            }
        }
    });

    this.createTaskBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final Button.ClickEvent event) {
                    TaskDisplayComponent.this
                            .removeComponent(TaskDisplayComponent.this.createTaskBtn.getParent());

                    TaskAddPopup taskAddView = new TaskAddPopup(TaskDisplayComponent.this,
                            TaskDisplayComponent.this.taskList);
                    TaskDisplayComponent.this.addComponent(taskAddView);
                }
            });
    this.createTaskBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    this.createTaskBtn.setIcon(FontAwesome.PLUS);
    this.createTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    final VerticalLayout taskGroupFooter = new VerticalLayout();
    taskGroupFooter.setMargin(true);
    taskGroupFooter.addStyleName("task-list-footer");
    taskGroupFooter.addComponent(this.createTaskBtn);
    taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT);
    this.addComponent(taskGroupFooter);

    if (CollectionUtils.isNotEmpty(taskList.getSubTasks())) {
        taskDisplay.setCurrentDataList(taskList.getSubTasks());
    } else {
        taskDisplay.setCurrentDataList(new ArrayList<SimpleTask>());
    }
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskDisplayComponent.java

License:Open Source License

public void closeTaskAdd() {
    final VerticalLayout taskGroupFooter = new VerticalLayout();
    taskGroupFooter.setMargin(true);/* ww w.  j  av a  2 s. c o  m*/
    taskGroupFooter.addStyleName("task-list-footer");
    taskGroupFooter.addComponent(this.createTaskBtn);
    taskGroupFooter.setComponentAlignment(this.createTaskBtn, Alignment.MIDDLE_RIGHT);
    this.addComponent(taskGroupFooter);

    Iterator<Component> comps = this.iterator();
    while (comps.hasNext()) {
        Component component = comps.next();
        if (component instanceof TaskAddPopup) {
            this.removeComponent(component);
            return;
        }
    }
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskFormLayoutFactory.java

License:Open Source License

@Override
public Layout getLayout() {
    this.informationLayout = new GridFormLayoutHelper(2, 8, "100%", "180px", Alignment.TOP_LEFT);
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(false);/* w  w  w. j  av  a2s .  c  om*/
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().setWidth("100%");
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupDisplayViewImpl.java

License:Open Source License

private void constructUI() {
    this.removeAllComponents();
    this.withMargin(new MarginInfo(false, true, true, true));

    header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withStyleName("hdr-view").withWidth("100%");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    this.taskGroupSelection = new PopupButton(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE));
    this.taskGroupSelection.setEnabled(CurrentProjectVariables.canRead(ProjectRolePermissionCollections.TASKS));
    this.taskGroupSelection.addStyleName("link");
    this.taskGroupSelection.addStyleName("hdr-text");
    taskGroupSelection.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK_LIST));
    header.with(taskGroupSelection).withAlign(taskGroupSelection, Alignment.MIDDLE_LEFT)
            .expand(taskGroupSelection);

    final MVerticalLayout filterBtnLayout = new MVerticalLayout().withMargin(true).withSpacing(true)
            .withWidth("200px");

    final Button allTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE), new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//from  w ww  . j  a  v a  2 s .  com
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.taskGroupSelection
                            .setCaption(AppContext.getMessage(TaskGroupI18nEnum.FILTER_ALL_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.displayAllTaskGroups();
                }
            });
    allTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(allTasksFilterBtn);

    final Button activeTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption(
                            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ACTIVE_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.displayActiveTaskGroups();
                }
            });
    activeTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(activeTasksFilterBtn);

    final Button archivedTasksFilterBtn = new Button(
            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setCaption(
                            AppContext.getMessage(TaskGroupI18nEnum.FILTER_ARCHIEVED_TASK_GROUPS_TITLE));
                    TaskGroupDisplayViewImpl.this.taskGroupSelection.setPopupVisible(false);
                    TaskGroupDisplayViewImpl.this.displayInActiveTaskGroups();
                }
            });
    archivedTasksFilterBtn.setStyleName("link");
    filterBtnLayout.addComponent(archivedTasksFilterBtn);

    this.taskGroupSelection.setContent(filterBtnLayout);

    final Button newTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow(
                            TaskGroupDisplayViewImpl.this);
                    UI.getCurrent().addWindow(taskListWindow);
                }
            });
    newTaskListBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    newTaskListBtn.setIcon(FontAwesome.PLUS);
    newTaskListBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP));
    newTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    header.addComponent(newTaskListBtn);
    header.setComponentAlignment(newTaskListBtn, Alignment.MIDDLE_RIGHT);

    Button reOrderBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            EventBusFactory.getInstance().post(new TaskListEvent.ReoderTaskList(this, null));
        }
    });
    reOrderBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    reOrderBtn.setIcon(FontAwesome.SORT);
    reOrderBtn.setStyleName(UIConstants.THEME_BLUE_LINK);
    reOrderBtn.setDescription(AppContext.getMessage(TaskI18nEnum.BUTTON_REODER_TASKGROUP));
    header.addComponent(reOrderBtn);
    header.setComponentAlignment(reOrderBtn, Alignment.MIDDLE_RIGHT);

    PopupButton exportButtonControl = new PopupButton();
    exportButtonControl.addStyleName(UIConstants.THEME_BLUE_LINK);
    exportButtonControl.setIcon(FontAwesome.EXTERNAL_LINK);
    exportButtonControl.setDescription("Export to file");

    VerticalLayout popupButtonsControl = new VerticalLayout();
    exportButtonControl.setContent(popupButtonsControl);
    exportButtonControl.setWidthUndefined();

    Button exportPdfBtn = new Button(AppContext.getMessage(FileI18nEnum.PDF));
    FileDownloader pdfDownloader = new FileDownloader(constructStreamResource(ReportExportType.PDF));
    pdfDownloader.extend(exportPdfBtn);
    exportPdfBtn.setIcon(FontAwesome.FILE_PDF_O);
    exportPdfBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportPdfBtn);

    Button exportExcelBtn = new Button(AppContext.getMessage(FileI18nEnum.EXCEL));
    FileDownloader excelDownloader = new FileDownloader(constructStreamResource(ReportExportType.EXCEL));
    excelDownloader.extend(exportExcelBtn);
    exportExcelBtn.setIcon(FontAwesome.FILE_EXCEL_O);
    exportExcelBtn.setStyleName("link");
    popupButtonsControl.addComponent(exportExcelBtn);

    header.with(exportButtonControl).withAlign(exportButtonControl, Alignment.MIDDLE_LEFT);

    Button advanceDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            displayAdvancedView();
        }
    });
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.ADVANCED_VIEW_TOOLTIP));

    Button simpleDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            TaskSearchCriteria searchCriteria = new TaskSearchCriteria();
            searchCriteria.setProjectid(new NumberSearchField(CurrentProjectVariables.getProjectId()));
            searchCriteria.setStatuses(new SetSearchField<>(new String[] { StatusI18nEnum.Open.name() }));
            TaskFilterParameter taskFilter = new TaskFilterParameter(searchCriteria, "Task Search");
            taskFilter.setAdvanceSearch(true);
            moveToTaskSearch(taskFilter);
        }
    });
    simpleDisplayBtn.setIcon(FontAwesome.LIST_UL);
    simpleDisplayBtn.setDescription(AppContext.getMessage(TaskGroupI18nEnum.LIST_VIEW_TOOLTIP));

    Button chartDisplayBtn = new Button(null, new Button.ClickListener() {
        private static final long serialVersionUID = -5707546605789537298L;

        @Override
        public void buttonClick(ClickEvent event) {
            displayGanttChartView();
        }
    });
    chartDisplayBtn.setIcon(FontAwesome.BAR_CHART_O);

    viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(simpleDisplayBtn);
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(chartDisplayBtn);
    viewButtons.setDefaultButton(advanceDisplayBtn);

    mainLayout = new MHorizontalLayout().withFullHeight().withFullWidth().withSpacing(true);
    this.taskListsWidget = new TaskGroupDisplayWidget();

    MVerticalLayout leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false))
            .with(taskListsWidget);

    this.rightColumn = new MVerticalLayout().withWidth("300px")
            .withMargin(new MarginInfo(true, false, false, false));

    mainLayout.with(leftColumn, rightColumn).expand(leftColumn);

    FloatingComponent floatSidebar = FloatingComponent.floatThis(this.rightColumn);
    floatSidebar.setContainerId("main-body");

    implementTaskFilterButton();
    basicSearchView = new TaskSearchViewImpl();
    basicSearchView.getSearchHandlers().addSearchHandler(new SearchHandler<TaskSearchCriteria>() {
        @Override
        public void onSearch(TaskSearchCriteria criteria) {
            doSearch(criteria);
        }
    });
    basicSearchView.removeComponent(basicSearchView.getComponent(0));

    displayAdvancedView();
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupFormLayoutFactory.java

License:Open Source License

@Override
public Layout getLayout() {
    this.informationLayout = new GridFormLayoutHelper(2, 4, "100%", "180px", Alignment.TOP_LEFT);
    this.informationLayout.getLayout().addStyleName("colored-gridlayout");
    this.informationLayout.getLayout().setMargin(false);
    this.informationLayout.getLayout().setWidth("100%");
    final VerticalLayout layout = new VerticalLayout();
    layout.addComponent(this.informationLayout.getLayout());
    layout.setComponentAlignment(this.informationLayout.getLayout(), Alignment.BOTTOM_CENTER);
    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupNoItemView.java

License:Open Source License

public TaskGroupNoItemView() {
    this.setMargin(new MarginInfo(true, false, false, false));
    VerticalLayout layout = new VerticalLayout();
    layout.addStyleName("taskgroup-noitem");
    layout.setSpacing(true);/*from  w w  w . j a  v  a 2 s  . c  o  m*/
    layout.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    layout.setMargin(true);

    Image image = new Image(null, MyCollabResource.newResource("icons/48/project/tasklist.png"));
    layout.addComponent(image);

    Label title = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_TITLE));
    title.addStyleName("h2");
    title.setWidthUndefined();
    layout.addComponent(title);

    Label body = new Label(AppContext.getMessage(TaskGroupI18nEnum.NO_ITEM_VIEW_HINT));
    body.setWidthUndefined();
    layout.addComponent(body);

    Button createTaskGroupBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASKGROUP),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(final ClickEvent event) {
                    final TaskGroupAddWindow taskListWindow = new TaskGroupAddWindow(null);
                    UI.getCurrent().addWindow(taskListWindow);
                }
            });
    createTaskGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));

    HorizontalLayout links = new HorizontalLayout();

    links.addComponent(createTaskGroupBtn);
    createTaskGroupBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    links.setSpacing(true);

    layout.addComponent(links);
    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.TOP_CENTER);
}