List of usage examples for com.vaadin.ui Label Label
public Label(String text, ContentMode contentMode)
From source file:com.esofthead.mycollab.shell.view.components.AdRequestWindow.java
License:Open Source License
public AdRequestWindow(final SimpleUser user) { super("Need help!"); this.setModal(true); this.setResizable(false); this.setWidth("600px"); MVerticalLayout content = new MVerticalLayout(); Label message = new Label("Hey <b>" + AppContext.getUser().getDisplayName() + "</b>, you've been " + "using MyCollab for a while now. And we hope you are happy with it. We spent countless hours and money developing this free " + "software for you. If you like it, please write a few words on twitter, blog or our " + "testimonial form. It will help other " + "people find this useful software quickly. <b> Thank you</b>", ContentMode.HTML); MVerticalLayout shareControls = new MVerticalLayout(); Label rateSourceforge = new Label( new Div().appendChild(new Text(FontAwesome.THUMBS_O_UP.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("http://sourceforge.net/projects/mycollab/reviews/new", "_blank") .appendText("Rate us on Sourceforge")) .setStyle("color:#006dac").write(), ContentMode.HTML);//w w w .j a va 2 s . c o m Label tweetUs = new Label(new Div().appendChild(new Text(FontAwesome.TWITTER.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("https://twitter.com/intent/tweet?text=Im using MyCollab to manage all project activities, accounts and it works great @mycollabdotcom&source=webclient", "_blank").appendText("Share on Twitter")) .setStyle("color:#006dac").write(), ContentMode.HTML); Label linkedIn = new Label(new Div().appendChild(new Text(FontAwesome.LINKEDIN_SQUARE.getHtml()), DivLessFormatter.EMPTY_SPACE(), new A("https://www.linkedin.com/cws/share?url=https%3A%2F%2Fwww.mycollab.com&original_referer=https%3A%2F%2Fwww.mycollab.com&token=&isFramed=false&lang=en_US", "_blank").appendText("Share on LinkedIn")) .setStyle("color:#006dac").write(), ContentMode.HTML); Button testimonialBtn = new Button("Write a testimonial", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { AdRequestWindow.this.close(); turnOffAdd(user); UI.getCurrent().addWindow(new TestimonialWindow()); } }); testimonialBtn.setStyleName(UIConstants.BUTTON_LINK); testimonialBtn.setIcon(FontAwesome.KEYBOARD_O); shareControls.with(rateSourceforge, tweetUs, linkedIn, testimonialBtn); MHorizontalLayout btnControls = new MHorizontalLayout(); Button ignoreBtn = new Button("No, thanks", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { close(); turnOffAdd(user); } }); ignoreBtn.addStyleName(UIConstants.BUTTON_OPTION); Button loveBtn = new Button("I did", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { AdRequestWindow.this.close(); NotificationUtil.showNotification("We appreciate your kindness action", "Thank you for your time"); turnOffAdd(user); } }); loveBtn.addStyleName(UIConstants.BUTTON_ACTION); loveBtn.setIcon(FontAwesome.HEART); btnControls.with(ignoreBtn, loveBtn); content.with(message, shareControls, btnControls).withAlign(btnControls, Alignment.MIDDLE_RIGHT); this.setContent(content); }
From source file:com.esofthead.mycollab.shell.view.components.UpgradeConfirmWindow.java
License:Open Source License
public UpgradeConfirmWindow(final String version, String manualDownloadLink, final String installerFilePath) { super("A new update is ready to install"); this.setModal(true); this.setResizable(false); this.center(); this.setWidth("600px"); this.installerFilePath = installerFilePath; currentUI = UI.getCurrent();/*from w w w . j a v a2s . c om*/ MVerticalLayout content = new MVerticalLayout(); this.setContent(content); String headerTemplate = "MyCollab just got better . For the " + "enhancements and security purpose, you should upgrade to the latest version"; Div titleDiv = new Div().appendText(String.format(headerTemplate, version)).setStyle("font-weight:bold"); content.with(new Label(titleDiv.write(), ContentMode.HTML)); Div manualInstallLink = new Div().appendText(" Manual install: ") .appendChild(new A(manualDownloadLink, "_blank").appendText("Download link")); content.with(new Label(manualInstallLink.write(), ContentMode.HTML)); Div manualUpgradeHowtoLink = new Div().appendText(" Manual upgrade: ").appendChild( new A("https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/upgrade-mycollab-automatically/", "_blank").appendText("Link")); content.with(new Label(manualUpgradeHowtoLink.write(), ContentMode.HTML)); Div releaseNoteLink = new Div().appendText(" Release Notes: ").appendChild( new A("https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/", "_blank") .appendText("Link")); content.with(new Label(releaseNoteLink.write(), ContentMode.HTML)); MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true); Button skipBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_SKIP), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UpgradeConfirmWindow.this.close(); } }); skipBtn.addStyleName(UIConstants.BUTTON_OPTION); Button autoUpgradeBtn = new Button("Auto Upgrade", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { close(); navigateToWaitingUpgradePage(); } }); if (installerFilePath == null) { autoUpgradeBtn.setEnabled(false); } autoUpgradeBtn.addStyleName(UIConstants.BUTTON_ACTION); buttonControls.with(skipBtn, autoUpgradeBtn); content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.shell.view.MainViewImpl.java
License:Open Source License
private MHorizontalLayout buildAccountMenuLayout() { accountLayout.removeAllComponents(); if (SiteConfiguration.isDemandEdition()) { // display trial box if user in trial mode SimpleBillingAccount billingAccount = AppContext.getBillingAccount(); if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) { if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) { Label informLbl = new Label( "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>>></div>", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); HorizontalLayout informBox = new HorizontalLayout(); informBox.addStyleName("trialInformBox"); informBox.setSizeFull(); informBox.addComponent(informLbl); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { private static final long serialVersionUID = 1L; @Override//from w ww . j a va2 s .c o m public void layoutClick(LayoutClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); } }); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); } else { Label informLbl = new Label("", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); HorizontalLayout informBox = new HorizontalLayout(); informBox.addStyleName("trialInformBox"); informBox.setSizeFull(); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addComponent(informLbl); informBox.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { private static final long serialVersionUID = 1L; @Override public void layoutClick(LayoutClickEvent event) { EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); } }); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime()); int daysLeft = dur.toStandardDays().getDays(); if (daysLeft > 30) { informLbl.setValue( "<div class='informBlock'>Trial<br></div><div class='informBlock'>>></div>"); // AppContext.getInstance().setIsValidAccount(false); } else { informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days " + "left</div><div class='informBlock'>>></div>", 30 - daysLeft)); } } } } Label accountNameLabel = new Label(AppContext.getSubDomain()); accountNameLabel.addStyleName("subdomain"); accountLayout.addComponent(accountNameLabel); if (SiteConfiguration.isCommunityEdition()) { Button buyPremiumBtn = new Button("Upgrade to Pro edition", new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new AdWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { LicenseInfo licenseInfo = licenseResolver.getLicenseInfo(); if (licenseInfo != null) { if (licenseInfo.isExpired()) { Button buyPremiumBtn = new Button(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION), new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } else if (licenseInfo.isTrial()) { Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate())); int days = dur.toStandardDays().getDays(); Button buyPremiumBtn = new Button( AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow()); } }); buyPremiumBtn.setIcon(FontAwesome.SHOPPING_CART); buyPremiumBtn.addStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } } } NotificationComponent notificationComponent = new NotificationComponent(); accountLayout.addComponent(notificationComponent); if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification())); } if (!SiteConfiguration.isDemandEdition()) { ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class); if (!mailService.isMailSetupValid()) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification())); } SimpleUser user = AppContext.getUser(); GregorianCalendar tenDaysAgo = new GregorianCalendar(); tenDaysAgo.add(Calendar.DATE, -10); if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) { UI.getCurrent().addWindow(new AdRequestWindow(user)); } } Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24); final PopupButton accountMenu = new PopupButton(""); accountMenu.setIcon(userAvatarRes); accountMenu.setDescription(AppContext.getUserDisplayName()); OptionPopupContent accountPopupContent = new OptionPopupContent(); Button myProfileBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); } }); myProfileBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE)); accountPopupContent.addOption(myProfileBtn); Button userMgtBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" })); } }); userMgtBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS)); accountPopupContent.addOption(userMgtBtn); Button generalSettingBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post( new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" })); } }); generalSettingBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING)); accountPopupContent.addOption(generalSettingBtn); Button themeCustomizeBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" })); } }); themeCustomizeBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE)); accountPopupContent.addOption(themeCustomizeBtn); if (!SiteConfiguration.isDemandEdition()) { Button setupBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); } }); setupBtn.setIcon(FontAwesome.WRENCH); accountPopupContent.addOption(setupBtn); } accountPopupContent.addSeparator(); Button helpBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_HELP)); helpBtn.setIcon(FontAwesome.MORTAR_BOARD); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); accountPopupContent.addOption(helpBtn); Button supportBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT)); supportBtn.setIcon(FontAwesome.LIFE_SAVER); ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/"); BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes); supportOpener.extend(supportBtn); accountPopupContent.addOption(supportBtn); Button translateBtn = new Button(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE)); translateBtn.setIcon(FontAwesome.PENCIL); ExternalResource translateRes = new ExternalResource( "https://community.mycollab.com/docs/developing-mycollab/translating/"); BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes); translateOpener.extend(translateBtn); accountPopupContent.addOption(translateBtn); if (!SiteConfiguration.isCommunityEdition()) { Button myAccountBtn = new Button(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); } }); myAccountBtn.setIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING)); accountPopupContent.addOption(myAccountBtn); } accountPopupContent.addSeparator(); Button aboutBtn = new Button("About MyCollab", new ClickListener() { @Override public void buttonClick(ClickEvent clickEvent) { accountMenu.setPopupVisible(false); Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class); UI.getCurrent().addWindow(aboutWindow); } }); aboutBtn.setIcon(FontAwesome.INFO_CIRCLE); accountPopupContent.addOption(aboutBtn); Button releaseNotesBtn = new Button("Release Notes"); ExternalResource releaseNotesRes = new ExternalResource( "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/"); BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes); releaseNotesOpener.extend(releaseNotesBtn); releaseNotesBtn.setIcon(FontAwesome.BULLHORN); accountPopupContent.addOption(releaseNotesBtn); Button signoutBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)); } }); signoutBtn.setIcon(FontAwesome.SIGN_OUT); accountPopupContent.addSeparator(); accountPopupContent.addOption(signoutBtn); accountMenu.setContent(accountPopupContent); accountLayout.addComponent(accountMenu); return accountLayout; }
From source file:com.esofthead.mycollab.shell.view.UpgradeConfirmWindow.java
License:Open Source License
public UpgradeConfirmWindow(Properties props) { super("There is the new MyCollab update"); this.props = props; this.setModal(true); this.setResizable(false); this.center(); this.setWidth("600px"); MVerticalLayout content = new MVerticalLayout(); this.setContent(content); Div titleDiv = new Div().appendText(String.format(headerTemplate, props.getProperty("version"))) .setStyle("font-weight:bold"); content.with(new Label(titleDiv.write(), ContentMode.HTML)); Div manualInstallLink = new Div().appendText(" Manual install: ") .appendChild(new A(props.getProperty("downloadLink"), "_blank").appendText("Download link")); content.with(new Label(manualInstallLink.write(), ContentMode.HTML)); Div releaseNoteLink = new Div().appendText(" Release Notes: ") .appendChild(new A(props.getProperty("releaseNotes"), "_blank").appendText("Link")); content.with(new Label(releaseNoteLink.write(), ContentMode.HTML)); MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(true); Button skipBtn = new Button("Skip", new Button.ClickListener() { @Override/* ww w. ja v a2 s .c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { UpgradeConfirmWindow.this.close(); } }); skipBtn.addStyleName(UIConstants.THEME_GRAY_LINK); Button autoUpgradeBtn = new Button("Auto Upgrade", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().setPollInterval(1000); new Thread(new AutoUpgradeProcess()).start(); UpgradeConfirmWindow.this.close(); } }); autoUpgradeBtn.addStyleName(UIConstants.THEME_GREEN_LINK); buttonControls.with(skipBtn, autoUpgradeBtn); content.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT); }
From source file:com.esofthead.mycollab.vaadin.mvp.view.NotPresentedView.java
License:Open Source License
public NotPresentedView() { this.withSpacing(true).withFullWidth(); this.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); final Label titleIcon = new Label(FontAwesome.EXCLAMATION_CIRCLE.getHtml(), ContentMode.HTML); titleIcon.setStyleName("warning-icon"); titleIcon.addStyleName(ValoTheme.LABEL_NO_MARGIN); titleIcon.setWidthUndefined();/*from w w w. j a v a 2 s. c o m*/ this.with(titleIcon); Label label = ELabel.h2(AppContext.getMessage(GenericI18Enum.NOTIFICATION_FEATURE_NOT_AVAILABLE_IN_VERSION)) .withWidthUndefined(); this.with(label).withAlign(label, Alignment.MIDDLE_CENTER); RestTemplate restTemplate = new RestTemplate(); try { String result = restTemplate.getForObject("https://api.mycollab.com/api/storeweb", String.class); Label webPage = new Label(result, ContentMode.HTML); webPage.setHeight("480px"); this.with(new MVerticalLayout(webPage).withMargin(false).withAlign(webPage, Alignment.TOP_CENTER)); } catch (Exception e) { Div informDiv = new Div() .appendText("Can not load the store page. You can check the online edition at ") .appendChild(new A("https://www.mycollab.com/pricing/download/", "_blank").appendText("here")); ELabel webPage = new ELabel(informDiv.write(), ContentMode.HTML).withWidthUndefined(); this.with(new MVerticalLayout(webPage).withAlign(webPage, Alignment.TOP_CENTER)); } }
From source file:com.esofthead.mycollab.vaadin.ui.AddViewLayout.java
License:Open Source License
public AddViewLayout(String viewTitle, Resource viewIcon) { super("addView"); this.viewIcon = viewIcon; this.header = new MHorizontalLayout().withWidth("100%"); this.header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.titleLbl = new Label("", ContentMode.HTML); this.titleLbl.setStyleName("headerName"); if (!(viewIcon instanceof FontAwesome)) { Image icon = new Image(null); icon.setIcon(viewIcon);//from ww w.j av a2 s.c o m icon.addStyleName(UIConstants.BUTTON_ICON_ONLY); this.header.with(icon); } this.header.with(titleLbl).expand(titleLbl); setHeader(viewTitle); this.addComponent(this.header, "addViewHeader"); }
From source file:com.esofthead.mycollab.vaadin.ui.AddViewLayout2.java
License:Open Source License
public AddViewLayout2(final String title, final Resource icon) { setStyleName("addview-layout"); this.viewIcon = icon; this.header = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withWidth("100%") .withStyleName(UIConstants.HEADER_VIEW); this.header.setDefaultComponentAlignment(Alignment.TOP_LEFT); if (!(icon instanceof FontAwesome)) { Image iconEmbed = new Image(); iconEmbed.setSource(icon);/* w w w. ja v a 2 s . c o m*/ this.header.with(iconEmbed); } this.titleLbl = new Label("", ContentMode.HTML); this.titleLbl.setStyleName(UIConstants.HEADER_TEXT); this.header.with(this.titleLbl).expand(titleLbl); if (title == null) { if (icon != null) { this.setTitle("Undefined"); } } else { this.setTitle(title); } this.addComponent(header); body = new MVerticalLayout().withSpacing(false).withMargin(false).withStyleName("addview-layout-body"); this.addComponent(body); }
From source file:com.esofthead.mycollab.vaadin.ui.AttachmentPanel.java
License:Open Source License
private void displayFileName(final String fileName) { final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout(); Button removeBtn = new Button(null, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override// w w w . j a v a 2 s . c o m public void buttonClick(ClickEvent event) { File file = fileStores.get(fileName); if (file != null) { file.delete(); } fileStores.remove(fileName); AttachmentPanel.this.removeComponent(fileAttachmentLayout); if (multiFileUpload != null) { multiFileUpload.removeAndReInitMultiUpload(); } } }); removeBtn.setIcon(FontAwesome.TRASH_O); removeBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY); Label fileIcon = new Label(getFileIconResource(fileName).getHtml(), ContentMode.HTML); Label fileLbl = new Label(fileName); fileAttachmentLayout.with(fileIcon, fileLbl, removeBtn).withAlign(fileLbl, Alignment.MIDDLE_CENTER); this.addComponent(fileAttachmentLayout); }
From source file:com.esofthead.mycollab.vaadin.ui.BuildCriterionComponent.java
License:Open Source License
public BuildCriterionComponent(Param[] paramFields, Class<S> type, String searchCategory) { this.setSpacing(true); this.paramFields = paramFields; this.type = type; this.searchCategory = searchCategory; MHorizontalLayout headerBox = new MHorizontalLayout().withSpacing(true) .withMargin(new MarginInfo(true, false, true, true)); headerBox.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); this.addComponent(headerBox); Label filterLbl = new Label(" Saved Filter: ", ContentMode.HTML); headerBox.with(filterLbl).withAlign(filterLbl, Alignment.MIDDLE_LEFT); filterBox = new MHorizontalLayout().withSpacing(true); headerBox.with(filterBox).withAlign(filterBox, Alignment.MIDDLE_LEFT); buildFilterBox(null);//from w ww . j a v a 2s . c om this.searchContainer = new MVerticalLayout().withSpacing(true).withMargin(false); this.searchContainer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); controlsBtn = new MHorizontalLayout().withSpacing(true).withMargin(true); Button addCriteriaBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD_CRITERIA), new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { CriteriaSelectionLayout newCriteriaBar = new CriteriaSelectionLayout( searchContainer.getComponentCount() + 1); searchContainer.addComponent(newCriteriaBar); } }); addCriteriaBtn.setStyleName(UIConstants.THEME_BROWN_LINK); addCriteriaBtn.setIcon(FontAwesome.PLUS); controlsBtn.with(addCriteriaBtn); this.with(searchContainer, controlsBtn); }
From source file:com.esofthead.mycollab.vaadin.ui.form.field.LinkViewField.java
License:Open Source License
@Override protected Component initContent() { if (StringUtils.isNotBlank(value)) { final LabelLink l = new LabelLink(value, href); if (iconResourceLink != null) { l.setIconLink(iconResourceLink); }//from www . ja va 2 s . co m l.setWidth("100%"); return l; } else { final Label l = new Label(" ", ContentMode.HTML); l.setWidth("100%"); return l; } }