List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
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(); }//from ww w . ja v 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:com.wintindustries.pfserver.interfaces.view.dashboard.DashboardMenu.java
private Component buildMenuItems() { CssLayout menuItemsLayout = new CssLayout(); menuItemsLayout.addStyleName("valo-menuitems"); for (final DashboardViewType view : DashboardViewType.values()) { Component menuItemComponent = new ValoMenuItemButton(view); /*/*w w w . j ava2 s . c o m*/ if (view == DashboardViewType.REPORTS) { // Add drop target to reports button DragAndDropWrapper reports = new DragAndDropWrapper( menuItemComponent); reports.setSizeUndefined(); reports.setDragStartMode(DragStartMode.NONE); reports.setDropHandler(new DropHandler() { @Override public void drop(final DragAndDropEvent event) { UI.getCurrent() .getNavigator() .navigateTo( DashboardViewType.REPORTS.getViewName()); Table table = (Table) event.getTransferable() .getSourceComponent(); DashboardEventBus.post(new TransactionReportEvent( (Collection<Transaction>) table.getValue())); } @Override public AcceptCriterion getAcceptCriterion() { return AcceptItem.ALL; } }); menuItemComponent = reports; }*/ if (view == DashboardViewType.DASHBOARD) { notificationsBadge = new Label(); notificationsBadge.setId(NOTIFICATIONS_BADGE_ID); menuItemComponent = buildBadgeWrapper(menuItemComponent, notificationsBadge); } if (view == DashboardViewType.REPORTS) { reportsBadge = new Label(); reportsBadge.setId(REPORTS_BADGE_ID); menuItemComponent = buildBadgeWrapper(menuItemComponent, reportsBadge); } menuItemsLayout.addComponent(menuItemComponent); } return menuItemsLayout; }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
private Component buildLabels() { CssLayout labels = new CssLayout(); labels.addStyleName("labels"); Label welcome = new Label("Welcome"); welcome.setSizeUndefined();/* w w w. j ava2 s. c o m*/ welcome.addStyleName(ValoTheme.LABEL_H4); welcome.addStyleName(ValoTheme.LABEL_COLORED); labels.addComponent(welcome); Label title = new Label("PFServer Dashboard"); title.setSizeUndefined(); title.addStyleName(ValoTheme.LABEL_H3); title.addStyleName(ValoTheme.LABEL_LIGHT); labels.addComponent(title); return labels; }
From source file:de.fatalix.app.view.login.LoginView.java
public LoginView() { CssLayout rootLayout = new CssLayout(); rootLayout.addStyleName("login-screen"); Component loginForm = buildLoginForm(); VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); CssLayout loginInformation = buildLoginInformation(); rootLayout.addComponent(centeringLayout); rootLayout.addComponent(loginInformation); setCompositionRoot(rootLayout);/*from www.j av a2 s. c o m*/ }
From source file:de.fatalix.app.view.login.LoginView.java
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();// www .j a va2 s .c om 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 w w . j a v a 2 s. c om loginInformation.addComponent(loginInfoText); return loginInformation; }
From source file:de.fatalix.bookery.App.java
License:Open Source License
@Override protected void init(VaadinRequest request) { Navigator navigator = new Navigator(this, appLayout.getMainContent()); navigator.addProvider(viewProvider); CssLayout contentWrapper = new CssLayout(); contentWrapper.addStyleName("crud-view"); contentWrapper.setSizeFull();/* w w w. j av a2s. c o m*/ contentWrapper.addComponents(appLayout, bookMenuLayout, bookDetailLayout); setContent(contentWrapper); getNavigator().addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeListener.ViewChangeEvent event) { if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); if (!event.getViewName().equals(LoginView.id)) { getNavigator().navigateTo(LoginView.id); return false; } return true; } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (event.getViewName().equals("")) { getNavigator().navigateTo(HomeView.id); return false; } return true; } } @Override public void afterViewChange(ViewChangeListener.ViewChangeEvent event) { } }); if (!isLoggedIn()) { appLayout.getAppHeader().setVisible(false); getNavigator().navigateTo(LoginView.id); } else { appLayout.getAppHeader().setVisible(isLoggedIn()); appLayout.getAppHeader().setLoginName(SecurityUtils.getSubject().getPrincipal().toString()); if (getNavigator().getState().isEmpty()) { getNavigator().navigateTo(HomeView.id); } } }
From source file:de.fatalix.bookery.AppLayout.java
License:Open Source License
@PostConstruct private void postInit() { setSpacing(false);//from www . j av a 2 s. co m setMargin(false); setSizeFull(); content = new CssLayout(); content.setPrimaryStyleName("valo-content"); content.addStyleName("v-scrollable"); content.setWidth(100, Unit.PERCENTAGE); addComponents(appHeader, content); expand(content); addAttachListener(new AttachListener() { @Override public void attach(AttachEvent event) { Responsive.makeResponsive(getUI()); } }); }
From source file:de.fatalix.bookery.view.login.LoginView.java
License:Open Source License
public LoginView() { setSizeFull();// w w w. j ava 2 s . c om CssLayout rootLayout = new CssLayout(); rootLayout.addStyleName("login-screen"); Component loginForm = buildLoginForm(); VerticalLayout centeringLayout = new VerticalLayout(); centeringLayout.setStyleName("centering-layout"); centeringLayout.addComponent(loginForm); centeringLayout.setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); CssLayout loginInformation = buildLoginInformation(); rootLayout.addComponent(centeringLayout); rootLayout.addComponent(loginInformation); setCompositionRoot(rootLayout); }
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 w w w .ja va 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(""); 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; }