List of usage examples for com.vaadin.ui Alignment MIDDLE_RIGHT
Alignment MIDDLE_RIGHT
To view the source code for com.vaadin.ui Alignment MIDDLE_RIGHT.
Click Source Link
From source file:com.esofthead.mycollab.module.crm.view.CrmToolbar.java
License:Open Source License
public CrmToolbar() { super();/*from w w w . ja v a 2 s. c o m*/ this.setStyleName("crm-toolbar"); this.setWidth("100%"); this.setMargin(new MarginInfo(false, true, false, true)); final NavigatorItemListener listener = new NavigatorItemListener(); final Button homeBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_DASHBOARD_HEADER), listener); homeBtn.setStyleName("link"); addComponent(homeBtn); final Button accountList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_ACCOUNTS_HEADER), listener); accountList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_ACCOUNT)); accountList.setStyleName("link"); addComponent(accountList); final Button contactList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CONTACTS_HEADER), listener); contactList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CONTACT)); contactList.setStyleName("link"); addComponent(contactList); final Button campaignList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CAMPAIGNS_HEADER), listener); campaignList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CAMPAIGN)); campaignList.setStyleName("link"); addComponent(campaignList); final Button leadList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_LEADS_HEADER), listener); leadList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_LEAD)); leadList.setStyleName("link"); addComponent(leadList); final Button opportunityList = new Button( AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_OPPORTUNTIES_HEADER), listener); opportunityList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_OPPORTUNITY)); opportunityList.setStyleName("link"); addComponent(opportunityList); final Button caseList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CASES_HEADER), listener); caseList.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_CASE)); caseList.setStyleName("link"); addComponent(caseList); final Button activitiesList = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_ACTIVITIES_HEADER), listener); final boolean isActivityEnable = AppContext.canRead(RolePermissionCollections.CRM_MEETING) || AppContext.canRead(RolePermissionCollections.CRM_TASK) || AppContext.canRead(RolePermissionCollections.CRM_CALL); activitiesList.setEnabled(isActivityEnable); activitiesList.setStyleName("link"); addComponent(activitiesList); addStyleName("h-sidebar-menu"); final Button fileBtn = new Button(AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_DOCUMENT_HEADER), listener); fileBtn.setEnabled(AppContext.canRead(RolePermissionCollections.CRM_DOCUMENT)); fileBtn.setStyleName("link"); addComponent(fileBtn); final Button notificationBtn = new Button( AppContext.getMessage(CrmCommonI18nEnum.TOOLBAR_CRMNOTIFICATION_HEADER), listener); notificationBtn.setStyleName("link"); addComponent(notificationBtn); addBtn = new PopupButton(AppContext.getMessage(CrmCommonI18nEnum.BUTTON_CREATE)); final GridLayout addBtnLayout = new GridLayout(3, 2); addBtnLayout.setMargin(true); addBtnLayout.setWidth("370px"); addBtnLayout.setSpacing(true); final ButtonLink newAccountBtn = new ButtonLink(AppContext.getMessage(AccountI18nEnum.BUTTON_NEW_ACCOUNT), listener, false); newAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)); newAccountBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.ACCOUNT)); addBtnLayout.addComponent(newAccountBtn); final ButtonLink newContactBtn = new ButtonLink(AppContext.getMessage(ContactI18nEnum.BUTTON_NEW_CONTACT), listener, false); newContactBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); newContactBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); addBtnLayout.addComponent(newContactBtn); final ButtonLink newCampaignBtn = new ButtonLink( AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN), listener, false); newCampaignBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)); newCampaignBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CAMPAIGN)); addBtnLayout.addComponent(newCampaignBtn); final ButtonLink newOpportunityBtn = new ButtonLink( AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), listener, false); newOpportunityBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)); newOpportunityBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY)); addBtnLayout.addComponent(newOpportunityBtn); final ButtonLink newLeadBtn = new ButtonLink(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD), listener, false); newLeadBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); newLeadBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.LEAD)); addBtnLayout.addComponent(newLeadBtn); final ButtonLink newCaseBtn = new ButtonLink(AppContext.getMessage(CaseI18nEnum.BUTTON_NEW_CASE), listener, false); newCaseBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CASE)); newCaseBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CASE)); addBtnLayout.addComponent(newCaseBtn); final ButtonLink newTaskBtn = new ButtonLink(AppContext.getMessage(TaskI18nEnum.BUTTON_NEW_TASK), listener, false); newTaskBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_TASK)); newTaskBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)); addBtnLayout.addComponent(newTaskBtn); final ButtonLink newCallBtn = new ButtonLink(AppContext.getMessage(CallI18nEnum.BUTTON_NEW_CALL), listener, false); newCallBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CALL)); newCallBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)); addBtnLayout.addComponent(newCallBtn); final ButtonLink newMeetingBtn = new ButtonLink(AppContext.getMessage(MeetingI18nEnum.BUTTON_NEW_MEETING), listener, false); newMeetingBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_MEETING)); newMeetingBtn.setIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)); addBtnLayout.addComponent(newMeetingBtn); addBtn.setContent(addBtnLayout); addBtn.setStyleName("link"); addBtn.addStyleName("quickadd-btn"); addComponent(addBtn); setExpandRatio(addBtn, 1.0f); setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadCampaignListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlBtnWrap = new VerticalLayout(); controlBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();/*from ww w .j av a 2s.c o m*/ controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CAMPAIGN)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(CampaignI18nEnum.BUTTON_NEW_CAMPAIGN)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1099580202385205069L; @Override public void splitButtonClick(SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); Button selectBtn = new Button("Select from existing campaigns", new Button.ClickListener() { private static final long serialVersionUID = 3046728004767791528L; @Override public void buttonClick(Button.ClickEvent event) { LeadCampaignSelectionWindow leadsWindow = new LeadCampaignSelectionWindow( LeadCampaignListComp.this); CampaignSearchCriteria criteria = new CampaignSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlsLayout = new VerticalLayout(); buttonControlsLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlsLayout); controlBtnWrap.addComponent(controlsBtn); controlBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadSearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(true, false, true, false)).withStyleName(UIConstants.HEADER_VIEW); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.LEAD, AppContext.getMessage(LeadI18nEnum.VIEW_LIST_TITLE)); searchtitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT).expand(searchtitle); final Button createAccountBtn = new Button(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD), new Button.ClickListener() { @Override//from w ww . j a v a 2 s.co m public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance().post(new LeadEvent.GotoAdd(this, null)); } }); createAccountBtn.setIcon(FontAwesome.PLUS); createAccountBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); layout.with(createAccountBtn).withAlign(createAccountBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityContactListComp.java
License:Open Source License
@Override protected Component generateTopControls() { HorizontalLayout controlsBtnWrap = new HorizontalLayout(); controlsBtnWrap.setWidth("100%"); HorizontalLayout notesWrap = new HorizontalLayout(); notesWrap.setWidth("100%"); notesWrap.setSpacing(true);/*from w w w . j a v a 2 s. c om*/ Label noteLbl = new Label("Note: "); noteLbl.setSizeUndefined(); noteLbl.setStyleName("list-note-lbl"); notesWrap.addComponent(noteLbl); CssLayout noteBlock = new CssLayout(); noteBlock.setWidth("100%"); noteBlock.setStyleName("list-note-block"); for (int i = 0; i < CrmDataTypeFactory.getOpportunityContactRoleList().length; i++) { Label note = new Label(CrmDataTypeFactory.getOpportunityContactRoleList()[i]); note.setStyleName("note-label"); note.addStyleName(colormap.get(CrmDataTypeFactory.getOpportunityContactRoleList()[i])); note.setSizeUndefined(); noteBlock.addComponent(note); } notesWrap.addComponent(noteBlock); notesWrap.setExpandRatio(noteBlock, 1.0f); controlsBtnWrap.addComponent(notesWrap); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined(); controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_CONTACT)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption("Add/Edit Contacts' Role"); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { EventBusFactory.getInstance().post(new OpportunityEvent.GotoContactRoleEdit(this, opportunity)); } }); final Button selectBtn = new Button("Select from existing contacts", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final OpportunityContactSelectionWindow contactsWindow = new OpportunityContactSelectionWindow( OpportunityContactListComp.this); final ContactSearchCriteria criteria = new ContactSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(contactsWindow); contactsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunityLeadListComp.java
License:Open Source License
@Override protected Component generateTopControls() { VerticalLayout controlsBtnWrap = new VerticalLayout(); controlsBtnWrap.setWidth("100%"); final SplitButton controlsBtn = new SplitButton(); controlsBtn.setSizeUndefined();//from w ww . j a v a2s . com controlsBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_LEAD)); controlsBtn.addStyleName(UIConstants.THEME_GREEN_LINK); controlsBtn.setCaption(AppContext.getMessage(LeadI18nEnum.BUTTON_NEW_LEAD)); controlsBtn.setIcon(FontAwesome.PLUS); controlsBtn.addClickListener(new SplitButton.SplitButtonClickListener() { private static final long serialVersionUID = 1L; @Override public void splitButtonClick(final SplitButton.SplitButtonClickEvent event) { fireNewRelatedItem(""); } }); final Button selectBtn = new Button("Select from existing leads", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { final OpportunityLeadSelectionWindow leadsWindow = new OpportunityLeadSelectionWindow( OpportunityLeadListComp.this); final LeadSearchCriteria criteria = new LeadSearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); UI.getCurrent().addWindow(leadsWindow); leadsWindow.setSearchCriteria(criteria); controlsBtn.setPopupVisible(false); } }); selectBtn.setIcon(MyCollabResource.newResource(WebResourceIds._16_select)); selectBtn.setStyleName("link"); VerticalLayout buttonControlLayout = new VerticalLayout(); buttonControlLayout.addComponent(selectBtn); controlsBtn.setContent(buttonControlLayout); controlsBtnWrap.addComponent(controlsBtn); controlsBtnWrap.setComponentAlignment(controlsBtn, Alignment.MIDDLE_RIGHT); return controlsBtnWrap; }
From source file:com.esofthead.mycollab.module.crm.view.opportunity.OpportunitySearchPanel.java
License:Open Source License
private HorizontalLayout createSearchTopPanel() { final MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%").withSpacing(true) .withMargin(new MarginInfo(true, false, true, false)).withStyleName(UIConstants.HEADER_VIEW); final Label searchtitle = new CrmViewHeader(CrmTypeConstants.OPPORTUNITY, AppContext.getMessage(OpportunityI18nEnum.VIEW_LIST_TITLE)); searchtitle.setStyleName(UIConstants.HEADER_TEXT); layout.with(searchtitle).expand(searchtitle).withAlign(searchtitle, Alignment.MIDDLE_LEFT); final Button createAccountBtn = new Button( AppContext.getMessage(OpportunityI18nEnum.BUTTON_NEW_OPPORTUNITY), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override/* w w w. j a v a2 s . c o m*/ public void buttonClick(final ClickEvent event) { EventBusFactory.getInstance() .post(new OpportunityEvent.GotoAdd(OpportunitySearchPanel.this, null)); } }); createAccountBtn.setIcon(FontAwesome.PLUS); createAccountBtn.setStyleName(UIConstants.THEME_GREEN_LINK); createAccountBtn.setEnabled(AppContext.canWrite(RolePermissionCollections.CRM_OPPORTUNITY)); layout.with(createAccountBtn).withAlign(createAccountBtn, Alignment.MIDDLE_RIGHT); return layout; }
From source file:com.esofthead.mycollab.module.project.ui.components.CommentRowDisplayHandler.java
License:Open Source License
@Override public Component generateRow(final SimpleComment comment, int rowIndex) { final MHorizontalLayout layout = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%").withStyleName("message"); ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName()); layout.addComponent(memberBlock);/* w w w. ja va 2 s . com*/ CssLayout rowLayout = new CssLayout(); rowLayout.setStyleName("message-container"); rowLayout.setWidth("100%"); MHorizontalLayout messageHeader = new MHorizontalLayout() .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%") .withStyleName("message-header"); messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())), ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime())); timePostLbl.setSizeUndefined(); timePostLbl.setStyleName("time-post"); messageHeader.with(timePostLbl).expand(timePostLbl); // Message delete button Button msgDeleteBtn = new Button(); msgDeleteBtn.setIcon(FontAwesome.TRASH_O); msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); messageHeader.addComponent(msgDeleteBtn); if (hasDeletePermission(comment)) { msgDeleteBtn.setVisible(true); msgDeleteBtn.addClickListener(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()) { CommentService commentService = ApplicationContextUtil .getSpringBean(CommentService.class); commentService.removeWithSession(comment.getId(), AppContext.getUsername(), AppContext.getAccountId()); CommentRowDisplayHandler.this.owner.removeRow(layout); } } }); } }); } else { msgDeleteBtn.setVisible(false); } rowLayout.addComponent(messageHeader); Label messageContent = new SafeHtmlLabel(comment.getComment()); messageContent.setStyleName("message-body"); rowLayout.addComponent(messageContent); List<Content> attachments = comment.getAttachments(); if (!CollectionUtils.isEmpty(attachments)) { MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withWidth("100%") .withStyleName("message-footer"); AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments); attachmentDisplay.setWidth("100%"); messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT); rowLayout.addComponent(messageFooter); } layout.with(rowLayout).expand(rowLayout); return layout; }
From source file:com.esofthead.mycollab.module.project.ui.components.ProjectActivityComponent.java
License:Open Source License
public ProjectActivityComponent(String type, Integer extraTypeId) { withMargin(false).withStyleName("activity-comp"); this.type = type; this.groupFormatter = AuditLogRegistry.getFieldGroupFormatter(type); headerLbl = new ELabel(AppContext.getMessage(GenericI18Enum.OPT_CHANGE_HISTORY, 0)); final OptionGroup sortDirection = new OptionGroup(); sortDirection.addStyleName("sortDirection"); String oldestFirstDirection = AppContext.getMessage(GenericI18Enum.OPT_OLDEST_FIRST); final String newestFirstDirection = AppContext.getMessage(GenericI18Enum.OPT_NEWEST_FIRST); sortDirection.addItems(newestFirstDirection, oldestFirstDirection); sortDirection.setValue(newestFirstDirection); sortDirection.addValueChangeListener(new Property.ValueChangeListener() { @Override/* w w w.j a v a 2 s . c om*/ public void valueChange(Property.ValueChangeEvent event) { Object value = sortDirection.getValue(); isAscending = newestFirstDirection.equals(value); displayActivities(); } }); MHorizontalLayout headerPanel = new MHorizontalLayout().withMargin(true) .withStyleName(UIConstants.FORM_SECTION).withFullWidth().with(headerLbl, sortDirection) .withAlign(headerLbl, Alignment.MIDDLE_LEFT).withAlign(sortDirection, Alignment.MIDDLE_RIGHT); commentBox = new ProjectCommentInput(this, type, extraTypeId); activityBox = new MVerticalLayout().withMargin(new MMarginInfo(true, true, true, false)); this.with(headerPanel, commentBox, activityBox); commentService = AppContextUtil.getSpringBean(CommentService.class); auditLogService = AppContextUtil.getSpringBean(AuditLogService.class); }
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 w w . j av a2 s . c om 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); }
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/*from w w w . ja v a 2 s .co 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; }