List of usage examples for com.vaadin.ui CssLayout addComponent
@Override public void addComponent(Component c)
From source file:annis.gui.components.HelpButton.java
License:Apache License
public HelpButton(Field<T> field) { Validate.notNull(field);/*from ww w .j a v a 2s . c om*/ this.field = field; CssLayout layout = new CssLayout(); setCompositionRoot(layout); Button btHelp = new Button(""); btHelp.setIcon(FontAwesome.QUESTION); btHelp.addStyleName(ChameleonTheme.BUTTON_BORDERLESS); btHelp.addStyleName("helpbutton"); btHelp.addClickListener((Button.ClickListener) this); setCaption(field.getCaption()); field.setCaption(null); layout.addComponent(field); layout.addComponent(btHelp); }
From source file:at.peppol.webgui.app.MainWindow.java
License:Mozilla Public License
@SuppressWarnings("serial") private void initUI() { final VerticalLayout root = new VerticalLayout(); root.setMargin(false);/*from w w w. ja va 2 s . c o m*/ setContent(root); // createTopBar(); // Changed with menuBar -- under testing createMenuBar(); // Changed with custom layout using bootstrap -- under testing // createHeaderMenu(); final UserFolder<File> userFolder = new UserFolder<File>(); final long polling = 20000; int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //Buttons final NativeButton inboxInvoices = new NativeButton("Invoices (" + inboxInvoicesNum + ")"); final NativeButton outboxInvoices = new NativeButton("Invoices (" + outboxInvoicesNum + ")"); final NativeButton draftInvoices = new NativeButton("Invoices (" + draftInvoicesNum + ")"); //thread final Thread tFolderCount = new Thread(new Runnable() { @Override public void run() { try { while (true) { int countDrafts = um.countItemsInSpace(um.getDrafts()); int countInbox = um.countItemsInSpace(um.getInbox()); int countOutbox = um.countItemsInSpace(um.getOutbox()); synchronized (MainWindow.this.getApplication()) { String labelD = draftInvoices.getCaption(); labelD = labelD.replaceFirst("[\\d]+", "" + countDrafts); draftInvoices.setCaption(labelD); String labelI = inboxInvoices.getCaption(); labelI = labelI.replaceFirst("[\\d]+", "" + countInbox); inboxInvoices.setCaption(labelI); String labelO = outboxInvoices.getCaption(); labelO = labelO.replaceFirst("[\\d]+", "" + countOutbox); outboxInvoices.setCaption(labelO); itemsPanel.reloadTable(userFolder); } Thread.sleep(polling); } } catch (InterruptedException e) { System.out.println("Thread folders interrupted!!!"); } } }); // ------ START: Left NavBar ------- final CssLayout leftNavBar = new CssLayout(); leftNavBar.setStyleName("sidebar-menu"); leftNavBar.setSizeFull(); leftNavBar.setWidth("220px"); // User theUser = (User) getApplication().getUser(); final Label homeLbl = new Label("HOME"); homeLbl.addStyleName("blue"); leftNavBar.addComponent(homeLbl); leftNavBar.addComponent(new Label("INBOX")); final NativeButton catalogueBtn = new NativeButton("Catalogue"); leftNavBar.addComponent(catalogueBtn); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int inboxInvoicesNum = um.countItemsInSpace(um.getInbox()); //inboxInvoices = new NativeButton ("Invoices ("+inboxInvoicesNum+")"); inboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { inboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getInbox()) + ")"); userFolder.setFolder(um.getInbox().getFolder()); userFolder.setName(um.getInbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(inboxInvoices); leftNavBar.addComponent(new Label("DRAFTS")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //int draftInvoicesNum = um.countItemsInSpace(um.getDrafts()); //draftInvoices = new NativeButton ("Invoices ("+draftInvoicesNum+")"); draftInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { draftInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getDrafts()) + ")"); userFolder.setFolder(um.getDrafts().getFolder()); userFolder.setName(um.getDrafts().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(draftInvoices); leftNavBar.addComponent(new Label("OUTBOX")); leftNavBar.addComponent(new NativeButton("Catalogue")); leftNavBar.addComponent(new NativeButton("Orders")); //leftNavBar.addComponent (new NativeButton ("Invoices")); //int outboxInvoicesNum = um.countItemsInSpace(um.getOutbox()); //outboxInvoices = new NativeButton ("Invoices ("+outboxInvoicesNum+")"); outboxInvoices.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { outboxInvoices.setCaption("Invoices (" + um.countItemsInSpace(um.getOutbox()) + ")"); userFolder.setFolder(um.getOutbox().getFolder()); userFolder.setName(um.getOutbox().getName()); showInitialMainContent(userFolder); draftInvoices.removeStyleName("v-bold-nativebuttoncaption"); } }); leftNavBar.addComponent(outboxInvoices); leftNavBar.addComponent(new Label("SETTINGS")); leftNavBar.addComponent(new NativeButton("My Profile")); leftNavBar.addComponent(new NativeButton("Customers")); leftNavBar.addComponent(new NativeButton("Suppliers")); final Embedded peppolLogoImg = new Embedded(null, new ExternalResource("img/peppol_logo.png")); peppolLogoImg.setStyleName("logo"); leftNavBar.addComponent(peppolLogoImg); middleContentLayout.addComponent(leftNavBar); /*Button refreshButton = new Button("Refresh"); refreshButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { int draftInvoices = um.countItemsInSpace(um.getDrafts()); invoices.setCaption("Invoices ("+draftInvoices+")"); } }); leftNavBar.addComponent(refreshButton);*/ //workaround so that thread refreshes UI. It seems that when a ProgressIndicator is present, //all components receive server side refreshes ProgressIndicator p = new ProgressIndicator(); p.setPollingInterval((int) polling); p.setWidth("0px"); p.setHeight("0px"); leftNavBar.addComponent(p); showInitialMainContent(null); draftInvoices.click(); tFolderCount.start(); draftInvoices.addStyleName("v-bold-nativebuttoncaption"); }
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();/*w w w.j a v a 2s . 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
/** * *///from w ww . j a v a 2 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);/* www. ja va 2s. 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 a2 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(); {//from ww w.j a v a 2 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);/* w w w . j a v 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.Dragging.java
License:Apache License
private List<Component> createComponents() { final List<Component> components = new ArrayList<Component>(); final Label label = new Label("This is a long text block that will wrap."); label.setWidth("120px"); components.add(label);/*from w w w . j av a 2s . co m*/ final Embedded image = new Embedded("", new ThemeResource("../runo/icons/64/document.png")); components.add(image); final CssLayout documentLayout = new CssLayout(); documentLayout.setWidth("19px"); for (int i = 0; i < 5; ++i) { final Embedded e = new Embedded(null, new ThemeResource("../runo/icons/16/document.png")); e.setHeight("16px"); e.setWidth("16px"); documentLayout.addComponent(e); } components.add(documentLayout); final VerticalLayout buttonLayout = new VerticalLayout(); final Button button = new Button("Button"); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(final ClickEvent event) { Notification.show("Button clicked"); } }); buttonLayout.addComponent(button); buttonLayout.setComponentAlignment(button, Alignment.MIDDLE_CENTER); components.add(buttonLayout); return components; }
From source file:com.cavisson.gui.dashboard.components.controls.Panels.java
License:Apache License
public Panels() { setMargin(true);/* w w w .j a va 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); }