List of usage examples for com.vaadin.ui Label Label
public Label(String text)
From source file:com.bsb.samples.vaadin.wizard.core.FinalStep.java
License:Apache License
public Component getContent() { final VerticalLayout content = new VerticalLayout(); content.setMargin(true);//w ww . j a v a2 s .c om final Label sorry = new Label( "We sincerely hope that you were not expecting a demo of a " + "kick-ass Wizard :)"); content.addComponent(sorry); return content; }
From source file:com.bsb.samples.vaadin.wizard.core.FirstStep.java
License:Apache License
public Component getContent() { final VerticalLayout content = new VerticalLayout(); content.setSpacing(true);// www . ja v a 2 s.c om content.setMargin(true); final Label intro = new Label("A trivial use of the Wizards for Vaadin add-on"); content.addComponent(intro); final Label description = new Label( "This demonstrates an application where a custom widgetset has been compiled in a separate JAR " + "project that is not bound to the standard build lifecycle of the project. By making this " + "project optional, the lengthy compilation of the widgetset is only performed on demand. " + "Besides, a full clean of your project in your IDE does not require you to rebuild the " + "widgetset."); content.addComponent(description); return content; }
From source file:com.cavisson.gui.dashboard.components.charts.Impl.ResizeInsideVaadinComponent.java
@Override protected Component getChart() { VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel(); HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel(); horizontalSplitPanel.setSecondComponent(verticalSplitPanel); verticalSplitPanel.setFirstComponent(createChart()); VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setMargin(true);// ww w . j a va 2 s .c o m verticalLayout.setSpacing(true); verticalLayout.addComponent( new Label("Relatively sized components resize themselves automatically when in Vaadin component.")); Button button = new Button("Open in a window"); button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Window window = new Window("Chart windodw"); window.setContent(createChart()); window.setWidth("50%"); window.setHeight("50%"); getUI().addWindow(window); } }); verticalLayout.addComponent(button); horizontalSplitPanel.setFirstComponent(verticalLayout); return horizontalSplitPanel; }
From source file:com.cavisson.gui.dashboard.components.controls.Accordions.java
License:Apache License
public Accordions() { setMargin(true);//from w ww . j av a 2 s . c om Label h1 = new Label("Accordions"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.setSpacing(true); row.setWidth("100%"); addComponent(row); row.addComponent(getAccordion("Normal")); Accordion ac = getAccordion("Borderless"); ac.addStyleName("borderless"); row.addComponent(ac); }
From source file:com.cavisson.gui.dashboard.components.controls.Accordions.java
License:Apache License
Accordion getAccordion(String caption) { TestIcon testIcon = new TestIcon(0); Accordion ac = new Accordion(); ac.setCaption(caption);//from w w w . j a va2 s .c om ac.addTab(new VerticalLayout() { { setMargin(true); addComponent(new Label( "Fabio vel iudice vincam, sunt in culpa qui officia. Ut enim ad minim veniam, quis nostrud exercitation.")); } }, "First Caption", testIcon.get()); ac.addTab(new VerticalLayout() { { setMargin(true); addComponent(new Label("Gallia est omnis divisa in partes tres, quarum.")); } }, "Second Caption", testIcon.get()); ac.addTab(new VerticalLayout() { { setMargin(true); addComponent(new Label( "Nihil hic munitissimus habendi senatus locus, nihil horum? Sed haec quis possit intrepidus aestimare tellus.")); } }, "Third Caption", testIcon.get()); ac.addTab(new VerticalLayout() { { setMargin(true); addComponent(new Label( "Inmensae subtilitatis, obscuris et malesuada fames. Quisque ut dolor gravida, placerat libero vel, euismod.")); } }, "Custom Caption Style", testIcon.get()).setStyleName("color1"); return ac; }
From source file:com.cavisson.gui.dashboard.components.controls.ButtonsAndLinks.java
License:Apache License
/** * *///from ww w. j a va 2s .c om public ButtonsAndLinks() { setMargin(true); Label h1 = new Label("Buttons"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Button button = new Button("Normal"); row.addComponent(button); button = new Button("Disabled"); button.setEnabled(false); row.addComponent(button); button = new Button("Primary"); button.addStyleName("primary"); row.addComponent(button); button = new Button("Friendly"); button.addStyleName("friendly"); row.addComponent(button); button = new Button("Danger"); button.addStyleName("danger"); row.addComponent(button); TestIcon testIcon = new TestIcon(10); button = new Button("Small"); button.addStyleName("small"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Large"); button.addStyleName("large"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Top"); button.addStyleName("icon-align-top"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button("Image icon"); button.setIcon(testIcon.get(true, 16)); row.addComponent(button); button = new Button("Image icon"); button.addStyleName("icon-align-right"); button.setIcon(testIcon.get(true)); row.addComponent(button); button = new Button("Photos"); button.setIcon(testIcon.get()); row.addComponent(button); button = new Button(); button.setIcon(testIcon.get()); button.addStyleName("icon-only"); row.addComponent(button); button = new Button("Borderless"); button.setIcon(testIcon.get()); button.addStyleName("borderless"); row.addComponent(button); button = new Button("Borderless, colored"); button.setIcon(testIcon.get()); button.addStyleName("borderless-colored"); row.addComponent(button); button = new Button("Quiet"); button.setIcon(testIcon.get()); button.addStyleName("quiet"); row.addComponent(button); button = new Button("Link style"); button.setIcon(testIcon.get()); button.addStyleName("link"); row.addComponent(button); button = new Button("Icon on right"); button.setIcon(testIcon.get()); button.addStyleName("icon-align-right"); row.addComponent(button); CssLayout group = new CssLayout(); group.addStyleName("v-component-group"); row.addComponent(group); button = new Button("One"); group.addComponent(button); button = new Button("Two"); group.addComponent(button); button = new Button("Three"); group.addComponent(button); button = new Button("Tiny"); button.addStyleName("tiny"); row.addComponent(button); button = new Button("Huge"); button.addStyleName("huge"); row.addComponent(button); NativeButton nbutton = new NativeButton("Native"); row.addComponent(nbutton); h1 = new Label("Links"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Link link = new Link("vaadin.com", new ExternalResource("https://vaadin.com")); row.addComponent(link); link = new Link("Link with icon", new ExternalResource("https://vaadin.com")); link.addStyleName("color3"); link.setIcon(testIcon.get()); row.addComponent(link); link = new Link("Small", new ExternalResource("https://vaadin.com")); link.addStyleName("small"); row.addComponent(link); link = new Link("Large", new ExternalResource("https://vaadin.com")); link.addStyleName("large"); row.addComponent(link); link = new Link(null, new ExternalResource("https://vaadin.com")); link.setIcon(testIcon.get()); link.addStyleName("large"); row.addComponent(link); }
From source file:com.cavisson.gui.dashboard.components.controls.CheckBoxes.java
License:Apache License
public CheckBoxes() { setMargin(true);// ww w . ja v a 2 s. co m Label h1 = new Label("Check Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); CheckBox check = new CheckBox("Checked", true); row.addComponent(check); check = new CheckBox("Checked, explicit width, so that the caption should wrap", true); row.addComponent(check); check.setWidth("150px"); check = new CheckBox("Not checked"); row.addComponent(check); check = new CheckBox(null, true); check.setDescription("No caption"); row.addComponent(check); check = new CheckBox("Custom color", true); check.addStyleName("color1"); row.addComponent(check); TestIcon testIcon = new TestIcon(30); check = new CheckBox("Custom color", true); check.addStyleName("color2"); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox("With Icon", true); check.setIcon(testIcon.get()); row.addComponent(check); check = new CheckBox(); check.setIcon(testIcon.get(true)); row.addComponent(check); check = new CheckBox("Small", true); check.addStyleName("small"); row.addComponent(check); check = new CheckBox("Large", true); check.addStyleName("large"); row.addComponent(check); h1 = new Label("Option Groups"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); OptionGroup options = new OptionGroup("Choose one, explicit width"); options.setWidth("200px"); options.addItem("Option One"); Item two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, explicit width"); options.setMultiSelect(true); options.setWidth("200px"); options.addItem("Option One"); two = options.addItem( "Option Two, with a longer caption that should wrap when the components width is explicitly set."); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, small"); options.addStyleName("small"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, small"); options.addStyleName("small"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose one, large"); options.addStyleName("large"); options.setMultiSelect(false); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Choose many, large"); options.addStyleName("large"); options.setMultiSelect(true); options.addItem("Option One"); options.addItem("Option Two"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon("Option Two", testIcon.get()); options.setItemIcon("Option Three", testIcon.get(true)); row.addComponent(options); options = new OptionGroup("Horizontal items"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); options = new OptionGroup("Horizontal items, explicit width"); options.setMultiSelect(true); options.setWidth("500px"); options.addStyleName("horizontal"); options.addItem("Option One"); two = options.addItem("Option Two, with a longer caption"); options.addItem("Option Three"); options.select("Option One"); options.setItemIcon("Option One", testIcon.get()); options.setItemIcon(two, testIcon.get()); options.setItemIcon("Option Three", testIcon.get()); row.addComponent(options); }
From source file:com.cavisson.gui.dashboard.components.controls.ColorPickers.java
License:Apache License
public ColorPickers() { setMargin(true);/*ww w . j av a 2s .c o m*/ Label h1 = new Label("Color Pickers"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(40); ColorPicker cp = new ColorPicker(); cp.setDefaultCaptionEnabled(true); cp.setIcon(testIcon.get()); cp.setColor(new Color(138, 73, 115)); row.addComponent(cp); cp = new ColorPicker(); cp.setPopupStyle(PopupStyle.POPUP_SIMPLE); cp.setTextfieldVisibility(true); row.addComponent(cp); }
From source file:com.cavisson.gui.dashboard.components.controls.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);//from w w w .j a v a2s . c om Label h1 = new Label("Combo Boxes"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); ComboBox combo = new ComboBox("Normal"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setItemIcon(combo.getItemIds().iterator().next(), new ThemeResource("../runo/icons/16/document.png")); row.addComponent(combo); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); combo = new ComboBox(); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.setWidth("240px"); group.addComponent(combo); Button today = new Button("Do It"); group.addComponent(today); combo = new ComboBox("Explicit size"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setWidth("260px"); combo.setHeight("60px"); row.addComponent(combo); combo = new ComboBox("No text input allowed"); combo.setInputPrompt("You can click here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.select("Option One"); row.addComponent(combo); combo = new ComboBox("Error"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); row.addComponent(combo); combo = new ComboBox("Error, borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setNullSelectionAllowed(false); combo.select("Option One"); combo.setComponentError(new UserError("Fix it, now!")); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Disabled"); combo.setInputPrompt("You can't type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.setEnabled(false); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("large"); row.addComponent(combo); combo = new ComboBox("Borderless"); combo.setInputPrompt("You can type here"); combo.addItem("Option One"); combo.addItem("Option Two"); combo.addItem("Option Three"); combo.addStyleName("borderless"); row.addComponent(combo); combo = new ComboBox("Tiny"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ValoThemeUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
From source file:com.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
public CommonParts() { setMargin(true);/* w w w . j av a 2 s . c o m*/ addStyleName("content-common"); Label h1 = new Label("Common UI Elements"); h1.addStyleName("h1"); addComponent(h1); VerticalLayout row = new VerticalLayout(); row.setWidth("100%"); row.setSpacing(true); addComponent(row); row.addComponent(loadingIndicators()); row.addComponent(notifications()); row.addComponent(windows()); row.addComponent(tooltips()); }