List of usage examples for com.vaadin.ui GridLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:probe.com.view.body.welcomelayout.PublicationsInformationWindow.java
public PublicationsInformationWindow(List<Object[]> publicationList) { int height = Page.getCurrent().getBrowserWindowHeight() - 100; int width = Page.getCurrent().getBrowserWindowWidth() - 100; int columnNum = width / 250; width = columnNum * 250;/*from w w w. j ava2 s. co m*/ VerticalLayout popupBodyWrapper = new VerticalLayout(); popupBodyWrapper.setWidth("100%"); popupBodyWrapper.setHeight("100%"); VerticalLayout popupBody = new VerticalLayout(); popupBody.setWidth((width) + "px"); popupBody.setHeightUndefined(); popupBody.setStyleName(Reindeer.LAYOUT_WHITE); popupBody.setMargin(true); popupBody.setSpacing(true); popupBodyWrapper.addComponent(popupBody); popupBodyWrapper.setComponentAlignment(popupBody, Alignment.TOP_CENTER); popupWindow = new Window() { @Override public void close() { popupWindow.setVisible(false); } }; popupWindow.setContent(popupBodyWrapper); popupWindow.setWindowMode(WindowMode.NORMAL); popupWindow.setWidth((width + 22) + "px"); popupWindow.setVisible(false); popupWindow.setResizable(false); popupWindow.setClosable(false); popupWindow.setStyleName(Reindeer.WINDOW_LIGHT); popupWindow.setModal(true); popupWindow.setDraggable(false); popupWindow.setCaption( "<font color='gray' style='font-weight: bold;!important'> Publication Information</font>"); UI.getCurrent().addWindow(popupWindow); popupWindow.center(); popupWindow.setCaptionAsHtml(true); popupWindow.setClosable(true); GridLayout publicationContainer = new GridLayout(); publicationContainer.setWidth("100%"); publicationContainer.setSpacing(true); publicationContainer.setMargin(true); popupBody.addComponent(publicationContainer); publicationContainer.setColumns(columnNum); publicationContainer.setRows(publicationList.size()); this.addLayoutClickListener(PublicationsInformationWindow.this); int row = 0; int col = 0; for (Object[] obj : publicationList) { VerticalLayout publicationLayout = initPublicationLayout(obj); String btnName = "<font size=1 >" + obj[0].toString() + "</font><br/>" + obj[1].toString() + "<br/><font size=1 >" + obj[2].toString() + "</font><br/><font size=1 >#Proteins: " + obj[5].toString() /*+ "/" + obj[5].toString() + */ + " #Peptides: " + obj[7].toString() /*+ "/" + obj[7].toString() +*/ + "</font>"; PopupInfoBtn publicationBtn = new PopupInfoBtn(publicationLayout, btnName, obj[1].toString()); publicationContainer.addComponent(publicationBtn, col++, row); publicationContainer.setComponentAlignment(publicationBtn, Alignment.TOP_CENTER); if (col >= columnNum) { row++; col = 0; } } height = Math.min((++row * 85) + 200, height); popupWindow.setHeight((height) + "px"); }
From source file:pt.ist.vaadinframework.ui.fields.MultiLanguageStringField.java
License:Open Source License
public MultiLanguageStringField(String bundlename, Language... languages) { this.languages = languages; GridLayout languagesLayout = new GridLayout(3, languages.length); languagesLayout.setSpacing(true); for (int i = 0; i < languages.length; ++i) { fields.put(languages[i], new TextField()); languagesLayout.addComponent(fields.get(languages[i]), 0, i); Embedded languageIcon = new Embedded(null, new ThemeResource("../icons/flags/" + languages[i].toString() + ".gif")); languagesLayout.addComponent(languageIcon, 1, i); languagesLayout.setComponentAlignment(languageIcon, Alignment.MIDDLE_RIGHT); Label languageLabel = new Label(languages[i].toString()); languagesLayout.addComponent(languageLabel, 2, i); languagesLayout.setComponentAlignment(languageLabel, Alignment.MIDDLE_LEFT); }/*from w ww . j av a 2 s .c o m*/ setCompositionRoot(languagesLayout); }
From source file:qbic.vaadincomponents.SelectFileComponent.java
License:Open Source License
public SelectFileComponent(String mainCaption, String info, String sourceCaption, String destinationCaption, BeanItemContainer<?> source, BeanItemContainer<?> destination) { setCaption(mainCaption);/*from www.j a v a 2 s .c om*/ VerticalLayout files = new VerticalLayout(); files.setSpacing(true); // info label Label rawFilesInfo = new Label(info); rawFilesInfo.addStyleName(ValoTheme.LABEL_COLORED); files.addComponent(rawFilesInfo); files.setWidth("100%"); // available files in openbis available = new Grid(source); available.setCaption(sourceCaption); available.setSelectionMode(SelectionMode.MULTI); // selected files for anaylsis selected = new Grid(destination); if (mainCaption.equals("Raw files")) { available.removeColumn("fullPath"); available.removeColumn("openbisCode"); } else if (mainCaption.equals("")) { available.removeColumn("name"); available.removeColumn("path"); selected.removeColumn("name"); selected.removeColumn("path"); } selected.setCaption(destinationCaption); selected.setSelectionMode(SelectionMode.MULTI); for (Grid.Column col : available.getColumns()) { col.setWidthUndefined(); } // selectedFiles.set // buttons to add or remove files VerticalLayout buttons = new VerticalLayout(); toLeft = new Button(); toLeft.setIcon(FontAwesome.ARROW_LEFT); toRight = new Button(); toRight.setIcon(FontAwesome.ARROW_RIGHT); buttons.addComponent(toRight); buttons.addComponent(toLeft); GridLayout grids = new GridLayout(3, 1); grids.setWidth("100%"); // grids.setSpacing(true); grids.addComponent(available, 0, 0); available.setWidth("100%"); grids.addComponent(buttons, 1, 0); grids.addComponent(selected, 2, 0); grids.setColumnExpandRatio(0, 0.45f); grids.setColumnExpandRatio(1, 0.029f); grids.setColumnExpandRatio(2, 0.45f); grids.setSpacing(false); grids.setComponentAlignment(buttons, com.vaadin.ui.Alignment.MIDDLE_CENTER); selected.setWidth("100%"); files.addComponent(grids); this.setCompositionRoot(files); files.setMargin(new MarginInfo(true, true, true, false)); this.setWidth("100%"); }
From source file:v7cr.ReviewTab.java
License:Open Source License
private Panel getBasicInfo(V7CR v7, Review r, Project proj, String linkUrl) { Panel p = new Panel(v7.getMessage("reviewTab.review")); p.setWidth("600px"); GridLayout grid = new GridLayout(3, 4); grid.setSizeFull();/*from w ww .j a v a2s . com*/ p.setContent(grid); grid.setSpacing(true); Locale l = v7.getLocale(); SchemaDefinition sd = r.getSchemaDefinition(); grid.addComponent(new Label(sd.getFieldCaption("s", l)), 0, 0, 1, 0); p.addComponent(new Label("<b>" + LocalizedString .get(sd.getFieldDefinition("s").getPossibleValueMetaData(r.getStatus()), "caption", l) + "</b>", Label.CONTENT_XHTML)); p.addComponent(new Label(sd.getFieldCaption("p", l))); p.addComponent(new Label("[" + proj.getId() + "]")); grid.addComponent(new Label(proj.getName())); p.addComponent(new Label(sd.getFieldCaption("reviewee", l))); p.addComponent(new Label(r.getReviewee().getId())); grid.addComponent(new Label(r.getReviewee().getName())); p.addComponent(new Label(sd.getFieldCaption("t", l))); grid.addComponent(new Label(r.getTitle()), 1, 3, 2, 3); p.addComponent(new Label(v7.getMessage("reviewTab.directLink"))); Link link = new Link(linkUrl, new ExternalResource(linkUrl)); link.setTargetName("_blank"); link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png")); grid.addComponent(link); return p; }
From source file:v7cr.ReviewTab.java
License:Open Source License
private Panel getSVNPanel(V7CR v7, SchemaDefinition sd, SVNLogEntry svn, Project proj) { if (svn == null) return null; Locale l = v7.getLocale();//ww w . j a v a 2 s . com Panel p = new Panel(v7.getMessage("reviewTab.subversion")); p.setWidth("600px"); GridLayout grid = new GridLayout(4, 4); grid.setSizeFull(); p.setContent(grid); grid.setSpacing(true); p.addComponent(new Label(sd.getFieldCaption("svn.rev", l))); p.addComponent(new Label("" + svn.getRevision())); p.addComponent(new Label(DateFormat.getDateTimeInstance().format(svn.getDate()))); p.addComponent(new Label(svn.getAuthor())); Link link = new Link(v7.getMessage("reviewTab.viewChanges"), new ExternalResource(proj.getChangesetViewUrl(svn.getRevision()))); link.setTargetName("_blank"); link.setIcon(new ThemeResource("../runo/icons/16/arrow-right.png")); p.addComponent(link); grid.addComponent(new Label(svn.getMessage()), 1, 1, 3, 1); Map<String, SVNLogEntryPath> changed = svn.getChangedPaths(); if (changed != null) { Tree changeTree = new Tree(sd.getFieldCaption("svn.changed", l) + "(" + changed.size() + ")"); Set<String> paths = changed.keySet(); for (String s : changed.keySet()) { changeTree.addItem(s); changeTree.setChildrenAllowed(s, false); changeTree.setItemCaption(s, changed.get(s).getType() + " " + s); } if (paths.size() > 5) { compressTree(changeTree, paths); } grid.addComponent(changeTree, 0, 2, 3, 2); } return p; }