List of usage examples for com.vaadin.ui CssLayout addStyleName
@Override public void addStyleName(String style)
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Welcome"); welcome.setSizeUndefined();// ww w . j a va 2 s . c o m welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label("QuickTickets Dashboard"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
From source file:com.cavisson.gui.dashboard.components.controls.ButtonsAndLinks.java
License:Apache License
/** * */// w ww .ja va2 s.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.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);//from ww w . java2 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);//from w ww. j ava2 s.c o 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(); {/* w w w . j a v a2 s .c o 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 www .j a va 2s .com 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.j av a 2 s . c o 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.cavisson.gui.dashboard.components.controls.TextFields.java
License:Apache License
public TextFields() { setMargin(true);//from w w w.j a v a 2 s. c o m Label h1 = new Label("Text Fields"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TextField tf = new TextField("Normal"); tf.setInputPrompt("First name"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Custom color"); tf.setInputPrompt("Email"); tf.addStyleName("color1"); row.addComponent(tf); tf = new TextField("User Color"); tf.setInputPrompt("Gender"); tf.addStyleName("color2"); row.addComponent(tf); tf = new TextField("Themed"); tf.setInputPrompt("Age"); tf.addStyleName("color3"); row.addComponent(tf); tf = new TextField("Error"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); row.addComponent(tf); tf = new TextField("Error, borderless"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); tf.addStyleName("borderless"); row.addComponent(tf); tf = new TextField("Read-only"); tf.setInputPrompt("Nationality"); tf.setValue("Finnish"); tf.setReadOnly(true); row.addComponent(tf); tf = new TextField("Small"); tf.setValue("Field value"); tf.addStyleName("small"); row.addComponent(tf); tf = new TextField("Large"); tf.setValue("Field value"); tf.addStyleName("large"); tf.setIcon(testIcon.get(true)); row.addComponent(tf); tf = new TextField("Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Large, Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("large"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Small, Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("small"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("16px supported by default"); tf.setInputPrompt("Image icon"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); tf = new TextField(); tf.setValue("Font, no caption"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField(); tf.setValue("Image, no caption"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); CssLayout group = new CssLayout(); group.addStyleName("v-component-group"); row.addComponent(group); tf = new TextField(); tf.setInputPrompt("Grouped with a button"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); tf.setWidth("260px"); group.addComponent(tf); Button button = new Button("Do It"); // button.addStyleName("primary"); group.addComponent(button); tf = new TextField("Borderless"); tf.setInputPrompt("Write here"); tf.addStyleName("inline-icon"); tf.addStyleName("borderless"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Right-aligned"); tf.setValue("1,234"); tf.addStyleName("align-right"); row.addComponent(tf); tf = new TextField("Centered"); tf.setInputPrompt("Guess what?"); tf.addStyleName("align-center"); row.addComponent(tf); PasswordField pwf = new PasswordField("Password"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, right-aligned"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.addStyleName("align-right"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, centered"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.addStyleName("align-center"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); tf = new TextField("Tiny"); tf.setValue("Field value"); tf.addStyleName("tiny"); row.addComponent(tf); tf = new TextField("Huge"); tf.setValue("Field value"); tf.addStyleName("huge"); row.addComponent(tf); h1 = new Label("Text Areas"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TextArea ta = new TextArea("Normal"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Inline icon"); ta.setInputPrompt("Inline icon not really working"); ta.addStyleName("inline-icon"); ta.setIcon(testIcon.get()); row.addComponent(ta); ta = new TextArea("Custom color"); ta.addStyleName("color1"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Custom color, read-only"); ta.addStyleName("color2"); ta.setValue("Field value, spanning multiple lines of text"); ta.setReadOnly(true); row.addComponent(ta); ta = new TextArea("Custom color"); ta.addStyleName("color3"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Small"); ta.addStyleName("small"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Large"); ta.addStyleName("large"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Borderless"); ta.addStyleName("borderless"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Right-aligned"); ta.addStyleName("align-right"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Centered"); ta.addStyleName("align-center"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Tiny"); ta.addStyleName("tiny"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Huge"); ta.addStyleName("huge"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); RichTextArea rta = new RichTextArea(); rta.setValue("<b>Some</b> <i>rich</i> content"); row.addComponent(rta); rta = new RichTextArea("Read-only"); rta.setValue("<b>Some</b> <i>rich</i> content"); rta.setReadOnly(true); row.addComponent(rta); }
From source file:com.cavisson.gui.dashboard.components.controls.ValoThemeUI.java
License:Apache License
Component buildTestMenu() { final CssLayout menu = new CssLayout(); menu.addStyleName("large-icons"); final Label logo = new Label("Va"); logo.setSizeUndefined();//w w w . java2 s . c o m logo.setPrimaryStyleName("valo-menu-logo"); menu.addComponent(logo); Button b = new Button("Reference <span class=\"valo-menu-badge\">3</span>"); b.setIcon(FontAwesome.TH_LIST); b.setPrimaryStyleName("valo-menu-item"); b.addStyleName("selected"); b.setHtmlContentAllowed(true); menu.addComponent(b); b = new Button("API"); b.setIcon(FontAwesome.BOOK); b.setPrimaryStyleName("valo-menu-item"); menu.addComponent(b); b = new Button("Examples <span class=\"valo-menu-badge\">12</span>"); b.setIcon(FontAwesome.TABLE); b.setPrimaryStyleName("valo-menu-item"); b.setHtmlContentAllowed(true); menu.addComponent(b); return menu; }
From source file:com.cms.component.CollapseablePanel.java
void draw(String title, Component body) { CssLayout titleLayout = new CssLayout(); titleLayout.addStyleName("collapsablebox-title"); titleLayout.addComponent(new Label(title)); titleLayout.addListener(new LayoutClickListener() { private static final long serialVersionUID = -4750845792730551399L; @Override/* ww w . ja va2 s . c o m*/ public void layoutClick(LayoutClickEvent event) { toggleBodyVisible(); } }); bodyContainer = new CssLayout(); bodyContainer.addStyleName("collapsablebox-body"); bodyContainer.addComponent(body); root.addComponent(titleLayout); root.addComponent(bodyContainer); }