List of usage examples for com.vaadin.ui VerticalLayout removeAllComponents
@Override public void removeAllComponents()
From source file:at.meikel.nentis.Nentis.java
License:Apache License
private void initMain(TabSheet tabSheet) { final VerticalLayout mainTab = new VerticalLayout(); tabSheet.addTab(mainTab);//from ww w . ja v a 2s . co m tabSheet.getTab(mainTab).setCaption("Main"); final HorizontalLayout buttons = new HorizontalLayout(); mainTab.addComponent(buttons); final VerticalLayout state = new VerticalLayout(); mainTab.addComponent(state); final VerticalLayout info = new VerticalLayout(); mainTab.addComponent(info); Button createTicket = new Button("Create a new ticket"); createTicket.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { state.removeAllComponents(); Ticket ticket = nentisApi.createTicket("Ticket (" + new Date() + ")"); state.addComponent( new Label("Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created.")); } }); buttons.addComponent(createTicket); Button listAllTickets = new Button("List all existing tickets"); listAllTickets.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { state.removeAllComponents(); List<Ticket> allTickets = nentisApi.getAllTickets(); info.removeAllComponents(); if (allTickets != null) { for (Ticket ticket : allTickets) { info.addComponent(new Label( "Ticket #" + ticket.getId() + " [" + ticket.getDescription() + "] created.")); } } } }); buttons.addComponent(listAllTickets); final Button openSubWindow = new Button("Open a sub window"); openSubWindow.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent clickEvent) { buttons.removeComponent(openSubWindow); Window subWindow = new Window("Sub window"); mainWindow.addWindow(subWindow); } }); buttons.addComponent(openSubWindow); }
From source file:ch.bfh.ti.soed.hs16.srs.white.controller.ApplicationController.java
License:Open Source License
private void updateBody(Component newBody) { VerticalLayout body = uniqueApplicationController.getBody(); body.removeAllComponents(); body.addComponent(newBody);/* ww w . j a v a2 s .com*/ }
From source file:com.blogspot.markogronroos.MainUI.java
License:GNU General Public License
protected void jpaContTable(AbstractOrderedLayout main) { final VerticalLayout layout = new VerticalLayout(); main.addComponent(layout);/*w w w . j a v a 2 s .c o m*/ show(layout, "Please notice table rows are selectable, column order movable, column sort order adjustable"); // Create a persistent person container JPAContainer<Trip> trips = JPAContainerFactory.make(Trip.class, "source.jpa"); // You can add entities to the container as well trips.addEntity(new Trip("Riga", "Brussels", 5.0F)); trips.addEntity(new Trip("London", "Riga", 101.0F)); // Bind it to a component Table personTable = new Table("Past Trips", trips); personTable.setSizeUndefined(); personTable.setSelectable(true); personTable.setMultiSelect(false); personTable.setImmediate(true); personTable.setColumnReorderingAllowed(true); personTable.setColumnCollapsingAllowed(true); personTable.setVisibleColumns(new String[] { "id", "price", "startLocation", "finishLocation" }); layout.addComponent(personTable); Button button = new Button("Clear"); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { //layout.addComponent(new Label("Thank you for clicking")); layout.removeAllComponents(); } }); layout.addComponent(button); }
From source file:com.blogspot.markogronroos.MainUI.java
License:GNU General Public License
protected void jpaContTable2(AbstractOrderedLayout main) { final VerticalLayout layout = new VerticalLayout(); main.addComponent(layout);/* w w w . jav a 2 s. c om*/ show(layout, "This is same as above but EntityManager is created explicitly"); EntityManager em = JPAContainerFactory.createEntityManagerForPersistenceUnit("source.jpa"); /* Notice that if you use update the persistent data with an entity manager outside a JPAContainer bound to the data, you need to refresh the container as described in Section 19.4.2, Creating and Accessing Entities?. Refreshing JPAContainer In cases where you change JPAContainer items outside the container, for example by through an EntityManager, or when they change in the database, you need to refresh the container. The EntityContainer interface implemented by JPAContainer provides two methods to refresh a container. The refresh() discards all container caches and buffers and refreshes all loaded items in the container. All changes made to items provided by the container are discarded. The refreshItem() refreshes a single item. */ // Create a persistent person container JPAContainer<Trip> trips = JPAContainerFactory.make(Trip.class, em); // You can add entities to the container as well trips.addEntity(new Trip("Riga", "Brussels", 5.0F)); trips.addEntity(new Trip("London", "Riga", 101.0F)); // Bind it to a component Table personTable = new Table("Past Trips", trips); personTable.setSizeUndefined(); personTable.setSelectable(true); personTable.setMultiSelect(false); personTable.setImmediate(true); personTable.setColumnReorderingAllowed(true); personTable.setColumnCollapsingAllowed(true); personTable.setVisibleColumns(new String[] { "id", "price", "startLocation", "finishLocation" }); layout.addComponent(personTable); Button button = new Button("Clear"); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { //layout.addComponent(new Label("Thank you for clicking")); layout.removeAllComponents(); } }); layout.addComponent(button); }
From source file:com.esofthead.mycollab.module.crm.view.SalesDashboardView.java
License:Open Source License
public void displayReport() { final String reportName = this.reportDashboard[this.currentReportIndex]; final VerticalLayout bodyContent = (VerticalLayout) this.bodyContent; bodyContent.removeAllComponents(); bodyContent.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); if ("OpportunitySalesStage".equals(reportName)) { this.setTitle("Opportunity Sales Stage"); final IOpportunitySalesStageDashboard salesStageDashboard = ViewManager .getCacheComponent(IOpportunitySalesStageDashboard.class); bodyContent.addComponent(salesStageDashboard); final OpportunitySearchCriteria criteria = new OpportunitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); salesStageDashboard.setSearchCriteria(criteria); } else if ("OpportunityLeadSource".equals(reportName)) { this.setTitle("Opportunity Lead Source"); final IOpportunityLeadSourceDashboard leadSourceDashboard = ViewManager .getCacheComponent(IOpportunityLeadSourceDashboard.class); bodyContent.addComponent(leadSourceDashboard); final OpportunitySearchCriteria criteria = new OpportunitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(AppContext.getAccountId())); leadSourceDashboard.setSearchCriteria(criteria); }/*from w ww. ja v a 2 s .c o m*/ }
From source file:com.esofthead.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { CssLayout memberBlock = new CssLayout(); memberBlock.addStyleName("member-block"); VerticalLayout blockContent = new VerticalLayout(); MHorizontalLayout blockTop = new MHorizontalLayout(); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100);//from ww w . j a v a 2 s . c o m blockTop.addComponent(memberAvatar); VerticalLayout memberInfo = new VerticalLayout(); Button deleteBtn = new Button("", FontAwesome.TRASH_O); deleteBtn.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { 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()) { ProjectMemberService prjMemberService = ApplicationContextUtil .getSpringBean(ProjectMemberService.class); member.setStatus(ProjectMemberStatusConstants.INACTIVE); prjMemberService.updateWithSession(member, AppContext.getUsername()); EventBusFactory.getInstance().post( new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } } }); } }); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); blockContent.addComponent(deleteBtn); deleteBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); blockContent.setComponentAlignment(deleteBtn, Alignment.TOP_RIGHT); LabelLink memberLink = new LabelLink(member.getMemberFullName(), ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())); memberLink.setWidth("100%"); memberLink.addStyleName("member-name"); memberInfo.addComponent(memberLink); String roleLink = "<a href=\"" + AppContext.getSiteUrl() + GenericLinkUtils.URL_PREFIX_PARAM + ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectRoleId()) + "\""; Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); memberRole.setStyleName("member-role"); if (member.isAdmin()) { memberRole.setValue(roleLink + "style=\"color: #B00000;\">" + "Project Admin" + "</a>"); } else { memberRole.setValue(roleLink + "style=\"color:gray;font-size:12px;\">" + member.getRoleName() + "</a>"); } memberRole.setSizeUndefined(); memberInfo.addComponent(memberRole); Label memberEmailLabel = new Label( "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML); memberEmailLabel.addStyleName("member-email"); memberEmailLabel.setWidth("100%"); memberInfo.addComponent(memberEmailLabel); Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getJoindate())); memberSinceLabel.addStyleName("member-email"); memberSinceLabel.setWidth("100%"); memberInfo.addComponent(memberSinceLabel); if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getStatus())) { final VerticalLayout waitingNotLayout = new VerticalLayout(); Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.WAITING_ACCEPT_INVITATION)); infoStatus.addStyleName("member-email"); waitingNotLayout.addComponent(infoStatus); ButtonLink resendInvitationLink = new ButtonLink( AppContext.getMessage(ProjectMemberI18nEnum.BUTTON_RESEND_INVITATION), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { ProjectMemberMapper projectMemberMapper = ApplicationContextUtil .getSpringBean(ProjectMemberMapper.class); member.setStatus(RegisterStatusConstants.VERIFICATING); projectMemberMapper.updateByPrimaryKeySelective(member); waitingNotLayout.removeAllComponents(); Label statusEmail = new Label( AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION)); statusEmail.addStyleName("member-email"); waitingNotLayout.addComponent(statusEmail); } }); resendInvitationLink.setStyleName("link"); resendInvitationLink.addStyleName("member-email"); waitingNotLayout.addComponent(resendInvitationLink); memberInfo.addComponent(waitingNotLayout); } else if (RegisterStatusConstants.ACTIVE.equals(member.getStatus())) { Label lastAccessTimeLbl = new Label("Logged in " + DateTimeUtils.getPrettyDateValue(member.getLastAccessTime(), AppContext.getUserLocale())); lastAccessTimeLbl.addStyleName("member-email"); memberInfo.addComponent(lastAccessTimeLbl); } else if (RegisterStatusConstants.VERIFICATING.equals(member.getStatus())) { Label infoStatus = new Label(AppContext.getMessage(ProjectMemberI18nEnum.SENDING_EMAIL_INVITATION)); infoStatus.addStyleName("member-email"); memberInfo.addComponent(infoStatus); } String bugStatus = member.getNumOpenBugs() + " open bug"; if (member.getNumOpenBugs() > 1) { bugStatus += "s"; } String taskStatus = member.getNumOpenTasks() + " open task"; if (member.getNumOpenTasks() > 1) { taskStatus += "s"; } Label memberWorkStatus = new Label(bugStatus + " - " + taskStatus); memberInfo.addComponent(memberWorkStatus); memberInfo.setWidth("100%"); blockTop.addComponent(memberInfo); blockTop.setExpandRatio(memberInfo, 1.0f); blockTop.setWidth("100%"); blockContent.addComponent(blockTop); blockContent.setWidth("100%"); memberBlock.addComponent(blockContent); return memberBlock; }
From source file:com.esofthead.mycollab.module.user.accountsettings.team.view.UserListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleUser member) { CssLayout memberBlock = new CssLayout(); memberBlock.addStyleName("member-block"); VerticalLayout blockContent = new VerticalLayout(); HorizontalLayout blockTop = new HorizontalLayout(); blockTop.setSpacing(true);// w ww. ja va 2 s .co m Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getAvatarid(), 100); blockTop.addComponent(memberAvatar); VerticalLayout memberInfo = new VerticalLayout(); HorizontalLayout layoutButtonDelete = new HorizontalLayout(); layoutButtonDelete.setVisible(AppContext.canWrite(RolePermissionCollections.ACCOUNT_USER)); layoutButtonDelete.setWidth("100%"); Label emptylb = new Label(""); layoutButtonDelete.addComponent(emptylb); layoutButtonDelete.setExpandRatio(emptylb, 1.0f); Button deleteBtn = new Button(); deleteBtn.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()) { UserService userService = ApplicationContextUtil .getSpringBean(UserService.class); userService.pendingUserAccounts(Arrays.asList(member.getUsername()), AppContext.getAccountId()); EventBusFactory.getInstance() .post(new UserEvent.GotoList(UserListViewImpl.this, null)); } } }); } }); deleteBtn.setIcon(FontAwesome.TRASH_O); deleteBtn.addStyleName(UIConstants.BUTTON_ICON_ONLY); layoutButtonDelete.addComponent(deleteBtn); memberInfo.addComponent(layoutButtonDelete); ButtonLink userAccountLink = new ButtonLink(member.getDisplayName()); userAccountLink.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { EventBusFactory.getInstance() .post(new UserEvent.GotoRead(UserListViewImpl.this, member.getUsername())); } }); userAccountLink.setWidth("100%"); userAccountLink.setHeight("100%"); memberInfo.addComponent(userAccountLink); Label memberEmailLabel = new Label( "<a href='mailto:" + member.getUsername() + "'>" + member.getUsername() + "</a>", ContentMode.HTML); memberEmailLabel.addStyleName("member-email"); memberEmailLabel.setWidth("100%"); memberInfo.addComponent(memberEmailLabel); Label memberSinceLabel = new Label("Member since: " + AppContext.formatDate(member.getRegisteredtime())); memberSinceLabel.addStyleName("member-email"); memberSinceLabel.setWidth("100%"); memberInfo.addComponent(memberSinceLabel); if (RegisterStatusConstants.SENT_VERIFICATION_EMAIL.equals(member.getRegisterstatus())) { final VerticalLayout waitingNotLayout = new VerticalLayout(); Label infoStatus = new Label("Waiting for accept invitation"); infoStatus.addStyleName("member-email"); waitingNotLayout.addComponent(infoStatus); ButtonLink resendInvitationLink = new ButtonLink("Resend Invitation", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { UserService userService = ApplicationContextUtil.getSpringBean(UserService.class); userService.updateUserAccountStatus(member.getUsername(), member.getAccountId(), RegisterStatusConstants.VERIFICATING); waitingNotLayout.removeAllComponents(); Label statusEmail = new Label("Sending invitation email"); statusEmail.addStyleName("member-email"); waitingNotLayout.addComponent(statusEmail); } }); resendInvitationLink.setStyleName("link"); resendInvitationLink.addStyleName("member-email"); waitingNotLayout.addComponent(resendInvitationLink); memberInfo.addComponent(waitingNotLayout); } else if (RegisterStatusConstants.ACTIVE.equals(member.getRegisterstatus())) { Label lastAccessTimeLbl = new Label("Logged in " + DateTimeUtils.getPrettyDateValue(member.getLastaccessedtime(), AppContext.getUserLocale())); lastAccessTimeLbl.addStyleName("member-email"); memberInfo.addComponent(lastAccessTimeLbl); } else if (RegisterStatusConstants.VERIFICATING.equals(member.getRegisterstatus())) { Label infoStatus = new Label("Sending invitation email"); infoStatus.addStyleName("member-email"); memberInfo.addComponent(infoStatus); } blockTop.addComponent(memberInfo); blockTop.setExpandRatio(memberInfo, 1.0f); blockTop.setWidth("100%"); blockContent.addComponent(blockTop); if (member.getRoleid() != null) { String memberRoleLinkPrefix = "<a href=\"" + AccountLinkBuilder.generatePreviewFullRoleLink(member.getRoleid()) + "\""; Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); if (member.getIsAccountOwner() != null && member.getIsAccountOwner()) { memberRole.setValue(memberRoleLinkPrefix + "style=\"color: #B00000;\">" + "Account Owner" + "</a>"); } else { memberRole.setValue(memberRoleLinkPrefix + "style=\"color:gray;font-size:12px;\">" + member.getRoleName() + "</a>"); } memberRole.setSizeUndefined(); blockContent.addComponent(memberRole); blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT); } else if (member.getIsAccountOwner() != null && member.getIsAccountOwner() == Boolean.TRUE) { Label memberRole = new Label(); memberRole.setContentMode(ContentMode.HTML); memberRole.setValue("<a style=\"color: #B00000;\">" + "Account Owner" + "</a>"); memberRole.setSizeUndefined(); blockContent.addComponent(memberRole); blockContent.setComponentAlignment(memberRole, Alignment.MIDDLE_RIGHT); } else { Label lbl = new Label(); lbl.setHeight("10px"); blockContent.addComponent(lbl); } blockContent.setWidth("100%"); memberBlock.addComponent(blockContent); return memberBlock; }
From source file:com.foc.vaadin.gui.layouts.validationLayout.FVStatusLayout.java
License:Apache License
public void refreshStatusLabel() { VerticalLayout root = getRootVerticalLayout(); if (statusLabel != null && root != null) { removeAllComponents();/* w ww. j a v a 2s. co m*/ root.removeAllComponents(); setFocObject(getFocObject()); fillMenu(root); } }
From source file:com.freebox.engeneering.application.web.layout.FooterController.java
License:Apache License
/** * This method can be called when it is required to clean up the view * * @param stateEvent - state event/*from w w w . ja v a 2 s . co m*/ */ @Override public void clearView(StateEvent stateEvent) { VerticalLayout content = super.getView(); if (content != null) { content.removeAllComponents(); } }
From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java
License:Apache License
@OnExitState @Override//from w w w .ja v a 2s. co m public void clearView(@SuppressWarnings("rawtypes") StateEvent stateEvent) { VerticalLayout content = super.getView(); if (content != null) { content.removeAllComponents(); } }