List of usage examples for com.vaadin.ui HorizontalLayout setWidth
@Override public void setWidth(String width)
From source file:com.esofthead.mycollab.module.project.view.bug.components.UnresolvedBugsByAssigneeWidget.java
License:Open Source License
public void setSearchCriteria(final BugSearchCriteria searchCriteria) { this.bugSearchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final int totalCount = bugService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = bugService.getAssignedDefectsSummary(searchCriteria); if (!groupItems.isEmpty()) { for (final GroupItem item : groupItems) { final HorizontalLayout assigneeLayout = new HorizontalLayout(); assigneeLayout.setSpacing(true); assigneeLayout.setWidth("100%"); String assignUser = item.getGroupid(); String assignUserFullName = item.getGroupid() == null ? AppContext.getMessage(BugI18nEnum.OPT_UNDEFINED_USER) : item.getGroupname(); if (assignUserFullName == null || "".equals(assignUserFullName.trim())) { assignUserFullName = StringUtils.extractNameFromEmail(assignUser); }/* w w w.j av a 2s .co m*/ final BugAssigneeButton userLbl = new BugAssigneeButton(assignUser, item.getExtraValue(), assignUserFullName); assigneeLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue(), false); indicator.setWidth("100%"); assigneeLayout.addComponent(indicator); assigneeLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(assigneeLayout); } } }
From source file:com.esofthead.mycollab.module.project.view.bug.components.UnresolvedBugsByAssigneeWidget2.java
License:Open Source License
public void setSearchCriteria(final BugSearchCriteria searchCriteria) { this.bugSearchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final int totalCount = bugService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = bugService.getAssignedDefectsSummary(searchCriteria); if (!groupItems.isEmpty()) { for (final GroupItem item : groupItems) { final HorizontalLayout assigneeLayout = new HorizontalLayout(); assigneeLayout.setSpacing(true); assigneeLayout.setWidth("100%"); String assignUser = item.getGroupid(); String assignUserFullName = item.getGroupid() == null ? AppContext.getMessage(BugI18nEnum.OPT_UNDEFINED_USER) : item.getGroupname(); if (assignUserFullName == null || "".equals(assignUserFullName.trim())) { assignUserFullName = StringUtils.extractNameFromEmail(assignUser); }//from w w w . jav a 2 s .com final BugAssigneeLink userLbl = new BugAssigneeLink(assignUser, item.getExtraValue(), assignUserFullName); assigneeLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue(), false); indicator.setWidth("100%"); assigneeLayout.addComponent(indicator); assigneeLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(assigneeLayout); } } }
From source file:com.esofthead.mycollab.module.project.view.bug.components.UnresolvedBugsByPriorityWidget.java
License:Open Source License
public void setSearchCriteria(final BugSearchCriteria searchCriteria) { this.bugSearchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final int totalCount = bugService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = bugService.getPrioritySummary(searchCriteria); final BugPriorityClickListener listener = new BugPriorityClickListener(); if (!groupItems.isEmpty()) { for (final BugPriority priority : OptionI18nEnum.bug_priorities) { boolean isFound = false; for (final GroupItem item : groupItems) { if (priority.name().equals(item.getGroupid())) { isFound = true;// w w w. j av a2 s .c o m final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final ButtonI18nComp priorityLink = new ButtonI18nComp(priority.name(), priority, listener); priorityLink.setWidth("110px"); priorityLink.setStyleName("link"); priorityLayout.addComponent(priorityLink); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue(), false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); continue; } } if (!isFound) { final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final ButtonI18nComp priorityLink = new ButtonI18nComp(priority.name(), priority, listener); priorityLink.setWidth("110px"); priorityLink.setStyleName("link"); priorityLayout.addComponent(priorityLink); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); } } } }
From source file:com.esofthead.mycollab.module.project.view.bug.UnresolvedBugsByPriorityWidget2.java
License:Open Source License
public void setSearchCriteria(final BugSearchCriteria searchCriteria) { this.bugSearchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); final BugService bugService = ApplicationContextUtil.getSpringBean(BugService.class); final int totalCount = bugService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = bugService.getPrioritySummary(searchCriteria); final BugPriorityClickListener listener = new BugPriorityClickListener(); if (!groupItems.isEmpty()) { for (final BugPriority priority : OptionI18nEnum.bug_priorities) { boolean isFound = false; for (final GroupItem item : groupItems) { if (priority.name().equals(item.getGroupid())) { isFound = true;//from w w w .j ava2 s .c om final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final ButtonI18nComp userLbl = new ButtonI18nComp(priority.name(), priority, listener); final Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByBugPriority(priority.name())); userLbl.setIcon(iconPriority); userLbl.setWidth("110px"); userLbl.setStyleName("link"); priorityLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount - item.getValue(), false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); continue; } } if (!isFound) { final HorizontalLayout priorityLayout = new HorizontalLayout(); priorityLayout.setSpacing(true); priorityLayout.setWidth("100%"); final Button userLbl = new ButtonI18nComp(priority.name(), priority, listener); final Resource iconPriority = new ExternalResource( ProjectResources.getIconResourceLink12ByBugPriority(priority.name())); userLbl.setIcon(iconPriority); userLbl.setWidth("110px"); userLbl.setStyleName("link"); priorityLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, totalCount, false); indicator.setWidth("100%"); priorityLayout.addComponent(indicator); priorityLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(priorityLayout); } } } }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java
License:Open Source License
private void constructHeader() { final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/* w ww .ja v a 2 s . c o m*/ header.setWidth("100%"); final Label taskGroupSelection = new Label(AppContext.getMessage(MilestoneI18nEnum.TAB_RELATED_BUGS)); taskGroupSelection.addStyleName("h2"); taskGroupSelection.addStyleName(UIConstants.THEME_NO_BORDER); header.addComponent(taskGroupSelection); header.setExpandRatio(taskGroupSelection, 1.0f); header.setComponentAlignment(taskGroupSelection, Alignment.MIDDLE_LEFT); this.viewGroup = new ToggleButtonGroup(); final Button simpleDisplay = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { MilestoneBugListComp.this.displaySimpleView(); } }); simpleDisplay.setIcon(MyCollabResource.newResource("icons/16/project/list_display.png")); this.viewGroup.addButton(simpleDisplay); final Button advanceDisplay = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { MilestoneBugListComp.this.displayAdvancedView(); } }); advanceDisplay.setIcon(MyCollabResource.newResource("icons/16/project/bug_advanced_display.png")); this.viewGroup.addButton(advanceDisplay); header.addComponent(this.viewGroup); header.setComponentAlignment(this.viewGroup, Alignment.MIDDLE_RIGHT); this.addComponent(header); }
From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneBugListComp.java
License:Open Source License
private void displayAdvancedView() { if (this.getComponentCount() > 1) { this.removeComponent(this.getComponent(1)); }// w w w .java 2 s. c om final HorizontalLayout bodyLayout = new HorizontalLayout(); bodyLayout.setSpacing(false); bodyLayout.setWidth("100%"); final VerticalLayout leftColumn = new VerticalLayout(); leftColumn.setMargin(new MarginInfo(false, true, false, false)); bodyLayout.addComponent(leftColumn); bodyLayout.setExpandRatio(leftColumn, 1.0f); final VerticalLayout rightColumn = new VerticalLayout(); bodyLayout.addComponent(rightColumn); final UnresolvedBugsByPriorityWidget unresolvedBugWidget = new UnresolvedBugsByPriorityWidget(this); unresolvedBugWidget.setWidth("100%"); leftColumn.addComponent(unresolvedBugWidget); final BugSearchCriteria unresolvedByPrioritySearchCriteria = new BugSearchCriteria(); unresolvedByPrioritySearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByPrioritySearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByPrioritySearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedBugWidget.setSearchCriteria(unresolvedByPrioritySearchCriteria); final UnresolvedBugsByAssigneeWidget unresolvedByAssigneeWidget = new UnresolvedBugsByAssigneeWidget(this); unresolvedByAssigneeWidget.setWidth("100%"); leftColumn.addComponent(unresolvedByAssigneeWidget); final BugSearchCriteria unresolvedByAssigneeSearchCriteria = new BugSearchCriteria(); unresolvedByAssigneeSearchCriteria .setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); unresolvedByAssigneeSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); unresolvedByAssigneeSearchCriteria.setStatuses(new SetSearchField<String>(SearchField.AND, new String[] { BugStatus.InProgress.name(), BugStatus.Open.name(), BugStatus.ReOpened.name() })); unresolvedByAssigneeWidget.setSearchCriteria(unresolvedByAssigneeSearchCriteria); final BugSearchCriteria chartSearchCriteria = new BugSearchCriteria(); chartSearchCriteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId())); chartSearchCriteria.setMilestoneIds(new SetSearchField<Integer>(this.milestone.getId())); BugChartComponent bugChartComponent = null; bugChartComponent = new BugChartComponent(chartSearchCriteria, 400, 200); rightColumn.addComponent(bugChartComponent); rightColumn.setWidth("400px"); this.addComponent(bodyLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.FilterTaskViewImpl.java
License:Open Source License
public FilterTaskViewImpl() { this.setMargin(new MarginInfo(false, true, true, true)); final HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);//w w w.j a v a 2 s . c om header.setMargin(new MarginInfo(true, false, true, false)); header.setStyleName(UIConstants.HEADER_VIEW); header.setWidth("100%"); Image titleIcon = new Image(null, MyCollabResource.newResource("icons/24/project/task.png")); headerText = new Label(); headerText.setSizeUndefined(); headerText.setStyleName(UIConstants.HEADER_TEXT); Button backtoTaskListBtn = new Button(AppContext.getMessage(TaskI18nEnum.BUTTON_BACK_TO_DASHBOARD), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backtoTaskListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); UiUtils.addComponent(header, titleIcon, Alignment.TOP_LEFT); UiUtils.addComponent(header, headerText, Alignment.MIDDLE_LEFT); UiUtils.addComponent(header, backtoTaskListBtn, Alignment.MIDDLE_RIGHT); header.setExpandRatio(headerText, 1.0f); this.addComponent(header); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setWidth("100%"); contentLayout.setSpacing(true); this.addComponent(contentLayout); this.taskTableDisplay = new TaskTableDisplay(Arrays.asList(TaskTableFieldDef.taskname, TaskTableFieldDef.startdate, TaskTableFieldDef.duedate, TaskTableFieldDef.percentagecomplete)); this.taskTableDisplay.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(FilterTaskViewImpl.this, task.getId())); } } }); taskTableDisplay.setWidth("100%"); taskTableDisplay.setStyleName("filter-task-table"); leftColumn = new VerticalLayout(); leftColumn.addComponent(taskTableDisplay); leftColumn.setStyleName("depotComp"); leftColumn.setMargin(new MarginInfo(true, true, false, false)); rightColumn = new VerticalLayout(); rightColumn.setWidth("300px"); contentLayout.addComponent(leftColumn); contentLayout.addComponent(rightColumn); contentLayout.setExpandRatio(leftColumn, 1.0f); unresolvedTaskByAssigneeWidget = new UnresolvedTaskByAssigneeWidget(); rightColumn.addComponent(unresolvedTaskByAssigneeWidget); unresolvedTaskByPriorityWidget = new UnresolvedTaskByPriorityWidget(); rightColumn.addComponent(unresolvedTaskByPriorityWidget); }
From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java
License:Open Source License
public GanttChartTaskContainer() { taskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); constructGanttChart();//from ww w . j a va2 s . co m Panel controls = createControls(); this.setStyleName("gantt-view"); this.addComponent(controls); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setWidth("100%"); mainLayout.setStyleName("gantt-wrap"); mainLayout.addComponent(taskTable); mainLayout.addComponent(gantt); this.addComponent(mainLayout); }
From source file:com.esofthead.mycollab.module.project.view.task.TaskGroupReorderViewImpl.java
License:Open Source License
private void constructHeader() { CssLayout headerWrapper = new CssLayout(); headerWrapper.setWidth("100%"); headerWrapper.addStyleName("taskgroup-header"); HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true);/* w w w.java 2s.c o m*/ header.setWidth("100%"); Label headerLbl = new Label("All Tasks"); headerLbl.setStyleName("h2"); header.addComponent(headerLbl); header.setComponentAlignment(headerLbl, Alignment.MIDDLE_LEFT); header.setExpandRatio(headerLbl, 1.0f); Button backToListBtn = new Button("Back to dashboard", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.GotoTaskListScreen(this, null)); } }); backToListBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(backToListBtn); header.setComponentAlignment(backToListBtn, Alignment.MIDDLE_RIGHT); saveOrderBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new TaskListEvent.SaveReoderTaskList(event, changeSet)); } }); saveOrderBtn.setStyleName(UIConstants.THEME_GREEN_LINK); header.addComponent(saveOrderBtn); header.setComponentAlignment(saveOrderBtn, Alignment.MIDDLE_RIGHT); headerWrapper.addComponent(header); this.addComponent(headerWrapper); final DDVerticalLayout ddLayout = new DDVerticalLayout(); ddLayout.addStyleName("taskgroup-reorder"); ddLayout.setComponentVerticalDropRatio(0.3f); ddLayout.setDragMode(LayoutDragMode.CLONE); ddLayout.setDropHandler(new DropHandler() { private static final long serialVersionUID = 1L; @Override public AcceptCriterion getAcceptCriterion() { return new Not(VerticalLocationIs.MIDDLE); } @Override public void drop(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); DDVerticalLayout.VerticalLayoutTargetDetails details = (DDVerticalLayout.VerticalLayoutTargetDetails) event .getTargetDetails(); TaskListComponent comp = (TaskListComponent) transferable.getComponent(); int currentIndex = ddLayout.getComponentIndex(comp); int newIndex = details.getOverIndex(); ddLayout.removeComponent(comp); if (currentIndex > newIndex && details.getDropLocation() == VerticalDropLocation.BOTTOM) { newIndex++; } SimpleTaskList dropTaskList = comp.getTaskList(); dropTaskList.setGroupindex(newIndex); changeSet.add(dropTaskList); ddLayout.addComponent(comp, newIndex); // change affected task list items for (int i = 0; i < ddLayout.getComponentCount(); i++) { TaskListComponent affectedComp = (TaskListComponent) ddLayout.getComponent(i); SimpleTaskList affectedTaskList = affectedComp.getTaskList(); affectedTaskList.setGroupindex(i); changeSet.add(affectedTaskList); } } }); taskLists = new BeanList<ProjectTaskListService, TaskListSearchCriteria, SimpleTaskList>(null, ApplicationContextUtil.getSpringBean(ProjectTaskListService.class), TaskListRowDisplayHandler.class, ddLayout); this.addComponent(taskLists); }
From source file:com.esofthead.mycollab.module.project.view.task.UnresolvedTaskByAssigneeWidget.java
License:Open Source License
public void setSearchCriteria(final TaskSearchCriteria searchCriteria) { this.searchCriteria = searchCriteria; this.bodyContent.removeAllComponents(); ProjectTaskService projectTaskService = ApplicationContextUtil.getSpringBean(ProjectTaskService.class); int totalCountItems = projectTaskService.getTotalCount(searchCriteria); final List<GroupItem> groupItems = projectTaskService.getAssignedDefectsSummary(searchCriteria); if (!groupItems.isEmpty()) { for (final GroupItem item : groupItems) { final HorizontalLayout assigneeLayout = new HorizontalLayout(); assigneeLayout.setSpacing(true); assigneeLayout.setWidth("100%"); final String assignUser = item.getGroupid(); String assignUserFullName = item.getGroupid() == null ? "" : item.getGroupname(); if (assignUserFullName == null || assignUserFullName.trim().equals("")) { String displayName = item.getGroupid(); int index = displayName != null ? displayName.indexOf("@") : 0; if (index > 0) { assignUserFullName = displayName.substring(0, index); } else { assignUserFullName = AppContext.getMessage(TaskI18nEnum.OPT_UNDEFINED_USER); }/*from w w w . j a v a 2 s .c om*/ } final TaskAssigneeLink userLbl = new TaskAssigneeLink(assignUser, item.getExtraValue(), assignUserFullName); assigneeLayout.addComponent(userLbl); final ProgressBarIndicator indicator = new ProgressBarIndicator(totalCountItems, totalCountItems - item.getValue(), false); indicator.setWidth("100%"); assigneeLayout.addComponent(indicator); assigneeLayout.setExpandRatio(indicator, 1.0f); this.bodyContent.addComponent(assigneeLayout); } } }