List of usage examples for com.vaadin.ui VerticalLayout setResponsive
public void setResponsive(boolean responsive)
From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java
License:Apache License
private VerticalLayout createVerticalLayout(final String caption, final String description, Resource icon) { VerticalLayout result = new VerticalLayout(); result.setSizeFull();//from w w w .j a v a 2 s . com result.setSpacing(true); result.setResponsive(true); if (caption != null) result.setCaption(presenter.translate(caption)); if (description != null) result.setDescription(presenter.translate(description)); if (icon != null) result.setIcon(icon); return result; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.BiologicalSamplesComponent.java
License:Open Source License
/** * Precondition: {DatasetView#table} has to be initialized. e.g. with * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the * Layout of this view./* w ww. ja va2 s. c o m*/ */ private void buildLayout() { this.vert.removeAllComponents(); this.vert.setSizeFull(); vert.setResponsive(true); // Table (containing datasets) section VerticalLayout tableSection = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); HorizontalLayout sampletableSectionContent = new HorizontalLayout(); tableSection.setResponsive(true); tableSectionContent.setResponsive(true); sampletableSectionContent.setResponsive(true); tableSectionContent.setMargin(new MarginInfo(true, false, false, false)); sampletableSectionContent.setMargin(new MarginInfo(true, false, false, false)); // tableSectionContent.setCaption("Datasets"); // tableSectionContent.setIcon(FontAwesome.FLASK); tableSection.addComponent(new Label(String.format( "This view shows the sample sources (e.g., human, mouse) to be studied and the corresponding extracted samples. With sample sources, information specific to the subject (e.g., age or BMI in the case of patient data) can be stored. The extracted sample is a sample which has been extracted from the corresponding sample source. This is the raw sample material that can be later prepared for specific analytical methods such as MS or NGS.<br> " + "\n\n There are %s extracted samples coming from %s distinct sample sources in this study.", numberOfBioSamples, numberOfEntitySamples), ContentMode.HTML)); tableSectionContent.addComponent(sampleBioGrid); sampletableSectionContent.addComponent(sampleEntityGrid); sampleEntityGrid.setCaption("Sample Sources"); sampleBioGrid.setCaption("Extracted Samples"); tableSection.setMargin(new MarginInfo(true, false, true, true)); tableSection.setSpacing(true); tableSection.addComponent(sampletableSectionContent); tableSection.addComponent(exportSources); tableSection.addComponent(tableSectionContent); tableSection.addComponent(exportSamples); this.vert.addComponent(tableSection); sampleBioGrid.setWidth(100, Unit.PERCENTAGE); sampleEntityGrid.setWidth(100, Unit.PERCENTAGE); // sampleBioGrid.setHeightMode(HeightMode.ROW); // sampleEntityGrid.setHeightMode(HeightMode.ROW); // sampleBioGrid.setHeightByRows(Math.min(10, numberOfBioSamples)); // sampleEntityGrid.setHeightByRows(Math.min(10, 5)); tableSection.setSizeFull(); sampletableSectionContent.setSizeFull(); tableSectionContent.setSizeFull(); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java
License:Open Source License
/** * /*from w w w . j av a2s . co m*/ * @param statusValues * @return */ public VerticalLayout createProjectStatusComponentNew(Map<String, Integer> statusValues) { VerticalLayout projectStatusContent = new VerticalLayout(); projectStatusContent.setResponsive(true); projectStatusContent.setMargin(true); projectStatusContent.setSpacing(true); Label planned = new Label(); Label design = new Label(); Label raw = new Label(); Label results = new Label(); Iterator<Entry<String, Integer>> it = statusValues.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, Integer> pairs = (Map.Entry<String, Integer>) it.next(); if ((Integer) pairs.getValue() == 0) { Label statusLabel = new Label(pairs.getKey()); statusLabel.setStyleName(ValoTheme.LABEL_FAILURE); statusLabel.setResponsive(true); // statusLabel.addStyleName("redicon"); if (pairs.getKey().equals("Project planned")) { planned = statusLabel; } else if (pairs.getKey().equals("Experimental design registered")) { design = statusLabel; } else if (pairs.getKey().equals("Raw data registered")) { raw = statusLabel; } else if (pairs.getKey().equals("Results registered")) { results = statusLabel; } } else { Label statusLabel = new Label(pairs.getKey()); statusLabel.setStyleName(ValoTheme.LABEL_SUCCESS); statusLabel.setResponsive(true); // statusLabel.addStyleName("greenicon"); if (pairs.getKey().equals("Project planned")) { planned = statusLabel; } else if (pairs.getKey().equals("Experimental design registered")) { design = statusLabel; } else if (pairs.getKey().equals("Raw data registered")) { raw = statusLabel; } else if (pairs.getKey().equals("Results registered")) { results = statusLabel; } } } projectStatusContent.addComponent(planned); projectStatusContent.addComponent(design); projectStatusContent.addComponent(raw); projectStatusContent.addComponent(results); // ProgressBar progressBar = new ProgressBar(); // progressBar.setValue((float) finishedExperiments / statusValues.keySet().size()); // projectStatusContent.addComponent(progressBar); return projectStatusContent; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetComponent.java
License:Open Source License
/** * Precondition: {DatasetView#table} has to be initialized. e.g. with * {DatasetView#buildFilterTable} If it is not, strange behaviour has to be expected. builds the * Layout of this view./*from w w w . j a v a2 s . co m*/ */ private void buildLayout() { this.vert.removeAllComponents(); this.vert.setSizeFull(); vert.setResponsive(true); // Table (containing datasets) section VerticalLayout tableSection = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); tableSection.setResponsive(true); tableSectionContent.setResponsive(true); // tableSectionContent.setCaption("Datasets"); // tableSectionContent.setIcon(FontAwesome.FLASK); // tableSection.addComponent(new Label(String.format("This project contains %s dataset(s).", // numberOfDatasets))); tableSectionContent.setMargin(new MarginInfo(true, false, true, false)); tableSection.addComponent(headerLabel); tableSectionContent.addComponent(this.table); vert.setMargin(new MarginInfo(false, true, false, false)); tableSection.setMargin(new MarginInfo(true, false, false, true)); // tableSectionContent.setMargin(true); // tableSection.setMargin(true); tableSection.addComponent(tableSectionContent); this.vert.addComponent(tableSection); table.setSizeFull(); tableSection.setSizeFull(); tableSectionContent.setSizeFull(); // this.table.setSizeFull(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(new MarginInfo(false, false, true, true)); buttonLayout.setHeight(null); // buttonLayout.setWidth("100%"); buttonLayout.setSpacing(true); buttonLayout.setResponsive(true); // final Button visualize = new Button(VISUALIZE_BUTTON_CAPTION); Button checkAll = new Button("Select all datasets"); checkAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : table.getItemIds()) { ((CheckBox) table.getItem(itemId).getItemProperty("Select").getValue()).setValue(true); } } }); Button uncheckAll = new Button("Unselect all datasets"); uncheckAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : table.getItemIds()) { ((CheckBox) table.getItem(itemId).getItemProperty("Select").getValue()).setValue(false); } } }); String content = "<p> In case of multiple file selections, Project Browser will create a tar archive.</p>" + "<hr>" + "<p> If you need help on extracting a tar archive file, follow the tips below: </p>" + "<p>" + FontAwesome.WINDOWS.getHtml() + " Windows </p>" + "<p> To open/extract TAR file on Windows, you can use 7-Zip, Easy 7-Zip, PeaZip.</p>" + "<hr>" + "<p>" + FontAwesome.APPLE.getHtml() + " MacOS </p>" + "<p> To open/extract TAR file on Mac, you can use Mac OS built-in utility Archive Utility,<br> or third-party freeware. </p>" + "<hr>" + "<p>" + FontAwesome.LINUX.getHtml() + " Linux </p>" + "<p> You need to use command tar. The tar is the GNU version of tar archiving utility. <br> " + "To extract/unpack a tar file, type: $ tar -xvf file.tar</p>"; export.setIcon(FontAwesome.DOWNLOAD); PopupView tooltip = new PopupView(new helpers.ToolTip(content)); tooltip.setHeight("44px"); HorizontalLayout help = new HorizontalLayout(); help.setSizeFull(); HorizontalLayout helpContent = new HorizontalLayout(); // helpContent.setSizeFull(); help.setMargin(new MarginInfo(false, false, false, true)); Label helpText = new Label("Attention: Click here before Download!"); helpContent.addComponent(new Label(FontAwesome.QUESTION_CIRCLE.getHtml(), ContentMode.HTML)); helpContent.addComponent(helpText); helpContent.addComponent(tooltip); helpContent.setSpacing(true); help.addComponent(helpContent); help.setComponentAlignment(helpContent, Alignment.TOP_CENTER); buttonLayout.addComponent(export); buttonLayout.addComponent(checkAll); buttonLayout.addComponent(uncheckAll); // buttonLayout.addComponent(visualize); buttonLayout.addComponent(this.download); /** * prepare download. */ download.setEnabled(false); download.setResource(new ExternalResource("javascript:")); // visualize.setEnabled(false); for (final Object itemId : this.table.getItemIds()) { setCheckedBox(itemId, (String) this.table.getItem(itemId).getItemProperty("CODE").getValue()); } this.table.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (!event.isDoubleClick() & !((boolean) table.getItem(event.getItemId()).getItemProperty("isDirectory").getValue())) { String datasetCode = (String) table.getItem(event.getItemId()).getItemProperty("CODE") .getValue(); String datasetFileName = (String) table.getItem(event.getItemId()).getItemProperty("File Name") .getValue(); URL url; try { Resource res = null; Object parent = table.getParent(event.getItemId()); if (parent != null) { String parentDatasetFileName = (String) table.getItem(parent) .getItemProperty("File Name").getValue(); url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, parentDatasetFileName + "/" + datasetFileName); } else { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, datasetFileName); } Window subWindow = new Window(); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subContent.setSizeFull(); subWindow.setContent(subContent); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); Boolean visualize = false; if (datasetFileName.endsWith(".pdf")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("application/pdf"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".png")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); // streamres.setMIMEType("application/png"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".qcML")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/xml"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".alleles")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".tsv")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".GSvar")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".log")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (datasetFileName.endsWith(".html")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/html"); res = streamres; visualize = true; } if (visualize) { // LOGGER.debug("Is resource null?: " + String.valueOf(res == null)); BrowserFrame frame = new BrowserFrame("", res); subContent.addComponent(frame); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setSizeUndefined(); subWindow.setHeight("75%"); subWindow.setWidth("75%"); subWindow.setResizable(false); frame.setSizeFull(); frame.setHeight("100%"); // frame.setHeight((int) (ui.getPage().getBrowserWindowHeight() * 0.9), Unit.PIXELS); // Open it in the UI ui.addWindow(subWindow); } } catch (MalformedURLException e) { LOGGER.error(String.format("Visualization failed because of malformedURL for dataset: %s", datasetCode)); Notification.show( "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", Notification.Type.ERROR_MESSAGE); } } } }); this.vert.addComponent(buttonLayout); this.vert.addComponent(help); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.SearchEngineView.java
License:Open Source License
public void initUI() { mainlayout = new Panel(); mainlayout.addStyleName(ValoTheme.PANEL_BORDERLESS); // Search bar // *----------- search text field .... search button-----------* VerticalLayout searchbar = new VerticalLayout(); searchbar.setWidth(100, Unit.PERCENTAGE); setResponsive(true);//from ww w .j a va 2 s .co m searchbar.setResponsive(true); // searchbar.setWidth(); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setResponsive(true); buttonLayout.setWidth(75, Unit.PERCENTAGE); // searchbar.setSpacing(true); final TextField searchfield = new TextField(); searchfield.setHeight("44px"); searchfield.setImmediate(true); searchfield.setResponsive(true); searchfield.setWidth(75, Unit.PERCENTAGE); buttonLayout.setSpacing(true); searchfield.setInputPrompt("search DB"); // searchfield.setCaption("QSearch"); // searchfield.setWidth(25.0f, Unit.EM); // searchfield.setWidth(60, Unit.PERCENTAGE); // TODO would be nice to have a autofill or something similar // searchFieldLayout.addComponent(searchfield); searchbar.addComponent(searchfield); searchbar.setComponentAlignment(searchfield, Alignment.MIDDLE_RIGHT); final NativeSelect navsel = new NativeSelect(); navsel.addItem("Whole DB"); navsel.addItem("Projects Only"); navsel.addItem("Experiments Only"); navsel.addItem("Samples Only"); navsel.setValue("Whole DB"); navsel.setHeight("20px"); navsel.setNullSelectionAllowed(false); navsel.setResponsive(true); navsel.setWidth(100, Unit.PERCENTAGE); navsel.addValueChangeListener(new Property.ValueChangeListener() { /** * */ private static final long serialVersionUID = -6896454887050432147L; @Override public void valueChange(ValueChangeEvent event) { // TODO Auto-generated method stub Notification.show((String) navsel.getValue()); switch ((String) navsel.getValue()) { case "Whole DB": datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; case "Projects Only": datahandler.setShowOptions(Arrays.asList("Projects")); break; case "Experiments Only": datahandler.setShowOptions(Arrays.asList("Experiments")); break; case "Samples Only": datahandler.setShowOptions(Arrays.asList("Samples")); break; default: datahandler.setShowOptions(Arrays.asList("Projects", "Experiments", "Samples")); break; } } }); searchbar.addComponent(buttonLayout); searchbar.setComponentAlignment(buttonLayout, Alignment.MIDDLE_RIGHT); Button searchOk = new Button(""); searchOk.setStyleName(ValoTheme.BUTTON_TINY); // searchOk.addStyleName(ValoTheme.BUTTON_BORDERLESS); searchOk.setIcon(FontAwesome.SEARCH); searchOk.setSizeUndefined(); // searchOk.setWidth(15.0f, Unit.EM); searchOk.setResponsive(true); searchOk.setHeight("20px"); searchOk.addClickListener(new ClickListener() { private static final long serialVersionUID = -2409450448301908214L; @Override public void buttonClick(ClickEvent event) { String queryString = (String) searchfield.getValue().toString(); LOGGER.debug("the query was " + queryString); if (searchfield.getValue() == null || searchfield.getValue().toString().equals("") || searchfield.getValue().toString().trim().length() == 0) { Notification.show("Query field was empty!", Type.WARNING_MESSAGE); } else { try { /** * Sample foundSample = datahandler.getOpenBisClient() .getSampleByIdentifier( * matcher.group(0).toString()); */ datahandler.setSampleResults(querySamples(queryString)); datahandler.setExpResults(queryExperiments(queryString)); datahandler.setProjResults(queryProjects(queryString)); datahandler.setLastQueryString(queryString); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add("view" + queryString); message.add("searchresults"); state.notifyObservers(message); } catch (Exception e) { LOGGER.error("after query: ", e); Notification.show("No Sample found for given barcode.", Type.WARNING_MESSAGE); } } } }); // setClickShortcut() would add global shortcut, instead we // 'scope' the shortcut to the panel: mainlayout.addAction(new com.vaadin.ui.Button.ClickShortcut(searchOk, KeyCode.ENTER)); // searchfield.addItems(this.getSearchResults("Q")); searchfield.setDescription(infotext); searchfield.addValidator(new NullValidator("Field must not be empty", false)); searchfield.setValidationVisible(false); buttonLayout.addComponent(navsel); // buttonLayout.addComponent(new Label("")); buttonLayout.addComponent(searchOk); // searchFieldLayout.setComponentAlignment(searchOk, Alignment.TOP_RIGHT); // buttonLayout.setExpandRatio(searchOk, 1); // buttonLayout.setExpandRatio(navsel, 1); // searchFieldLayout.setSpacing(true); buttonLayout.setComponentAlignment(searchOk, Alignment.BOTTOM_RIGHT); // buttonLayout.setComponentAlignment(navsel, Alignment.BOTTOM_LEFT); buttonLayout.setExpandRatio(searchOk, 1); buttonLayout.setExpandRatio(navsel, 2); // searchbar.setMargin(new MarginInfo(true, false, true, false)); mainlayout.setContent(searchbar); // mainlayout.setComponentAlignment(searchbar, Alignment.MIDDLE_RIGHT); // mainlayout.setWidth(100, Unit.PERCENTAGE); setCompositionRoot(mainlayout); }
From source file:fr.amapj.view.engine.popup.corepopup.CorePopup.java
License:Open Source License
public void createPopup() { // Creation du contenu VerticalLayout contentLayout = new VerticalLayout(); createContent(contentLayout);/*from w w w .j av a 2 s . c o m*/ // Construction de la barre de boutons popupButtonBarLayout = new HorizontalLayout(); popupButtonBarLayout.setMargin(false); popupButtonBarLayout.addStyleName("buttonbar"); createButtonBar(); popupButtonBarLayout.setSpacing(true); // Creation de la fenetre window.setClosable(true); window.setResizable(true); window.setModal(true); // Agencement suivant le type if (popupType == PopupType.CENTERFIT) { // contentLayout.setWidthUndefined(); // VerticalLayout mainLayout = new VerticalLayout(); mainLayout.addStyleName("corepopup"); mainLayout.setResponsive(true); mainLayout.addStyleName("centerfit-corepopup"); mainLayout.addStyleName("centerfit-corepopup-" + getWidthRange()); mainLayout.setWidth(null); // mainLayout.addComponent(contentLayout); // popupButtonBarLayout.setWidth(null); mainLayout.addComponent(popupButtonBarLayout); mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT); // window.setContent(mainLayout); window.setSizeUndefined(); } else { // contentLayout.setWidth("100%"); // VerticalLayout mainLayout = new VerticalLayout(); mainLayout.addStyleName("corepopup"); mainLayout.setResponsive(true); mainLayout.addStyleName("fill-corepopup"); mainLayout.addStyleName("fill-corepopup-" + getWidthRange()); mainLayout.setWidth("100%"); // mainLayout.addComponent(contentLayout); // popupButtonBarLayout.setWidth(null); mainLayout.addComponent(popupButtonBarLayout); mainLayout.setComponentAlignment(popupButtonBarLayout, Alignment.MIDDLE_RIGHT); // window.setContent(mainLayout); computeWindowSize(); // window.setHeight(popupHeight); } // Partie commune dans tous les cas window.center(); window.setCaption(popupTitle); window.setStyleName("opaque"); if (colorStyle == ColorStyle.RED) { window.setStyleName("corepopup-red"); } }
From source file:rs.co.micro.bwNet.main.java
public main() { //Layout/*from w w w . j a v a2s . c o m*/ final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.addStyleName("odvoji"); layout.setSpacing(true); layout.setResponsive(true); layout.setId("oprem"); //Prvo dugme Button conf = new Button("Configure"); Button.ClickListener listener = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { navigator.addView("configure", new configure()); navigator.navigateTo("configure"); } }; conf.addClickListener(listener); //Drugo dugme Button log = new Button("Login"); Button.ClickListener listener2 = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { navigator.addView("login", new login()); navigator.navigateTo("login"); } }; log.addClickListener(listener2); //Trece dugme Button wel = new Button("Welcome"); Button.ClickListener listener3 = new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { navigator.addView("welcome", new welcome()); navigator.navigateTo("welcome"); } }; wel.addClickListener(listener3); layout.addComponents(conf, log, wel); addComponent(layout); }