List of usage examples for com.vaadin.ui Label setCaption
@Override public void setCaption(String caption)
From source file:com.neatresults.mgnltweaks.app.status.ConfigStatusViewImpl.java
License:Open Source License
protected Component buildAndBind(String key, String caption) { Label field = new Label(); field.setCaption(caption); dataBindings.put(key, field);/*w w w . j a va 2 s . c o m*/ return field; }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createCenterPiece() { HorizontalLayout centerpieceLayout = new HorizontalLayout(); centerpieceLayout.setWidth("100%"); centerpieceLayout.setSpacing(true);/*from ww w . j ava2s . co m*/ VerticalLayout centerpieceSettings = new VerticalLayout(); centerpieceSettings.setWidth("100%"); centerpieceSettings.setSpacing(true); Field richTextField = listener.createRichTextField(); richTextField.setCaption("Teaser"); richTextField.setWidth("100%"); richTextField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { try { articleItem.removeItemProperty("siteAlert"); articleItem.addItemProperty("siteAlert", DefaultPropertyUtil.newDefaultProperty(String.class, event.getProperty().getValue().toString())); articleItem.applyChanges(); } catch (RepositoryException e) { e.printStackTrace(); } } }); centerpieceSettings.addComponent(richTextField); Label placementLabel = new Label("", ContentMode.HTML); placementLabel.setCaption("Placement"); centerpieceSettings.addComponent(placementLabel); CheckBox home = listener.createCheckBox("Home Page"); centerpieceSettings.addComponent(home); CheckBox news = listener.createCheckBox("News Landing"); centerpieceSettings.addComponent(news); CheckBox comm = listener.createCheckBox("Community Landing"); centerpieceSettings.addComponent(comm); CheckBox team = listener.createCheckBox("Team Landing"); centerpieceSettings.addComponent(team); CheckBox cheer = listener.createCheckBox("Cheerleader Landing"); centerpieceSettings.addComponent(cheer); centerpieceLayout.addComponent(centerpieceSettings); Label previewLabel = new Label("", ContentMode.HTML); previewLabel.setCaption("Centerpiece preview"); centerpieceLayout.addComponent(previewLabel); centerPiece.setContent(centerpieceLayout); }
From source file:com.nfl.dm.clubsites.cms.articles.subapp.articleeditor.promote.ArticlePromotionViewImpl.java
License:Open Source License
private void createAlert() { VerticalLayout alertTextLayout = new VerticalLayout(); alertTextLayout.setSpacing(true);/*from w w w .j av a 2s. c o m*/ alertTextLayout.setCaption("Alert Text"); MagnoliaRichTextField textField = (MagnoliaRichTextField) listener.createRichTextField(); textField.setSizeFull(); HorizontalLayout periodLayout = new HorizontalLayout(); periodLayout.setSpacing(true); // periodLayout.setWidth("100%"); DateField startDate = new DateField(); // startDate.setWidth("100%"); DateField endDate = new DateField(); // endDate.setWidth("100%"); periodLayout.addComponent(new Label("START")); periodLayout.addComponent(startDate); periodLayout.addComponent(new Label("END")); periodLayout.addComponent(endDate); alertTextLayout.addComponent(textField); alertTextLayout.addComponent(periodLayout); HorizontalLayout alertLayout = new HorizontalLayout(); alertLayout.setSpacing(true); alertLayout.setWidth("100%"); alertLayout.addComponent(alertTextLayout); final Label alertPreview = new Label("", ContentMode.HTML); alertPreview.setCaption("Alert Preview"); alertPreview.addStyleName("preview-label"); textField.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { alertPreview.setValue(String.valueOf(event.getProperty().getValue())); } }); alertPreview.setSizeUndefined(); alertLayout.addComponent(alertPreview); alert.setContent(alertLayout); textField.setValue( "<b>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</b>"); }
From source file:com.ocs.dynamo.ui.composite.layout.BaseCustomComponent.java
License:Apache License
/** * Constructs a (formatted) label based on the attribute model * /*from w ww. j av a2 s . c o m*/ * @param entity * the entity that is being displayed * @param attributeModel * @return */ @SuppressWarnings("unchecked") protected Component constructLabel(Object entity, AttributeModel attributeModel) { Label fieldLabel = new Label(); fieldLabel.setCaption(attributeModel.getDisplayName()); Object value = ClassUtils.getFieldValue(entity, attributeModel.getName()); if (value != null) { Class<?> type = attributeModel.getType(); Property<?> property = null; if (attributeModel.isWeek()) { property = new ObjectProperty<Date>((Date) value); fieldLabel.setConverter(new WeekCodeConverter()); fieldLabel.setPropertyDataSource(property); } else if (String.class.equals(type)) { // string property = new ObjectProperty<String>((String) value); fieldLabel.setPropertyDataSource(property); } else if (Date.class.equals(type)) { property = new ObjectProperty<Date>((Date) value); if (AttributeDateType.TIME.equals(attributeModel.getDateType())) { // for a time, do not include a time zone (we have no way of // knowing it!) fieldLabel.setConverter( new FormattedStringToDateConverter(null, attributeModel.getDisplayFormat())); } else { fieldLabel.setConverter(new FormattedStringToDateConverter( VaadinUtils.getTimeZone(UI.getCurrent()), attributeModel.getDisplayFormat())); } } else if (attributeModel.getType().isEnum()) { String msg = getMessageService().getEnumMessage((Class<Enum<?>>) attributeModel.getType(), (Enum<?>) value); if (msg != null) { fieldLabel.setValue(msg); } } else if (BigDecimal.class.equals(type)) { property = new ObjectProperty<BigDecimal>((BigDecimal) value); fieldLabel.setConverter(ConverterFactory.createBigDecimalConverter(attributeModel.isCurrency(), attributeModel.isPercentage(), attributeModel.isUseThousandsGrouping(), attributeModel.getPrecision(), VaadinUtils.getCurrencySymbol())); } else if (Integer.class.equals(type)) { property = new ObjectProperty<Integer>((Integer) value); fieldLabel.setConverter( ConverterFactory.createIntegerConverter(attributeModel.isUseThousandsGrouping())); } else if (Long.class.equals(type)) { property = new ObjectProperty<Long>((Long) value); fieldLabel.setConverter( ConverterFactory.createLongConverter(attributeModel.isUseThousandsGrouping())); } else if (AbstractEntity.class.isAssignableFrom(type)) { // another entity - use the value of the "displayProperty" EntityModel<?> model = getEntityModelFactory().getModel(type); String displayProperty = model.getDisplayProperty(); property = new NestedMethodProperty<String>(value, displayProperty); } else if (attributeModel.isImage()) { // create image preview final byte[] bytes = ClassUtils.getBytes(entity, attributeModel.getName()); Embedded image = new DefaultEmbedded(attributeModel.getDisplayName(), bytes); image.setStyleName(DynamoConstants.CSS_CLASS_UPLOAD); return image; } else if (Boolean.class.equals(attributeModel.getType()) || boolean.class.equals(attributeModel.getType())) { if (!StringUtils.isEmpty(attributeModel.getTrueRepresentation()) && Boolean.TRUE.equals(value)) { property = new ObjectProperty<String>(attributeModel.getTrueRepresentation()); } else if (!StringUtils.isEmpty(attributeModel.getFalseRepresentation()) && Boolean.FALSE.equals(value)) { property = new ObjectProperty<String>(attributeModel.getFalseRepresentation()); } else { property = new ObjectProperty<Boolean>((Boolean) value); fieldLabel.setConverter(new StringToBooleanConverter()); } } else if (Iterable.class.isAssignableFrom(attributeModel.getType())) { // collection of entities String str = TableUtils.formatEntityCollection(getEntityModelFactory(), (Iterable<?>) value); property = new ObjectProperty<String>(str); fieldLabel.setPropertyDataSource(property); } if (attributeModel.isNumerical()) { fieldLabel.setStyleName(DynamoConstants.CSS_NUMERICAL); } if (property != null) { fieldLabel.setPropertyDataSource(property); } } return fieldLabel; }
From source file:com.peergreen.webconsole.scope.deployment.internal.components.DeployableWindow.java
License:Open Source License
public Component getContent() { FormLayout content = new FormLayout(); content.setSpacing(true);/*from www . j a v a 2s . c o m*/ content.setMargin(true); Label name = new Label(deployableEntry.getName()); name.setCaption("Name"); content.addComponent(name); Label uri = new Label(deployableEntry.getUri().toString()); uri.setCaption("URI"); content.addComponent(uri); VerticalLayout status = new VerticalLayout(); status.setCaption("Status"); content.addComponent(status); if (report == null) { // is not deployed yet status.addComponent(new Label("Ready to be deployed")); } else { if (report.getExceptions().size() == 0) { status.addComponent(new Label("<p style=\"color:#329932\">Deployed</p>", ContentMode.HTML)); } else { for (ArtifactError artifactError : report.getExceptions()) { for (ArtifactErrorDetail detail : artifactError.getDetails()) { ExceptionView exceptionView = new ExceptionView(detail); status.addComponent(exceptionView); } } } VerticalLayout endPointsLayout = new VerticalLayout(); for (Endpoint endpoint : report.getEndpoints()) { try { Link link = new Link(endpoint.getURI().toString(), new ExternalResource(endpoint.getURI().toURL())); link.setTargetName("_blank"); endPointsLayout.addComponent(link); } catch (MalformedURLException e) { endPointsLayout.addComponent(new Label(endpoint.getURI().toString())); } } if (endPointsLayout.getComponentCount() > 0) { content.addComponent(endPointsLayout); endPointsLayout.setCaption("End points"); } } return content; }
From source file:com.peergreen.webconsole.scope.home.extensions.PeergreenNewsFeedFrame.java
License:Open Source License
/** * News popup/* w w w .j av a 2 s.c o m*/ * * @param feedMessage * @return */ private Window getNewsDescription(FeedMessage feedMessage) { FormLayout fields = new FormLayout(); fields.setWidth("35em"); fields.setSpacing(true); fields.setMargin(true); Label label = new Label("<a href=\"" + feedMessage.getLink() + "\">" + feedMessage.getLink().substring(0, 50) + "..." + "</a>"); label.setContentMode(ContentMode.HTML); label.setSizeUndefined(); label.setCaption("URL"); fields.addComponent(label); String description = feedMessage.getDescription(); if (description.length() > 1000) { description = description.substring(0, 999) + "..."; } Label desc = new Label(description); desc.setContentMode(ContentMode.HTML); desc.setCaption("Description"); fields.addComponent(desc); Button ok = new Button("Close"); ok.addStyleName("wide"); ok.addStyleName("default"); final Window w = new DefaultWindow(feedMessage.getTitle(), fields, ok); w.center(); ok.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { w.close(); } }); return w; }
From source file:com.rex.components.valo.CommonParts.java
License:Apache License
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);// w w w . j a v a 2 s . com 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 (!ReportEngineUI.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.rex.components.valo.Tables.java
License:Apache License
public Tables() { setMargin(true);// w ww . java 2s . c o m setSpacing(true); Label h1 = new Label("Tables & Grids"); h1.addStyleName("h1"); addComponent(h1); Label disclaimer = new Label( "<p>Note that most of the toggles only affect the Table component. The Grid component supports footers, expand ratios, row indexes/captions/icons and cell renderers, but those have not been implemented here.</p>", ContentMode.HTML); disclaimer.setCaption("Toggle features/styles"); addComponent(disclaimer); disclaimer.addStyleName(ValoTheme.LABEL_SMALL); HorizontalLayout wrap = new HorizontalLayout(); wrap.addStyleName("wrapping"); wrap.setSpacing(true); addComponent(wrap); wrap.addComponents(hierarchical, footer, sized, expandRatios, stripes, verticalLines, horizontalLines, borderless, headers, compact, small, rowIndex, rowCaption, rowIcon, componentsInCells); ValueChangeListener update = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { if (table == null) { table = new Table("Table component"); table.setContainerDataSource(normalContainer); addComponent(table); } if (grid == null) { grid = new Grid("Grid component"); grid.setContainerDataSource(gridContainer); addComponent(grid); } if (hierarchical.getValue() && table instanceof Table) { removeComponent(table); table = new TreeTable(); table.setContainerDataSource(hierarchicalContainer); addComponent(table); removeComponent(grid); } else if (!hierarchical.getValue() && table instanceof TreeTable) { removeComponent(table); table = new Table(); table.setContainerDataSource(normalContainer); addComponent(table); addComponent(grid); } configure(table, grid, footer.getValue(), sized.getValue(), expandRatios.getValue(), stripes.getValue(), verticalLines.getValue(), horizontalLines.getValue(), borderless.getValue(), headers.getValue(), compact.getValue(), small.getValue(), rowIndex.getValue(), rowCaption.getValue(), rowIcon.getValue(), componentsInCells.getValue()); } }; hierarchical.addValueChangeListener(update); footer.addValueChangeListener(update); sized.addValueChangeListener(update); expandRatios.addValueChangeListener(update); stripes.addValueChangeListener(update); verticalLines.addValueChangeListener(update); horizontalLines.addValueChangeListener(update); borderless.addValueChangeListener(update); headers.addValueChangeListener(update); compact.addValueChangeListener(update); small.addValueChangeListener(update); rowIndex.addValueChangeListener(update); rowCaption.addValueChangeListener(update); rowIcon.addValueChangeListener(update); componentsInCells.addValueChangeListener(update); footer.setValue(false); }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private VerticalLayout getUDContainer(String strUID) { if (bee == null) bee = new UserDetailsBackEnd(); hm = bee.getUD(strUID);/* ww w . j a va 2 s . co m*/ String strProf = hm.get("Profile Type"); VerticalLayout cAgentInfo = new VerticalLayout(); cAgentInfo.setMargin(new MarginInfo(true, false, true, false)); cAgentInfo.setStyleName("c_details_test"); cAgentInfo.setSizeUndefined(); FormLayout cBasic = new FormLayout(); // cBasic.setSpacing(true); Label lbB = new Label(); lbB.setCaption("General"); lbB.setStyleName("label_search_user u_d_t"); cBasic.addComponent(lbB); String cap = "First Name"; TextField tF = new TextField(cap); tFFN = tF; tFFN.setRequired(true); tF.setValue(hm.get(cap)); addDatum("Username", hm.get("Username"), cBasic); addDatum("Profile", strProf, cBasic); addDatum("Account Status", hm.get("Status"), cBasic); addDatum("First Name", hm.get("First Name"), cBasic); tF = new TextField("Middle Name"); addDatum("Middle Name", hm.get("Middle Name"), cBasic); addDatum("Last Name", hm.get("Last Name"), cBasic); addDatum("Gender", hm.get("Gender"), cBasic); addDatum("Occupation", hm.get("Occupation"), cBasic); addDatum("Date of Birth", hm.get("Date of Birth"), cBasic); addDatum("Country", hm.get("Country"), cBasic); addDatum("State", hm.get("State"), cBasic); addDatum("Local Government", hm.get("Local Government"), cBasic); VerticalLayout cC = new VerticalLayout(); HorizontalLayout cBAndCAndAcc = new HorizontalLayout(); cBAndCAndAcc.addComponent(cBasic); cBAndCAndAcc.addComponent(cC); FormLayout cCompany = new FormLayout(); // Label lbC = new Label("Company"); Label lbC = new Label(); lbC.setCaption("Identification"); lbC.setStyleName("label_search_user lb_frm_add_user u_d_t"); combo = new ComboBox("ID Type"); combo.addItem("Passport Number"); combo.addItem("National Registration Identification Number"); combo.addItem("Drivers License Number"); combo.addItem("Identification Card"); combo.addItem("Employer Identification Number"); combo.select("Passport Number"); comboIDType = combo; comboIDType.setRequired(true); cCompany.addComponent(lbC); addDatum("ID Type", hm.get("ID Type"), cCompany); addDatum("ID No.", hm.get("ID No."), cCompany); addDatum("Issuer", hm.get("Issuer"), cCompany); addDatum("Issue Date", hm.get("Issue Date"), cCompany); addDatum("Expiry Date", hm.get("Expiry Date"), cCompany); cC.addComponent(cCompany); FormLayout pC = new FormLayout(); lbC = new Label(); lbC.setCaption("Primary Contacts"); lbC.setStyleName("label_search_user u_d_t"); pC.addComponent(lbC); addDatum("Mobile Phone No.", hm.get("P-Mobile Phone No."), pC); addDatum("Alt. Phone No.", hm.get("P-Alt. Phone No."), pC); addDatum("Email Address", hm.get("Email"), pC); cC.addComponent(pC); FormLayout sC = new FormLayout(); lbC = new Label(); lbC.setCaption("Secondary Contacts"); lbC.setStyleName("label_search_user lb_frm_add_user u_d_t"); sC.addComponent(lbC); addDatum("Mobile Phone No.", hm.get("S-Mobile Phone No."), sC); addDatum("Alt. Phone No.", hm.get("S-Alt. Phone No."), sC); addDatum("Email Address", hm.get("Email"), sC); cC.addComponent(sC); FormLayout physicalC = new FormLayout(); lbC = new Label(); lbC.setCaption("Physical Address"); lbC.setStyleName("label_search_user lb_frm_add_user u_d_t"); physicalC.addComponent(lbC); StringBuilder sbAddr = new StringBuilder(); String strp = hm.get("Postal Code"); sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : "P.O.Box " + strp + ", "); strp = hm.get("Street"); sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", "); strp = hm.get("Province"); sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", "); strp = hm.get("State"); sbAddr.append((strp == null || strp.trim().isEmpty()) ? "" : strp + ", "); strp = hm.get("Country"); sbAddr.append((strp == null || strp.trim().isEmpty()) ? "." : strp); Label lb = new Label(); lbC.setContentMode(ContentMode.HTML); lb.setStyleName("label_ud"); lb.setCaption(sbAddr.toString()); physicalC.addComponent(lb); cC.addComponent(physicalC); cC.addComponent(cBtnEditCancel); cC.setMargin(new MarginInfo(false, true, false, true)); cAgentInfo.addComponent(cBAndCAndAcc); return cAgentInfo; }
From source file:com.swifta.mats.web.usermanagement.UserDetailsModule.java
private HorizontalLayout getADC() { // Notification.show(strTbName); VerticalLayout cAgentInfo = new VerticalLayout(); cAgentInfo.setMargin(new MarginInfo(true, true, true, true)); cAgentInfo.setStyleName("c_details_test"); // VerticalLayout cAcc = new VerticalLayout(); Label lbAcc = new Label(); lbAcc.setCaption("Account"); lbAcc.setStyleName("label_search_user lb_frm_add_user u_d_t"); // lbC.setCaption("Identification"); // lbC.setStyleName("label_search_user lb_frm_add_user u_d_t"); // lbAcc.setStyleName("lb_frm_add_user"); ComboBox comboHierarchy = null;/*from w ww . j a v a2s . c o m*/ comboHierarchy = new ComboBox("Profile"); final FormLayout cLBody = new FormLayout(); cLBody.addComponent(lbAcc); // cLBody.setSpacing(true); comboHierarchy.addItem(1); comboHierarchy.setItemCaption(1, "MATS_ADMIN_USER_PROFILE"); comboHierarchy.select(1); comboProfile = comboHierarchy; comboProfile.setRequired(true); // cAcc.addComponent(comboHierarchy); addDatum("Profile", hm.get("Profile Type"), cLBody); TextField tF = new TextField("Username"); tF.setValue("Livepwndz"); tFUN = tF; tFUN.setRequired(true); // cLBody.addComponent(tF); addDatum("Username", hm.get("Username"), cLBody); tF = new TextField("MSISDN"); tF.setValue("+256774191152"); tFMSISDN = tF; tFMSISDN.setRequired(true); // cLBody.addComponent(tF); addDatum("MSISDN", hm.get("MSISDN"), cLBody); tF = new TextField("PIN"); // / cLBody.addComponent(tF); tF = new TextField("Email"); tFAccEmail = tF; tFAccEmail.setRequired(true); tFAccEmail.setValue("ppounds1@gmail.com"); // // cLBody.addComponent(tF); addDatum("Email", hm.get("Email"), cLBody); combo = new ComboBox("Bank Domain"); combo.addItem("Stanbic Bank"); combo.select("Stanbic Bank"); comboBDomain = combo; // // cLBody.addComponent(combo); addDatum("Bank Domain", hm.get("Bank"), cLBody); combo = new ComboBox("Bank Code ID"); combo.addItem("001"); combo.select("001"); comboBID = combo; // cLBody.addComponent(combo); addDatum("Bank Code ID", hm.get("Bank Code"), cLBody); tF = new TextField("Bank Account"); tF.setValue("00232333452315"); tFBAcc = tF; // tFBAcc.setValidationVisible(true); // tFBAcc.addValidator(new NoNull()); // cLBody.addComponent(tF); addDatum("Bank Account", hm.get("Bank Account"), cLBody); combo.addItem(1); combo.setItemCaption(1, "US Dollars"); combo.select(1); comboCur = combo; // cLBody.addComponent(combo); addDatum("Currency", hm.get("Currency"), cLBody); tF = new TextField("Clearing Number"); tF.setValue("00212"); tFClrNo = tF; // cLBody.addComponent(tF); addDatum("Clearing No. ", hm.get("Clearing No."), cLBody); String strNameCap = "Username"; tF = new TextField(strNameCap); HorizontalLayout cAccBody = new HorizontalLayout(); cAccBody.addComponent(cLBody); cLBody.addComponent(cBtnEditCancel); cLBody.setStyleName("c_body_visible"); // cAcc.addComponent(cAccBody); cAgentInfo.addComponent(cLBody); // cBAndCAndAcc.addComponent(cAcc); HorizontalLayout c = new HorizontalLayout(); c.addComponent(cAgentInfo); return c; }