List of usage examples for com.vaadin.ui Alignment TOP_CENTER
Alignment TOP_CENTER
To view the source code for com.vaadin.ui Alignment TOP_CENTER.
Click Source Link
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
@AutoGenerated private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); HorizontalLayout titleLabel = getTitlePanel(); layout.addComponent(titleLabel);/*from ww w .j a va 2 s.co m*/ layout.setComponentAlignment(titleLabel, Alignment.TOP_CENTER); nameField = new TextField(); HorizontalLayout nameLayout = UIHelper.buildAttributePanel("Name", nameField); layout.addComponent(nameLayout); layout.setComponentAlignment(nameLayout, Alignment.TOP_CENTER); typeComboBox = new ComboBox(); for (String name : DeviceFactory.getAvailableDevicetypes()) { typeComboBox.addItem(name); } HorizontalLayout typelayout = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typelayout); layout.setComponentAlignment(typelayout, Alignment.TOP_CENTER); parameterType = new ComboBox(); String[] manufacturers = ManufacturerManager.getClassNames(); for (String name : manufacturers) { parameterType.addItem(name); } parameterType.addListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { fillManufacturerDetails((String) event.getProperty().getValue()); } }); parameterType.setImmediate(true); HorizontalLayout parameterTypeLayout = UIHelper.buildAttributePanel("Hersteller", parameterType); layout.addComponent(parameterTypeLayout); layout.setComponentAlignment(parameterTypeLayout, Alignment.TOP_CENTER); manufacturerLayout = new VerticalLayout(); layout.addComponent(manufacturerLayout); layout.setComponentAlignment(manufacturerLayout, Alignment.TOP_CENTER); Button saveButton = new Button("Speichern"); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.TOP_CENTER); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (allParametersMatches()) { String[] parameters = new String[currentManufacturerTextFields.size() + 1]; parameters[0] = (String) nameField.getValue(); for (int i = 1; i < parameters.length; i++) { parameters[i] = (String) currentManufacturerTextFields.get(i - 1).getValue(); } ActuatorParameters params = ParameterExtractor .getJavaParameters((String) parameterType.getValue(), parameters); MessageResponse response = parent.server.getDeviceManager().createNewActuatorAsMessage(params); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getDeviceManager().update(); parent.server.getDeviceManager().getDevice(params.get(FHEMParameters.NAME)) .setDeviceType((String) typeComboBox.getValue()); parent.reloadTree(); } } }); return layout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private static HorizontalLayout getTitlePanel() { HorizontalLayout titleLayout = new HorizontalLayout(); titleLayout.setImmediate(false);//from w w w . jav a 2 s .c om titleLayout.setWidth("-1"); titleLayout.setHeight("-1"); titleLayout.setMargin(false); // deviceTitle Label title = new Label(); title.setImmediate(true); title.setWidth("100%"); title.setHeight("50"); title.setValue("<h1>Neues Gert..</h1>"); title.setContentMode(Label.CONTENT_XHTML); titleLayout.addComponent(title); titleLayout.setComponentAlignment(title, Alignment.TOP_CENTER); return titleLayout; }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewDevicePanel.java
License:Apache License
private void fillManufacturerDetails(String className) { // if(currentManufacturerDetails != null) // for(HorizontalLayout layout : currentManufacturerDetails) // mainLayout.removeComponent(layout); manufacturerLayout.removeAllComponents(); String[] parameterNames = ParameterExtractor.getParameters(className); // currentManufacturerDetails = new ArrayList<HorizontalLayout>(); currentManufacturerTextFields = new ArrayList<TextField>(); for (String name : parameterNames) { if (!name.toLowerCase().equals("name")) { TextField paramField = new TextField(); HorizontalLayout paramLayout = UIHelper.buildAttributePanel(name, paramField); manufacturerLayout.addComponent(paramLayout); manufacturerLayout.setComponentAlignment(paramLayout, Alignment.TOP_CENTER); // currentManufacturerDetails.add(paramLayout); currentManufacturerTextFields.add(paramField); }/*from w w w .jav a 2s. com*/ } }
From source file:de.fzi.fhemapi.view.vaadin.ui.NewRoomPanel.java
License:Apache License
private VerticalLayout buildMainLayout() { VerticalLayout layout = new VerticalLayout(); nameTextField = new TextField(); HorizontalLayout nameLay = UIHelper.buildAttributePanel("Name", nameTextField); layout.addComponent(nameLay);//from w w w. ja va 2 s. com typeComboBox = new ComboBox(); for (String type : roomTypes) { typeComboBox.addItem(type); } HorizontalLayout typeLay = UIHelper.buildAttributePanel("Typ", typeComboBox); layout.addComponent(typeLay); layout.setComponentAlignment(typeLay, Alignment.TOP_CENTER); Label devicesLabel = new Label(); devicesLabel.setImmediate(false); devicesLabel.setWidth("100%"); devicesLabel.setHeight("50"); devicesLabel.setValue("<b>Gerte</b>"); devicesLabel.setContentMode(Label.CONTENT_XHTML); layout.addComponent(devicesLabel); layout.setComponentAlignment(devicesLabel, Alignment.TOP_CENTER); List<Device> deviceList = parent.server.getDeviceManager().getDevices(); devicesCheckBox = new CheckBox[deviceList.size()]; for (int i = 0; i < deviceList.size(); i++) { devicesCheckBox[i] = new CheckBox(deviceList.get(i).getName()); layout.addComponent(devicesCheckBox[i]); layout.setComponentAlignment(devicesCheckBox[i], Alignment.MIDDLE_CENTER); } Button saveButton = new Button("Speichern"); saveButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { List<String> names = new LinkedList<String>(); for (CheckBox checkbox : devicesCheckBox) { if (checkbox.booleanValue()) names.add(checkbox.getCaption()); } Structure struc = new Structure((String) nameTextField.getValue(), (String) typeComboBox.getValue(), names); MessageResponse response = parent.server.getStructureManager().createNewStructure(struc); getWindow().showNotification(response.toString(), Notification.TYPE_TRAY_NOTIFICATION); parent.server.getStructureManager().rereadFromFHEM(); parent.reloadTree(); } }); layout.addComponent(saveButton); layout.setComponentAlignment(saveButton, Alignment.MIDDLE_CENTER); return layout; }
From source file:de.gedoplan.webclients.vaadin.views.BaseMasterView.java
@Override public void myenter(ViewChangeListener.ViewChangeEvent event) { if (getComponentCount() > 0) { return;//ww w.j a va 2 s.c o m } LazyQueryDefinition queryDefinition = new LazyQueryDefinition(false, 10, getIdProperty()); queryDefinition.setMaxNestedPropertyDepth(3); LazyQueryContainer container = new LazyQueryContainer(queryDefinition, createQueryFactory()); container.getQueryView().setMaxCacheSize(100); table = new PagedTable(null); table.setContainerDataSource(container); table.setWidth(100, Unit.PERCENTAGE); table.setStyleName("masterview"); getColumns().forEach((field) -> { container.addContainerProperty(field.getPropertyId(), field.getType(), null, true, true); table.setColumnHeader(field.getPropertyId(), field.title.value()); }); table.setVisibleColumns( (Object[]) getColumns().stream().map(f -> f.getPropertyId()).toArray(size -> new String[size])); setMargin(true); setSizeFull(); addComponent(table); addComponent(table.createControls()); table.setPageLength(10); setComponentAlignment(table, Alignment.TOP_CENTER); configureTable(); }
From source file:de.gedoplan.webclients.vaadin.views.IndexView.java
@Override public void enter(ViewChangeListener.ViewChangeEvent event) { if (getComponentCount() > 0) { return;//from ww w.jav a 2 s. com } setSizeFull(); setMargin(true); setDefaultComponentAlignment(Alignment.TOP_CENTER); Label text = new Label("Demo Anwendung Vaadin"); text.setWidthUndefined(); text.setStyleName(ValoTheme.LABEL_H1); addComponent(text); }
From source file:de.symeda.sormas.ui.dashboard.map.DashboardMapComponent.java
License:Open Source License
private HorizontalLayout createFooter() { HorizontalLayout mapFooterLayout = new HorizontalLayout(); mapFooterLayout.setWidth(100, Unit.PERCENTAGE); mapFooterLayout.setSpacing(true);/*from ww w .ja va 2 s.co m*/ CssStyles.style(mapFooterLayout, CssStyles.VSPACE_4, CssStyles.VSPACE_TOP_3); // Map key dropdown button legendDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapKey)); CssStyles.style(legendDropdown, CssStyles.BUTTON_SUBTLE); legendDropdown.setContent(createLegend()); mapFooterLayout.addComponent(legendDropdown); mapFooterLayout.setComponentAlignment(legendDropdown, Alignment.MIDDLE_RIGHT); mapFooterLayout.setExpandRatio(legendDropdown, 1); // Layers dropdown button PopupButton layersDropdown = new PopupButton(I18nProperties.getCaption(Captions.dashboardMapLayers)); { CssStyles.style(layersDropdown, CssStyles.BUTTON_SUBTLE); VerticalLayout layersLayout = new VerticalLayout(); layersLayout.setMargin(true); layersLayout.setSpacing(false); layersLayout.setSizeUndefined(); layersDropdown.setContent(layersLayout); // Add check boxes and apply button { OptionGroup mapCaseDisplayModeSelect = new OptionGroup(); mapCaseDisplayModeSelect.setWidth(100, Unit.PERCENTAGE); mapCaseDisplayModeSelect.addItems((Object[]) MapCaseDisplayMode.values()); mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode); mapCaseDisplayModeSelect.addValueChangeListener(event -> { mapCaseDisplayMode = (MapCaseDisplayMode) event.getProperty().getValue(); refreshMap(); }); HorizontalLayout showCasesLayout = new HorizontalLayout(); { showCasesLayout.setMargin(false); showCasesLayout.setSpacing(false); CheckBox showCasesCheckBox = new CheckBox(); showCasesCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowCases)); showCasesCheckBox.setValue(showCases); showCasesCheckBox.addValueChangeListener(e -> { showCases = (boolean) e.getProperty().getValue(); mapCaseDisplayModeSelect.setEnabled(showCases); mapCaseDisplayModeSelect.setValue(mapCaseDisplayMode); refreshMap(); }); showCasesLayout.addComponent(showCasesCheckBox); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseMap)); CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY, CssStyles.HSPACE_LEFT_3); infoLabel.setHeightUndefined(); showCasesLayout.addComponent(infoLabel); showCasesLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER); } layersLayout.addComponent(showCasesLayout); layersLayout.addComponent(mapCaseDisplayModeSelect); mapCaseDisplayModeSelect.setEnabled(showCases); CheckBox showConfirmedContactsCheckBox = new CheckBox(); CheckBox showUnconfirmedContactsCheckBox = new CheckBox(); CheckBox showContactsCheckBox = new CheckBox(); showContactsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowContacts)); showContactsCheckBox.setValue(showContacts); showContactsCheckBox.addValueChangeListener(e -> { showContacts = (boolean) e.getProperty().getValue(); showConfirmedContactsCheckBox.setEnabled(showContacts); showConfirmedContactsCheckBox.setValue(true); showUnconfirmedContactsCheckBox.setEnabled(showContacts); showUnconfirmedContactsCheckBox.setValue(true); refreshMap(); }); layersLayout.addComponent(showContactsCheckBox); showConfirmedContactsCheckBox .setCaption(I18nProperties.getCaption(Captions.dashboardShowConfirmedContacts)); showConfirmedContactsCheckBox.setValue(showConfirmedContacts); showConfirmedContactsCheckBox.addValueChangeListener(e -> { showConfirmedContacts = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showConfirmedContactsCheckBox); CssStyles.style(showUnconfirmedContactsCheckBox, CssStyles.VSPACE_3); showUnconfirmedContactsCheckBox .setCaption(I18nProperties.getCaption(Captions.dashboardShowUnconfirmedContacts)); showUnconfirmedContactsCheckBox.setValue(showUnconfirmedContacts); showUnconfirmedContactsCheckBox.addValueChangeListener(e -> { showUnconfirmedContacts = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showUnconfirmedContactsCheckBox); showConfirmedContactsCheckBox.setEnabled(showContacts); showUnconfirmedContactsCheckBox.setEnabled(showContacts); CheckBox showEventsCheckBox = new CheckBox(); CssStyles.style(showEventsCheckBox, CssStyles.VSPACE_3); showEventsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowEvents)); showEventsCheckBox.setValue(showEvents); showEventsCheckBox.addValueChangeListener(e -> { showEvents = (boolean) e.getProperty().getValue(); refreshMap(); }); layersLayout.addComponent(showEventsCheckBox); if (UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_USER) || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_CLINICIAN) || UserProvider.getCurrent().hasUserRole(UserRole.NATIONAL_OBSERVER)) { OptionGroup regionMapVisualizationSelect = new OptionGroup(); regionMapVisualizationSelect.setWidth(100, Unit.PERCENTAGE); regionMapVisualizationSelect.addItems((Object[]) CaseMeasure.values()); regionMapVisualizationSelect.setValue(caseMeasure); regionMapVisualizationSelect.addValueChangeListener(event -> { caseMeasure = (CaseMeasure) event.getProperty().getValue(); refreshMap(); }); HorizontalLayout showRegionsLayout = new HorizontalLayout(); { showRegionsLayout.setMargin(false); showRegionsLayout.setSpacing(false); CheckBox showRegionsCheckBox = new CheckBox(); showRegionsCheckBox.setCaption(I18nProperties.getCaption(Captions.dashboardShowRegions)); showRegionsCheckBox.setValue(showRegions); showRegionsCheckBox.addValueChangeListener(e -> { showRegions = (boolean) e.getProperty().getValue(); regionMapVisualizationSelect.setEnabled(showRegions); regionMapVisualizationSelect.setValue(caseMeasure); refreshMap(); }); showRegionsLayout.addComponent(showRegionsCheckBox); Label infoLabel = new Label(VaadinIcons.INFO_CIRCLE.getHtml(), ContentMode.HTML); infoLabel.setDescription(I18nProperties.getString(Strings.infoCaseIncidence)); CssStyles.style(infoLabel, CssStyles.LABEL_MEDIUM, CssStyles.LABEL_SECONDARY, CssStyles.HSPACE_LEFT_3); infoLabel.setHeightUndefined(); showRegionsLayout.addComponent(infoLabel); showRegionsLayout.setComponentAlignment(infoLabel, Alignment.TOP_CENTER); } layersLayout.addComponent(showRegionsLayout); layersLayout.addComponent(regionMapVisualizationSelect); regionMapVisualizationSelect.setEnabled(showRegions); } } } mapFooterLayout.addComponent(layersDropdown); mapFooterLayout.setComponentAlignment(layersDropdown, Alignment.MIDDLE_RIGHT); return mapFooterLayout; }
From source file:de.symeda.sormas.ui.login.LoginScreen.java
License:Open Source License
private CssLayout buildLoginInformation() { CssLayout loginInformation = new CssLayout(); loginInformation.setStyleName("login-information"); VerticalLayout innerLayout = new VerticalLayout(); innerLayout.setSizeFull();//from www. java 2s . co m Image img = new Image(null, new ThemeResource("img/sormas-logo-big.png")); img.setHeight(240, Unit.PIXELS); innerLayout.addComponent(img); innerLayout.setComponentAlignment(img, Alignment.TOP_CENTER); innerLayout.setExpandRatio(img, 0); Label loginInfoText = new Label("<h1>SORMAS</h1>" + "<h2 style='color:white'>Surveillance, Outbreak Response Management and Analysis System</h2>" + "<h3 style='color:white; text-transform:uppercase'>● Disease Prevention<br>● Disease Detection<br>● Outbreak Response</h3>", ContentMode.HTML); loginInfoText.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoText); innerLayout.setExpandRatio(loginInfoText, 1); Label loginInfoCopyright = new Label(" 2019 SORMAS. All Rights Reserved."); loginInfoCopyright.setWidth(100, Unit.PERCENTAGE); innerLayout.addComponent(loginInfoCopyright); innerLayout.setExpandRatio(loginInfoCopyright, 0); innerLayout.setComponentAlignment(loginInfoCopyright, Alignment.BOTTOM_LEFT); loginInformation.addComponent(innerLayout); return loginInformation; }
From source file:de.symeda.sormas.ui.Menu.java
License:Open Source License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.TOP_CENTER); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);/*w w w . j av a 2 s.co m*/ Label title = new Label("SORMAS"); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/sormas-logo.png")); CssStyles.style(image, ValoTheme.MENU_LOGO, ValoTheme.BUTTON_LINK); image.addClickListener(new MouseEvents.ClickListener() { @Override public void click(MouseEvents.ClickEvent event) { SormasUI.get().getNavigator().navigateTo(SurveillanceDashboardView.VIEW_NAME); } }); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem(I18nProperties.getCaption(Captions.actionLogout) + " (" + UserProvider.getCurrent().getUserName() + ")", VaadinIcons.SIGN_OUT, new Command() { @Override public void menuSelected(MenuItem selectedItem) { LoginHelper.logout(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button(I18nProperties.getCaption(Captions.menu), new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(VaadinIcons.MENU); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
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. java2s .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); }