List of usage examples for com.vaadin.ui GridLayout iterator
@Override
public Iterator<Component> iterator()
From source file:com.m4gik.views.component.LibraryScreen.java
/** * This method builds library screen. This method overrides an existing * method.// www . ja v a 2 s .c om * * @see com.m4gik.views.component.ViewScreen#build() */ @Override public Layout build() { HorizontalLayout root = new HorizontalLayout(); root.setSizeFull(); root.setCaption("Media Library"); root.setHeight("200%"); root.setWidth("100%"); this.content = new VerticalLayout(); content.setSizeFull(); root.addComponent(content); final GridLayout grid = new GridLayout(4, 1); Panel top = new Panel("Music Collection", grid); top.setSizeFull(); top.addStyleName(Runo.PANEL_LIGHT); grid.setWidth("100%"); grid.setMargin(true); grid.addStyleName(Runo.LAYOUT_DARKER); content.addComponent(top); content.setExpandRatio(top, 1); grid.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = -1864555729437118182L; @Override public void layoutClick(LayoutClickEvent event) { for (Iterator<Component> it = grid.iterator(); it.hasNext();) { Component c = it.next(); c.removeStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED); } if (event.getChildComponent() != null) { event.getChildComponent().addStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED); } } }); buildAudioLibrary(grid, null); return root; }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPageTabImages.java
License:Open Source License
@Override public boolean actionPlanUpdatedOobTL(Serializable apId) { if (apId != this.apId) return false; // For media updates, such as caption, url changes, etc., the mediaUpdatedOob method gets hit // Here, we have to check for additions and subtractions Vector<Media> imagesInAp = new Vector<Media>(); // what the plan has Vector<Media> imagesInGui = new Vector<Media>(); // what the gui is showing ActionPlan ap = ActionPlan.getTL(apId); List<Media> mLis = ap.getMedia(); for (Media m : mLis) { if (m.getType() == MediaType.IMAGE) imagesInAp.add(m);//from w w w. j a v a 2 s. c o m } GridLayout gl = (GridLayout) this.imageScroller.getContent(); Iterator<Component> cItr = gl.iterator(); while (cItr.hasNext()) { Component c = cItr.next(); MPanelWrapper mpw = (MPanelWrapper) c; imagesInGui.add(mpw.ip.getMedia()); } int apNum = imagesInAp.size(); int guiNum = imagesInGui.size(); if (apNum == guiNum) return false; if (imagesInAp.size() > imagesInGui.size()) addTheNewOne(ap, imagesInAp, imagesInGui); else if (imagesInAp.size() < imagesInGui.size()) deleteTheOldOne_oobTL(ap, imagesInAp, imagesInGui); return true; }