List of usage examples for com.vaadin.ui CssLayout setCaption
@Override public void setCaption(String caption)
From source file:com.cavisson.gui.dashboard.components.controls.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);/*from w w w . j av a 2 s . c o m*/ 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
Panel loadingIndicators() { Panel p = new Panel("Loading Indicator"); final VerticalLayout content = new VerticalLayout(); p.setContent(content);/*ww w . j av a 2 s .co m*/ 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 (!ValoThemeUI.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.cavisson.gui.dashboard.components.controls.CommonParts.java
License:Apache License
Panel notifications() { Panel p = new Panel("Notifications"); VerticalLayout content = new VerticalLayout() { Notification notification = new Notification(""); TextField title = new TextField("Title"); TextArea description = new TextArea("Description"); MenuBar style = new MenuBar(); MenuBar type = new MenuBar(); String typeString = ""; String styleString = ""; TextField delay = new TextField(); {/*from ww w. jav a 2 s . co m*/ setSpacing(true); setMargin(true); title.setInputPrompt("Title for the notification"); title.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (title.getValue() == null || title.getValue().length() == 0) { notification.setCaption(null); } else { notification.setCaption(title.getValue()); } } }); title.setValue("Notification Title"); title.setWidth("100%"); addComponent(title); description.setInputPrompt("Description for the notification"); description.addStyleName("small"); description.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { if (description.getValue() == null || description.getValue().length() == 0) { notification.setDescription(null); } else { notification.setDescription(description.getValue()); } } }); description.setValue( "A more informative message about what has happened. Nihil hic munitissimus habendi senatus locus, nihil horum? Inmensae subtilitatis, obscuris et malesuada fames. Hi omnes lingua, institutis, legibus inter se differunt."); description.setWidth("100%"); addComponent(description); Command typeCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { if (selectedItem.getText().equals("Humanized")) { typeString = ""; notification.setStyleName(styleString.trim()); } else { typeString = selectedItem.getText().toLowerCase(); notification.setStyleName((typeString + " " + styleString.trim()).trim()); } for (MenuItem item : type.getItems()) { item.setChecked(false); } selectedItem.setChecked(true); } }; type.setCaption("Type"); MenuItem humanized = type.addItem("Humanized", typeCommand); humanized.setCheckable(true); humanized.setChecked(true); type.addItem("Tray", typeCommand).setCheckable(true); type.addItem("Warning", typeCommand).setCheckable(true); type.addItem("Error", typeCommand).setCheckable(true); type.addItem("System", typeCommand).setCheckable(true); addComponent(type); type.addStyleName("small"); Command styleCommand = new Command() { @Override public void menuSelected(final MenuItem selectedItem) { styleString = ""; for (MenuItem item : style.getItems()) { if (item.isChecked()) { styleString += " " + item.getText().toLowerCase(); } } if (styleString.trim().length() > 0) { notification.setStyleName((typeString + " " + styleString.trim()).trim()); } else if (typeString.length() > 0) { notification.setStyleName(typeString.trim()); } else { notification.setStyleName(null); } } }; style.setCaption("Additional style"); style.addItem("Dark", styleCommand).setCheckable(true); style.addItem("Success", styleCommand).setCheckable(true); style.addItem("Failure", styleCommand).setCheckable(true); style.addItem("Bar", styleCommand).setCheckable(true); style.addItem("Small", styleCommand).setCheckable(true); style.addItem("Closable", styleCommand).setCheckable(true); addComponent(style); style.addStyleName("small"); CssLayout group = new CssLayout(); group.setCaption("Fade delay"); group.addStyleName("v-component-group"); addComponent(group); delay.setInputPrompt("Infinite"); delay.addStyleName("align-right"); delay.addStyleName("small"); delay.setWidth("7em"); delay.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { try { notification.setDelayMsec(Integer.parseInt(delay.getValue())); } catch (Exception e) { notification.setDelayMsec(-1); delay.setValue(""); } } }); delay.setValue("1000"); group.addComponent(delay); Button clear = new Button(null, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { delay.setValue(""); } }); clear.setIcon(FontAwesome.TIMES_CIRCLE); clear.addStyleName("last"); clear.addStyleName("small"); clear.addStyleName("icon-only"); group.addComponent(clear); group.addComponent(new Label(" msec", ContentMode.HTML)); GridLayout grid = new GridLayout(3, 3); grid.setCaption("Show in position"); addComponent(grid); grid.setSpacing(true); Button pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.TOP_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.MIDDLE_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_LEFT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_CENTER); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); pos = new Button("", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { notification.setPosition(Position.BOTTOM_RIGHT); notification.show(Page.getCurrent()); } }); pos.addStyleName("small"); grid.addComponent(pos); } }; p.setContent(content); return p; }
From source file:com.cavisson.gui.dashboard.components.controls.DateFields.java
License:Apache License
public DateFields() { setMargin(true);//from ww w . j av a 2 s . c o m Label h1 = new Label("Date Fields"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); DateField date = new DateField("Default resolution"); setDate(date); row.addComponent(date); date = new DateField("Error"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); row.addComponent(date); date = new DateField("Error, borderless"); setDate(date); date.setComponentError(new UserError("Fix it, now!")); date.addStyleName("borderless"); row.addComponent(date); CssLayout group = new CssLayout(); group.setCaption("Grouped with a Button"); group.addStyleName("v-component-group"); row.addComponent(group); final DateField date2 = new DateField(); group.addComponent(date2); Button today = new Button("Today", new ClickListener() { @Override public void buttonClick(ClickEvent event) { date2.setValue(new Date()); } }); group.addComponent(today); date = new DateField("Default resolution, explicit size"); setDate(date); row.addComponent(date); date.setWidth("260px"); date.setHeight("60px"); date = new DateField("Second resolution"); setDate(date); date.setResolution(Resolution.SECOND); row.addComponent(date); date = new DateField("Minute resolution"); setDate(date); date.setResolution(Resolution.MINUTE); row.addComponent(date); date = new DateField("Hour resolution"); setDate(date); date.setResolution(Resolution.HOUR); row.addComponent(date); date = new DateField("Disabled"); setDate(date); date.setResolution(Resolution.HOUR); date.setEnabled(false); row.addComponent(date); date = new DateField("Day resolution"); setDate(date); date.setResolution(Resolution.DAY); row.addComponent(date); date = new DateField("Month resolution"); setDate(date); date.setResolution(Resolution.MONTH); row.addComponent(date); date = new DateField("Year resolution"); setDate(date); date.setResolution(Resolution.YEAR); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color1"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color2"); row.addComponent(date); date = new DateField("Custom color"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("color3"); row.addComponent(date); date = new DateField("Small"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("small"); row.addComponent(date); date = new DateField("Large"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("large"); row.addComponent(date); date = new DateField("Borderless"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("borderless"); row.addComponent(date); date = new DateField("Week numbers"); setDate(date); date.setResolution(Resolution.DAY); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); date = new DateField("US locale"); setDate(date); date.setResolution(Resolution.SECOND); date.setLocale(new Locale("en", "US")); row.addComponent(date); date = new DateField("Custom format"); setDate(date); date.setDateFormat("E dd/MM/yyyy"); row.addComponent(date); date = new DateField("Tiny"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("tiny"); row.addComponent(date); date = new DateField("Huge"); setDate(date); date.setResolution(Resolution.DAY); date.addStyleName("huge"); row.addComponent(date); date = new InlineDateField("Date picker"); setDate(date); row.addComponent(date); date = new InlineDateField("Date picker with week numbers"); setDate(date); date.setLocale(new Locale("fi", "fi")); date.setShowISOWeekNumbers(true); row.addComponent(date); }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);/*from w w w .ja v a2s . co m*/ 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.etest.valo.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);//from w ww . j av a 2 s . com 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(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.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(MainUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.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(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.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(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(MainUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(MainUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(MainUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
From source file:com.etest.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 ava 2s. c om*/ 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 (!MainUI.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.nfl.dm.clubsites.cms.articles.subapp.articleeditor.tagging.TaggingPresenter.java
License:Open Source License
private void generatePreview() { final CssLayout preview = new CssLayout(); preview.addStyleName("tagging-preview"); preview.setCaption("Tags"); List<Tag> tags = service.getTagsForNode(articleItem.getJcrItem()); for (int i = 0; i < Math.min(5, tags.size()); ++i) { final Tag tag = tags.get(i); preview.addComponent(new TagField(tag, new Button.ClickListener() { @Override//from www . j a v a 2 s . co m public void buttonClick(ClickEvent event) { onTagRemoved(tag); renderTags(articleItem); } })); } eventBus.fireEvent(new PreviewChangedEvent(preview, ViewType.Tags)); }
From source file:com.rex.components.valo.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);// ww w .j a va 2 s.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(ReportEngineUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false)); combo.setNullSelectionAllowed(false); combo.select(combo.getItemIds().iterator().next()); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("color1"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("color2"); row.addComponent(combo); combo = new ComboBox("Custom color"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("color3"); row.addComponent(combo); combo = new ComboBox("Small"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("small"); row.addComponent(combo); combo = new ComboBox("Large"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.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(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("tiny"); row.addComponent(combo); combo = new ComboBox("Huge"); combo.setInputPrompt("You can type here"); combo.setContainerDataSource(ReportEngineUI.generateContainer(200, false)); combo.setItemCaptionPropertyId(ReportEngineUI.CAPTION_PROPERTY); combo.setItemIconPropertyId(ReportEngineUI.ICON_PROPERTY); combo.addStyleName("huge"); row.addComponent(combo); }
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 . jav a2s . co m 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; }