List of usage examples for com.vaadin.ui Label setSizeUndefined
@Override public void setSizeUndefined()
From source file:com.esofthead.mycollab.module.project.view.page.PageListViewImpl.java
License:Open Source License
private void initHeader() { Label headerText = new ProjectViewHeader(ProjectTypeConstants.PAGE, AppContext.getMessage(Page18InEnum.VIEW_LIST_TITLE)); headerLayout.with(headerText).alignAll(Alignment.MIDDLE_LEFT).expand(headerText); Label sortLbl = new Label(AppContext.getMessage(Page18InEnum.OPT_SORT_LABEL)); sortLbl.setSizeUndefined(); headerLayout.with(sortLbl).withAlign(sortLbl, Alignment.MIDDLE_RIGHT); ToggleButtonGroup sortGroup = new ToggleButtonGroup(); headerLayout.with(sortGroup).withAlign(sortGroup, Alignment.MIDDLE_RIGHT); SortButton sortDateBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_DATE), new Button.ClickListener() { private static final long serialVersionUID = -6987503077975316907L; @Override/*from w w w . j av a2s.co m*/ public void buttonClick(Button.ClickEvent event) { dateSourceAscend = !dateSourceAscend; if (dateSourceAscend) { Collections.sort(resources, Ordering.from(dateSort)); } else { Collections.sort(resources, Ordering.from(dateSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortDateBtn); SortButton sortNameBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_NAME), new Button.ClickListener() { private static final long serialVersionUID = 2847554379518387585L; @Override public void buttonClick(Button.ClickEvent event) { nameSortAscend = !nameSortAscend; if (nameSortAscend) { Collections.sort(resources, Ordering.from(nameSort)); } else { Collections.sort(resources, Ordering.from(nameSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortNameBtn); SortButton sortKindBtn = new SortButton(AppContext.getMessage(Page18InEnum.OPT_SORT_BY_KIND), new Button.ClickListener() { private static final long serialVersionUID = 2230933690084074590L; @Override public void buttonClick(Button.ClickEvent event) { kindSortAscend = !kindSortAscend; if (kindSortAscend) { Collections.sort(resources, Ordering.from(kindSort)); } else { Collections.sort(resources, Ordering.from(kindSort).reverse()); } displayPages(resources); } }); sortGroup.addButton(sortKindBtn); sortGroup.setDefaultButton(sortDateBtn); final Button newGroupBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_GROUP), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { UI.getCurrent().addWindow(new PageGroupWindow()); } }); newGroupBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newGroupBtn.setIcon(FontAwesome.PLUS); newGroupBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerLayout.with(newGroupBtn).withAlign(newGroupBtn, Alignment.MIDDLE_RIGHT); final Button newPageBtn = new Button(AppContext.getMessage(Page18InEnum.BUTTON_NEW_PAGE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null)); } }); newPageBtn.setStyleName(UIConstants.THEME_GREEN_LINK); newPageBtn.setIcon(FontAwesome.PLUS); newPageBtn.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES)); headerText.setStyleName(UIConstants.HEADER_TEXT); headerLayout.with(newPageBtn).withAlign(newPageBtn, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.module.project.view.ProjectInformationComponent.java
License:Open Source License
public void displayProjectInformation() { this.project = CurrentProjectVariables.getProject(); this.projectInfoHeader.removeAllComponents(); final Button icon = new Button(null, ProjectAssetsManager.getAsset(ProjectTypeConstants.DASHBOARD)); icon.addStyleName(UIConstants.BUTTON_ICON_ONLY); icon.addStyleName("icon-18px"); final Label projectName = new Label(this.project.getName()); projectName.setStyleName(UIConstants.PROJECT_NAME); projectName.setSizeUndefined(); final Label projectShortname = new Label("(" + this.project.getShortname() + ")"); projectShortname.setStyleName(UIConstants.PROJECT_SHORT_NAME); this.projectInfoHeader.with(icon, projectName, projectShortname).expand(projectShortname); this.prjDisplay.show(); }
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 w ww . jav a 2s . 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.project.view.TagListViewImpl.java
License:Open Source License
@Override public void displayTags(Tag tag) { removeAllComponents();/*from w w w .j av a 2s .co m*/ MHorizontalLayout header = new MHorizontalLayout().withStyleName("hdr-view").withWidth("100%"); Label headerLbl = new Label(FontAwesome.TAGS.getHtml() + " Tags", ContentMode.HTML); headerLbl.setSizeUndefined(); headerLbl.setStyleName("hdr-text"); header.with(headerLbl); MHorizontalLayout contentWrapper = new MHorizontalLayout(); MVerticalLayout rightSideBar = new MVerticalLayout().withSpacing(false).withWidth("450px"); MHorizontalLayout panelHeader = new MHorizontalLayout().withMargin(new MarginInfo(false, true, false, true)) .withHeight("34px").withWidth("100%"); panelHeader.addStyleName("panel-header"); Label lbl = new Label("Tag Cloud"); panelHeader.with(lbl); TagCloudComp cloudComp = new TagCloudComp(); cloudComp.displayTagItems(); rightSideBar.with(panelHeader, cloudComp); contentWrapper.with(rightSideBar); with(header, contentWrapper); }
From source file:com.esofthead.mycollab.module.project.view.user.ProjectActivityStreamPagedList.java
License:Open Source License
protected void feedBlocksPut(Date currentDate, Date nextDate, CssLayout currentBlock) { MHorizontalLayout blockWrapper = new MHorizontalLayout().withWidth("100%").withStyleName("feed-block-wrap"); blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT); Calendar cal1 = Calendar.getInstance(); cal1.setTime(currentDate);//from w ww.ja va 2 s . c o m Calendar cal2 = Calendar.getInstance(); cal2.setTime(nextDate); if (cal1.get(Calendar.YEAR) != cal2.get(Calendar.YEAR)) { int currentYear = cal2.get(Calendar.YEAR); Label yearLbl = new Label(String.valueOf(currentYear)); yearLbl.setStyleName("year-lbl"); yearLbl.setWidthUndefined(); yearLbl.setHeight("49px"); this.listContainer.addComponent(yearLbl); } else { blockWrapper.setMargin(new MarginInfo(true, false, false, false)); } Label dateLbl = new Label(DateFormatUtils.format(nextDate, AppContext.getUserDayMonthFormat())); dateLbl.setSizeUndefined(); dateLbl.setStyleName("date-lbl"); blockWrapper.addComponent(dateLbl); blockWrapper.addComponent(currentBlock); blockWrapper.setExpandRatio(currentBlock, 1.0f); this.listContainer.addComponent(blockWrapper); }
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);/*from www. jav a 2 s. c om*/ 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.esofthead.mycollab.shell.view.MainView.java
License:Open Source License
private CustomLayout createFooter() { final CustomLayout footer = CustomLayoutExt.createLayout("footer"); Link companyLink = new Link("eSoftHead", new ExternalResource("http://www.esofthead.com")); companyLink.setTargetName("_blank"); footer.addComponent(companyLink, "company-url"); Calendar currentCal = Calendar.getInstance(); Label currentYear = new Label(String.valueOf(currentCal.get(Calendar.YEAR))); currentYear.setSizeUndefined(); footer.addComponent(currentYear, "current-year"); HorizontalLayout footerRight = new HorizontalLayout(); footerRight.setSpacing(true);/*from w w w.ja v a 2 s.c o m*/ final Button sendFeedback = new Button("Feedback"); sendFeedback.setStyleName("link"); sendFeedback.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { UI.getCurrent().addWindow(new FeedbackWindow()); } }); Link blogLink = new Link("Blog", new ExternalResource("https://www.mycollab.com/blog")); blogLink.setTargetName("_blank"); Link forumLink = new Link("Forum", new ExternalResource("http://forum.mycollab.com")); forumLink.setTargetName("_blank"); Link wikiLink = new Link("Knowledge Base", new ExternalResource("https://www.mycollab.com/help/")); wikiLink.setTargetName("_blank"); footerRight.addComponent(blogLink); footerRight.addComponent(forumLink); footerRight.addComponent(wikiLink); footerRight.addComponent(sendFeedback); footer.addComponent(footerRight, "footer-right"); return footer; }
From source file:com.esofthead.mycollab.vaadin.ui.NotPresentedView.java
License:Open Source License
public NotPresentedView() { this.setHeight("370px"); this.setWidth("100%"); VerticalLayout layoutWapper = new VerticalLayout(); layoutWapper.setWidth("100%"); VerticalLayout layout = new VerticalLayout(); final Label titleIcon = new Label(FontAwesome.EXCLAMATION_CIRCLE.getHtml(), ContentMode.HTML); titleIcon.setStyleName("warning-icon"); titleIcon.setSizeUndefined(); layout.addComponent(titleIcon);//from w w w .ja v a 2 s .co m layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER); Label label = new Label("The feature is not presented for this edition"); label.setStyleName("h2_community"); layout.addComponent(label); layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER); layoutWapper.addComponent(layout); layoutWapper.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); this.addComponent(layoutWapper); this.setComponentAlignment(layoutWapper, Alignment.MIDDLE_CENTER); }
From source file:com.etest.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);/* w ww. jav a 2 s .co m*/ content.setSpacing(true); content.setMargin(true); content.addComponent(new Label("You can test the loading indicator by pressing the buttons.")); CssLayout group = new CssLayout(); group.setCaption("Show the loading indicator for"); group.addStyleName("v-component-group"); content.addComponent(group); Button loading = new Button("0.8"); loading.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(800); } catch (InterruptedException e) { } } }); group.addComponent(loading); Button delay = new Button("3"); delay.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(3000); } catch (InterruptedException e) { } } }); group.addComponent(delay); Button wait = new Button("15"); wait.addClickListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { try { Thread.sleep(15000); } catch (InterruptedException e) { } } }); wait.addStyleName("last"); group.addComponent(wait); Label label = new Label(" seconds", ContentMode.HTML); label.setSizeUndefined(); group.addComponent(label); Label spinnerDesc = new Label( "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added."); spinnerDesc.addStyleName("small"); spinnerDesc.setCaption("Spinner"); content.addComponent(spinnerDesc); if (!MainUI.isTestMode()) { final Label spinner = new Label(); spinner.addStyleName("spinner"); Button showSpinnerButton = new Button("Show spinner", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { content.replaceComponent(event.getComponent(), spinner); } }); content.addComponent(showSpinnerButton); } return p; }
From source file:com.etest.valo.Tables.java
License:Apache License
static void configure(Table table, boolean footer, boolean sized, boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true);// www. j av a 2 s. co m table.setMultiSelect(true); table.setSortEnabled(true); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setPageLength(6); table.addActionHandler(MainUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); table.setColumnAlignment(MainUI.DESCRIPTION_PROPERTY, Align.RIGHT); table.setColumnAlignment(MainUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.removeGeneratedColumn("textfield"); table.removeContainerProperty("button"); table.removeGeneratedColumn("button"); table.removeContainerProperty("label"); table.removeGeneratedColumn("label"); table.removeContainerProperty("checkbox"); table.removeGeneratedColumn("checkbox"); table.removeContainerProperty("datefield"); table.removeGeneratedColumn("datefield"); table.removeContainerProperty("combobox"); table.removeGeneratedColumn("combobox"); table.removeContainerProperty("optiongroup"); table.removeGeneratedColumn("optiongroup"); table.removeContainerProperty("slider"); table.removeGeneratedColumn("slider"); table.removeContainerProperty("progress"); table.removeGeneratedColumn("progress"); if (componentsInRows) { table.addContainerProperty("textfield", TextField.class, null); table.addGeneratedColumn("textfield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here"); // tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("datefield", TextField.class, null); table.addGeneratedColumn("datefield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("combobox", TextField.class, null); table.addGeneratedColumn("combobox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("button", Button.class, null); table.addGeneratedColumn("button", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); b.addStyleName("small"); return b; } }); table.addContainerProperty("label", TextField.class, null); table.addGeneratedColumn("label", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); label.addStyleName("bold"); return label; } }); table.addContainerProperty("checkbox", TextField.class, null); table.addGeneratedColumn("checkbox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(null, true); return cb; } }); table.addContainerProperty("optiongroup", TextField.class, null); table.addGeneratedColumn("optiongroup", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); op.addStyleName("horizontal"); return op; } }); table.addContainerProperty("slider", TextField.class, null); table.addGeneratedColumn("slider", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Slider s = new Slider(); s.setValue(30.0); return s; } }); table.addContainerProperty("progress", TextField.class, null); table.addGeneratedColumn("progress", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ProgressBar bar = new ProgressBar(); bar.setValue(0.7f); return bar; } }); } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(MainUI.CAPTION_PROPERTY, "caption"); table.setColumnFooter(MainUI.DESCRIPTION_PROPERTY, "description"); table.setColumnFooter(MainUI.ICON_PROPERTY, "icon"); table.setColumnFooter(MainUI.INDEX_PROPERTY, "index"); } if (sized) { table.setWidth("400px"); table.setHeight("300px"); } else { table.setSizeUndefined(); } if (expandRatios) { if (!sized) { table.setWidth("100%"); } } table.setColumnExpandRatio(MainUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); table.setColumnExpandRatio(MainUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { table.addStyleName("no-stripes"); } else { table.removeStyleName("no-stripes"); } if (!verticalLines) { table.addStyleName("no-vertical-lines"); } else { table.removeStyleName("no-vertical-lines"); } if (!horizontalLines) { table.addStyleName("no-horizontal-lines"); } else { table.removeStyleName("no-horizontal-lines"); } if (borderless) { table.addStyleName("borderless"); } else { table.removeStyleName("borderless"); } if (!headers) { table.addStyleName("no-header"); } else { table.removeStyleName("no-header"); } if (compact) { table.addStyleName("compact"); } else { table.removeStyleName("compact"); } if (small) { table.addStyleName("small"); } else { table.removeStyleName("small"); } if (!rowIndex && !rowCaption && rowIcon) { table.setRowHeaderMode(RowHeaderMode.HIDDEN); } if (rowIndex) { table.setRowHeaderMode(RowHeaderMode.INDEX); } if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); table.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); table.setItemIconPropertyId(MainUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } }