List of usage examples for com.vaadin.ui Button.ClickEvent getData
public Object getData()
From source file:com.esofthead.mycollab.module.crm.view.activity.ActivityRelatedItemListComp.java
License:Open Source License
private void initUI() { if (allowCreateNew) { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true);/* w w w . j av a2 s . com*/ final Button newTaskBtn = new Button("New Task", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("task"); } }); newTaskBtn.setIcon(FontAwesome.PLUS); newTaskBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); newTaskBtn.setStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newTaskBtn); final Button newCallBtn = new Button("New Call", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("call"); } }); newCallBtn.setIcon(FontAwesome.PLUS); newCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); newCallBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newCallBtn); final Button newMeetingBtn = new Button("New Meeting", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { fireNewRelatedItem("call"); } }); newMeetingBtn.setIcon(FontAwesome.PLUS); newMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); newMeetingBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonLayout.addComponent(newMeetingBtn); this.addComponent(buttonLayout); this.addStyleName("activity-realated-content"); } tableItem = new ActivityTableDisplay(Arrays.asList( new TableViewField(ActivityI18nEnum.FORM_SUBJECT, "subject", UIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(ActivityI18nEnum.FORM_STATUS, "status", UIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(TaskI18nEnum.FORM_START_DATE, "startDate", UIConstants.TABLE_DATE_TIME_WIDTH), new TableViewField(TaskI18nEnum.TABLE_END_DATE_HEADER, "endDate", UIConstants.TABLE_DATE_TIME_WIDTH))); tableItem.addTableListener(new TableClickListener() { private static final long serialVersionUID = 1L; @Override public void itemClick(final TableClickEvent event) { final SimpleActivity simpleEvent = (SimpleActivity) event.getData(); if (CrmTypeConstants.TASK.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.TaskRead(this, simpleEvent.getId())); } else if (CrmTypeConstants.MEETING.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingRead(this, simpleEvent.getId())); } else if (CrmTypeConstants.CALL.equals(simpleEvent.getEventType())) { EventBusFactory.getInstance().post(new ActivityEvent.CallRead(this, simpleEvent.getId())); } } }); this.addComponent(tableItem); }