List of usage examples for com.vaadin.ui TabSheet getComponentIterator
@Deprecated
@Override
public Iterator<Component> getComponentIterator()
From source file:de.catma.ui.visualizer.VisualizationManagerView.java
License:Open Source License
/** * Additional handling for charts because when closing a non active chart, * the active chart becomes empty. In addition to the standard behaviour this * method removes and reinserts all remaining {@link DistributionChartView}s. * //from ww w.ja v a 2s .co m * @see de.catma.ui.tabbedview.TabbedView#onTabClose(com.vaadin.ui.TabSheet, com.vaadin.ui.Component) */ @Override public void onTabClose(TabSheet tabsheet, Component tabContent) { Iterator<Component> compIter = tabsheet.getComponentIterator(); HashSet<Component> contents = new HashSet<Component>(); while (compIter.hasNext()) { contents.add(compIter.next()); } boolean hasLeft = (tabsheet.getComponentCount() > 1); super.onTabClose(tabsheet, tabContent); if (hasLeft) { tabsheet.removeAllComponents(); contents.remove(tabContent); for (Component c : contents) { addClosableTab((ClosableTab) c, c.toString()); } } }
From source file:nz.co.senanque.vaadinsupport.I18n.I18nCaptionHelper.java
License:Apache License
private static void switchCaption(TabSheet tabSheet, MessageSourceAccessor messageSourceAccessor) { int j = 0;//from w w w . ja v a2 s. c om for (final Iterator<Component> i = tabSheet.getComponentIterator(); i.hasNext();) { final Component component = i.next(); Tab tab = tabSheet.getTab(j++); String newCaption = getTranslatedCaption(tab.getCaption(), messageSourceAccessor); if (newCaption != null) { tab.setCaption(newCaption); } } }
From source file:v7cr.ReviewTab.java
License:Open Source License
private void reload() { final V7CR v7 = V7CR.getInstance(); r = new Review(v7.load("reviews", reviewId)); Project p = new Project(v7.load("projects", r.getProjectName())); SVNLogEntry svn = r.getSVNLogEntry(); String url;/*from ww w. j a va2s . c om*/ if (svn != null) { url = r.getProjectName() + "-" + svn.getRevision(); setCaption(url); } else { url = reviewId.toString(); setCaption(StringUtils.abbreviate(r.getTitle(), 20)); } VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.addComponent(getBasicInfo(v7, r, p, url)); Panel s = getSVNPanel(v7, r.getSchemaDefinition(), svn, p); if (s != null) vl.addComponent(s); final BSONBackedObject[] notes = r.getObjectFieldAsArray("notes"); if (notes != null) { for (BSONBackedObject note : notes) { vl.addComponent(getNotesPanel(note)); } } final BSONBackedObject[] votes = r.getObjectFieldAsArray("v"); if (votes != null) { for (BSONBackedObject vote : votes) { vl.addComponent(new CommentPanel(vote)); } } { HorizontalLayout commentGrid = new HorizontalLayout(); newComment = new TextArea(); newComment.setColumns(50); newComment.setRows(10); commentGrid.addComponent(newComment); voteOptions = new OptionGroup(); voteOptions.addItem("+"); voteOptions.addItem("0"); voteOptions.addItem("-"); voteOptions.setValue("0"); commentGrid.addComponent(voteOptions); vl.addComponent(commentGrid); fileArea = new VerticalLayout(); vl.addComponent(fileArea); MultiFileUpload uploader = new MultiFileUpload() { @Override protected void handleFile(File file, String fileName, String mimeType, long length) { try { BSONBackedObject gf = v7.storeFile(file, fileName, mimeType); TemporaryFile tf = new TemporaryFile(v7, gf); fileArea.addComponent(tf); } catch (IOException e) { throw new RuntimeException(e); } } }; vl.addComponent(uploader); Button submitButton = new Button(v7.getMessage("button.submit")); submitButton.addListener(this); vl.addComponent(submitButton); } setCompositionRoot(vl); Component parent = getParent(); if (parent instanceof TabSheet) { TabSheet t = (TabSheet) parent; Iterator<Component> i = t.getComponentIterator(); while (i.hasNext()) { Component c = i.next(); if (c instanceof ReviewList && r.getProjectName().equals(c.getCaption())) { ((ReviewList) c).reload(); break; } } } }