List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
public Layout initContent() { CssLayout contentLayout = new CssLayout(); contentLayout.setWidth("100%"); contentLayout.setStyleName("lead-convert-window"); contentLayout.addComponent(createBody()); ComponentContainer buttonControls = createButtonControls(); if (buttonControls != null) { final HorizontalLayout controlPanel = new HorizontalLayout(); buttonControls.setSizeUndefined(); controlPanel.addComponent(buttonControls); controlPanel.setWidth("100%"); controlPanel.setMargin(true);//w w w .ja v a2 s .com controlPanel.setComponentAlignment(buttonControls, Alignment.MIDDLE_CENTER); contentLayout.addComponent(controlPanel); } return contentLayout; }
From source file:com.esofthead.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
private ComponentContainer createBody() { final CssLayout layout = new CssLayout(); layout.setSizeFull();/* w w w . j a va 2 s . com*/ Label shortDescription = new Label( "<p> By clicking the \"Convert\" button, the following tasks will be done:</p>", ContentMode.HTML); layout.addComponent(shortDescription); VerticalLayout infoLayout = new VerticalLayout(); infoLayout.setMargin(new MarginInfo(false, true, true, true)); infoLayout.setSpacing(true); String createAccountTxt = "Create Account: <span class='" + UIConstants.TEXT_BLUE + "'>" + lead.getAccountname() + "</span>"; Label createAccountLbl = new Label(createAccountTxt, ContentMode.HTML); createAccountLbl.addStyleName(UIConstants.LABEL_CHECKED); infoLayout.addComponent(createAccountLbl); String createContactTxt = "Create Contact: <span class='" + UIConstants.TEXT_BLUE + "'>" + lead.getLastname() + (lead.getFirstname() != null ? " " + lead.getFirstname() : "") + "</span>"; Label createContactLbl = new Label(createContactTxt, ContentMode.HTML); createContactLbl.addStyleName(UIConstants.LABEL_CHECKED); infoLayout.addComponent(createContactLbl); final CheckBox isCreateOpportunityChk = new CheckBox("Create a new opportunity for this account"); isCreateOpportunityChk.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { Boolean isSelected = isCreateOpportunityChk.getValue(); if (isSelected) { opportunityForm = new LeadOpportunityForm(); Opportunity opportunity = new Opportunity(); // this is a trick to pass validation opportunity.setAccountid(0); opportunityForm.setBean(opportunity); layout.addComponent(opportunityForm); } else { layout.removeComponent(opportunityForm); } } }); infoLayout.addComponent(isCreateOpportunityChk); layout.addComponent(infoLayout); 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 ww . j av 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.setting.CrmSettingContainer.java
License:Open Source License
public CrmSettingContainer() { this.setWidth("100%"); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setWidth("100%"); this.addComponent(contentWrapper); settingTab = new CrmVerticalTabsheet(false); settingTab.setSizeFull();//from w ww . j a v a 2 s .c om settingTab.setNavigatorWidth("250px"); settingTab.setNavigatorStyleName("sidebar-menu"); settingTab.setContainerStyleName("tab-content"); settingTab.setHeight(null); buildComponents(); contentWrapper.addComponent(settingTab); }
From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp.java
License:Open Source License
private void initContent() { previewForm = initPreviewForm();//from w ww . ja va 2s . c o m ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { actionControls.addStyleName("control-buttons"); addHeaderRightContent(actionControls); } CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); if (previewLayout == null) previewLayout = new DefaultReadViewLayout(""); contentWrapper.addComponent(previewLayout); RightSidebarLayout bodyContainer = new RightSidebarLayout(); bodyContainer.setSizeFull(); bodyContainer.addStyleName("readview-body-wrap"); bodyContent = new MVerticalLayout().withSpacing(false).withMargin(false).with(previewForm); bodyContainer.setContent(bodyContent); sidebarContent = new MVerticalLayout().withWidth("250px").withSpacing(true) .withStyleName("readview-sidebar"); bodyContainer.setSidebar(sidebarContent); FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent); floatSidebar.setContainerId("main-body"); previewLayout.addBody(bodyContainer); this.addComponent(contentWrapper); }
From source file:com.esofthead.mycollab.module.project.ui.components.AbstractPreviewItemComp2.java
License:Open Source License
public AbstractPreviewItemComp2(String headerText, Resource iconResource) { if (iconResource != null) this.titleIcon = new Image(null, iconResource); this.addComponent(constructHeader(headerText)); previewForm = initPreviewForm();//from w ww .j av a 2 s . c om ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { actionControls.addStyleName("control-buttons"); addHeaderRightContent(actionControls); } CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); previewLayout = new ReadViewLayout(""); contentWrapper.addComponent(previewLayout); bodyContainer = new HorizontalLayout(); bodyContainer.setSizeFull(); bodyContainer.setStyleName("readview-body-wrap"); bodyContent = new VerticalLayout(); bodyContent.addComponent(previewForm); bodyContainer.addComponent(bodyContent); bodyContainer.setExpandRatio(bodyContent, 1); sidebarContent = new VerticalLayout(); sidebarContent.setWidth("250px"); sidebarContent.setSpacing(true); sidebarContent.setStyleName("readview-sidebar"); bodyContainer.addComponent(sidebarContent); FloatingComponent floatSidebar = FloatingComponent.floatThis(sidebarContent); floatSidebar.setContainerId("main-body"); previewLayout.addBody(bodyContainer); this.addComponent(contentWrapper); }
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);// www . jav a 2 s . c o m 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.ProjectSubscribersComp.java
License:Open Source License
@Override protected Component initContent() { ProjectMemberService projectMemberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); List<SimpleUser> members = projectMemberService.getActiveUsersInProject(projectId, AppContext.getAccountId());// w w w.ja v a 2 s .c o m CssLayout container = new CssLayout(); container.setStyleName("followers-container"); final CheckBox selectAllCheckbox = new CheckBox("All", defaultSelectAll); selectAllCheckbox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { boolean val = selectAllCheckbox.getValue(); for (FollowerCheckbox followerCheckbox : memberSelections) { followerCheckbox.setValue(val); } } }); container.addComponent(selectAllCheckbox); for (SimpleUser user : members) { final FollowerCheckbox memberCheckbox = new FollowerCheckbox(user); memberCheckbox.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (!memberCheckbox.getValue()) { selectAllCheckbox.setValue(false); } } }); if (defaultSelectAll || selectedUsers.contains(user.getUsername())) { memberCheckbox.setValue(true); } memberSelections.add(memberCheckbox); container.addComponent(memberCheckbox); } return container; }
From source file:com.esofthead.mycollab.module.project.view.AbstractProjectPageView.java
License:Open Source License
public AbstractProjectPageView(String headerText, FontAwesome icon) { super();/* w ww. j av a 2s . c o m*/ this.headerText = new Label(icon.getHtml() + " " + headerText, ContentMode.HTML); super.addComponent(constructHeader()); contentWrapper = new CssLayout(); contentWrapper.setStyleName("content-wrapper"); super.addComponent(contentWrapper); }
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 www .j ava2s. 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); }