List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
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// w ww . ja va 2 s . c o m public void buttonClick(ClickEvent event) { onTagRemoved(tag); renderTags(articleItem); } })); } eventBus.fireEvent(new PreviewChangedEvent(preview, ViewType.Tags)); }
From source file:com.peergreen.webconsole.core.exception.ExceptionView.java
License:Open Source License
public ExceptionView(Exception ex) { setSizeFull();/*from w w w. ja v a2 s . c o m*/ addStyleName("dashboard-view"); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setSpacing(true); top.addStyleName("toolbar"); addComponent(top); final Label title = new Label("Oops ! A problem occurred when drawing this view"); title.setSizeUndefined(); title.addStyleName("h1"); top.addComponent(title); top.setComponentAlignment(title, Alignment.MIDDLE_LEFT); top.setExpandRatio(title, 1); HorizontalLayout row = new HorizontalLayout(); row.setSizeFull(); row.setMargin(new MarginInfo(true, true, false, true)); row.setSpacing(true); addComponent(row); setExpandRatio(row, 1.5f); Table t = new Table(); t.setCaption("Stack trace"); t.addContainerProperty("<p style=\"display:none\">Stack</p>", String.class, null); t.setWidth("100%"); t.setImmediate(true); t.addStyleName("plain"); t.addStyleName("borderless"); t.setSortEnabled(false); t.setImmediate(true); t.setSizeFull(); int i = 1; t.addItem(new Object[] { ex.toString() }, i++); for (StackTraceElement element : ex.getStackTrace()) { t.addItem(new Object[] { element.toString() }, i++); } CssLayout panel = new CssLayout(); panel.addStyleName("layout-panel"); panel.setSizeFull(); panel.addComponent(t); row.addComponent(panel); }
From source file:com.peergreen.webconsole.core.navigator.BaseViewNavigator.java
License:Open Source License
/** * Configure navigator// w ww . ja v a 2s. c o m */ private void configure() { this.nav.addView("", new NavigatorView(new CssLayout())); this.nav.addView("/", new NavigatorView(new CssLayout())); this.nav.addViewChangeListener(new NavigatorViewChangeListener()); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build login view// www . j av a 2 s . c om * * @param exit */ private void buildLoginView(final boolean exit) { if (exit) { root.removeAllComponents(); } notifierService.closeAll(); addStyleName("login"); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setId("webconsole_loginlayout_id"); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); //title.setSizeUndefined(); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.focus(); username.setId("webconsole_login_username"); fields.addComponent(username); final PasswordField password = new PasswordField("Password"); password.setId("webconsole_login_password"); fields.addComponent(password); final Button signin = new Button("Sign In"); signin.setId("webconsole_login_signin"); signin.addStyleName("default"); fields.addComponent(signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { signin.click(); } }; signin.addShortcutListener(enter); loginPanel.addComponent(fields); HorizontalLayout bottomRow = new HorizontalLayout(); bottomRow.setWidth(MAX_WIDTH); bottomRow.setMargin(new MarginInfo(false, true, false, true)); final CheckBox keepLoggedIn = new CheckBox("Keep me logged in"); bottomRow.addComponent(keepLoggedIn); bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT); // Add new error message final Label error = new Label("Wrong username or password.", ContentMode.HTML); error.setId("webconsole_login_error"); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); // Add animation error.addStyleName("v-animate-reveal"); error.setVisible(false); bottomRow.addComponent(error); bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT); loginPanel.addComponent(bottomRow); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (authenticate(username.getValue(), password.getValue())) { // if (keepLoggedIn.getValue()) { // //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) { // // Get a token for this user and create a cooki // Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'", // PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath())); // } else { // // update token // userCookie.setValue(token); // userCookie.setPath(VaadinService.getCurrentRequest().getContextPath()); // } // } buildMainView(); } else { error.setVisible(true); } } }); loginLayout.addComponent(loginPanel); loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build main view//from ww w . j a va 2 s .c om */ private void buildMainView() { getPage().setTitle(consoleName); menu = new CssLayout(); menu.setId("webconsole_mainlayout_id"); notifierService.closeAll(); final Button notify = new Button(""); final HorizontalLayout tasksBar = new HorizontalLayout(); tasksBar.setMargin(true); // Build menu layout main = new HorizontalLayout() { { setSizeFull(); addStyleName("main-view"); addComponent(new SidebarView()); VerticalLayout contentRoot = new ConsoleContentView(notify, tasksBar); addComponent(contentRoot); setExpandRatio(contentRoot, 1); } }; notifications = new NotificationWindow(); notifierService.addNotificationsButton(notify, notifications, this); notifierService.addTasksBar(tasksBar, this); menu.removeAllComponents(); // Tell scopesFactories view factories to create views nbScopesToBind = scopesFactories.size(); createScopeViews(); // Start progress indicator root.removeAllComponents(); progressIndicatorLayout = new VerticalLayout(); progressIndicatorLayout.setSizeFull(); progressIndicatorLayout.addStyleName("login-layout"); root.addComponent(progressIndicatorLayout); buildProgressIndicatorView(); menu.addStyleName("menu"); menu.setHeight(MAX_HEIGHT); navigateToPageLocation(); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build Welcome progress indicator view *//*from w w w . ja va 2s .c o m*/ private void buildProgressIndicatorView() { final CssLayout progressPanel = new CssLayout(); progressPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); progressPanel.addComponent(labels); Label welcome = new Label("Welcome " + ((securityManager == null) ? "" : securityManager.getUserName())); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); Float scopesViewsBound = (float) scopes.size(); final Float stopValue = new Float(1.0); if (scopesFactories.isEmpty()) { progressIndicator.setValue(stopValue); } else { progressIndicator.setValue(scopesViewsBound / nbScopesToBind); } if (stopValue.equals(progressIndicator.getValue())) { showMainContent(); } else { // We are still waiting for scopes we have requested their creation, wait a while. TimeOutThread timeOutThread = new TimeOutThread(); timeOutThread.start(); progressIndicator.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (stopValue.equals(event.getProperty().getValue())) { showMainContent(); } } }); } HorizontalLayout progressBarPanel = new HorizontalLayout(); progressBarPanel.setWidth(MAX_WIDTH); progressBarPanel.setMargin(true); progressBarPanel.addComponent(progressIndicator); progressBarPanel.setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER); progressPanel.addComponent(progressBarPanel); progressIndicatorLayout.addComponent(progressPanel); progressIndicatorLayout.setComponentAlignment(progressPanel, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.HelpOverlay.java
License:Open Source License
/** * Notification overlay constructor// w w w . j a v a2s. c o m */ public HelpOverlay() { setContent(new CssLayout()); setPrimaryStyleName("help-overlay"); setDraggable(false); setResizable(false); center(); addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { seen = true; } }); }
From source file:com.peergreen.webconsole.scope.home.FrameView.java
License:Open Source License
private CssLayout createPanel() { panel = new CssLayout(); panel.addStyleName("layout"); panel.setSizeFull(); return panel; }
From source file:com.peergreen.webconsole.vaadin.tabs.DefaultTab.java
License:Open Source License
/** * Add extension shortcut to the default tab content * * @param extension extension object * @param extensionName extension name// w w w. j a va 2 s. c o m * @param extensionIcon extension icon */ public void addExtension(Component extension, final String extensionName, Resource extensionIcon) { Image moduleIcon = new Image(extensionName, extensionIcon); final CssLayout frame = new CssLayout(); frame.addComponent(moduleIcon); frame.addLayoutClickListener(new LayoutEvents.LayoutClickListener() { @Override public void layoutClick(LayoutEvents.LayoutClickEvent event) { Component moduleComponent = modulesComponents.get(extensionName); if (tabs.getTab(moduleComponent) == null) { tabs.addComponent(moduleComponent); tabs.getTab(moduleComponent).setCaption(extensionName); tabs.getTab(moduleComponent).setClosable(true); tabs.setSelectedTab(moduleComponent); } else { tabs.setSelectedTab(moduleComponent); } } }); if (ui != null) { ui.access(new Runnable() { @Override public void run() { addComponent(frame); } }); } else { addComponent(frame); } modulesComponents.put(extensionName, extension); modulesFrames.put(extensionName, frame); }
From source file:com.rex.components.valo.ComboBoxes.java
License:Apache License
public ComboBoxes() { setMargin(true);/*from w w w. j a v 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(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); }