List of usage examples for com.vaadin.ui Button Button
public Button(Resource icon, ClickListener listener)
From source file:com.esofthead.mycollab.module.file.view.components.AbstractResourceMovingWindow.java
License:Open Source License
private void constructBody() { MVerticalLayout contentLayout = new MVerticalLayout().withSpacing(true).withMargin(true); this.setContent(contentLayout); final HorizontalLayout resourceContainer = new HorizontalLayout(); resourceContainer.setSizeFull();//from w w w . j a v a 2 s .co m this.folderTree = new TreeTable(); this.folderTree.setMultiSelect(false); this.folderTree.setSelectable(true); this.folderTree.setImmediate(true); this.folderTree.addContainerProperty("Name", String.class, ""); this.folderTree.addContainerProperty("Date Modified", String.class, ""); this.folderTree.setColumnWidth("Date Modified", UIConstants.TABLE_DATE_TIME_WIDTH); this.folderTree.setColumnExpandRatio("Name", 1.0f); this.folderTree.setWidth("100%"); resourceContainer.addComponent(this.folderTree); this.folderTree.addExpandListener(new Tree.ExpandListener() { private static final long serialVersionUID = 1L; @Override public void nodeExpand(final ExpandEvent event) { final Folder expandFolder = (Folder) event.getItemId(); // load externalResource if currentExpandFolder is // rootFolder if (rootPath.equals(expandFolder.getPath())) { List<ExternalDrive> externalDrives = externalDriveService .getExternalDrivesOfUser(AppContext.getUsername()); for (ExternalDrive externalDrive : externalDrives) { ExternalFolder externalMapFolder = new ExternalFolder("/"); externalMapFolder.setStorageName(externalDrive.getStoragename()); externalMapFolder.setExternalDrive(externalDrive); externalMapFolder.setName(externalDrive.getFoldername()); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(externalDrive.getCreatedtime()); externalMapFolder.setCreated(cal); expandFolder.addChild(externalMapFolder); AbstractResourceMovingWindow.this.folderTree .addItem( new Object[] { externalMapFolder.getName(), AppContext .formatDateTime(externalMapFolder.getCreated().getTime()) }, externalMapFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(externalMapFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(externalMapFolder, externalMapFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(externalMapFolder, expandFolder); } } if (expandFolder instanceof ExternalFolder) { List<ExternalFolder> subFolders = externalResourceService.getSubFolders( ((ExternalFolder) expandFolder).getExternalDrive(), expandFolder.getPath()); for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); Date dateTime = ((ExternalFolder) subFolder).getExternalDrive().getCreatedtime(); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(dateTime) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } else { final List<Folder> subFolders = AbstractResourceMovingWindow.this.resourceService .getSubFolders(expandFolder.getPath()); AbstractResourceMovingWindow.this.folderTree.setItemIcon(expandFolder, MyCollabResource.newResource("icons/16/ecm/folder_open.png")); if (subFolders != null) { for (final Folder subFolder : subFolders) { expandFolder.addChild(subFolder); AbstractResourceMovingWindow.this.folderTree.addItem( new Object[] { subFolder.getName(), AppContext.formatDateTime(subFolder.getCreated().getTime()) }, subFolder); AbstractResourceMovingWindow.this.folderTree.setItemIcon(subFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); AbstractResourceMovingWindow.this.folderTree.setItemCaption(subFolder, subFolder.getName()); AbstractResourceMovingWindow.this.folderTree.setParent(subFolder, expandFolder); } } } } }); this.folderTree.addCollapseListener(new Tree.CollapseListener() { private static final long serialVersionUID = 1L; @Override public void nodeCollapse(final CollapseEvent event) { final Folder collapseFolder = (Folder) event.getItemId(); if (collapseFolder instanceof ExternalFolder) { if (collapseFolder.getPath().equals("/")) AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox.png")); else AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/dropbox_subfolder.png")); } else { AbstractResourceMovingWindow.this.folderTree.setItemIcon(collapseFolder, MyCollabResource.newResource("icons/16/ecm/folder_close.png")); } for (Folder folder : collapseFolder.getChilds()) { recursiveRemoveSubItem(folder); } } private void recursiveRemoveSubItem(Folder collapseFolder) { List<Folder> childs = collapseFolder.getChilds(); if (childs.size() > 0) { for (final Folder subFolder : childs) { recursiveRemoveSubItem(subFolder); } AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } else { AbstractResourceMovingWindow.this.folderTree.removeItem(collapseFolder); } } }); this.folderTree.addItemClickListener(new ItemClickEvent.ItemClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final ItemClickEvent event) { AbstractResourceMovingWindow.this.baseFolder = (Folder) event.getItemId(); } }); contentLayout.addComponent(resourceContainer); displayFiles(); HorizontalLayout controlGroupBtnLayout = new HorizontalLayout(); controlGroupBtnLayout.setSpacing(true); Button moveBtn = new Button("Move", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (resourceEditting != null) { try { resourceMover.moveResource(resourceEditting, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, false); } finally { AbstractResourceMovingWindow.this.close(); } } else if (!CollectionUtils.isEmpty(lstResEditting)) { boolean checkingFail = false; for (Resource res : lstResEditting) { try { resourceMover.moveResource(res, baseFolder, AppContext.getUsername(), AppContext.getAccountId()); } catch (Exception e) { checkingFail = true; } } AbstractResourceMovingWindow.this.close(); displayAfterMoveSuccess(AbstractResourceMovingWindow.this.baseFolder, checkingFail); } } }); moveBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlGroupBtnLayout.addComponent(moveBtn); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { AbstractResourceMovingWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.THEME_GRAY_LINK); controlGroupBtnLayout.addComponent(cancelBtn); contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_CENTER); }
From source file:com.esofthead.mycollab.module.file.view.components.FileBreadcrumb.java
License:Open Source License
void initBreadcrumb() { // home Btn ---------------- this.addLink(new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override//from w w w. j a va 2 s. c om public void buttonClick(ClickEvent event) { FileSearchCriteria criteria = new FileSearchCriteria(); criteria.setBaseFolder(rootFolderPath); criteria.setRootFolder(rootFolderPath); notifySearchHandler(criteria); } })); this.setHeight(25, Unit.PIXELS); this.select(0); Button documentBtnLink = generateBreadcrumbLink("My Documents", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { FileSearchCriteria criteria = new FileSearchCriteria(); criteria.setBaseFolder(rootFolderPath); criteria.setRootFolder(rootFolderPath); notifySearchHandler(criteria); } }); documentBtnLink.addStyleName("link"); this.addLink(documentBtnLink); this.setLinkEnabled(true, 1); }
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectFollowersComp.java
License:Open Source License
public void displayFollowers(final V bean) { this.bean = bean; this.removeAllComponents(); this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true)); MHorizontalLayout header = new MHorizontalLayout().withSpacing(true); Label followerHeader = new Label( FontAwesome.EYE.getHtml() + " " + AppContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML);/* w w w.j a v a 2s.c o m*/ followerHeader.setStyleName("info-hdr"); header.addComponent(followerHeader); if (hasEditPermission()) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { showEditWatchersWindow(bean); } }); editBtn.setStyleName("link"); editBtn.addStyleName("info-hdr"); header.addComponent(editBtn); } this.addComponent(header); Label sep = new Label("/"); sep.setStyleName("info-hdr"); header.addComponent(sep); currentUserFollow = isUserWatching(bean); final Button toogleWatching = new Button(""); toogleWatching.setStyleName("link"); toogleWatching.addStyleName("info-hdr"); toogleWatching.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (currentUserFollow) { unfollowItem(AppContext.getUsername(), bean); currentUserFollow = false; toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW)); } else { followItem(AppContext.getUsername(), bean); toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW)); currentUserFollow = true; } updateTotalFollowers(bean); } }); header.addComponent(toogleWatching); if (currentUserFollow) { toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_UNFOLLOW)); } else { toogleWatching.setCaption(AppContext.getMessage(FollowerI18nEnum.BUTTON_FOLLOW)); } MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(false, false, false, true)); this.addComponent(layout); int totalFollowers = getTotalFollowers(bean); followersBtn = new Button(AppContext.getMessage(FollowerI18nEnum.OPT_NUM_FOLLOWERS, totalFollowers), new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { if (hasReadPermission()) { showEditWatchersWindow(bean); } } }); followersBtn.setStyleName("link"); layout.addComponent(followersBtn); }
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectListNoItemView.java
License:Open Source License
public ProjectListNoItemView() { MVerticalLayout layout = new MVerticalLayout(); layout.addStyleName("case-noitem"); layout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Label image = new Label(viewIcon().getHtml(), ContentMode.HTML); image.setSizeUndefined();//from ww w .j ava 2 s .c om layout.with(image).withAlign(image, Alignment.TOP_CENTER); Label title = new Label(viewTitle()); title.addStyleName("h2"); title.setSizeUndefined(); layout.with(title).withAlign(title, Alignment.TOP_CENTER); Label body = new Label(viewHint()); body.setWidthUndefined(); layout.addComponent(body); Button createBugBtn = new Button(actionMessage(), actionListener()); createBugBtn.setEnabled(hasPermission()); MHorizontalLayout links = new MHorizontalLayout(); links.addComponent(createBugBtn); createBugBtn.addStyleName(UIConstants.THEME_GREEN_LINK); layout.addComponent(links); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.TOP_CENTER); }
From source file:com.esofthead.mycollab.module.project.ui.components.TagViewComponent.java
License:Open Source License
private Button createAddTagBtn() { final Button addTagBtn = new Button("Add tag", FontAwesome.PLUS_CIRCLE); addTagBtn.addClickListener(new Button.ClickListener() { @Override//from www. ja va 2 s .co m public void buttonClick(Button.ClickEvent clickEvent) { TagViewComponent.this.removeComponent(addTagBtn); TagViewComponent.this.addComponent(createSaveTagComp()); } }); addTagBtn.setStyleName("link"); return addTagBtn; }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogComp.java
License:Open Source License
public void displayTime(final V bean) { this.removeAllComponents(); this.withSpacing(true).withMargin(new MarginInfo(false, false, false, true)); HorizontalLayout header = new MHorizontalLayout().withSpacing(true).withMargin(false); Label dateInfoHeader = new Label( FontAwesome.CLOCK_O.getHtml() + " " + AppContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME), ContentMode.HTML);/*from w ww.ja v a2 s. c o m*/ dateInfoHeader.setStyleName("info-hdr"); header.addComponent(dateInfoHeader); if (hasEditPermission()) { Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { showEditTimeWindow(bean); } }); editBtn.setStyleName("link"); editBtn.addStyleName("info-hdr"); header.addComponent(editBtn); } this.addComponent(header); MVerticalLayout layout = new MVerticalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(false, false, false, true)); double billableHours = getTotalBillableHours(bean); double nonBillableHours = getTotalNonBillableHours(bean); double remainHours = getRemainedHours(bean); layout.addComponent(new Label( String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS), billableHours))); layout.addComponent(new Label(String .format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS), nonBillableHours))); layout.addComponent(new Label( String.format(AppContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS), remainHours))); this.addComponent(layout); }
From source file:com.esofthead.mycollab.module.project.ui.components.TimeLogEditWindow.java
License:Open Source License
private void initUI() { this.setWidth("900px"); headerPanel = new MHorizontalLayout().withWidth("100%"); content.addComponent(headerPanel);// w w w .j a v a 2 s.co m constructSpentTimeEntryPanel(); constructRemainTimeEntryPanel(); this.tableItem = new DefaultPagedBeanTable<>( ApplicationContextUtil.getSpringBean(ItemTimeLoggingService.class), SimpleItemTimeLogging.class, Arrays.asList(TimeTableFieldDef.logUser, TimeTableFieldDef.logForDate, TimeTableFieldDef.logValue, TimeTableFieldDef.billable, new TableViewField(null, "id", UIConstants.TABLE_CONTROL_WIDTH))); this.tableItem.addGeneratedColumn("logUserFullName", new Table.ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging timeLoggingItem = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); return new ProjectUserLink(timeLoggingItem.getLoguser(), timeLoggingItem.getLogUserAvatarId(), timeLoggingItem.getLogUserFullName()); } }); this.tableItem.addGeneratedColumn("logforday", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging monitorItem = TimeLogEditWindow.this.tableItem.getBeanByIndex(itemId); final Label l = new Label(); l.setValue(AppContext.formatDate(monitorItem.getLogforday())); return l; } }); this.tableItem.addGeneratedColumn("logvalue", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Label l = new Label(); l.setValue(itemTimeLogging.getLogvalue() + ""); return l; } }); this.tableItem.addGeneratedColumn("isbillable", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public Object generateCell(Table source, Object itemId, Object columnId) { final SimpleItemTimeLogging monitorItem = tableItem.getBeanByIndex(itemId); FontIconLabel icon; if (monitorItem.getIsbillable()) { icon = new FontIconLabel(FontAwesome.CHECK); } else { icon = new FontIconLabel(FontAwesome.TIMES); } icon.setStyleName(UIConstants.BUTTON_ICON_ONLY); return icon; } }); this.tableItem.addGeneratedColumn("id", new ColumnGenerator() { private static final long serialVersionUID = 1L; @Override public com.vaadin.ui.Component generateCell(final Table source, final Object itemId, final Object columnId) { final SimpleItemTimeLogging itemTimeLogging = TimeLogEditWindow.this.tableItem .getBeanByIndex(itemId); final Button deleteBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { TimeLogEditWindow.this.itemTimeLoggingService.removeWithSession(itemTimeLogging.getId(), AppContext.getUsername(), AppContext.getAccountId()); TimeLogEditWindow.this.loadTimeValue(); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); itemTimeLogging.setExtraData(deleteBtn); deleteBtn.setEnabled(CurrentProjectVariables.isAdmin() || AppContext.getUsername().equals(itemTimeLogging.getLoguser())); return deleteBtn; } }); this.tableItem.setWidth("100%"); content.addComponent(tableItem); }
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 ww w . jav a 2 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);//from w w w. java 2s .co 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.PredecessorWindow.java
License:Open Source License
PredecessorWindow(final GanttTreeTable taskTreeTable, final GanttItemWrapper ganttItemWrapper) { super("Edit predecessors"); this.setModal(true); this.setResizable(false); this.setWidth("650px"); this.center(); this.taskTreeTable = taskTreeTable; this.ganttItemWrapper = ganttItemWrapper; MVerticalLayout content = new MVerticalLayout(); this.setContent(content); Label headerLbl = new Label( String.format("Row %d: %s", ganttItemWrapper.getGanttIndex(), ganttItemWrapper.getName())); headerLbl.addStyleName(ValoTheme.LABEL_H2); content.add(headerLbl);/*from w ww . j a v a 2 s . c o m*/ CssLayout preWrapper = new CssLayout(); content.with(preWrapper); MHorizontalLayout headerLayout = new MHorizontalLayout(); headerLayout.addComponent(new ELabel("Row").withWidth(ROW_WDITH)); headerLayout.addComponent(new ELabel("Task").withWidth(TASK_WIDTH)); headerLayout.addComponent(new ELabel("Dependency").withWidth(PRE_TYPE_WIDTH)); headerLayout.addComponent(new ELabel("Lag").withWidth(LAG_WIDTH)); predecessorsLayout = new PredecessorsLayout(); new Restrain(predecessorsLayout).setMaxHeight("600px"); preWrapper.addComponent(headerLayout); preWrapper.addComponent(predecessorsLayout); MHorizontalLayout buttonControls = new MHorizontalLayout(); content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); Button cancelBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CANCEL), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { PredecessorWindow.this.close(); } }); cancelBtn.addStyleName(UIConstants.BUTTON_OPTION); Button saveBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SAVE), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { List<TaskPredecessor> predecessors = predecessorsLayout.buildPredecessors(); EventBusFactory.getInstance() .post(new GanttEvent.ModifyPredecessors(ganttItemWrapper, predecessors)); PredecessorWindow.this.close(); } }); saveBtn.addStyleName(UIConstants.BUTTON_ACTION); buttonControls.with(cancelBtn, saveBtn); }