List of usage examples for com.vaadin.ui Label Label
public Label(String text)
From source file:com.emuanalytics.vaadin.enhancedjavascript.BasicTestUI.java
License:Apache License
private Component createComponentContainer(SampleEnhancedComponent component) { Label label = new Label("Component Under Test:"); VerticalLayout layout = new VerticalLayout(label, component); layout.setSpacing(true);// w w w . j a va 2 s . c om return layout; }
From source file:com.esofthead.mycollab.common.ui.components.notification.SmtpSetupNotification.java
License:Open Source License
@Override public Component renderContent() { MHorizontalLayout layout = new MHorizontalLayout(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Button smtpBtn = new Button("Setup", new Button.ClickListener() { @Override/*from w w w . j av a 2 s . c o m*/ public void buttonClick(Button.ClickEvent clickEvent) { UI.getCurrent().addWindow(new SmtpConfigurationWindow()); } }); smtpBtn.setStyleName("link"); layout.with(new Label("You did not set up a SMTP account yet."), smtpBtn); return layout; }
From source file:com.esofthead.mycollab.community.shell.view.components.AboutWindow.java
License:Open Source License
public AboutWindow() { MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth(); this.setContent(content); Image about = new Image("", new AssetResource(WebResourceIds._about)); MVerticalLayout rightPanel = new MVerticalLayout(); ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", MyCollabVersion.getVersion())); Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"), System.getProperty("java.runtime.version"))); Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath()); WebBrowser browser = Page.getCurrent().getWebBrowser(); Label osLbl = new Label( String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())); osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP); Div licenseDiv = new Div().appendChild(new Text("Powered by: ")) .appendChild(new A("https://www.mycollab.com").appendText("MyCollab")) .appendChild(new Text(". Open source under GPL license")); Label licenseLbl = new Label(licenseDiv.write(), ContentMode.HTML); Label copyRightLbl = new Label(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011", new GregorianCalendar().get(Calendar.YEAR) + ""), ContentMode.HTML); rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl) .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT); content.with(about, rightPanel).expand(rightPanel); }
From source file:com.esofthead.mycollab.community.ui.chart.PieChartWrapper.java
License:Open Source License
@Override protected final ComponentContainer createLegendBox() { final CustomLayout boxWrapper = CustomLayoutExt.createLayout("legendBox"); final CssLayout mainLayout = new CssLayout(); mainLayout.setSizeUndefined();/* w ww . ja v a 2s. com*/ final List keys = pieDataSet.getKeys(); for (int i = 0; i < keys.size(); i++) { final HorizontalLayout layout = new HorizontalLayout(); layout.setMargin(new MarginInfo(false, false, false, true)); layout.addStyleName("inline-block"); final Comparable key = (Comparable) keys.get(i); final String color = "<div style = \" width:8px;height:8px;border-radius:5px;background: #" + GenericChartWrapper.CHART_COLOR_STR[i % GenericChartWrapper.CHART_COLOR_STR.length] + "\" />"; final Label lblCircle = new Label(color); lblCircle.setContentMode(ContentMode.HTML); String btnCaption; if (enumKeyCls == null) { btnCaption = String.format("%s(%d)", key, pieDataSet.getValue(key).intValue()); } else { btnCaption = String.format("%s(%d)", AppContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue()); } final Button btnLink = new Button(btnCaption, new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { PieChartWrapper.this.onClickedDescription(key.toString()); } }); btnLink.addStyleName("link"); layout.addComponent(lblCircle); layout.setComponentAlignment(lblCircle, Alignment.MIDDLE_CENTER); layout.addComponent(btnLink); layout.setComponentAlignment(btnLink, Alignment.MIDDLE_CENTER); layout.setSizeUndefined(); mainLayout.addComponent(layout); } boxWrapper.setWidth("100%"); boxWrapper.addComponent(mainLayout, "legendBoxContent"); return boxWrapper; }
From source file:com.esofthead.mycollab.community.vaadin.web.ui.field.PopupFieldBuilder.java
License:Open Source License
public PopupView build() { view = new PopupView(new PopupView.Content() { @Override/*w ww.jav a 2 s . co m*/ public String getMinimizedValueAsHTML() { return captionHtml; } @Override public Component getPopupComponent() { MVerticalLayout layout = new MVerticalLayout(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); Label infoLbl = new Label( AppContext.getMessage(GenericI18Enum.NOTIFICATION_FEATURE_NOT_AVAILABLE_IN_VERSION)); Button requestFeatureBtn = new Button("Buy the premium edition", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { UI.getCurrent().addWindow(new AdWindow()); view.setPopupVisible(false); } }); requestFeatureBtn.addStyleName(UIConstants.BUTTON_ACTION); layout.with(infoLbl, requestFeatureBtn); return layout; } }); view.setDescription(description); view.setStyleName("block-popupedit"); return view; }
From source file:com.esofthead.mycollab.community.view.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 Embedded titleIcon = new Embedded(); titleIcon.setSource(MyCollabResource.newResource("icons/not_present.png")); layout.addComponent(titleIcon);/* ww w .j a va 2 s. co m*/ layout.setComponentAlignment(titleIcon, Alignment.MIDDLE_CENTER); Label label = new Label("Module is not presented for community 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.esofthead.mycollab.form.view.DynaFormLayout.java
License:Open Source License
@Override public Layout getLayout() { layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<DynaSection, GridFormLayoutHelper>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }//w w w . jav a 2 s. c o m Label header = new Label(section.getHeader()); header.setStyleName("h2"); layout.addComponent(header); GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } if (section.getLayoutType() == LayoutType.ONE_COLUMN) { gridLayout = new GridFormLayoutHelper(2, section.getFieldCount(), "100%", "167px", Alignment.TOP_LEFT); } else if (section.getLayoutType() == LayoutType.TWO_COLUMN) { gridLayout = new GridFormLayoutHelper(2, (section.getFieldCount() + 3) / 2, "100%", "167px", Alignment.TOP_LEFT); } else { throw new MyCollabException("Does not support attachForm layout except 1 or 2 columns"); } gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.mycollab.mobile.form.view.DynaFormLayout.java
License:Open Source License
@Override public ComponentContainer getLayout() { layout = new VerticalLayout(); int sectionCount = dynaForm.getSectionCount(); sectionMappings = new HashMap<DynaSection, GridFormLayoutHelper>(); for (int i = 0; i < sectionCount; i++) { DynaSection section = dynaForm.getSection(i); if (section.isDeletedSection()) { continue; }/*from ww w .j ava 2s . com*/ Label header = new Label(section.getHeader()); header.setStyleName("h2"); layout.addComponent(header); GridFormLayoutHelper gridLayout; if (section.isDeletedSection() || section.getFieldCount() == 0) { continue; } gridLayout = new GridFormLayoutHelper(1, section.getFieldCount(), "100%", "150px", Alignment.TOP_RIGHT); gridLayout.getLayout().setWidth("100%"); gridLayout.getLayout().setMargin(false); gridLayout.getLayout().setSpacing(false); gridLayout.getLayout().addStyleName("colored-gridlayout"); layout.addComponent(gridLayout.getLayout()); sectionMappings.put(section, gridLayout); } return layout; }
From source file:com.esofthead.mycollab.mobile.module.crm.ui.RelatedReadItemField.java
License:Open Source License
@Override protected Component initContent() { try {//from ww w .ja v a2 s.c om final String type = (String) PropertyUtils.getProperty(RelatedReadItemField.this.bean, "type"); if (type == null || type.equals("")) { return new Label(""); } final Integer typeid = (Integer) PropertyUtils.getProperty(bean, "typeid"); if (typeid == null) { return new Label(""); } Resource relatedLink = null; String relateItemName = null; if ("Account".equals(type)) { AccountService accountService = ApplicationContextUtil.getSpringBean(AccountService.class); final SimpleAccount account = accountService.findById(typeid, AppContext.getAccountId()); if (account != null) { relateItemName = account.getAccountname(); relatedLink = MyCollabResource.newResource("icons/16/crm/account.png"); } } else if ("Campaign".equals(type)) { CampaignService campaignService = ApplicationContextUtil.getSpringBean(CampaignService.class); final SimpleCampaign campaign = campaignService.findById(typeid, AppContext.getAccountId()); if (campaign != null) { relateItemName = campaign.getCampaignname(); relatedLink = MyCollabResource.newResource("icons/16/crm/campaign.png"); } } else if ("Contact".equals(type)) { ContactService contactService = ApplicationContextUtil.getSpringBean(ContactService.class); final SimpleContact contact = contactService.findById(typeid, AppContext.getAccountId()); if (contact != null) { relateItemName = contact.getContactName(); relatedLink = MyCollabResource.newResource("icons/16/crm/contact.png"); } } else if ("Lead".equals(type)) { LeadService leadService = ApplicationContextUtil.getSpringBean(LeadService.class); final SimpleLead lead = leadService.findById(typeid, AppContext.getAccountId()); if (lead != null) { relateItemName = lead.getLeadName(); relatedLink = MyCollabResource.newResource("icons/16/crm/lead.png"); } } else if ("Opportunity".equals(type)) { OpportunityService opportunityService = ApplicationContextUtil .getSpringBean(OpportunityService.class); final SimpleOpportunity opportunity = opportunityService.findById(typeid, AppContext.getAccountId()); if (opportunity != null) { relateItemName = opportunity.getOpportunityname(); relatedLink = MyCollabResource.newResource("icons/16/crm/opportunity.png"); } } else if ("Case".equals(type)) { CaseService caseService = ApplicationContextUtil.getSpringBean(CaseService.class); final SimpleCase cases = caseService.findById(typeid, AppContext.getAccountId()); if (cases != null) { relateItemName = cases.getSubject(); relatedLink = MyCollabResource.newResource("icons/16/crm/case.png"); } } Button related = new Button(relateItemName); if (relatedLink != null) related.setIcon(relatedLink); if (relatedLink != null) { return related; } else { return new Label(""); } } catch (Exception e) { return new Label(""); } }
From source file:com.esofthead.mycollab.mobile.module.crm.view.CrmLoginViewImpl.java
License:Open Source License
private void initUI() { this.setStyleName("login-view"); this.setSizeFull(); VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setStyleName("content-wrapper"); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); contentLayout.setMargin(true);// w w w . java 2 s . c o m contentLayout.setSpacing(true); contentLayout.setWidth("320px"); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); Label welcomeText = new Label("Login to CRM"); welcomeText.setWidth("150px"); welcomeTextWrapper.addComponent(welcomeText); contentLayout.addComponent(welcomeTextWrapper); final EmailField emailField = new EmailField(); emailField.setWidth("100%"); emailField.setInputPrompt("E-mail Address"); emailField.setStyleName("email-input"); contentLayout.addComponent(emailField); final PasswordField pwdField = new PasswordField(); pwdField.setWidth("100%"); pwdField.setInputPrompt("Password"); pwdField.setStyleName("password-input"); contentLayout.addComponent(pwdField); final CheckBox rememberPassword = new CheckBox(); rememberPassword.setWidth("100%"); rememberPassword.setCaption("Remember password"); rememberPassword.setValue(true); contentLayout.addComponent(rememberPassword); Button signInBtn = new Button("Sign In"); signInBtn.setWidth("100%"); signInBtn.addStyleName(UIConstants.BUTTON_BIG); signInBtn.addStyleName(UIConstants.COLOR_BLUE); signInBtn.addClickListener(new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { EventBusFactory.getInstance().post(new CrmEvent.PlainLogin(this, new String[] { emailField.getValue(), pwdField.getValue(), String.valueOf(rememberPassword.getValue()) })); } }); contentLayout.addComponent(signInBtn); Button createAccountBtn = new Button("Create Account"); createAccountBtn.setWidth("100%"); createAccountBtn.addStyleName(UIConstants.BUTTON_BIG); createAccountBtn.addStyleName(UIConstants.COLOR_GRAY); contentLayout.addComponent(createAccountBtn); this.addComponent(contentLayout); }