List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout
public VerticalLayout()
From source file:com.freebox.engeneering.application.web.layout.RightSideBarController.java
License:Apache License
/** * This method is called every time system enters any profile state * * @param stateEvent -state event.//from w ww .j a va 2s . co m */ @OnEnterState(StateConstants.PROFILE) public void buildRightSideBarView(StateEvent stateEvent) { clearView(stateEvent); final Accordion accordion = super.getView(); final VerticalLayout verticalLayout = new VerticalLayout(); accordion.addTab(verticalLayout, "Right Side Bar"); final VerticalLayout contentLayout = new VerticalLayout(); contentLayout.setMargin(true); contentLayout.setSpacing(true); contentLayout.addComponent(new Label("www.lexaden.com<br/>contact@lexaden.com", ContentMode.HTML)); verticalLayout.addComponent(contentLayout); }
From source file:com.garyclayburg.vconsole.TargetWindows.java
License:Open Source License
private VerticalLayout populateTargetWindowData(User selectedUser, String entitledTarget) { VerticalLayout windowContent = new VerticalLayout(); windowContent.setMargin(false);/* ww w .j a v a 2 s . c o m*/ final Table attributeTargetTable = new Table(); attributeTargetTable.setSizeFull(); attributeTargetTable.setSelectable(true); attributeTargetTable.setMultiSelect(false); attributeTargetTable.setImmediate(true); final BeanContainer<String, GeneratedAttributesBean> attributesBeanContainer = new BeanContainer<>( GeneratedAttributesBean.class); attributesBeanContainer.setBeanIdProperty("attributeName"); populateItems(selectedUser, attributesBeanContainer, entitledTarget); attributeTargetTable.setContainerDataSource(attributesBeanContainer); windowContent.addComponent(attributeTargetTable); return windowContent; }
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
protected void init(VaadinRequest vaadinRequest) { final Refresher refresher = new Refresher(); refresher.addListener(new Refresher.RefreshListener() { @Override//w ww . j ava 2 s.c o m public void refresh(Refresher refresher) { // log.debug("refreshing UI..."); } }); addExtension(refresher); addStyleName("dashboard-view"); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); searchStatus = new Label("0 users matching: "); TextField searchField = new TextField(); searchField.setInputPrompt("first or last name"); searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); searchField.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override public void textChange(FieldEvents.TextChangeEvent event) { String searchText = event.getText(); log.debug("search: {}", searchText); QUser qUser = new QUser("user"); long startSearch = System.nanoTime(); if (searchText.length() > 2) { Iterable<User> searchedUsers = autoUserRepo.findAll(qUser.firstname .containsIgnoreCase(searchText).or(qUser.lastname.containsIgnoreCase(searchText))); long endSearch = System.nanoTime(); log.info("Finshed searching for \"{}\" in {} secs", searchText, ((endSearch - startSearch) / 1000000000.0)); searchStatus.setValue("? users matching: " + searchText); updateUserList(searchedUsers, searchText); } else if (searchText.equals("*")) { Iterable<User> searchedUsers = autoUserRepo.findAll(); long endSearch = System.nanoTime(); log.info("Searched for \"{}\" in {} secs", searchText, ((endSearch - startSearch) / 1000000000.0)); searchStatus.setValue("? users matching: " + searchText); updateUserList(searchedUsers, searchText); } else { log.debug("not enough chars"); searchStatus.setValue("* for all users..."); } } }); createExceptionWindow("no errors yet..."); final User finalFirstUser = firstUser; policyChangeController.addChangeListener(new PolicyChangeListener() { @Override public void policyChanged() { log.info("policy is changing"); BeanContainer beanContainer = (BeanContainer) userTable.getContainerDataSource(); List itemIds = beanContainer.getItemIds(); boolean refreshedSelected = false; for (Object itemId : itemIds) { String id = (String) itemId; BeanItem item = beanContainer.getItem(itemId); log.debug("refreshing user id: " + id); User user = (User) item.getBean(); log.debug("refreshing user: " + user.getFirstname()); if (userTable.isSelected(itemId)) { refreshUserValues(user); refreshedSelected = true; } } log.debug("forcing table update"); updateRightClickItems(); log.debug("forcing table update complete"); if (!refreshedSelected && finalFirstUser != null) { refreshUserValues(finalFirstUser); } int numErrors = populatePolicyExceptionList(); // this will catch runtime errors not caught during groovy compile if (numErrors == 0) { showPolicyUpdated(); } } @Override public void policyException(Throwable e) { populatePolicyExceptionList(); //cannot compile operator supplied groovy? } }); attributeTable = new Table(); attributeTable.setSizeFull(); attributeTable.setSelectable(true); attributeTable.setMultiSelect(false); attributeTable.setImmediate(true); attributesBeanContainer = new BeanContainer<>(GeneratedAttributesBean.class); attributesBeanContainer.setBeanIdProperty("attributeName"); attributeTable.setContainerDataSource(attributesBeanContainer); BeanContainer<String, User> userBeanContainer = new BeanContainer<>(User.class); userBeanContainer.setBeanIdProperty("id"); userTable = createUserTable(userBeanContainer); userTable.addItemClickListener(new ItemClickEvent.ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { User selectedUser = (User) ((BeanItem) event.getItem()).getBean(); refreshUserValues(selectedUser); populatePolicyExceptionList(); // maybe this user clicked on causes runtime exception in groovy? } }); HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); splitPanel.setSizeFull(); splitPanel.setSplitPosition(150, Unit.PIXELS); splitPanel.setFirstComponent(userTable); splitPanel.setSecondComponent(attributeTable); // MenuBar menuBar = createMenu(); // layout.addComponent(menuBar); HorizontalLayout top = createTop(); populatePolicyExceptionList(); //initial check for groovy errors layout.addComponent(top); layout.addComponent(searchField); layout.addComponent(searchStatus); layout.addComponent(splitPanel); populateItems(firstUser, attributesBeanContainer); }
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
private void buildNotifications(Button.ClickEvent event) { VerticalLayout l = new VerticalLayout(); l.setMargin(true);/*from w w w. ja v a 2 s . co m*/ l.setSpacing(true); notifications.setContent(l); notifications.setWidth("1000px"); notifications.setHeight("500px"); notifications.addStyleName("notifications"); notifications.setClosable(false); notifications.setResizable(true); notifications.setDraggable(false); notifications.setPositionX(event.getClientX() - event.getRelativeX() - 40); /* magic number used to adjust right edge of window so that it draws within the browser window. This number is related to css values in dashboard.scss and relative positioning of the bell icon in topLayout */ notifications.setPositionY(event.getClientY() - event.getRelativeY()); notifications.setCloseShortcut(ShortcutAction.KeyCode.ESCAPE, null); synchronized (scriptErrorsLock) { log.debug("checking for new policy errors {}", scriptErrors.size()); Label messageLabel; if (scriptErrors.size() > 0) { for (String absolutePath : scriptErrors.keySet()) { Throwable scriptException = scriptErrors.get(absolutePath); String message = scriptException.getMessage(); if (message != null) { String formattedMessage = MessageHelper.scrubMessage(message); messageLabel = new Label("<hr>" + formattedMessage, ContentMode.HTML); } else { StringWriter errors = new StringWriter(); scriptException.printStackTrace(new PrintWriter(errors)); String stackTrace = errors.toString(); stackTrace = MessageHelper.scrubMessage(stackTrace); messageLabel = new Label("<hr>" + stackTrace, ContentMode.HTML); } messageLabel.setStyleName(Runo.LABEL_SMALL); l.addComponent(messageLabel); } } else { messageLabel = new Label("<hr>none<br>", ContentMode.HTML); messageLabel.setStyleName(Runo.LABEL_SMALL); l.addComponent(messageLabel); } } }
From source file:com.garyclayburg.vconsole.VConsole.java
License:Open Source License
private void populateExceptionMessage(String message, boolean visible) { VerticalLayout windowContent = new VerticalLayout(); windowContent.setMargin(true);// w w w.ja va 2 s . c o m Label messageLabel = new Label(message, ContentMode.PREFORMATTED); messageLabel.setStyleName(Runo.LABEL_SMALL); // messageLabel.setWidth("120em"); windowContent.addComponent(messageLabel); Button closeButton = new Button("Close"); closeButton.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { exceptionWindow.setVisible(false); } }); windowContent.addComponent(closeButton); UI ui = exceptionWindow.getUI(); if (ui != null) { VaadinSession session = ui.getSession(); if (session != null) { session.getLockInstance().lock(); try { exceptionWindow.setContent(windowContent); exceptionWindow.setVisible(visible); } finally { session.getLockInstance().unlock(); } } else { exceptionWindow.setContent(windowContent); exceptionWindow.setVisible(visible); } } else { exceptionWindow.setContent(windowContent); exceptionWindow.setVisible(visible); } }
From source file:com.github.carljmosca.ui.MainUI.java
private void addComponents() { mainLayout = new VerticalLayout(); addHeader(); setContent(mainLayout); }
From source file:com.github.cjm.TmdbUI.java
public TmdbUI() { mainLayout = new VerticalLayout(); buttonLayout = new HorizontalLayout(); userSectionLayout = new HorizontalLayout(); tvShowGridLayout = new HorizontalLayout(); }
From source file:com.github.djabry.platform.vaadin.ui.MainUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull();// w ww . j a va 2s. co m setContent(rootLayout); BannerView banner = bannerPresenter.getView(); rootLayout.addComponent(banner); HorizontalLayout mainLayout = new HorizontalLayout(); mainLayout.setSizeFull(); body = new VerticalLayout(); body.setSizeFull(); Navigator navigator = new Navigator(this, body); navigator.addProvider(vP); this.setNavigator(navigator); SideBarView sidebarView = sideBarPresenter.getView(); mainLayout.addComponent(sidebarView); mainLayout.addComponent(body); rootLayout.addComponent(mainLayout); rootLayout.setExpandRatio(mainLayout, 10); sidebarView.setWidth(150, Unit.PIXELS); mainLayout.setExpandRatio(body, 10); //rootLayout.setSplitPosition(150, Unit.PIXELS); navigator.navigateTo(LoginView.VIEW_NAME); eventBus.publish(EventScope.SESSION, this, Action.START); }
From source file:com.github.djabry.platform.vaadin.view.SideBarView.java
License:Open Source License
@PostConstruct public void init() { this.setSizeFull(); HorizontalLayout titleHolder = new HorizontalLayout(); titleHolder.addComponent(buildTitle()); titleHolder.addStyleName(ValoTheme.LAYOUT_WELL); //titleHolder.setMargin(true); //titleHolder.setSpacing(true); //this.addComponent(titleHolder); VerticalLayout sidebarHolder = new VerticalLayout(); //sidebarHolder.addStyleName(ValoTheme.LAYOUT_WELL); sidebarHolder.addStyleName(ValoTheme.MENU_ROOT); //sidebarHolder.addStyleName(ValoTheme.MENUBAR_BORDERLESS); this.addComponent(sidebarHolder); sidebarHolder.setSizeFull();/*w w w . j a va 2 s . co m*/ sidebarHolder.addComponent(sideBar); //sideBar.setStyleName(ValoTheme.ACCORDION_BORDERLESS); sideBar.addStyleName(ValoTheme.MENU_PART); sideBar.setSizeFull(); }
From source file:com.github.fbhd.AbstractSideBarUI.java
@Override protected void init(VaadinRequest vaadinRequest) { getPage().setTitle("fbhd"); final HorizontalLayout rootLayout = new HorizontalLayout(); rootLayout.setSizeFull();/*from w w w . ja v a2s .c o m*/ setContent(rootLayout); final VerticalLayout viewContainer = new VerticalLayout(); viewContainer.setSizeFull(); final Navigator navigator = new Navigator(this, viewContainer); navigator.setErrorView(new ErrorView()); navigator.addProvider(viewProvider); setNavigator(navigator); rootLayout.addComponent(getSideBar()); rootLayout.addComponent(viewContainer); rootLayout.setExpandRatio(viewContainer, 1.0f); }