List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java
License:Apache License
private void createFooterSideBar() { VerticalLayout verticalLayout = super.getView(); sideBarFooter.setSizeUndefined();/* w w w . ja v a2 s . c o m*/ sideBarFooter.addStyleName("user"); Image profilePic = new Image(null, new ThemeResource("img/profile-pic.png")); profilePic.setWidth("34px"); sideBarFooter.addComponent(profilePic); Label userName = new Label("MOHELLEBI ATAF"); userName.setSizeUndefined(); sideBarFooter.addComponent(userName); Command cmd = new Command() { @Override public void menuSelected(MenuItem selectedItem) { Notification.show("Not implemented in this demo"); } }; MenuBar settings = new MenuBar(); MenuItem settingsMenu = settings.addItem("", null); settingsMenu.setStyleName("icon-cog"); settingsMenu.addItem("Settings", cmd); settingsMenu.addItem("Preferences", cmd); settingsMenu.addSeparator(); settingsMenu.addItem("My Account", cmd); sideBarFooter.addComponent(settings); Button exit = new NativeButton("Exit"); exit.addStyleName("icon-cancel"); exit.setDescription("Sign Out"); sideBarFooter.addComponent(exit); exit.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { } }); verticalLayout.addComponent(sideBarFooter); }
From source file:com.freebox.engeneering.application.web.layout.LeftSideBarController.java
License:Apache License
private void createMenuSideBar() { menu.addStyleName("no-vertical-drag-hints"); menu.addStyleName("no-horizontal-drag-hints"); menu.addStyleName("menu"); menu.setHeight("100%"); Button freeboxState;/*from w w w . java 2 s .c om*/ Button freeboxDownloads; Button freeboxContacts; Button freeboxCalls; freeboxState = new NativeButton("Etat Freebox");//Etat de la freebox freeboxState.addStyleName("icon-dashboard"); freeboxState.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); menu.addComponent(freeboxState); freeboxDownloads = new NativeButton("Dashbord");//Tlchargement freeboxDownloads.addStyleName("icon-sales"); freeboxDownloads.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { eventProcessor.fireEvent("dashboard", ""); } }); menu.addComponent(freeboxDownloads); freeboxContacts = new NativeButton("Contacts"); freeboxContacts.addStyleName("icon-transactions"); freeboxContacts.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); menu.addComponent(freeboxContacts); freeboxCalls = new NativeButton("Journal"); freeboxCalls.addStyleName("icon-reports"); freeboxCalls.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); menu.addComponent(freeboxCalls); freeboxState = new NativeButton("Explorateur"); freeboxState.addStyleName("icon-schedule"); freeboxState.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("explorer"); } }); menu.addComponent(freeboxState); freeboxState = new NativeButton("Etat"); freeboxState.addStyleName("icon-dashboard"); freeboxState.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); menu.addComponent(freeboxState); freeboxState = new NativeButton("Etat"); freeboxState.addStyleName("icon-dashboard"); freeboxState.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); menu.addComponent(freeboxState); freeboxState = new NativeButton("Etat"); freeboxState.addStyleName("icon-dashboard"); freeboxState.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent clickEvent) { getEventProcessor().fireEvent("register"); } }); VerticalLayout verticalLayout = super.getView(); verticalLayout.addComponent(menu); verticalLayout.setExpandRatio(menu, 1); }
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 .c o 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);// w w w . j av a 2s . com 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// ww w .j av a 2s .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 . j a va2s. c o 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 va2 s . co 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.djabry.platform.vaadin.ui.MainUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { VerticalLayout rootLayout = new VerticalLayout(); rootLayout.setSizeFull();//from w ww . j a va 2 s . c o 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 . ja v a2s . c o m sidebarHolder.addComponent(sideBar); //sideBar.setStyleName(ValoTheme.ACCORDION_BORDERLESS); sideBar.addStyleName(ValoTheme.MENU_PART); sideBar.setSizeFull(); }
From source file:com.github.lsiu.MyVaadinApplication.java
@Override public void init() { window = new Window("My Vaadin Application"); setMainWindow(window);/*from w w w. j a va2 s . com*/ VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); table = new FilterTable(); initTable(table); HorizontalLayout topBar = new HorizontalLayout(); initTopBar(topBar); layout.addComponent(topBar); layout.addComponent(table); layout.setExpandRatio(table, 1); window.setContent(layout); }