Example usage for com.vaadin.ui Alignment MIDDLE_LEFT

List of usage examples for com.vaadin.ui Alignment MIDDLE_LEFT

Introduction

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

Prototype

Alignment MIDDLE_LEFT

To view the source code for com.vaadin.ui Alignment MIDDLE_LEFT.

Click Source Link

Usage

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java

License:Open Source License

private void constructSpentTimeEntryPanel() {
    VerticalLayout spentTimePanel = new VerticalLayout();
    spentTimePanel.setSpacing(true);/*from  w ww  .j a va2  s.c o m*/
    headerPanel.addComponent(spentTimePanel);

    final VerticalLayout totalLayout = new VerticalLayout();
    totalLayout.setMargin(true);
    totalLayout.addStyleName("boxTotal");
    totalLayout.setWidth("100%");
    spentTimePanel.addComponent(totalLayout);
    final Label lbTimeInstructTotal = new Label(
            AppContext.getMessage(TimeTrackingI18nEnum.OPT_TOTAL_SPENT_HOURS));
    totalLayout.addComponent(lbTimeInstructTotal);
    this.totalSpentTimeLbl = new Label("_");
    this.totalSpentTimeLbl.addStyleName("numberTotal");
    totalLayout.addComponent(this.totalSpentTimeLbl);

    final MHorizontalLayout addLayout = new MHorizontalLayout();
    addLayout.setSizeUndefined();
    addLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    spentTimePanel.addComponent(addLayout);

    this.newTimeInputField = new NumericTextField();
    this.newTimeInputField.setWidth("80px");

    this.forDateField = new DateFieldExt();
    this.forDateField.setValue(new GregorianCalendar().getTime());

    this.isBillableField = new CheckBox(AppContext.getMessage(TimeTrackingI18nEnum.FORM_IS_BILLABLE), true);

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

        @Override
        public void buttonClick(final ClickEvent event) {
            double d = 0;
            try {
                d = Double.parseDouble(newTimeInputField.getValue());
            } catch (NumberFormatException e) {
                NotificationUtil.showWarningNotification("You must enter a positive number value");
            }
            if (d > 0) {
                saveTimeInvest();
                loadTimeValue();
                newTimeInputField.setValue("0.0");
            }
        }

    });

    btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd());
    btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK);
    btnAdd.setIcon(FontAwesome.PLUS);
    addLayout.with(this.newTimeInputField, this.forDateField, this.isBillableField, btnAdd);
}

From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java

License:Open Source License

private void constructRemainTimeEntryPanel() {
    VerticalLayout remainTimePanel = new VerticalLayout();
    remainTimePanel.setSpacing(true);/* ww  w  .j  a  va 2 s .c  o m*/
    this.headerPanel.addComponent(remainTimePanel);

    final VerticalLayout updateLayout = new VerticalLayout();
    updateLayout.setMargin(true);
    updateLayout.addStyleName("boxTotal");
    updateLayout.setWidth("100%");
    remainTimePanel.addComponent(updateLayout);

    final Label lbTimeInstructTotal = new Label(
            AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAINING_WORK_HOURS));
    updateLayout.addComponent(lbTimeInstructTotal);
    this.remainTimeLbl = new Label("_");
    this.remainTimeLbl.addStyleName("numberTotal");
    updateLayout.addComponent(this.remainTimeLbl);

    final MHorizontalLayout addLayout = new MHorizontalLayout();
    addLayout.setSizeUndefined();
    remainTimePanel.addComponent(addLayout);

    this.remainTimeInputField = new NumericTextField();
    this.remainTimeInputField.setWidth("80px");
    addLayout.addComponent(this.remainTimeInputField);
    addLayout.setComponentAlignment(this.remainTimeInputField, Alignment.MIDDLE_LEFT);

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

        @Override
        public void buttonClick(final ClickEvent event) {

            try {
                double d = 0;
                try {
                    d = Double.parseDouble(remainTimeInputField.getValue());
                } catch (Exception e) {
                    NotificationUtil.showWarningNotification("You must enter a positive number value");
                }
                if (d >= 0) {
                    updateTimeRemain();
                    remainTimeLbl.setValue(remainTimeInputField.getValue());
                    remainTimeInputField.setValue("0.0");
                }
            } catch (final Exception e) {
                remainTimeInputField.setValue("0.0");
            }
        }

    });

    btnAdd.setEnabled(TimeLogEditWindow.this.isEnableAdd());
    btnAdd.setStyleName(UIConstants.THEME_GREEN_LINK);
    addLayout.addComponent(btnAdd);
    addLayout.setComponentAlignment(btnAdd, Alignment.MIDDLE_LEFT);
}

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

License:Open Source License

@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%");
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    field.setBuffered(true);// w ww .  j  av a2s.  co  m
    field.setWidth("100%");
    Label icon = new Label(ProjectAssetsManager.getAsset(type).getHtml(), ContentMode.HTML);
    layout.with(new CssLayout(icon), field).expand(field);
    return layout;
}

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// w  w w. j  av  a 2  s .c  om
        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.BugDashboardViewImpl.java

License:Open Source License

private void initUI() {
    this.setMargin(new MarginInfo(false, true, false, true));
    header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withWidth("100%");
    header.addStyleName("hdr-view");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    this.addComponent(header);

    final MHorizontalLayout body = new MHorizontalLayout().withMargin(false).withWidth("100%");

    this.leftColumn = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, false));
    body.with(this.leftColumn).expand(leftColumn);

    this.rightColumn = new MVerticalLayout().withMargin(false);

    body.with(this.rightColumn).withAlign(rightColumn, Alignment.TOP_RIGHT);

    this.addComponent(body);

    initHeader();/*from   ww  w .j  av a  2s  .co  m*/
}

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

License:Open Source License

private void initHeader() {
    final Label title = new ProjectViewHeader(ProjectTypeConstants.BUG,
            AppContext.getMessage(BugI18nEnum.VIEW_BUG_DASHBOARD_TITLE));
    header.with(title).withAlign(title, Alignment.MIDDLE_LEFT).expand(title);

    final Button createBugBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG),
            new Button.ClickListener() {
                @Override/*from   w ww.j av a2 s .c  om*/
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null));
                }
            });
    createBugBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    createBugBtn.setIcon(FontAwesome.PLUS);
    final SplitButton controlsBtn = new SplitButton(createBugBtn);
    controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK);
    controlsBtn.setWidthUndefined();

    final VerticalLayout btnControlsLayout = new VerticalLayout();
    final Button createComponentBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_COMPONENT),
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new BugComponentEvent.GotoAdd(this, null));
                }
            });
    createComponentBtn.setStyleName("link");
    createComponentBtn
            .setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.COMPONENTS));
    btnControlsLayout.addComponent(createComponentBtn);

    final Button createVersionBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_VERSION),
            new Button.ClickListener() {
                @Override
                public void buttonClick(final ClickEvent event) {
                    controlsBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new BugVersionEvent.GotoAdd(this, null));
                }
            });
    createVersionBtn.setStyleName("link");
    createVersionBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.VERSIONS));
    btnControlsLayout.addComponent(createVersionBtn);

    controlsBtn.setContent(btnControlsLayout);
    header.addComponent(controlsBtn);
}

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

License:Open Source License

public BugKanbanViewImpl() {
    this.setSizeFull();
    this.withSpacing(true).withMargin(new MarginInfo(false, true, true, true));

    searchPanel = new BugSearchPanel();
    MHorizontalLayout groupWrapLayout = new MHorizontalLayout();
    groupWrapLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    searchPanel.addHeaderRight(groupWrapLayout);

    Button advanceDisplayBtn = new Button("List", new Button.ClickListener() {
        @Override// w  w  w. j a va2 s .co  m
        public void buttonClick(Button.ClickEvent clickEvent) {
            EventBusFactory.getInstance().post(new BugEvent.GotoList(BugKanbanViewImpl.this, null));
        }
    });
    advanceDisplayBtn.setWidth("100px");
    advanceDisplayBtn.setIcon(FontAwesome.SITEMAP);
    advanceDisplayBtn.setDescription("Detail");

    Button kanbanBtn = new Button("Kanban");
    kanbanBtn.setWidth("100px");
    kanbanBtn.setDescription("Kanban View");
    kanbanBtn.setIcon(FontAwesome.TH);

    ToggleButtonGroup viewButtons = new ToggleButtonGroup();
    viewButtons.addButton(advanceDisplayBtn);
    viewButtons.addButton(kanbanBtn);
    viewButtons.withDefaultButton(kanbanBtn);
    groupWrapLayout.addComponent(viewButtons);

    kanbanLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false))
            .withFullHeight();
    kanbanLayout.addStyleName("kanban-layout");
    this.with(searchPanel, kanbanLayout).expand(kanbanLayout);
}

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

License:Open Source License

public void displayRelatedBugs(final SimpleBug bug) {
    this.bug = bug;
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setWidth("100%");
    mainLayout.setMargin(true);//from www  . j  a va 2  s  . c om
    mainLayout.setSpacing(true);

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

    Label lbBug = new Label("Bug:");
    lbBug.setWidth("70px");
    layoutAdd.addComponent(lbBug);
    layoutAdd.setComponentAlignment(lbBug, Alignment.MIDDLE_LEFT);

    itemField = new TextField();
    itemField.setWidth("300px");
    itemField.setNullRepresentation("");
    itemField.setReadOnly(true);
    itemField.setEnabled(true);
    layoutAdd.addComponent(itemField);
    layoutAdd.setComponentAlignment(itemField, Alignment.MIDDLE_LEFT);

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

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            callItemSelectionWindow();

        }
    });
    browseBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_browseItem));
    browseBtn.setStyleName("link");

    layoutAdd.addComponent(browseBtn);
    layoutAdd.setComponentAlignment(browseBtn, Alignment.MIDDLE_LEFT);

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

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            setItemFieldValue("");
        }
    });
    clearBtn.setIcon(MyCollabResource.newResource("icons/16/clearItem.png"));
    clearBtn.setStyleName("link");

    layoutAdd.addComponent(clearBtn);
    layoutAdd.setComponentAlignment(clearBtn, Alignment.MIDDLE_LEFT);

    Label lbIs = new Label("is");
    layoutAdd.addComponent(lbIs);
    layoutAdd.setComponentAlignment(lbIs, Alignment.MIDDLE_LEFT);

    comboRelation = new BugRelationComboBox();
    comboRelation.setWidth("200px");
    layoutAdd.addComponent(comboRelation);
    layoutAdd.setComponentAlignment(comboRelation, Alignment.MIDDLE_LEFT);

    btnRelate = new Button("Relate");
    btnRelate.setStyleName(UIConstants.THEME_GREEN_LINK);
    btnRelate.setIcon(MyCollabResource.newResource(WebResourceIds._16_addRecord));

    ProjectMemberService memberService = ApplicationContextUtil.getSpringBean(ProjectMemberService.class);
    SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(),
            CurrentProjectVariables.getProjectId(), AppContext.getAccountId());

    if (member != null) {
        btnRelate.setEnabled((member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser()))
                || (AppContext.getUsername().equals(bug.getLogby())))
                && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    }

    btnRelate.addClickListener(new Button.ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            if (!itemField.getValue().toString().trim().equals("") && relatedBean != null
                    && !relatedBean.getSummary().equals(bug.getSummary())) {
                SimpleRelatedBug relatedBug = new SimpleRelatedBug();
                relatedBug.setBugid(bug.getId());
                relatedBug.setRelatedid(relatedBean.getId());
                relatedBug.setRelatetype((String) comboRelation.getValue());
                relatedBug.setComment(txtComment.getValue().toString());
                relatedBugService.saveWithSession(relatedBug, AppContext.getUsername());

                SimpleRelatedBug oppositeRelation = new SimpleRelatedBug();
                oppositeRelation.setBugid(relatedBean.getId());
                oppositeRelation.setRelatedid(bug.getId());
                oppositeRelation.setComment(txtComment.getValue().toString());

                if (comboRelation.getValue().toString().equals(BugRelationConstants.PARENT)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.CHILD);
                } else if (comboRelation.getValue().toString().equals(BugRelationConstants.CHILD)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.PARENT);
                } else if (comboRelation.getValue().toString().equals(BugRelationConstants.RELATED)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.RELATED);
                } else if (comboRelation.getValue().toString().equals(BugRelationConstants.BEFORE)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.AFTER);
                } else if (comboRelation.getValue().toString().equals(BugRelationConstants.AFTER)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.BEFORE);
                } else if (comboRelation.getValue().toString().equals(BugRelationConstants.DUPLICATED)) {
                    oppositeRelation.setRelatetype(BugRelationConstants.DUPLICATED);
                    BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
                    bug.setStatus(BugStatus.Resolved.name());
                    bug.setResolution(BugResolution.Duplicate.name());
                    bugService.updateWithSession(bug, AppContext.getUsername());
                }
                relatedBugService.saveWithSession(oppositeRelation, AppContext.getUsername());

                setCriteria();

                setItemFieldValue("");
                txtComment.setValue("");
                relatedBean = null;
            }
        }
    });
    layoutAdd.addComponent(btnRelate);
    layoutAdd.setComponentAlignment(btnRelate, Alignment.MIDDLE_LEFT);

    Label lbInstruction = new Label("<strong>Relate to an existing ticket</strong>", ContentMode.HTML);
    mainLayout.addComponent(lbInstruction);

    mainLayout.addComponent(layoutAdd);

    HorizontalLayout layoutComment = new HorizontalLayout();
    layoutComment.setSpacing(true);
    Label lbComment = new Label("Comment:");
    lbComment.setWidth("70px");
    layoutComment.addComponent(lbComment);
    layoutComment.setComponentAlignment(lbComment, Alignment.TOP_LEFT);
    txtComment = new RichTextArea();
    txtComment.setHeight("130px");
    txtComment.setWidth("565px");
    layoutComment.addComponent(txtComment);
    layoutComment.setComponentAlignment(txtComment, Alignment.MIDDLE_LEFT);
    mainLayout.addComponent(layoutComment);

    tableItem = new DefaultPagedBeanTable<RelatedBugService, BugRelatedSearchCriteria, SimpleRelatedBug>(
            ApplicationContextUtil.getSpringBean(RelatedBugService.class), SimpleRelatedBug.class,
            Arrays.asList(
                    new TableViewField(BugI18nEnum.RELATED_BUG_NAME, "bugName",
                            UIConstants.TABLE_EX_LABEL_WIDTH),
                    new TableViewField(BugI18nEnum.RELATED_BUG_TYPE, "relatetype",
                            UIConstants.TABLE_S_LABEL_WIDTH),
                    new TableViewField(BugI18nEnum.RELATED_BUG_COMMENT, "comment",
                            UIConstants.TABLE_EX_LABEL_WIDTH),
                    new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH)));

    tableItem.addGeneratedColumn("bugName", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId);
            String bugname = "[%s-%s] %s";
            bugname = String.format(bugname, CurrentProjectVariables.getProject().getShortname(),
                    relatedItem.getRelatedid(), relatedItem.getBugName());

            BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class);
            final SimpleBug bug = bugService.findById(relatedItem.getRelatedid(), AppContext.getAccountId());

            LabelLink b = new LabelLink(bugname,
                    ProjectLinkBuilder.generateBugPreviewFullLink(bug.getBugkey(), bug.getProjectShortName()));

            if (StringUtils.isNotBlank(bug.getPriority())) {
                String iconPriority = ProjectResources.getIconResourceLink12ByBugPriority(bug.getPriority());

                b.setIconLink(iconPriority);
            }

            if (BugStatus.Verified.name().equals(bug.getStatus())) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            } else if (bug.getDuedate() != null
                    && (bug.getDuedate().before(new GregorianCalendar().getTime()))) {
                b.addStyleName(UIConstants.LINK_OVERDUE);
            }
            b.setWidth("100%");
            return b;

        }
    });

    tableItem.addGeneratedColumn("id", new ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            final SimpleRelatedBug relatedItem = tableItem.getBeanByIndex(itemId);

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

                @Override
                public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                    BugRelatedSearchCriteria relateBugIdCriteria = new BugRelatedSearchCriteria();
                    relateBugIdCriteria.setBugId(new NumberSearchField(relatedItem.getBugid()));
                    relateBugIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getRelatedid()));

                    relatedBugService.removeByCriteria(relateBugIdCriteria, AppContext.getAccountId());

                    BugRelatedSearchCriteria relateIdCriteria = new BugRelatedSearchCriteria();
                    relateIdCriteria.setBugId(new NumberSearchField(relatedItem.getRelatedid()));
                    relateIdCriteria.setRelatedId(new NumberSearchField(relatedItem.getBugid()));

                    relatedBugService.removeByCriteria(relateIdCriteria, AppContext.getAccountId());

                    BugRelatedField.this.setCriteria();
                }
            });
            deleteBtn.setStyleName("link");
            deleteBtn.setIcon(MyCollabResource.newResource("icons/16/delete.png"));
            relatedItem.setExtraData(deleteBtn);

            ProjectMemberService memberService = ApplicationContextUtil
                    .getSpringBean(ProjectMemberService.class);
            SimpleProjectMember member = memberService.findMemberByUsername(AppContext.getUsername(),
                    CurrentProjectVariables.getProjectId(), AppContext.getAccountId());

            if (member != null) {
                deleteBtn.setEnabled(
                        member.getIsadmin() || (AppContext.getUsername().equals(bug.getAssignuser()))
                                || (AppContext.getUsername().equals(bug.getLogby())));
            }
            return deleteBtn;
        }
    });

    mainLayout.addComponent(tableItem);

    setCriteria();

    this.setCompositionRoot(mainLayout);
}

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

License:Open Source License

private ComponentContainer constructHeader() {
    Label headerText = new ProjectViewHeader(ProjectTypeConstants.BUG,
            AppContext.getMessage(BugI18nEnum.VIEW_LIST_TITLE));

    final Button createBtn = new Button(AppContext.getMessage(BugI18nEnum.BUTTON_NEW_BUG),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override//  w w w . ja v  a2 s.c  o  m
                public void buttonClick(final ClickEvent event) {
                    EventBusFactory.getInstance().post(new BugEvent.GotoAdd(this, null));
                }
            });
    createBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
    createBtn.setIcon(FontAwesome.PLUS);
    createBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));

    headerText.setStyleName(UIConstants.HEADER_TEXT);

    rightComponent = new MHorizontalLayout();

    MHorizontalLayout header = new MHorizontalLayout().withStyleName(UIConstants.HEADER_VIEW).withWidth("100%")
            .withSpacing(true).withMargin(new MarginInfo(true, false, true, false));

    header.with(headerText, createBtn, rightComponent).withAlign(headerText, Alignment.MIDDLE_LEFT)
            .withAlign(createBtn, Alignment.MIDDLE_RIGHT).withAlign(rightComponent, Alignment.MIDDLE_RIGHT)
            .expand(headerText);

    return header;
}

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

License:Open Source License

@Override
protected void displayPlainMode() {
    bodyContent.removeAllComponents();/*  w w w . j a va 2s.  c  om*/
    BugStatusClickListener listener = new BugStatusClickListener();
    if (!groupItems.isEmpty()) {
        for (OptionI18nEnum.BugStatus status : OptionI18nEnum.bug_statuses) {
            boolean isFound = false;
            for (GroupItem item : groupItems) {
                if (status.name().equals(item.getGroupid())) {
                    isFound = true;
                    MHorizontalLayout statusLayout = new MHorizontalLayout().withFullWidth();
                    statusLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                    ButtonI18nComp statusLink = new ButtonI18nComp(status.name(), status, listener);
                    statusLink.setWidth("110px");
                    statusLink.setIcon(FontAwesome.FLAG);
                    statusLink.setStyleName(UIConstants.BUTTON_LINK);

                    ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount,
                            totalCount - item.getValue().intValue(), false);
                    indicator.setWidth("100%");
                    statusLayout.with(statusLink, indicator).expand(indicator);
                    bodyContent.addComponent(statusLayout);
                }
            }

            if (!isFound && !status.name().equals(OptionI18nEnum.BugStatus.Resolved.name())
                    && !status.name().equals(OptionI18nEnum.BugStatus.Verified.name())) {
                MHorizontalLayout statusLayout = new MHorizontalLayout().withFullWidth();
                statusLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                Button statusLink = new ButtonI18nComp(status.name(), status, listener);
                statusLink.setWidth("110px");
                statusLink.setIcon(FontAwesome.FLAG);
                statusLink.setStyleName(UIConstants.BUTTON_LINK);
                ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false);
                indicator.setWidth("100%");
                statusLayout.with(statusLink, indicator).expand(indicator);
                bodyContent.addComponent(statusLayout);
            }
        }
    }
}