Example usage for com.vaadin.ui CssLayout CssLayout

List of usage examples for com.vaadin.ui CssLayout CssLayout

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:com.esofthead.mycollab.module.project.view.assignments.GanttChartViewImpl.java

License:Open Source License

private void constructUI() {
    MHorizontalLayout header = new MHorizontalLayout().withMargin(new MarginInfo(false, false, true, false))
            .withStyleName("hdr-view").withWidth("100%");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label headerText = new Label(FontAwesome.BAR_CHART_O.getHtml() + " Gantt chart", ContentMode.HTML);
    headerText.setStyleName(ValoTheme.LABEL_H2);
    headerText.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    CssLayout headerWrapper = new CssLayout();
    headerWrapper.addComponent(headerText);

    MHorizontalLayout resWrapper = new MHorizontalLayout();
    Label resLbl = new Label("Resolution: ");
    final ComboBox resValue = new ValueComboBox(false, "Day", "Week");
    resValue.addValueChangeListener(new Property.ValueChangeListener() {
        @Override/*from   w w w  . j  a v  a  2 s .  c o  m*/
        public void valueChange(Property.ValueChangeEvent event) {
            String val = (String) resValue.getValue();
            if ("Day".equals(val)) {
                gantt.setResolution(Resolution.Day);
            } else if ("Week".equals(val)) {
                gantt.setResolution(Resolution.Week);
            }
        }
    });
    resWrapper.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    resWrapper.with(resLbl, resValue);

    header.with(headerWrapper, resWrapper).withAlign(headerWrapper, Alignment.MIDDLE_LEFT)
            .expand(headerWrapper);

    mainLayout = new MHorizontalLayout().withSpacing(false);
    mainLayout.addStyleName("gantt_container");
    mainLayout.setSizeFull();
    this.with(header, mainLayout);
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugChartComponent.java

License:Open Source License

public BugChartComponent(final BugSearchCriteria baseSearchCriteria, final int headerWidth,
        final int titleWidth) {
    super(AppContext.getMessage(BugI18nEnum.WIDGET_CHARTS_TITLE), null, new CssLayout(), headerWidth + "px",
            titleWidth + "px");
    this.setSizeFull();
    this.baseSearchCriteria = baseSearchCriteria;
    this.setContentBorder(true);
    this.bodyContent.setSizeFull();
    initUI();/*from  w  ww. ja  v a  2 s .  com*/
}

From source file:com.esofthead.mycollab.module.project.view.bug.ComponentListViewImpl.java

License:Open Source License

private ComponentContainer constructTableActionControls() {
    final CssLayout layoutWrapper = new CssLayout();
    layoutWrapper.setWidth("100%");

    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from  ww  w .j a  v  a  2 s  . c  o m
    layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS);
    layoutWrapper.addComponent(layout);

    this.selectOptionButton = new SelectionOptionButton(this.tableItem);
    layout.addComponent(this.selectOptionButton);

    this.tableActionControls = new DefaultMassItemActionHandlersContainer();
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.COMPONENTS)) {
        tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete",
                AppContext.getMessage(GenericI18Enum.BUTTON_DELETE));
    }

    tableActionControls.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail",
            AppContext.getMessage(GenericI18Enum.BUTTON_MAIL));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O,
            "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION,
            FontAwesome.FILE_EXCEL_O, "export", "export.xlsx",
            AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O,
            "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV));

    layout.addComponent(this.tableActionControls);
    layout.addComponent(this.selectedItemsNumberLabel);
    layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER);
    return layoutWrapper;
}

From source file:com.esofthead.mycollab.module.project.view.bug.components.BugRowComponent.java

License:Open Source License

public BugRowComponent(final SimpleBug bug) {
    this.bug = bug;
    withSpacing(true).withMargin(false).withFullWidth().addStyleName(UIConstants.BORDER_LIST_ROW);

    bugSettingPopupBtn = new PopupButton();
    bugSettingPopupBtn.setIcon(FontAwesome.COGS);
    bugSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
    OptionPopupContent filterBtnLayout = createPopupContent();
    bugSettingPopupBtn.setContent(filterBtnLayout);

    final ToggleBugSummaryField bugWrapper = new ToggleBugSummaryField(bug);

    BugPopupFieldFactory popupFieldFactory = ViewManager.getCacheComponent(BugPopupFieldFactory.class);
    MHorizontalLayout headerLayout = new MHorizontalLayout().withFullWidth()
            .withMargin(new MarginInfo(false, true, false, false));
    Component priorityField = popupFieldFactory.createPriorityPopupField(bug);
    Component assigneeField = popupFieldFactory.createAssigneePopupField(bug);
    headerLayout.with(bugSettingPopupBtn, priorityField, assigneeField, bugWrapper).expand(bugWrapper);

    CssLayout footer = new CssLayout();

    Component commentsField = popupFieldFactory.createCommentsPopupField(bug);
    footer.addComponent(commentsField);/*from  w ww.  jav  a  2 s . c o m*/

    Component followerField = popupFieldFactory.createFollowersPopupField(bug);
    footer.addComponent(followerField);

    Component statusField = popupFieldFactory.createStatusPopupField(bug);
    footer.addComponent(statusField);

    Component milestoneField = popupFieldFactory.createMilestonePopupField(bug);
    footer.addComponent(milestoneField);

    String deadlineTooltip = String.format("%s: %s", AppContext.getMessage(GenericI18Enum.FORM_DUE_DATE),
            AppContext.formatDate(bug.getDuedate()));
    AbstractComponent deadlineField = popupFieldFactory.createDeadlinePopupField(bug);
    deadlineField.setDescription(deadlineTooltip);
    footer.addComponent(deadlineField);

    Component startDateField = popupFieldFactory.createStartDatePopupField(bug);
    footer.addComponent(startDateField);

    Component endDateField = popupFieldFactory.createEndDatePopupField(bug);
    footer.addComponent(endDateField);

    if (!SiteConfiguration.isCommunityEdition()) {
        Component billableHoursView = popupFieldFactory.createBillableHoursPopupField(bug);
        footer.addComponent(billableHoursView);

        Component nonBillableHoursView = popupFieldFactory.createNonbillableHoursPopupField(bug);
        footer.addComponent(nonBillableHoursView);
    }

    this.with(headerLayout, footer);
}

From source file:com.esofthead.mycollab.module.project.view.bug.VersionListViewImpl.java

License:Open Source License

private ComponentContainer constructTableActionControls() {
    final CssLayout layoutWrapper = new CssLayout();
    layoutWrapper.setWidth("100%");
    final HorizontalLayout layout = new HorizontalLayout();
    layout.setSpacing(true);//from ww  w  . j av  a 2  s  . c om
    layoutWrapper.addStyleName(UIConstants.TABLE_ACTION_CONTROLS);
    layoutWrapper.addComponent(layout);

    this.selectOptionButton = new SelectionOptionButton(this.tableItem);
    layout.addComponent(this.selectOptionButton);

    tableActionControls = new DefaultMassItemActionHandlersContainer();

    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.VERSIONS)) {
        tableActionControls.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete",
                AppContext.getMessage(GenericI18Enum.BUTTON_DELETE));
    }

    tableActionControls.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail",
            AppContext.getMessage(GenericI18Enum.BUTTON_MAIL));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O,
            "export", "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION,
            FontAwesome.FILE_EXCEL_O, "export", "export.xlsx",
            AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL));

    tableActionControls.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O,
            "export", "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV));

    layout.addComponent(this.tableActionControls);
    layout.addComponent(this.selectedItemsNumberLabel);
    layout.setComponentAlignment(this.selectedItemsNumberLabel, Alignment.MIDDLE_CENTER);
    return layoutWrapper;
}

From source file:com.esofthead.mycollab.module.project.view.message.MessageReadViewImpl.java

License:Open Source License

public MessageReadViewImpl() {
    super();//  w  w w  . j  a  va 2s .  c o  m

    this.header = new MHorizontalLayout().withStyleName("hdr-view").withWidth("100%").withSpacing(true)
            .withMargin(true);

    this.addComponent(header);
    previewForm = new AdvancedPreviewBeanForm<>();

    contentWrapper = new CssLayout();
    contentWrapper.setStyleName("content-wrapper");
    contentWrapper.addComponent(previewForm);
    contentWrapper.setWidth("900px");
    this.addComponent(contentWrapper);
    this.setMargin(false);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.AllMilestoneTimelineWidget.java

License:Open Source License

public void display() {
    this.withMargin(new MarginInfo(true, false, true, false));
    this.setWidth("100%");
    this.addStyleName("tm-container");

    MHorizontalLayout headerLayout = new MHorizontalLayout()
            .withMargin(new MarginInfo(false, true, false, true));
    ELabel titleLbl = ELabel.h2("Phase Timeline");

    final CheckBox includeNoDateSet = new CheckBox("No date set");
    includeNoDateSet.setValue(false);/*from   w ww .  j  ava2  s . co  m*/

    final CheckBox includeClosedMilestone = new CheckBox("Closed phase");
    includeClosedMilestone.setValue(false);

    includeNoDateSet.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue());
        }
    });
    includeClosedMilestone.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue());
        }
    });
    headerLayout.with(titleLbl, includeNoDateSet, includeClosedMilestone).expand(titleLbl)
            .withAlign(includeNoDateSet, Alignment.MIDDLE_RIGHT)
            .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    searchCriteria.setOrderFields(
            Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = milestoneService
            .findPagableListByCriteria(new BasicSearchRequest<>(searchCriteria, 0, Integer.MAX_VALUE));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

private void constructBody() {
    this.bodyContent = CustomLayoutExt.createLayout("milestoneView");

    bodyContent.setWidth("100%");
    bodyContent.setStyleName("milestone-view");

    final MHorizontalLayout closedHeaderLayout = new MHorizontalLayout();

    final Label closedHeader = new Label(FontAwesome.MINUS.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_TITLE), ContentMode.HTML);
    closedHeader.setSizeUndefined();// w w  w.  j  a  v  a2s. c om
    closedHeaderLayout.addComponent(closedHeader);
    closedHeaderLayout.setComponentAlignment(closedHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(closedHeaderLayout, "closed-header");
    closeContainer = new CssLayout();
    closeContainer.setStyleName("milestone-col");
    closeContainer.setWidth("100%");
    bodyContent.addComponent(this.closeContainer, "closed-milestones");

    final MHorizontalLayout inProgressHeaderLayout = new MHorizontalLayout();
    final Label inProgressHeader = new Label(FontAwesome.SPINNER.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_TITLE), ContentMode.HTML);
    inProgressHeader.setSizeUndefined();
    inProgressHeaderLayout.addComponent(inProgressHeader);
    inProgressHeaderLayout.setComponentAlignment(inProgressHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(inProgressHeaderLayout, "in-progress-header");
    inProgressContainer = new CssLayout();
    inProgressContainer.setStyleName("milestone-col");
    inProgressContainer.setWidth("100%");
    bodyContent.addComponent(this.inProgressContainer, "in-progress-milestones");

    final MHorizontalLayout futureHeaderLayout = new MHorizontalLayout();
    final Label futureHeader = new Label(FontAwesome.CLOCK_O.getHtml() + " "
            + AppContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_TITLE), ContentMode.HTML);
    futureHeader.setSizeUndefined();
    futureHeaderLayout.addComponent(futureHeader);
    futureHeaderLayout.setComponentAlignment(futureHeader, Alignment.MIDDLE_CENTER);

    bodyContent.addComponent(futureHeaderLayout, "future-header");
    futureContainer = new CssLayout();
    futureContainer.setStyleName("milestone-col");
    futureContainer.setWidth("100%");
    bodyContent.addComponent(this.futureContainer, "future-milestones");

    this.addComponent(bodyContent);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneListViewImpl.java

License:Open Source License

private ComponentContainer constructMilestoneBox(final SimpleMilestone milestone) {
    final CssLayout layout = new CssLayout();
    layout.addStyleName(UIConstants.MILESTONE_BOX);
    layout.setWidth("100%");

    final LabelLink milestoneLink = new LabelLink(milestone.getName(),
            ProjectLinkBuilder.generateMilestonePreviewFullLink(milestone.getProjectid(), milestone.getId()));
    milestoneLink.setStyleName("link");
    milestoneLink.addStyleName("bold");
    milestoneLink.addStyleName(UIConstants.WORD_WRAP);
    milestoneLink.addStyleName("milestone-name");
    milestoneLink.setWidth("100%");

    MHorizontalLayout milestoneHeader = new MHorizontalLayout().withWidth("100%").with(milestoneLink)
            .expand(milestoneLink);// w w w  .  j a v a  2  s. co  m

    PopupButton taskSettingPopupBtn = new PopupButton();
    taskSettingPopupBtn.setWidth("20px");
    MVerticalLayout filterBtnLayout = new MVerticalLayout().withWidth("100px");

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

                @Override
                public void buttonClick(ClickEvent event) {
                    EventBusFactory.getInstance()
                            .post(new MilestoneEvent.GotoEdit(MilestoneListViewImpl.this, milestone));
                }
            });
    editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    editButton.setStyleName("link");
    filterBtnLayout.addComponent(editButton);

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

                @Override
                public void buttonClick(ClickEvent event) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                    SiteConfiguration.getSiteName()),
                            AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                            AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                            AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                                private static final long serialVersionUID = 1L;

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        MilestoneService projectTaskService = ApplicationContextUtil
                                                .getSpringBean(MilestoneService.class);
                                        projectTaskService.removeWithSession(milestone.getId(),
                                                AppContext.getUsername(), AppContext.getAccountId());
                                        milestones.remove(milestone);
                                        displayMilestones(milestones);
                                    }
                                }
                            });
                }
            });
    deleteBtn.setStyleName("link");
    deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES));
    filterBtnLayout.addComponent(deleteBtn);

    taskSettingPopupBtn.setIcon(FontAwesome.COG);
    taskSettingPopupBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY);
    taskSettingPopupBtn.setContent(filterBtnLayout);

    milestoneHeader.addComponent(taskSettingPopupBtn);
    layout.addComponent(milestoneHeader);

    MHorizontalLayout spacing = new MHorizontalLayout().withHeight("8px").withWidth("100%");
    layout.addComponent(spacing);

    final GridFormLayoutHelper layoutHelper = new GridFormLayoutHelper(1, 5, "100%", "80px");
    layoutHelper.addComponent(
            new Label(AppContext.formatDate(milestone.getStartdate(),
                    AppContext.getMessage(GenericI18Enum.FORM_EMPTY))),
            AppContext.getMessage(MilestoneI18nEnum.FORM_START_DATE_FIELD), 0, 0, Alignment.MIDDLE_LEFT);
    layoutHelper.addComponent(
            new Label(AppContext.formatDate(milestone.getEnddate(),
                    AppContext.getMessage(GenericI18Enum.FORM_EMPTY))),
            AppContext.getMessage(MilestoneI18nEnum.FORM_END_DATE_FIELD), 0, 1, Alignment.MIDDLE_LEFT);

    CssLayout linkWrapper = new CssLayout();
    linkWrapper.setWidth("100%");
    linkWrapper.addComponent(new ProjectUserLink(milestone.getOwner(), milestone.getOwnerAvatarId(),
            milestone.getOwnerFullName(), false, true));
    layoutHelper.addComponent(linkWrapper, AppContext.getMessage(GenericI18Enum.FORM_ASSIGNEE), 0, 2,
            Alignment.MIDDLE_LEFT);

    final ProgressBarIndicator progressTask = new ProgressBarIndicator(milestone.getNumTasks(),
            milestone.getNumOpenTasks());
    progressTask.setWidth("100%");

    layoutHelper.addComponent(progressTask, AppContext.getMessage(MilestoneI18nEnum.FORM_TASK_FIELD), 0, 3,
            Alignment.MIDDLE_LEFT);

    final ProgressBarIndicator progressBug = new ProgressBarIndicator(milestone.getNumBugs(),
            milestone.getNumOpenBugs());
    progressBug.setWidth("100%");

    layoutHelper.addComponent(progressBug, AppContext.getMessage(MilestoneI18nEnum.FORM_BUG_FIELD), 0, 4,
            Alignment.MIDDLE_LEFT);
    final GridLayout milestoneInfoLayout = layoutHelper.getLayout();
    milestoneInfoLayout.setWidth("100%");
    milestoneInfoLayout.setMargin(false);
    milestoneInfoLayout.setSpacing(true);
    layout.addComponent(milestoneInfoLayout);

    return layout;
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneTimelineWidget.java

License:Open Source License

public void display() {
    this.setWidth("100%");
    this.addStyleName("tm-container");

    MHorizontalLayout headerLayout = new MHorizontalLayout();
    ELabel titleLbl = ELabel.h2("Phase Timeline");

    final CheckBox noDateSetMilestone = new CheckBox("No date set");
    noDateSetMilestone.setValue(false);//from w  ww . j ava2 s .  c o m

    final CheckBox includeClosedMilestone = new CheckBox("Closed phase");
    includeClosedMilestone.setValue(false);

    noDateSetMilestone.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue());
        }
    });
    includeClosedMilestone.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue());
        }
    });
    headerLayout.with(titleLbl, noDateSetMilestone, includeClosedMilestone).expand(titleLbl)
            .withAlign(noDateSetMilestone, Alignment.MIDDLE_RIGHT)
            .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT);

    MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria();
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    searchCriteria.setOrderFields(
            Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC")));
    MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
    milestones = milestoneService
            .findPagableListByCriteria(new BasicSearchRequest<>(searchCriteria, 0, Integer.MAX_VALUE));

    this.addComponent(headerLayout);
    timelineContainer = new CssLayout();
    timelineContainer.setWidth("100%");
    this.addComponent(timelineContainer);
    timelineContainer.addStyleName("tm-wrapper");
    displayTimelines(false, false);
}