List of usage examples for com.vaadin.ui CheckBox CheckBox
public CheckBox(String caption)
From source file:com.mycollab.module.crm.view.lead.LeadConvertInfoWindow.java
License:Open Source License
private ComponentContainer createBody() { final CssLayout layout = new CssLayout(); layout.setSizeFull();//from ww w .j a v a 2 s . c om Label shortDescription = ELabel.html( "<p> By clicking the \"Convert\" button, the following tasks will be done:</p>"); layout.addComponent(shortDescription); MVerticalLayout infoLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true)); String createAccountTxt = FontAwesome.CHECK.getHtml() + " Create Account: " + lead.getAccountname(); Label createAccountLbl = new Label(createAccountTxt, ContentMode.HTML); infoLayout.addComponent(createAccountLbl); String createContactTxt = FontAwesome.CHECK.getHtml() + " Create Contact: " + lead.getLastname() + (lead.getFirstname() != null ? " " + lead.getFirstname() : ""); Label createContactLbl = new Label(createContactTxt, ContentMode.HTML); infoLayout.addComponent(createContactLbl); final CheckBox isCreateOpportunityChk = new CheckBox("Create a new opportunity for this account"); isCreateOpportunityChk.addValueChangeListener(valueChangeEvent -> { 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.mycollab.module.project.view.milestone.AllMilestoneTimelineWidget.java
License:Open Source License
public void display() { this.withMargin(new MarginInfo(false, false, true, false)).withStyleName("tm-container").withFullWidth(); MHorizontalLayout headerLayout = new MHorizontalLayout() .withMargin(new MarginInfo(false, true, false, true)).withStyleName(WebThemes.PANEL_HEADER); headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE)); final CheckBox includeNoDateSet = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); includeNoDateSet.setValue(false);/*from w ww .j a va 2 s . c o m*/ final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); includeNoDateSet.addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(includeNoDateSet.getValue(), includeClosedMilestone.getValue())); headerLayout.with(titleLbl, includeNoDateSet, includeClosedMilestone).expand(titleLbl) .withAlign(includeNoDateSet, Alignment.MIDDLE_RIGHT) .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class); searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys())); searchCriteria.setOrderFields( Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); this.addComponent(headerLayout); timelineContainer = new CssLayout(); timelineContainer.setWidth("100%"); this.addComponent(timelineContainer); timelineContainer.addStyleName("tm-wrapper"); displayTimelines(false, false); }
From source file:com.mycollab.module.project.view.milestone.MilestoneTimelineWidget.java
License:Open Source License
public void display() { this.setWidth("100%"); this.addStyleName("tm-container"); this.setSpacing(true); this.setMargin(new MarginInfo(false, false, true, false)); MHorizontalLayout headerLayout = new MHorizontalLayout().withStyleName(WebThemes.PANEL_HEADER); headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); ELabel titleLbl = ELabel.h3(UserUIContext.getMessage(MilestoneI18nEnum.OPT_TIMELINE)); final CheckBox noDateSetMilestone = new CheckBox(UserUIContext.getMessage(DayI18nEnum.OPT_NO_DATE_SET)); noDateSetMilestone.setValue(false);/* ww w. j a va2 s .c o m*/ final CheckBox includeClosedMilestone = new CheckBox(UserUIContext.getMessage(MilestoneStatus.Closed)); includeClosedMilestone.setValue(false); noDateSetMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); includeClosedMilestone .addValueChangeListener(valueChangeEvent -> displayTimelines(noDateSetMilestone.getValue(), includeClosedMilestone.getValue())); headerLayout.with(titleLbl, noDateSetMilestone, includeClosedMilestone).expand(titleLbl) .withAlign(noDateSetMilestone, Alignment.MIDDLE_RIGHT) .withAlign(includeClosedMilestone, Alignment.MIDDLE_RIGHT); MilestoneSearchCriteria searchCriteria = new MilestoneSearchCriteria(); searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId())); searchCriteria.setOrderFields( Collections.singletonList(new SearchCriteria.OrderField(Milestone.Field.enddate.name(), "ASC"))); MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class); milestones = milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria)); this.addComponent(headerLayout); timelineContainer = new CssLayout(); timelineContainer.setWidth("100%"); this.addComponent(timelineContainer); timelineContainer.addStyleName("tm-wrapper"); displayTimelines(false, false); }
From source file:com.mycollab.module.project.view.ticket.TicketOverdueWidget.java
License:Open Source License
public TicketOverdueWidget() { super(UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS) + " (0)", new CssLayout()); final CheckBox myItemsOnly = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsOnly.addValueChangeListener(valueChangeEvent -> { if (searchCriteria != null) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); }//from w ww . j a v a 2 s . co m ticketOverdueComponent.setSearchCriteria(searchCriteria); } }); this.addHeaderElement(myItemsOnly); ticketOverdueComponent = new TicketOverduePagedList(); bodyContent.addComponent(ticketOverdueComponent); }
From source file:com.mycollab.module.project.view.user.ProjectOverdueTicketsWidget.java
License:Open Source License
public ProjectOverdueTicketsWidget() { super(String.format("%s (0)", UserUIContext.getMessage(TicketI18nEnum.VAL_OVERDUE_TICKETS)), new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else {/*from w ww. j ava 2 s. com*/ searchCriteria.setAssignUser(null); } updateSearchResult(); }); ticketList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_OVERDUE_TICKET); } }; this.addHeaderElement(myItemsSelection); bodyContent.addComponent(ticketList); }
From source file:com.mycollab.module.project.view.user.ProjectUnresolvedTicketsWidget.java
License:Open Source License
public ProjectUnresolvedTicketsWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else {//from w w w . j a va2s . c o m searchCriteria.setAssignUser(null); } updateSearchResult(); }); taskList = new DefaultBeanPagedList(AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; addHeaderElement(myItemsSelection); bodyContent.addComponent(taskList); }
From source file:com.mycollab.module.project.view.user.TaskStatusComponent.java
License:Open Source License
public TaskStatusComponent() { super(AppContext.getMessage(ProjectCommonI18nEnum.WIDGET_OVERDUE_ASSIGNMENTS_TITLE, 0), new CssLayout()); final CheckBox myItemsOnly = new CheckBox(AppContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsOnly.addValueChangeListener(new Property.ValueChangeListener() { @Override//from www. j a v a2 s. c om public void valueChange(Property.ValueChangeEvent valueChangeEvent) { if (searchCriteria != null) { boolean selectMyItemsOnly = myItemsOnly.getValue(); if (selectMyItemsOnly) { searchCriteria.setAssignUser(StringSearchField.and(AppContext.getUsername())); } else { searchCriteria.setAssignUser(null); } taskComponents.setSearchCriteria(searchCriteria); } } }); this.addHeaderElement(myItemsOnly); taskComponents = new TaskStatusPagedList(); bodyContent.addComponent(taskComponents); }
From source file:com.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java
License:Open Source License
public UserUnresolvedAssignmentWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (searchCriteria != null) { if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); }//from ww w .j a va 2 s . co m updateSearchResult(); } }); taskList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket>( AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; this.addHeaderElement(myItemsSelection); this.bodyContent.addComponent(taskList); }
From source file:com.mycollab.module.project.view.user.UserUnresolvedTicketWidget.java
License:Open Source License
public UserUnresolvedTicketWidget() { super("", new CssLayout()); this.setWidth("100%"); final CheckBox myItemsSelection = new CheckBox(UserUIContext.getMessage(GenericI18Enum.OPT_MY_ITEMS)); myItemsSelection.addValueChangeListener(valueChangeEvent -> { boolean isMyItemsOption = myItemsSelection.getValue(); if (searchCriteria != null) { if (isMyItemsOption) { searchCriteria.setAssignUser(StringSearchField.and(UserUIContext.getUsername())); } else { searchCriteria.setAssignUser(null); }/* w w w. ja v a2 s. c om*/ updateSearchResult(); } }); ticketList = new DefaultBeanPagedList<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket>( AppContextUtil.getSpringBean(ProjectTicketService.class), new TicketRowDisplayHandler(), 10) { @Override protected String stringWhenEmptyList() { return UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET); } }; this.addHeaderElement(myItemsSelection); this.bodyContent.addComponent(ticketList); }
From source file:com.mycompany.project.components.ContactDetails.java
public void loadAllGroups() { groupsHLayout.removeAllComponents(); BusinessLogic bl = ((MyVaadinUI) getUI()).getBusinessLogic(); ArrayList<Group> allGroups = bl.getAllGroups(); for (int i = 0; i < allGroups.size(); i++) { Group group = allGroups.get(i); CheckBox cb = new CheckBox(group.getName()); cb.setImmediate(true);/* w w w . j a v a 2 s . c om*/ groupsMap.put(group.getId(), cb); groupsHLayout.addComponent(cb); } }