List of usage examples for com.vaadin.ui CssLayout setStyleName
@Override public void setStyleName(String style)
From source file:com.thingtrack.myToolbar.MyVaadinApplication.java
License:Apache License
@Override public void init() { setTheme("konekti"); mainWindow = new Window("My dynamic toolbar"); mainWindow.setStyleName("background"); toolbarLayout = new CssLayout() { int brickCounter = 0; @Override/*from w w w .ja v a 2 s. c o m*/ protected String getCss(Component c) { // colorize every third rendered brick if (c instanceof Brick) { brickCounter++; if (brickCounter % 3 == 0) { // make every third brick colored and italic return "color: #ff6611; font-style: italic;"; } } return null; } public void removeComponent(Component c) { brickCounter--; super.removeComponent(c); }; }; toolbarLayout.setStyleName("toolbar_layout"); toolbarLayout.setWidth("100%"); mainWindow.addComponent(toolbarLayout); setMainWindow(mainWindow); //Buttons HorizontalLayout buttonLayout = new HorizontalLayout(); mainWindow.addComponent(buttonLayout); Button btnAddToolbar = new Button("Add Toolbar"); btnAddToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // toolbarLayout.addComponent(new NavigationToolbar()); // toolbarLayout.addComponent(new Brick()); // toolbarLayout.addComponent(new SimplifiedNavigationToolbar()); CssLayout layout = new CssLayout(); layout.setStyleName("toolbar"); layout.addComponent(new Button("Botn 1")); layout.addComponent(new Button("Botn 2")); layout.addComponent(new Button("Botn 3")); toolbarLayout.addComponent(layout); } }); buttonLayout.addComponent(btnAddToolbar); Button btnBoxToolbar = new Button("Box Toolbar"); btnBoxToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { //toolbarLayout2.addToolbar(new BoxToolbar()); toolbarLayout.addComponent(new BoxToolbar()); } }); buttonLayout.addComponent(btnBoxToolbar); Button btnRemoveToolbar = new Button("Remove Toolbar"); btnRemoveToolbar.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { // if (toolBarPanel.getToolbarLayout().getToolbars().length == 0) // return; // // Component toolbar = toolBarPanel.getToolbarLayout().getToolbars()[toolBarPanel.getToolbarLayout().getToolbars().length - 1]; // // toolbarLayout.removeComponent((CustomComponent) toolbar); if (toolbarLayout.getComponentCount() == 0) return; toolbarLayout.removeComponent(toolbarLayout.getComponent(toolbarLayout.getComponentCount() - 1)); // } }); buttonLayout.addComponent(btnRemoveToolbar); }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildFolderTree() { CssLayout treeLayout = new CssLayout(); treeLayout.setWidth("100%"); if (treeLayout.getComponentCount() > 0) { treeLayout.removeAllComponents(); }/* w w w . jav a 2 s .c om*/ System.out.println("Init Dataasource"); for (PFDataSource source : PFCore.core.getDataSources()) { System.out.println("NEW TREE"); Label label = new Label(source.getName(), ContentMode.HTML); label.setPrimaryStyleName("valo-menu-subtitle"); label.addStyleName("h4"); label.setSizeUndefined(); treeLayout.addComponent(label); // label.setIcon(FontAwesome.LAPTOP); treeLayout.addStyleName("valo-menuitems"); Tree tree = new Tree(); //tree.setIcon(FontAwesome.LAPTOP); // tree.setWidth("100%"); // container.setItemSorter(new l); source.Session().OpenSession(); source.Session().getSession().beginTransaction(); source.Session().getSession().getTransaction().setTimeout(4); System.out.println(": " + source.getDatabase().getSessionManager()); Set<PFFolder> rootFolders = PFLocation.getRootDirectoriesFromDatabase(source.getDatabase()); System.out.println(": " + source.getDatabase().getSessionManager()); final PFFolderProxyContainer container = new PFFolderProxyContainer(rootFolders, source); container.setSortAlphabetic(true); tree.setContainerDataSource(container); tree.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); tree.setItemCaptionPropertyId("Name"); tree.setItemIconPropertyId("Icon"); ItemClickListener treeclick; treeclick = new ItemClickListener() { @Override public void itemClick(final ItemClickEvent event) { // Notification note = new Notification("Notificaton", event.getItemId().toString(), Notification.Type.ERROR_MESSAGE); // note.show(Page.getCurrent()); PFFolderProxy proxyFolder = (PFFolderProxy) event.getItemId(); MyUI.getPFNavigator().navigateTo(MyUI.PAGE_FOLDERVIEW + "/" + proxyFolder.getIdentifier()); } }; tree.addItemClickListener(treeclick); // Allow all nodes to have children // .dashboard-menu-folder-wrapper // all these wrappers are a hacky workaround to a Vaadin CSS glitch CssLayout treeWrapper = new CssLayout(); treeWrapper.setStyleName(".dashboard-menu-folder-wrapper"); treeWrapper.addComponent(tree); treeWrapper.setWidth("40px"); tree.setWidth("800px"); tree.setStyleName(".dashboard-menu-folder-tree"); treeLayout.addComponent(treeWrapper); source.Session().getSession().getTransaction().commit(); source.getDatabase().getSessionManager().CloseSession(); } return treeLayout; }
From source file:de.fatalix.app.view.login.LoginView.java
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();/*from w w w . j a v a 2s .c o m*/ loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription("Write anything"); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); buttons.addComponent(login = new Button("Login")); login.setDisableOnClick(true); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } finally { login.setEnabled(true); } } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Try anything", Notification.Type.HUMANIZED_MESSAGE), ValoTheme.NOTIFICATION_SUCCESS); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:de.fatalix.app.view.login.LoginView.java
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); Label loginInfoText = new Label("<h1>Welcome to Bookshelf</h1>" + "Please provide your login to access your library. If you have problems logging in, please contact your administrator.", ContentMode.HTML);/* w ww .ja v a 2s . co m*/ loginInformation.addComponent(loginInfoText); return loginInformation; }
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();/*from ww w .j a v a 2 s. c o m*/ loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription(""); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); login = new Button("login"); buttons.addComponent(login); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } finally { login.setEnabled(true); } } }); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Ask me", Notification.Type.HUMANIZED_MESSAGE), ValoTheme.NOTIFICATION_SUCCESS); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); Panel loginPanel = new Panel(loginForm); loginPanel.setWidthUndefined(); loginPanel.addStyleName(ValoTheme.PANEL_BORDERLESS); loginPanel.addAction(new ShortcutListener("commit", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { try { presenter.doLogin(username.getValue(), password.getValue()); } catch (AuthenticationException ex) { LoginView.this.showNotification( new Notification("Wrong login", Notification.Type.ERROR_MESSAGE), ValoTheme.NOTIFICATION_FAILURE); } } }); return loginPanel; }
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); Label loginInfoText = new Label("<h1>Welcome to Bookery</h1>" + "Please provide your login to access your library. If you have problems logging in, please contact your administrator.", ContentMode.HTML);// w ww . j a v a2s . co m loginInformation.addComponent(loginInfoText); return loginInformation; }
From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java
License:Apache License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();// w ww .j ava 2 s . c om loginForm.setMargin(false); loginForm.addComponent(username = new TextField(translate("login.name.caption"))); username.setDescription(translate("login.name.description")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField(translate("login.password.caption"))); password.setWidth(15, Unit.EM); password.setDescription(translate("login.password.description")); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); login = new Button(translate("login.login-button.caption")); buttons.addComponent(login); login.setDescription(translate("login.login-button.description")); login.setDisableOnClick(true); login.addClickListener(event -> { try { login(); } finally { login.setEnabled(true); } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button forgotPassword; buttons.addComponent(forgotPassword = new Button(translate("login.password-forgotten.caption"))); forgotPassword.setDescription(translate("login.password-forgotten.description")); forgotPassword.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { NotificationPayload notification = new NotificationPayload("login.password-forgotten.text"); bus.post(new NotificationEvent(this, notification)); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:de.kaiserpfalzEdv.vaadin.LoginScreen.java
License:Apache License
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); Label loginInfoText = new Label(translate("login.info-text"), ContentMode.HTML); loginInformation.addComponent(loginInfoText); return loginInformation; }
From source file:de.symeda.sormas.ui.login.LoginScreen.java
License:Open Source License
private void buildUI() { addStyleName("login-screen"); // login form, centered in the available part of the screen VerticalLayout loginFormLayout = new VerticalLayout(); loginFormLayout.addStyleName("login-form"); loginFormLayout.setMargin(false);//from w w w . ja v a 2 s. c o m Component loginForm = buildLoginForm(); loginFormLayout.addComponent(loginForm); loginFormLayout.addComponent(buildLoginDetailsLayout()); // layout to center login form when there is sufficient screen space // - see the theme for how this is made responsive for various screen // sizes CssLayout loginLayout = new CssLayout(); loginLayout.setStyleName("login-form-container"); loginLayout.addComponent(loginFormLayout); // information text about logging in CssLayout loginInformation = buildLoginInformation(); // custom html layout CssLayout loginSidebarLayout = buildLoginSidebarLayout(); addComponent(loginInformation); addComponent(loginLayout); addComponent(loginSidebarLayout); }
From source file:de.symeda.sormas.ui.login.LoginScreen.java
License:Open Source License
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); VerticalLayout innerLayout = new VerticalLayout(); innerLayout.setSizeFull();// w ww.j a v a 2 s . c o m Image img = new Image(null, new ThemeResource("img/sormas-logo-big.png")); img.setHeight(240, Unit.PIXELS); innerLayout.addComponent(img); innerLayout.setComponentAlignment(img, Alignment.TOP_CENTER); innerLayout.setExpandRatio(img, 0); Label loginInfoText = new Label("<h1>SORMAS</h1>" + "<h2 style='color:white'>Surveillance, Outbreak Response Management and Analysis System</h2>" + "<h3 style='color:white; text-transform:uppercase'>● Disease Prevention<br>● Disease Detection<br>● Outbreak Response</h3>", ContentMode.HTML); loginInfoText.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoText); innerLayout.setExpandRatio(loginInfoText, 1); Label loginInfoCopyright = new Label(" 2019 SORMAS. All Rights Reserved."); loginInfoCopyright.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoCopyright); innerLayout.setExpandRatio(loginInfoCopyright, 0); innerLayout.setComponentAlignment(loginInfoCopyright, Alignment.BOTTOM_LEFT); loginInformation.addComponent(innerLayout); return loginInformation; }