List of usage examples for com.vaadin.ui Label setStyleName
@Override public void setStyleName(String style)
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthDirect.java
License:Open Source License
private Popover getPopoverLabel(String val, String title) { Popover popover = new Popover(); popover.setModal(true);// w w w.ja va 2 s . com popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setStyleName(Runo.LABEL_SMALL); lbl.setValue(val); layout2.addComponent(lbl); popLayout.addComponent(layout2); Button close = new Button(null, new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:gov.va.ds4p.ds4pmobileportal.ui.eHealthExchange.java
License:Open Source License
private Popover getPopoverLabel(String val, String title) { Popover popover = new Popover(); popover.setModal(true);/*from w w w .jav a 2s . c o m*/ popover.setClosable(true); popover.setWidth("700px"); popover.setHeight("100%"); CssLayout popLayout = new CssLayout(); popLayout.setSizeFull(); popLayout.setMargin(true); NavigationView navView = new NavigationView(popLayout); navView.setCaption(title); CssLayout layout2 = new CssLayout(); Label lbl = new Label(); lbl.setContentMode(Label.CONTENT_XHTML); lbl.setStyleName(Runo.LABEL_SMALL); lbl.setValue(val); layout2.addComponent(lbl); popLayout.addComponent(layout2); Button close = new Button(null, new ClickListener() { public void buttonClick(ClickEvent event) { event.getButton().getWindow().getParent().removeWindow(event.getButton().getWindow()); } }); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); navView.setRightComponent(close); popover.setContent(navView); return popover; }
From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesEntry.java
License:Open Source License
private void construct(final AbstractJcrNodeAdapter favorite, final FavoritesView.Listener listener) { addStyleName("favorites-entry"); setSizeUndefined();/* ww w . j a va2s.com*/ root.setSizeUndefined(); this.enterKeyShortcutListener = new EnterKeyShortcutListener(listener); this.escapeKeyShortcutListener = new EscapeKeyShortcutListener(); this.nodename = favorite.getNodeName(); this.location = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.URL).getValue().toString(); this.title = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.TITLE).getValue().toString(); String icon = "icon-app"; if (favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue() != null) { icon = favorite.getItemProperty(AdmincentralNodeTypes.Favorite.ICON).getValue().toString(); } final Label iconLabel = new Label(); iconLabel.setValue("<span class=\"" + icon + "\"></span>"); iconLabel.setStyleName("icon"); iconLabel.setContentMode(ContentMode.HTML); root.addComponent(iconLabel); titleField = new TextField(); titleField.setValue(title); titleField.setReadOnly(true); titleField.addFocusListener(new FocusListener() { @Override public void focus(FocusEvent event) { iconLabel.removeShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(enterKeyShortcutListener); titleField.addShortcutListener(escapeKeyShortcutListener); } }); titleField.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { titleField.removeShortcutListener(enterKeyShortcutListener); titleField.removeShortcutListener(escapeKeyShortcutListener); } }); root.addComponent(titleField); editButton = new NativeButton(); editButton.setHtmlContentAllowed(true); editButton.setCaption("<span class=\"icon-edit\"></span>"); editButton.addStyleName("favorite-action"); editButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { doEditTitle(listener); } }); editButton.setVisible(false); root.addComponent(editButton); removeButton = new NativeButton(); removeButton.setHtmlContentAllowed(true); removeButton.setCaption("<span class=\"icon-trash\"></span>"); removeButton.addStyleName("favorite-action"); removeButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { shell.openConfirmation(MessageStyleTypeEnum.WARNING, i18n.translate("confirmation.delete.title.generic"), i18n.translate("confirmation.cannot.undo"), i18n.translate("confirmation.delete.yes"), i18n.translate("confirmation.no"), false, new ConfirmationCallback() { @Override public void onSuccess() { listener.removeFavorite(getRelPath()); } @Override public void onCancel() { // no op } }); } }); removeButton.setVisible(false); root.addComponent(removeButton); root.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { if (event.getClickedComponent() == titleField && !editable) { if (event.isDoubleClick()) { // TODO fgrilli commented out as, besides making the text editable, it also goes to the saved location // See MGNLUI-1317 } else { listener.goToLocation(location); } } } }); setCompositionRoot(root); setIconsVisibility(false); }
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneField.java
License:Apache License
public DettaglioMissioneField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);/*from w w w. ja v a2s. c o m*/ setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneSTField.java
License:Apache License
public DettaglioMissioneSTField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);//from ww w. ja v a 2 s .c o m setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label opLabel = new Label(); opLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_OPERATORE_LOGISTICO) + " " + missione.getCompagnia()); opLabel.setStyleName("missione_label"); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(opLabel); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
From source file:it.vige.greenarea.bpm.custom.ui.form.DettaglioMissioneTRField.java
License:Apache License
public DettaglioMissioneTRField(FormProperty formProperty, GreenareaAbstractFormPropertyRenderer<T> greenareaAbstractFormPropertyRenderer, Missione missione) { I18nManager i18nManager = get().getI18nManager(); String caption = i18nManager.getMessage(DETTAGLIO_MISSIONE_TITLE); setSpacing(true);//from w ww. j av a 2 s. com setCaption(caption); setHeight(Sizeable.SIZE_UNDEFINED, 0); Label opLabel = new Label(); opLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_OPERATORE_LOGISTICO) + " " + missione.getCompagnia()); opLabel.setStyleName("missione_label"); Label missionIdLabel = new Label(); missionIdLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_ID_MISSIONE) + " " + missione.getNome()); missionIdLabel.setStyleName("missione_label"); Label missionDateLabel = new Label(); missionDateLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_DATA_MISSIONE) + " " + giornata.format(missione.getDataInizio())); missionDateLabel.setStyleName("missione_label"); Label agencyCodeLabel = new Label(); agencyCodeLabel.setValue( i18nManager.getMessage(DETTAGLIO_MISSIONE_CODICE_FILIALE) + " " + missione.getCodiceFiliale()); agencyCodeLabel.setStyleName("missione_label"); Label rankingLabel = new Label(); rankingLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_RANKING)); Embedded rankingImage = null; if (missione.getRanking() != null) { if (missione.getRanking().equals(VERDE)) rankingImage = new Embedded(null, new ThemeResource("img/circle_green.png")); else if (missione.getRanking().equals(GIALLO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_orange.png")); else if (missione.getRanking().equals(ROSSO)) rankingImage = new Embedded(null, new ThemeResource("img/circle_red.png")); rankingImage.setWidth(20, UNITS_PIXELS); rankingImage.setStyleName("missione_label"); } Label mobilityCreditLabel = new Label(); mobilityCreditLabel.setValue(i18nManager.getMessage(DETTAGLIO_MISSIONE_CREDITO_DI_MOBILITA) + " " + missione.getCreditoMobilita()); mobilityCreditLabel.setStyleName("missione_label"); addComponent(opLabel); addComponent(missionIdLabel); addComponent(missionDateLabel); addComponent(agencyCodeLabel); addComponent(rankingLabel); if (rankingImage != null) addComponent(rankingImage); addComponent(mobilityCreditLabel); setStyleName("dettaglio-missione"); policyDetailsButton = new Button(); policyDetailsButton.setCaption(i18nManager.getMessage(DETTAGLIO_MISSIONE_BUTTON)); final GreenareaAbstractFormPropertyRenderer<?> fGreenareaAbstractFormPropertyRenderer = greenareaAbstractFormPropertyRenderer; policyDetailsButton.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { fGreenareaAbstractFormPropertyRenderer.getGreenareaFormPropertiesForm().getSubmitFormButton() .click(); } }); addComponent(policyDetailsButton); // Invisible textfield, only used as wrapped field wrappedField = new TextField(); wrappedField.setVisible(false); addComponent(wrappedField); }
From source file:lifetime.component.welcome.register.RegistrationForm.java
License:Apache License
public RegistrationForm(String language) { super();/*from w w w .j a v a 2s . c o m*/ setSizeUndefined(); setMargin(true); setSpacing(true); Label text = new Label("Register"); setSpacing(true); text.setStyleName("login"); defaultLanguage = new LocalesComboBox(language); /* Creates the firstname text field and registers a validator */ firstname = new LifetimeTextField("Firstname"); // Creates text field firstname.addValidator(new NameValidator()); // Register Validator firstname.setValidationVisible(true); // Automatic validation firstname.setId(StyleClassName.REGISTRATION_FORM_FIRSTNAME.getId()); /* Creates lastnames text field and registers a validator */ lastname = new LifetimeTextField("Lastname"); lastname.addValidator(new NameValidator()); lastname.setValidationVisible(true); lastname.setRequired(true); lastname.setId(StyleClassName.REGISTRATION_FORM_LASTNAME.getId()); /* Creates email text field and registers a validator */ email = new LifetimeTextField("Email / Username"); email.addValidator(new EmailValidator("Invalid email address")); email.setValidationVisible(true); email.setId(StyleClassName.REGISTRATION_FORM_EMAIL.getId()); /* Creates password text field and registers a validator */ password = new PasswordField("Password"); password.addValidator(new PasswordValidator()); password.setId(StyleClassName.REGISTRATION_FORM_ENCRYPTED.getId()); passwordRepeat = new PasswordField("Repeat password"); passwordRepeat.setId(StyleClassName.REGISTRATION_FORM_ENCRYPTED_REPEAT.getId()); birthDate = new DateField("Birthdate"); birthDate.setLocale(new Locale(language)); birthDate.setId(StyleClassName.REGISTRATION_FORM_BIRTHDATE.getId()); // birthPlace = new LifetimeTextField("Birth place"); birthPlace.setId(StyleClassName.REGISTRATION_FORM_BIRTHPLACE.getId()); VerticalLayout personalData = new VerticalLayout(defaultLanguage, firstname, lastname, email, password, passwordRepeat); VerticalLayout birthData = new VerticalLayout(birthDate, birthPlace); birthData.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); addComponents(personalData, birthData); setStyleName(StyleClassName.REGISTRATION_FORM.getStyleName()); setId(StyleClassName.REGISTRATION_FORM.getId()); }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Component getBennuInterface() { GridSystemLayout gsl = new GridSystemLayout(); gsl.setMargin(false);/*from ww w .ja va 2 s.com*/ Label lblBigTitle = new Label("A Big Title (H1)", Label.CONTENT_TEXT); lblBigTitle.setStyleName(BennuTheme.LABEL_H1); Label lblBigText = new Label(LOREM_TEXT_LARGE, Label.CONTENT_TEXT); gsl.setCell("big_title", 16, lblBigTitle); gsl.setCell("big_text", 16, lblBigText); Label lblOneLink = new Label( "<a href='http://www.google.com'>Label Link : One link a day keeps the doctor away</a>", Label.CONTENT_XHTML); gsl.setCell("label_one_link", 16, lblOneLink); Button btOneLink = new Button("Button Link: One link a day keeps the doctor away", new ClickListener() { @Override public void buttonClick(ClickEvent event) { event.getButton().getWindow().showNotification("You just clicked a button link!"); } }); btOneLink.setStyleName(BaseTheme.BUTTON_LINK); gsl.setCell("button_one_link", 16, btOneLink); Label lblTitleH2 = new Label("A Not So Big Title (H2)", Label.CONTENT_TEXT); lblTitleH2.setStyleName(BennuTheme.LABEL_H2); gsl.setCell("not_so_big_title", 16, lblTitleH2); Label lblSmallText = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT); gsl.setCell("small_text", 16, lblSmallText); Table table = new Table(); table.setSizeFull(); table.setPageLength(0); table.addContainerProperty("Name", String.class, ""); table.addContainerProperty("Age", Integer.class, ""); table.addContainerProperty("Nickname", String.class, ""); table.addItem(new Object[] { "Giacomo Guilizzoni", 34, "Peidi" }, 1); table.addItem(new Object[] { "Giodp Jack Guilizzoni", 4, "The Guids" }, 2); table.addItem(new Object[] { "Marco Botton", 31, "" }, 3); table.addItem(new Object[] { "Mariah Maciachlan", 35, "Patata" }, 4); table.addItem(new Object[] { "Valerie Libery WOW! Division", 23, "Val" }, 5); table.addItem(new Object[] { "Guido Master lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum", 99, "Booya Master" }, 6); gsl.setCell("table", 16, table); Label lblTitleH3 = new Label("A Getting Smaller Title (H3)", Label.CONTENT_TEXT); lblTitleH3.setStyleName(BennuTheme.LABEL_H3); gsl.setCell("getting_smaller_title", 16, lblTitleH3); Panel panelLeft = new Panel(); panelLeft.setScrollable(true); panelLeft.setSizeFull(); panelLeft.setHeight("145px"); panelLeft.addComponent(new Label(LOREM_TEXT_ALL)); Panel panelRight = new Panel(); panelRight.addComponent(new Label(LOREM_TEXT_LARGE)); gsl.setCell("panel_left", 8, panelLeft); gsl.setCell("panel_right", 8, panelRight); Label lblTitleH4 = new Label("A Smaller Title (H4)", Label.CONTENT_TEXT); lblTitleH4.setStyleName(BennuTheme.LABEL_H4); gsl.setCell("smaller_title", 16, lblTitleH4); Label lblTextb4Form = new Label(LOREM_TEXT_SMALL, Label.CONTENT_TEXT); gsl.setCell("txtB4Form", 0, 8, 8, lblTextb4Form); Form form = new Form(); form.setSizeFull(); form.addField("form_label", new TextField("Form Label")); form.addField("large_form_label", new DateField("Large Form Label")); form.addField("much_larger_form_label", new Select("Much Larger Form Label")); form.addField("something_diff", new TextArea("And now for something completely different")); final OptionGroup checkboxes = new OptionGroup("Checkboxes fun"); checkboxes.setMultiSelect(true); checkboxes.addItem("not selected"); checkboxes.addItem("selected"); checkboxes.select("selected"); checkboxes.addItem("disabled"); checkboxes.setItemEnabled("disabled", false); checkboxes.addItem("disabled selected"); checkboxes.select("disabled selected"); checkboxes.setItemEnabled("disabled selected", false); form.addField("checkboxes", checkboxes); final OptionGroup radiobuttons = new OptionGroup("Radio on/off"); radiobuttons.addItem("option 1(selected)"); radiobuttons.select("option 1(selected)"); radiobuttons.addItem("option 2"); radiobuttons.addItem("option 3 (disabled)"); radiobuttons.setItemEnabled("option 3 (disabled)", false); radiobuttons.addItem("option 4 (disabled and selected)"); radiobuttons.select("option 4 (disabled and selected)"); radiobuttons.setItemEnabled("option 4 (disabled and selected)", false); form.addField("radiobuttons", radiobuttons); form.getFooter().addComponent(new Button("Submit the info")); form.getFooter().addComponent(new Button("Cancel the info")); final Panel rightFormPanel = new Panel(); rightFormPanel.setScrollable(true); rightFormPanel.setSizeFull(); rightFormPanel.setHeight("400px"); rightFormPanel.addComponent(new Label(LOREM_TEXT_ALL, Label.CONTENT_TEXT)); gsl.setCell("form", 12, form); gsl.setCell("rightFormPanel", 4, rightFormPanel); return gsl; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getLabelPreviews() { Layout grid = getPreviewLayout("Labels"); Label label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); grid.addComponent(label);/* www . j a v a2 s.c om*/ label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big"); grid.addComponent(label); label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny"); grid.addComponent(label); label = new Label("<h1>Top Level Header</h1>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h1\");<br>or<br>new Label(\"<h1>Top Level Header</h1>\", Label.CONTENT_XHTML);"); label = new Label("<h2>Second Header</h2>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h2\");<br>or<br>new Label(\"<h2>Second Header</h2>\", Label.CONTENT_XHTML);"); label = new Label("<h3>Subtitle</h3>", Label.CONTENT_XHTML); label.setSizeUndefined(); grid.addComponent(label); label.setDescription( "Label.addStyleName(\"h3\");<br>or<br>new Label(\"<h3>Subtitle</h3>\", Label.CONTENT_XHTML);"); label = new Label("<h4>Paragraph Header</h4>Plain text, lorem ipsum dolor sit amet consectetur amit.", Label.CONTENT_XHTML); label.setWidth("200px"); label.setStyleName("color"); grid.addComponent(label); label = new Label("Big plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("big color"); grid.addComponent(label); label = new Label("Small plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("small color"); grid.addComponent(label); label = new Label("Tiny plain text, lorem ipsum dolor sit amet consectetur amit."); label.setWidth("200px"); label.setStyleName("tiny color"); grid.addComponent(label); label = new Label("Top Level Header"); label.setSizeUndefined(); label.setStyleName("h1 color"); grid.addComponent(label); label = new Label("Second Header"); label.setSizeUndefined(); label.setStyleName("h2 color"); grid.addComponent(label); label = new Label("Subtitle"); label.setSizeUndefined(); label.setStyleName("h3 color"); grid.addComponent(label); label = new Label("Warning text, lorem ipsum dolor sit."); label.setStyleName("warning"); grid.addComponent(label); label = new Label("Error text, lorem ipsum dolor."); label.setStyleName("error"); grid.addComponent(label); label = new Label("Big warning text"); label.setStyleName("big warning"); grid.addComponent(label); label = new Label("Big error text"); label.setStyleName("big error"); grid.addComponent(label); label = new Label("Loading text..."); label.setStyleName("h3 loading"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); grid.addComponent(label); label = new Label("1"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("green"); label.addStyleName("big"); grid.addComponent(label); label = new Label("2"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("yellow"); label.addStyleName("big"); grid.addComponent(label); label = new Label("3"); label.setSizeUndefined(); label.addStyleName("numeral"); label.addStyleName("blue"); label.addStyleName("big"); grid.addComponent(label); return grid; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
Layout getCompoundButtons() { Layout grid = getPreviewLayout("Compound Buttons"); Label title = new Label("Segment"); title.setStyleName("h1"); grid.addComponent(title);/* w w w. j av a 2s.c o m*/ ((GridLayout) grid).newLine(); Label segments = new Label( "The segment control is just a set of buttons inside a HorizontalLayout. Use the structure shown on the right, <strong>and remember that you need to implement all logic yourself</strong>. This theme just provides suitable stylenames for you to use.", Label.CONTENT_XHTML); grid.addComponent(segments); segments = new Label( "HorizontalLayout.setStyleName(\"segment\") and .addStyleName(\"segment-alternate\")\n + Button.addStyleName(\"first\") and .addStyleName(\"down\")\n + Button\n\t...\n + Button.addStyleName(\"last\")", Label.CONTENT_PREFORMATTED); ((GridLayout) grid).addComponent(segments, 1, 1, 2, 1); Segment segment = new Segment(); segment.setCaption("Segment"); Button b = new Button("One"); b.setStyleName("down"); b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three")) .addButton(new Button("Four")); grid.addComponent(segment); segment = new Segment(); segment.addStyleName("segment-alternate"); segment.setCaption("Segment (alternate)"); b = new Button("One"); b.setStyleName("down"); b.setIcon(new ThemeResource("../runo/icons/16/document-txt.png")); segment.addButton(b).addButton(new Button("Two")).addButton(new Button("Three")) .addButton(new Button("Four")); grid.addComponent(segment); segment = new Segment(); segment.setCaption("Small segment"); b = new Button("Apples"); b.setStyleName("small"); b.addStyleName("down"); segment.addButton(b); b = new Button("Oranges"); b.setStyleName("small"); segment.addButton(b); b = new Button("Bananas"); b.setStyleName("small"); segment.addButton(b); b = new Button("Grapes"); b.setStyleName("small"); segment.addButton(b); grid.addComponent(segment); return grid; }