List of usage examples for com.vaadin.ui Label Label
public Label(String text)
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);//from www.j a v a 2 s. c om Label h1 = new Label("Panels & Layout panels"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TestIcon testIcon = new TestIcon(60); Panel panel = new Panel("Normal"); panel.setIcon(testIcon.get()); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Sized"); panel.setIcon(testIcon.get()); panel.setWidth("10em"); panel.setHeight("250px"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color1"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color2"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Custom Caption"); panel.setIcon(testIcon.get()); panel.addStyleName("color3"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless style"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.setContent(panelContent()); row.addComponent(panel); panel = new Panel("Borderless + scroll divider"); panel.setIcon(testIcon.get()); panel.addStyleName("borderless"); panel.addStyleName("scroll-divider"); panel.setContent(panelContentScroll()); panel.setHeight("17em"); row.addComponent(panel); panel = new Panel("Well style"); panel.setIcon(testIcon.get()); panel.addStyleName("well"); panel.setContent(panelContent()); row.addComponent(panel); CssLayout layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Panel style layout"); layout.addStyleName("card"); layout.addComponent(panelContent()); row.addComponent(layout); layout = new CssLayout(); layout.addStyleName("card"); row.addComponent(layout); HorizontalLayout panelCaption = new HorizontalLayout(); panelCaption.addStyleName("v-panel-caption"); panelCaption.setWidth("100%"); // panelCaption.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label label = new Label("Panel style layout"); panelCaption.addComponent(label); panelCaption.setExpandRatio(label, 1); Button action = new Button(); action.setIcon(FontAwesome.PENCIL); action.addStyleName("borderless-colored"); action.addStyleName("small"); action.addStyleName("icon-only"); panelCaption.addComponent(action); MenuBar dropdown = new MenuBar(); dropdown.addStyleName("borderless"); dropdown.addStyleName("small"); MenuItem addItem = dropdown.addItem("", FontAwesome.CHEVRON_DOWN, null); addItem.setStyleName("icon-only"); addItem.addItem("Settings", null); addItem.addItem("Preferences", null); addItem.addSeparator(); addItem.addItem("Sign Out", null); panelCaption.addComponent(dropdown); layout.addComponent(panelCaption); layout.addComponent(panelContent()); layout.setWidth("14em"); layout = new CssLayout(); layout.setIcon(testIcon.get()); layout.setCaption("Well style layout"); layout.addStyleName("well"); layout.addComponent(panelContent()); row.addComponent(layout); }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
Component panelContent() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull();/* w w w. j a v a 2s.c o m*/ layout.setMargin(true); layout.setSpacing(true); Label content = new Label( "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio."); content.setWidth("10em"); layout.addComponent(content); Button button = new Button("Button"); button.setSizeFull(); layout.addComponent(button); return layout; }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
Component panelContentScroll() { VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);//from ww w . j av a2 s.c o m layout.setSpacing(true); Label content = new Label( "Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio. Suspendisse dictum feugiat nisl ut dapibus. Mauris iaculis porttitor posuere. Praesent id metus massa, ut blandit odio."); content.setWidth("10em"); layout.addComponent(content); Button button = new Button("Button"); layout.addComponent(button); return layout; }
From source file:com.cavisson.gui.dashboard.components.controls.PopupViews.java
License:Apache License
public PopupViews() { setMargin(true);// www. j a v a2s.c o m Label h1 = new Label("Popup Views"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); PopupView pv = new PopupView(new Content() { @Override public Component getPopupComponent() { return new VerticalLayout() { { setMargin(true); setWidth("300px"); addComponent(new Label( "Fictum, deserunt mollit anim laborum astutumque! Magna pars studiorum, prodita quaerimus.")); } }; } @Override public String getMinimizedValueAsHTML() { return "Click to view"; } }); row.addComponent(pv); pv.setHideOnMouseOut(true); pv.setCaption("Hide on mouse-out"); pv = new PopupView(new Content() { int count = 0; @Override public Component getPopupComponent() { try { Thread.sleep(1000); } catch (InterruptedException e) { } return new VerticalLayout() { { setMargin(true); addComponent(new Label("<h3>Thanks for waiting!</h3><p>You've opened this popup <b>" + ++count + " time" + (count > 1 ? "s" : " only") + "</b>.</p>", ContentMode.HTML)); } }; } @Override public String getMinimizedValueAsHTML() { return "Show slow loading content"; } }); row.addComponent(pv); pv.setHideOnMouseOut(false); pv.setCaption("Hide on click-outside"); }
From source file:com.cavisson.gui.dashboard.components.controls.Sliders.java
License:Apache License
public Sliders() { setMargin(true);// w ww . j a v a 2 s .co m Label h1 = new Label("Sliders"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); Slider slider = new Slider("Horizontal"); slider.setValue(50.0); row.addComponent(slider); slider = new Slider("Horizontal, sized"); slider.setValue(50.0); slider.setWidth("200px"); row.addComponent(slider); slider = new Slider("Custom handle"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color1"); row.addComponent(slider); slider = new Slider("Custom track"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color2"); row.addComponent(slider); slider = new Slider("Custom indicator"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("color3"); row.addComponent(slider); slider = new Slider("No indicator"); slider.setValue(50.0); slider.setWidth("200px"); slider.addStyleName("no-indicator"); row.addComponent(slider); slider = new Slider("With ticks (not in IE8 & IE9)"); slider.setValue(3.0); slider.setWidth("200px"); slider.setMax(4); slider.addStyleName("ticks"); row.addComponent(slider); slider = new Slider("Toggle imitation"); slider.setWidth("50px"); slider.setResolution(0); slider.setMin(0); slider.setMax(1); row.addComponent(slider); slider = new Slider("Vertical"); slider.setValue(50.0); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Vertical, sized"); slider.setValue(50.0); slider.setOrientation(SliderOrientation.VERTICAL); slider.setHeight("200px"); row.addComponent(slider); slider = new Slider("Custom handle"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color1"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Custom track"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color2"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Custom indicator"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("color3"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("No indicator"); slider.setValue(50.0); slider.setHeight("200px"); slider.addStyleName("no-indicator"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("With ticks"); slider.setValue(3.0); slider.setHeight("200px"); slider.setMax(4); slider.addStyleName("ticks"); slider.setOrientation(SliderOrientation.VERTICAL); row.addComponent(slider); slider = new Slider("Disabled"); slider.setValue(50.0); slider.setEnabled(false); row.addComponent(slider); h1 = new Label("Progress Bars"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); pb = new ProgressBar(); pb.setCaption("Default"); pb.setWidth("300px"); // pb.setValue(0.6f); row.addComponent(pb); pb2 = new ProgressBar(); pb2.setCaption("Point style"); pb2.setWidth("300px"); pb2.addStyleName("point"); // pb2.setValue(0.6f); row.addComponent(pb2); if (!ValoThemeUI.isTestMode()) { ProgressBar pb3 = new ProgressBar(); pb3.setIndeterminate(true); pb3.setCaption("Indeterminate"); row.addComponent(pb3); } }
From source file:com.cavisson.gui.dashboard.components.controls.SplitPanels.java
License:Apache License
public SplitPanels() { setMargin(true);//www.ja va 2 s . c om Label h1 = new Label("Split Panels"); h1.addStyleName("h1"); addComponent(h1); addComponent(new Label( "Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style.")); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); row.setMargin(new MarginInfo(true, false, false, false)); addComponent(row); HorizontalSplitPanel sp = new HorizontalSplitPanel(); sp.setCaption("Default style"); sp.setWidth("400px"); sp.setHeight(null); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); VerticalSplitPanel sp2 = new VerticalSplitPanel(); sp2.setCaption("Default style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); sp = new HorizontalSplitPanel(); sp.setCaption("Large style"); sp.setWidth("300px"); sp.setHeight("200px"); sp.addStyleName("large"); sp.setFirstComponent(getContent()); sp.setSecondComponent(getContent()); row.addComponent(sp); sp2 = new VerticalSplitPanel(); sp2.setCaption("Large style"); sp2.setWidth("300px"); sp2.setHeight("200px"); sp2.addStyleName("large"); sp2.setFirstComponent(getContent()); sp2.setSecondComponent(getContent()); row.addComponent(sp2); }
From source file:com.cavisson.gui.dashboard.components.controls.SplitPanels.java
License:Apache License
VerticalLayout getContent() { return new VerticalLayout() { {/*from w w w . j av a 2 s . c o m*/ setMargin(true); addComponent(new Label("Fictum, deserunt mollit anim laborum astutumque!")); } }; }
From source file:com.cavisson.gui.dashboard.components.controls.Tables.java
License:Apache License
public Tables() { setMargin(true);//w w w . j ava2s .co m setSpacing(true); Label h1 = new Label("Tables"); h1.addStyleName("h1"); addComponent(h1); 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.setContainerDataSource(normalContainer); addComponent(table); } if (hierarchical.getValue() && table instanceof Table) { removeComponent(table); table = new TreeTable(); table.setContainerDataSource(hierarchicalContainer); addComponent(table); } else if (!hierarchical.getValue() && table instanceof TreeTable) { removeComponent(table); table = new Table(); table.setContainerDataSource(normalContainer); addComponent(table); } configure(table, 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.cavisson.gui.dashboard.components.controls.Tables.java
License:Apache License
static void configure(Table table, boolean footer, boolean sized, boolean expandRatios, boolean stripes, boolean verticalLines, boolean horizontalLines, boolean borderless, boolean headers, boolean compact, boolean small, boolean rowIndex, boolean rowCaption, boolean rowIcon, boolean componentsInRows) { table.setSelectable(true);//w w w . j a v a 2s . com table.setMultiSelect(true); table.setSortEnabled(true); table.setColumnCollapsingAllowed(true); table.setColumnReorderingAllowed(true); table.setPageLength(6); table.addActionHandler(ValoThemeUI.getActionHandler()); table.setDragMode(TableDragMode.MULTIROW); table.setDropHandler(new DropHandler() { @Override public AcceptCriterion getAcceptCriterion() { return AcceptAll.get(); } @Override public void drop(DragAndDropEvent event) { Notification.show(event.getTransferable().toString()); } }); table.setColumnAlignment(ValoThemeUI.DESCRIPTION_PROPERTY, Align.RIGHT); table.setColumnAlignment(ValoThemeUI.INDEX_PROPERTY, Align.CENTER); table.removeContainerProperty("textfield"); table.removeGeneratedColumn("textfield"); table.removeContainerProperty("button"); table.removeGeneratedColumn("button"); table.removeContainerProperty("label"); table.removeGeneratedColumn("label"); table.removeContainerProperty("checkbox"); table.removeGeneratedColumn("checkbox"); table.removeContainerProperty("datefield"); table.removeGeneratedColumn("datefield"); table.removeContainerProperty("combobox"); table.removeGeneratedColumn("combobox"); table.removeContainerProperty("optiongroup"); table.removeGeneratedColumn("optiongroup"); table.removeContainerProperty("slider"); table.removeGeneratedColumn("slider"); table.removeContainerProperty("progress"); table.removeGeneratedColumn("progress"); if (componentsInRows) { table.addContainerProperty("textfield", TextField.class, null); table.addGeneratedColumn("textfield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { TextField tf = new TextField(); tf.setInputPrompt("Type here"); // tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("datefield", TextField.class, null); table.addGeneratedColumn("datefield", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { DateField tf = new DateField(); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("combobox", TextField.class, null); table.addGeneratedColumn("combobox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ComboBox tf = new ComboBox(); tf.setInputPrompt("Select"); tf.addStyleName("compact"); if ((Integer) itemId % 2 == 0) { tf.addStyleName("borderless"); } return tf; } }); table.addContainerProperty("button", Button.class, null); table.addGeneratedColumn("button", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Button b = new Button("Button"); b.addStyleName("small"); return b; } }); table.addContainerProperty("label", TextField.class, null); table.addGeneratedColumn("label", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("Label component"); label.setSizeUndefined(); label.addStyleName("bold"); return label; } }); table.addContainerProperty("checkbox", TextField.class, null); table.addGeneratedColumn("checkbox", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { CheckBox cb = new CheckBox(null, true); return cb; } }); table.addContainerProperty("optiongroup", TextField.class, null); table.addGeneratedColumn("optiongroup", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { OptionGroup op = new OptionGroup(); op.addItem("Male"); op.addItem("Female"); op.addStyleName("horizontal"); return op; } }); table.addContainerProperty("slider", TextField.class, null); table.addGeneratedColumn("slider", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Slider s = new Slider(); s.setValue(30.0); return s; } }); table.addContainerProperty("progress", TextField.class, null); table.addGeneratedColumn("progress", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { ProgressBar bar = new ProgressBar(); bar.setValue(0.7f); return bar; } }); } table.setFooterVisible(footer); if (footer) { table.setColumnFooter(ValoThemeUI.CAPTION_PROPERTY, "caption"); table.setColumnFooter(ValoThemeUI.DESCRIPTION_PROPERTY, "description"); table.setColumnFooter(ValoThemeUI.ICON_PROPERTY, "icon"); table.setColumnFooter(ValoThemeUI.INDEX_PROPERTY, "index"); } if (sized) { table.setWidth("400px"); table.setHeight("300px"); } else { table.setSizeUndefined(); } if (expandRatios) { if (!sized) { table.setWidth("100%"); } } table.setColumnExpandRatio(ValoThemeUI.CAPTION_PROPERTY, expandRatios ? 1.0f : 0); table.setColumnExpandRatio(ValoThemeUI.DESCRIPTION_PROPERTY, expandRatios ? 1.0f : 0); if (!stripes) { table.addStyleName("no-stripes"); } else { table.removeStyleName("no-stripes"); } if (!verticalLines) { table.addStyleName("no-vertical-lines"); } else { table.removeStyleName("no-vertical-lines"); } if (!horizontalLines) { table.addStyleName("no-horizontal-lines"); } else { table.removeStyleName("no-horizontal-lines"); } if (borderless) { table.addStyleName("borderless"); } else { table.removeStyleName("borderless"); } if (!headers) { table.addStyleName("no-header"); } else { table.removeStyleName("no-header"); } if (compact) { table.addStyleName("compact"); } else { table.removeStyleName("compact"); } if (small) { table.addStyleName("small"); } else { table.removeStyleName("small"); } if (!rowIndex && !rowCaption && rowIcon) { table.setRowHeaderMode(RowHeaderMode.HIDDEN); } if (rowIndex) { table.setRowHeaderMode(RowHeaderMode.INDEX); } if (rowCaption) { table.setRowHeaderMode(RowHeaderMode.PROPERTY); table.setItemCaptionPropertyId(ValoThemeUI.CAPTION_PROPERTY); } else { table.setItemCaptionPropertyId(null); } if (rowIcon) { table.setRowHeaderMode(RowHeaderMode.ICON_ONLY); table.setItemIconPropertyId(ValoThemeUI.ICON_PROPERTY); } else { table.setItemIconPropertyId(null); } }
From source file:com.cavisson.gui.dashboard.components.controls.Tabsheets.java
License:Apache License
public Tabsheets() { setMargin(true);/*from www .ja va 2 s . com*/ Label h1 = new Label("Tabs"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.addStyleName("wrapping"); addComponent(wrap); final CheckBox closable = new CheckBox("Closable"); closable.setImmediate(true); wrap.addComponent(closable); final CheckBox overflow = new CheckBox("Overflow"); overflow.setImmediate(true); wrap.addComponent(overflow); final CheckBox caption = new CheckBox("Captions", true); caption.setImmediate(true); wrap.addComponent(caption); final CheckBox icon = new CheckBox("Icons"); icon.setImmediate(true); wrap.addComponent(icon); final CheckBox disable = new CheckBox("Disable tabs"); disable.setImmediate(true); wrap.addComponent(disable); Label h3 = new Label("Additional Styles"); h3.addStyleName("h3"); addComponent(h3); wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.addStyleName("wrapping"); wrap.setMargin(new MarginInfo(false, false, true, false)); addComponent(wrap); final CheckBox framed = new CheckBox("Framed", true); framed.setImmediate(true); wrap.addComponent(framed); final CheckBox centered = new CheckBox("Centered tabs"); centered.setImmediate(true); wrap.addComponent(centered); final CheckBox rightAlign = new CheckBox("Right-aligned tabs"); rightAlign.setImmediate(true); wrap.addComponent(rightAlign); final CheckBox equal = new CheckBox("Equal-width tabs"); equal.setImmediate(true); wrap.addComponent(equal); final CheckBox padded = new CheckBox("Padded tabbar"); padded.setImmediate(true); wrap.addComponent(padded); final CheckBox compact = new CheckBox("Compact"); compact.setImmediate(true); wrap.addComponent(compact); final CheckBox iconsOnTop = new CheckBox("Icons on top"); iconsOnTop.setImmediate(true); wrap.addComponent(iconsOnTop); final CheckBox selectedOnly = new CheckBox("Selected tab closable"); selectedOnly.setImmediate(true); wrap.addComponent(selectedOnly); ValueChangeListener update = new ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { String style = framed.getValue() ? "framed " : ""; style += centered.getValue() ? " centered-tabs" : ""; style += rightAlign.getValue() ? " right-aligned-tabs" : ""; style += equal.getValue() ? " equal-width-tabs" : ""; style += padded.getValue() ? " padded-tabbar" : ""; style += compact.getValue() ? " compact-tabbar" : ""; style += iconsOnTop.getValue() ? " icons-on-top" : ""; style += selectedOnly.getValue() ? " only-selected-closable" : ""; if (tabs != null) { removeComponent(tabs); } tabs = getTabSheet(caption.getValue(), style.trim(), closable.getValue(), overflow.getValue(), icon.getValue(), disable.getValue()); addComponent(tabs); } }; closable.addValueChangeListener(update); overflow.addValueChangeListener(update); caption.addValueChangeListener(update); icon.addValueChangeListener(update); disable.addValueChangeListener(update); framed.addValueChangeListener(update); centered.addValueChangeListener(update); rightAlign.addValueChangeListener(update); equal.addValueChangeListener(update); padded.addValueChangeListener(update); compact.addValueChangeListener(update); iconsOnTop.addValueChangeListener(update); selectedOnly.addValueChangeListener(update); // Generate initial view icon.setValue(true); }