List of usage examples for com.vaadin.ui Window setSizeUndefined
@Override public void setSizeUndefined()
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window createPopupWindow() { Window window = new Window(null); window.setModal(true);//w w w. j a v a2 s.c om window.setSizeUndefined(); window.setResizable(false); window.center(); return window; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showSimplePopupWindow(String caption, String contentText) { Window window = new Window(null); window.setModal(true);// w w w . j ava 2 s. c o m window.setSizeUndefined(); window.setResizable(false); window.center(); VerticalLayout popupLayout = new VerticalLayout(); popupLayout.setMargin(true); popupLayout.setSpacing(true); popupLayout.setSizeUndefined(); Label contentLabel = new Label(contentText); contentLabel.setWidth(100, Unit.PERCENTAGE); popupLayout.addComponent(contentLabel); Button okayButton = new Button(I18nProperties.getCaption(Captions.actionOkay)); okayButton.addClickListener(e -> { window.close(); }); CssStyles.style(okayButton, ValoTheme.BUTTON_PRIMARY); popupLayout.addComponent(okayButton); popupLayout.setComponentAlignment(okayButton, Alignment.BOTTOM_RIGHT); window.setCaption(caption); window.setContent(popupLayout); UI.getCurrent().addWindow(window); return window; }
From source file:de.symeda.sormas.ui.utils.VaadinUiUtil.java
License:Open Source License
public static Window showPopupWindow(Component content) { Window window = new Window(null); window.setModal(true);/* ww w .j a v a 2s. c o m*/ window.setSizeUndefined(); window.setResizable(false); window.center(); window.setContent(content); UI.getCurrent().addWindow(window); return window; }
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./* w w w . java2s .c om*/ */ 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.ExperimentComponent.java
License:Open Source License
public void updateUI(ProjectBean currentBean) { projectBean = currentBean;//from w ww . j a v a2 s. c om experiments.removeAllColumns(); // experiments.setContainerDataSource(projectBean.getExperiments()); // BeanItemContainer<ExperimentBean> experimentBeans = // loadMoreExperimentInformation(projectBean.getExperiments()); // GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(experimentBeans); GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(projectBean.getExperiments()); gpc.removeContainerProperty("containsData"); gpc.removeContainerProperty("controlledVocabularies"); gpc.removeContainerProperty("id"); gpc.removeContainerProperty("lastChangedDataset"); gpc.removeContainerProperty("lastChangedSample"); gpc.removeContainerProperty("properties"); gpc.removeContainerProperty("type"); gpc.removeContainerProperty("samples"); gpc.removeContainerProperty("status"); gpc.removeContainerProperty("typeLabels"); gpc.removeContainerProperty("registrationDate"); experiments.addItemClickListener(new ItemClickListener() { /** * */ private static final long serialVersionUID = -43367719647620455L; @Override public void itemClick(ItemClickEvent event) { BeanItem selected = (BeanItem) projectBean.getExperiments().getItem(event.getItemId()); ExperimentBean selectedExp = (ExperimentBean) selected.getBean(); State state = (State) UI.getCurrent().getSession().getAttribute("state"); ArrayList<String> message = new ArrayList<String>(); message.add("clicked"); message.add(selectedExp.getId()); message.add("experiment"); state.notifyObservers(message); } }); gpc.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { /** * */ private static final long serialVersionUID = 7558511163500976236L; @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); gpc.addGeneratedProperty("registrationDate", new PropertyValueGenerator<String>() { @Override public Class<String> getType() { return String.class; } @Override public String getValue(Item item, Object itemId, Object propertyId) { BeanItem selected = (BeanItem) projectBean.getExperiments().getItem(itemId); ExperimentBean expBean = (ExperimentBean) selected.getBean(); Date date = expBean.getRegistrationDate(); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm a"); String dateString = sd.format(date); return dateString; } }); experiments.setContainerDataSource(gpc); experiments.getColumn("prettyType").setHeaderCaption("Type"); experiments.getColumn("edit").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { BeanItem selected = (BeanItem) projectBean.getExperiments().getItem(event.getItemId()); ExperimentBean selectedSample = (ExperimentBean) selected.getBean(); Window subWindow = new Window("Edit Metadata"); changeMetadata.updateUI(selectedSample.getId(), selectedSample.getType()); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subContent.addComponent(changeMetadata); subWindow.setContent(subContent); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setSizeUndefined(); subWindow.setIcon(FontAwesome.PENCIL); subWindow.setHeight("75%"); subWindow.setResizable(false); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(subWindow); } })); experiments.getColumn("edit").setWidth(70); experiments.setColumnOrder("edit", "prettyType"); experiments.getColumn("edit").setHeaderCaption(""); // experiments.setHeightMode(HeightMode.ROW); // experiments.setHeightByRows(gpc.size()); if (fileDownloader != null) this.export.removeExtension(fileDownloader); StreamResource sr = Utils.getTSVStream(Utils.containerToString(projectBean.getExperiments()), String.format("%s_%s_", projectBean.getId().substring(1).replace("/", "_"), "experimental_steps")); fileDownloader = new FileDownloader(sr); fileDownloader.extend(export); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.LevelComponent.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 ww w. jav a 2s. c o m */ private void buildLayout() { this.vert.removeAllComponents(); this.vert.setWidth("100%"); // Table (containing datasets) section VerticalLayout tableSectionDatasets = new VerticalLayout(); VerticalLayout tableSectionSamples = new VerticalLayout(); HorizontalLayout tableSectionContent = new HorizontalLayout(); HorizontalLayout sampletableSectionContent = new HorizontalLayout(); tableSectionContent.setMargin(new MarginInfo(false, false, false, false)); sampletableSectionContent.setMargin(new MarginInfo(false, false, false, false)); // tableSectionContent.setCaption("Datasets"); // tableSectionContent.setIcon(FontAwesome.FLASK); descriptionLabel.setWidth("100%"); tableSectionDatasets.addComponent(descriptionLabel); sampletableSectionContent.addComponent(sampleGrid); tableSectionContent.addComponent(this.datasetTable); tableSectionDatasets.setMargin(new MarginInfo(true, false, false, true)); tableSectionDatasets.setSpacing(true); tableSectionSamples.setMargin(new MarginInfo(true, false, true, true)); tableSectionSamples.setSpacing(true); tableSectionDatasets.addComponent(tableSectionContent); tableSectionSamples.addComponent(sampletableSectionContent); tableSectionSamples.addComponent(exportSamples); this.vert.addComponent(tableSectionDatasets); sampleGrid.setWidth("100%"); datasetTable.setWidth("100%"); tableSectionDatasets.setWidth("100%"); tableSectionSamples.setWidth("100%"); sampletableSectionContent.setWidth("100%"); tableSectionContent.setWidth("100%"); HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setMargin(new MarginInfo(false, false, false, true)); buttonLayout.setHeight(null); buttonLayout.setSpacing(true); this.download.setEnabled(false); buttonLayout.setSpacing(true); Button checkAll = new Button("Select all datasets"); checkAll.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object itemId : datasetTable.getItemIds()) { ((CheckBox) datasetTable.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 : datasetTable.getItemIds()) { ((CheckBox) datasetTable.getItem(itemId).getItemProperty("Select").getValue()).setValue(false); } } }); buttonLayout.addComponent(exportData); buttonLayout.addComponent(checkAll); buttonLayout.addComponent(uncheckAll); // buttonLayout.addComponent(visualize); buttonLayout.addComponent(this.download); 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-part 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>"; 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); /** * prepare download. */ download.setResource(new ExternalResource("javascript:")); download.setEnabled(false); for (final Object itemId : this.datasetTable.getItemIds()) { setCheckedBox(itemId, (String) this.datasetTable.getItem(itemId).getItemProperty("CODE").getValue()); } this.datasetTable.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { if (!event.isDoubleClick() & !((boolean) datasetTable.getItem(event.getItemId()) .getItemProperty("isDirectory").getValue())) { String datasetCode = (String) datasetTable.getItem(event.getItemId()).getItemProperty("CODE") .getValue(); String datasetFileName = (String) datasetTable.getItem(event.getItemId()) .getItemProperty("File Name").getValue(); URL url = null; try { Resource res = null; Object parent = datasetTable.getParent(event.getItemId()); if (parent != null) { String parentDatasetFileName = (String) datasetTable.getItem(parent) .getItemProperty("File Name").getValue(); try { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, parentDatasetFileName + "/" + URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { url = datahandler.getOpenBisClient().getUrlForDataset(datasetCode, URLEncoder.encode(datasetFileName, "UTF-8")); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 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(".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 (datasetFileName.endsWith(".GSvar")) { QcMlOpenbisSource re = new QcMlOpenbisSource(url); StreamResource streamres = new StreamResource(re, datasetFileName); streamres.setMIMEType("text/plain"); res = streamres; visualize = true; } if (visualize) { BrowserFrame frame = new BrowserFrame("", res); frame.setSizeFull(); 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)); helpers.Utils.Notification("No file attached.", "Given dataset has no file attached to it!! Please Contact your project manager. Or check whether it already has some data", "error"); // 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(help); this.vert.addComponent(buttonLayout); this.vert.addComponent(tableSectionSamples); }
From source file:edu.nps.moves.mmowgli.modules.registrationlogin.RegistrationPageBase.java
License:Open Source License
@SuppressWarnings("serial") @HibernateUserRead//from ww w. ja v a2 s. co m public void checkUserLimitsTL() { Serializable uid = Mmowgli2UI.getGlobals().getUserID(); if (uid != NO_LOGGEDIN_USER_ID) { // can't do this check if we don't have a user yet MSysOut.println(DEBUG_LOGS, "User.getTL() in RegistrationPageBase.checkUserLimitsTL()"); User u = User.getTL(uid); if (u != null) // why should it be? if (u.getUserName() != null) // why should it be? if (u.isGameMaster())//getUserName().toLowerCase().startsWith("gm_")) return; } int maxIn = Game.getTL().getMaxUsersOnline(); // List<User> lis = (List<User>)HibernateContainers.getSession().createCriteria(User.class).add(Restrictions.eq("online", true)).list(); // if(lis.size()>=maxIn) { if (Mmowgli2UI.getGlobals().getSessionCount() >= maxIn) { // new improved lockedOut = true; VerticalLayout vl = new VerticalLayout(); vl.setWidth("325px"); vl.addStyleName("m-errorNotificationEquivalent"); vl.setSpacing(false); vl.setMargin(true); Label lab = new Label("We're loaded to the max with players right now."); lab.setSizeUndefined(); vl.addComponent(lab); lab = new Label("Idle players are timed-out after 15 minutes."); lab.setSizeUndefined(); vl.addComponent(lab); lab = new Label("Please try again later."); lab.setSizeUndefined(); vl.addComponent(lab); Window win = new Window("Sorry, but...."); win.setSizeUndefined(); win.addStyleName("m-transparent"); win.setWidth("308px"); win.setResizable(false); win.setContent(vl); openPopupWindowInMainWindow(win, 400); win.setModal(false); win.addCloseListener(new CloseListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void windowClose(CloseEvent e) { HSess.init(); Mmowgli2UI.getAppUI().quitAndGoTo(GameLinks.getTL().getGameFullLink()); HSess.close(); } }); } }
From source file:fi.vtt.RVaadin.RContainer.java
License:Apache License
/** * Get a Vaadin Window element that contains the corresponding R plot * generated by submitting and evaluating the RPlotCall String. The * imageName corresponds to the downloadable .png image name. The full name * of the images shown in the browser are of the format * {@code imageName_ISODate_runningId_[sessionId].png}, e.g. * 'Image_2012-08-29_001_[bmgolmfgvk].png' to keep them chronologically * ordered.//from w w w. ja v a 2 s .co m * * @param RPlotCall * the String to be evaluated by R * @param width * the width of the graphical image * @param height * the height of the graphical image * @param imageName * the image name attached to the right-click downloadable file * @param windowName * the title name of the Vaadin window element * @return Vaadin Window object */ public Window getGraph(final String RPlotCall, final int width, final int height, final String imageName, String windowName) { /* Construct a Window to show the graphics */ Window RGraphics = new Window(windowName); HorizontalLayout root = new HorizontalLayout(); root.setMargin(true); RGraphics.setContent(root); RGraphics.setSizeUndefined(); /* Control the image position */ final int imageXoffset = 180; final int imageYoffset = 60; int imageYpos = rand.nextInt(50); int imageXpos = rand.nextInt(90); RGraphics.setPositionX(imageXoffset + imageXpos); RGraphics.setPositionY(imageYoffset + imageYpos); /* Call R for the graphics */ Embedded rPlot = getEmbeddedGraph(RPlotCall, width, height, imageName); root.addComponent(rPlot); /* * Button bar to generate PDF (and for other options in the future) */ if (showButtonsInGraph) { final HorizontalLayout buttonLayout = new HorizontalLayout(); Button open = new Button("PDF"); open.setStyleName(Reindeer.BUTTON_SMALL); buttonLayout.addComponent(open); Button.ClickListener openClicked = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { StreamResource s = getImageResource(RPlotCall, width / screen_dpi, height / screen_dpi, imageName, "pdf"); Link pdfLink = new Link("Open pdf", s); pdfLink.setTargetName("_blank"); buttonLayout.removeAllComponents(); buttonLayout.addComponent(pdfLink); } }; open.addClickListener(openClicked); root.addComponent(buttonLayout); } return RGraphics; }
From source file:org.aksw.autosparql.tbsl.gui.vaadin.TBSLApplication.java
License:Apache License
private void onShowLearnedQuery() { String learnedSPARQLQuery = UserSession.getManager().getLearnedSPARQLQuery(); VerticalLayout layout = new VerticalLayout(); final Window w = new Window("Learned SPARQL Query", layout); w.setWidth("300px"); w.setSizeUndefined(); w.setPositionX(200);/*from w w w .ja v a 2 s . c o m*/ w.setPositionY(100); getMainWindow().addWindow(w); w.addListener(new Window.CloseListener() { @Override public void windowClose(CloseEvent e) { getMainWindow().removeWindow(w); } }); Label queryLabel = new Label(learnedSPARQLQuery, Label.CONTENT_PREFORMATTED); queryLabel.setWidth(null); layout.addComponent(queryLabel); Label nlLabel = new Label(UserSession.getManager().getNLRepresentation(learnedSPARQLQuery)); layout.addComponent(nlLabel); }
From source file:org.eclipse.hawkbit.ui.common.builder.WindowBuilder.java
License:Open Source License
/** * Build window based on type./*w w w . j a va 2 s . c o m*/ * * @return Window */ public Window buildWindow() { final Window window = new Window(caption); window.setContent(content); window.setSizeUndefined(); window.setModal(true); window.setResizable(false); decorateWindow(window); if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) { window.setClosable(false); } return window; }