List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.m1kah.ui.MyVaadinUI.java
License:Open Source License
@Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*from w w w .j a v a2 s . c om*/ setContent(layout); Button button = new Button("Click Me"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { layout.addComponent(new Label(messageService.getMessage())); } }); layout.addComponent(button); }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * @param audioFile//w w w . j a v a 2 s . c om */ protected void buildInformationPanel(AudioFile audioFile) { if (bottom == null) { this.bottom = new HorizontalLayout(); bottom.setWidth("100%"); content.addComponent(bottom); VerticalLayout side = new VerticalLayout(); side.setMargin(true); side.setSpacing(true); side.setWidth("170px"); bottom.addComponent(side); CssLayout musicFile = new CssLayout(); musicFile.addStyleName(Runo.CSSLAYOUT_SHADOW); musicFile.addComponent(createPlayImage(audioFile, audioFile.getCover())); side.addComponent(musicFile); side.addComponent(setFavorite()); side.addComponent(setRate()); Component details = addDetails(audioFile); bottom.addComponent(details); bottom.setExpandRatio(details, 1); } else { bottom.removeAllComponents(); content.removeComponent(bottom); this.bottom = null; buildInformationPanel(audioFile); } }
From source file:com.m4gik.views.component.LicenseScreen.java
/** * Method builds license layout with texts. * /*from w w w .j av a 2 s .c o m*/ * @return The VerticalLayout with texts. * * @see com.m4gik.views.component.ViewScreen#build() */ @Override public Layout build() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setCaption("Welcome"); Panel welcome = new Panel("License"); welcome.setSizeFull(); welcome.addStyleName(Runo.PANEL_LIGHT); layout.addComponent(welcome); layout.setExpandRatio(welcome, 1); CssLayout margin = new CssLayout(); // margin.setMargin(true); margin.setWidth("100%"); welcome.setContent(margin); Label title = new Label("Music player"); title.addStyleName(Runo.LABEL_H1); // margin.addComponent(title); HorizontalLayout texts = new HorizontalLayout(); texts.setSpacing(true); texts.setWidth("100%"); margin.addComponent(texts); addText(texts, "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>", null); addText(texts, "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>", null); addText(texts, "<h3>Everything You Need Is Here</h3>" + "<p>Everything you see inside this application...</p>", null); layout.addComponent(new Label("<hr />", Label.CONTENT_XHTML)); return layout; }
From source file:com.m4gik.views.MainView.java
/** * @param root/*from www . ja v a 2 s. com*/ */ private void addSlogan(VerticalLayout root) { Label slogan = new Label("All music now without limits"); slogan.addStyleName(Runo.LABEL_SMALL); slogan.setSizeUndefined(); root.addComponent(slogan); root.setComponentAlignment(slogan, Alignment.TOP_CENTER); }
From source file:com.m4gik.views.MainView.java
/** * @param root/*from w w w . ja v a2 s. c o m*/ */ private void addSpace(VerticalLayout root) { Label space = new Label(""); space.setHeight("20px"); root.addComponent(space); }
From source file:com.m4gik.views.MainView.java
/** * @param root// www . j av a 2 s . c o m */ private void addSplitPanel(VerticalLayout root) { final HorizontalSplitPanel split = new HorizontalSplitPanel(); split.setStyleName(Runo.SPLITPANEL_REDUCED); split.setSplitPosition(1, Sizeable.Unit.PIXELS); split.setLocked(true); root.addComponent(split); root.setExpandRatio(split, 1); addPanelLeft(split); addPanelRight(split); }
From source file:com.m4gik.views.MainView.java
/** * @param root/* w w w .jav a 2s .c om*/ */ private void addTitle(VerticalLayout root) { Label title = new Label("Music Player"); title.addStyleName(Runo.LABEL_H1); title.setSizeUndefined(); root.addComponent(title); root.setComponentAlignment(title, Alignment.TOP_CENTER); addSlogan(root); }
From source file:com.m4gik.views.MainView.java
/** * Initial layout for {@link MainView}//from ww w .ja v a 2s.c om */ private void initLayout() { VerticalLayout root = new VerticalLayout(); root.setMargin(true); root.setSizeFull(); VerticalLayout main = new VerticalLayout(); main.setSizeFull(); main.addComponent(root); playerLayout = new VerticalLayout(); main.addComponent(playerLayout); if (MusicPlayerPanel.isRunning()) { MusicPlayerPanel.setPlayerLayout(playerLayout); MusicPlayerPanel.runDefaultSetup(); } setContent(main); addTitle(root); addSpace(root); addSplitPanel(root); // setSizeFull(); // VerticalLayout layout = new VerticalLayout(); // layout.setSpacing(true); // layout.setMargin(true); // // HorizontalLayout usernameLayout = new HorizontalLayout(); // usernameLayout.setSpacing(true); // usernameLayout.addComponent(new Label("Username:")); // usernameLayout.addComponent(usernameLabel); // // //HorizontalLayout userRolesLayout = new HorizontalLayout(); // //userRolesLayout.setSpacing(true); // //userRolesLayout.addComponent(new Label("Roles:")); // //userRolesLayout.addComponent(rolesLabel); // // layout.addComponent(usernameLayout); // //addComponent(userRolesLayout); // // Link roleUserView = new // Link("Role \"user\" View (disabled, if user doesn't have access)", // new ExternalResource("#!" + RoleUserView.NAME)); // Link roleAdminView = new // Link("Role \"admin\" View (disabled, if user doesn't have access)", // new ExternalResource("#!" + RoleAdminView.NAME)); // Link authenticatedView = new // Link("@RequiresAuthentication View (disabled, if user doesn't have access)", // new ExternalResource("#!" + AuthenticatedView.NAME)); // Link guestView = new // Link("@RequiresGuest View (disabled, if user doesn't have access)", // new ExternalResource("#!" + GuestView.NAME)); // Link userView = new // Link("@RequiresUser View (disabled, if user doesn't have access)", // new ExternalResource("#!" + UserView.NAME)); // // roleUserView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleUserView.class)); // roleAdminView.setEnabled(ShiroSecurityNavigator.hasAccess(RoleAdminView.class)); // authenticatedView.setEnabled(ShiroSecurityNavigator.hasAccess(AuthenticatedView.class)); // guestView.setEnabled(ShiroSecurityNavigator.hasAccess(GuestView.class)); // userView.setEnabled(ShiroSecurityNavigator.hasAccess(UserView.class)); // // layout.addComponent(roleUserView); // layout.addComponent(roleAdminView); // layout.addComponent(authenticatedView); // layout.addComponent(guestView); // layout.addComponent(userView); // layout.addComponent(new // Link("Role \"admin\" View (throw exception, if user doesn't have access)", // new ExternalResource("#!" + RoleAdminView.NAME))); // // layout.addComponent(new Link("Logout", new // ExternalResource("/logout/"))); // // setContent(layout); }
From source file:com.mcparland.john.TabsURL.java
License:Apache License
/** * Create the tabs./* w ww . j a va2s .c om*/ * * @param tabNames * the names of the tabs to create. */ private void createTabs(String[] tabNames) { for (String tabName : tabNames) { VerticalLayout tab = new VerticalLayout(); tab.setCaption(tabName); tab.addComponent(new Label("<h1>" + tabName + "</h1>", ContentMode.HTML)); tab.setHeight(400, Unit.PIXELS); addComponent(tab); } }
From source file:com.mcparland.john.vaadin_cookbook.PriceList.java
License:Apache License
/** * Create a PriceList.// w ww. ja va2 s. c o m * * @param container * the container of products. */ public PriceList(BeanItemContainer<Product> container) { super(); this.container = container; // Table stuff Table table = createTable(); table.setContainerDataSource(this.container); // Layout VerticalLayout layout = new VerticalLayout(); layout.addComponent(createAddProductButton()); layout.addComponent(table); setCompositionRoot(layout); }