List of usage examples for com.vaadin.server FontAwesome PENCIL
FontAwesome PENCIL
To view the source code for com.vaadin.server FontAwesome PENCIL.
Click Source Link
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();/*from www . j a va 2 s. co m*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }
From source file:com.mycollab.shell.view.MainViewImpl.java
License:Open Source License
private MHorizontalLayout buildAccountMenuLayout() { accountLayout.removeAllComponents(); if (SiteConfiguration.isDemandEdition()) { // display trial box if user in trial mode SimpleBillingAccount billingAccount = AppContext.getBillingAccount(); if (AccountStatusConstants.TRIAL.equals(billingAccount.getStatus())) { if ("Free".equals(billingAccount.getBillingPlan().getBillingtype())) { Label informLbl = new Label( "<div class='informBlock'>FREE CHARGE<br>UPGRADE</div><div class='informBlock'>>></div>", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withFullHeight() .withStyleName("trialInformBox"); informBox.setMargin(new MarginInfo(false, true, false, false)); informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }))); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); } else { Label informLbl = new Label("", ContentMode.HTML); informLbl.addStyleName("trialEndingNotification"); informLbl.setHeight("100%"); MHorizontalLayout informBox = new MHorizontalLayout(informLbl).withStyleName("trialInformBox") .withMargin(new MarginInfo(false, true, false, false)).withFullHeight(); informBox.addLayoutClickListener(layoutClickEvent -> EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" }))); accountLayout.with(informBox).withAlign(informBox, Alignment.MIDDLE_LEFT); Duration dur = new Duration(new DateTime(billingAccount.getCreatedtime()), new DateTime()); int daysLeft = dur.toStandardDays().getDays(); if (daysLeft > 30) { informLbl.setValue("<div class='informBlock'>Trial ended<br></div>"); AppContext.getInstance().setIsValidAccount(false); } else { informLbl.setValue(String.format("<div class='informBlock'>Trial ending<br>%d days " + "left</div><div class='informBlock'>>></div>", 30 - daysLeft)); }/*from w ww . ja v a2 s . c om*/ } } } Label accountNameLabel = new Label(AppContext.getSubDomain()); accountNameLabel.addStyleName("subdomain"); accountLayout.addComponent(accountNameLabel); if (SiteConfiguration.isCommunityEdition()) { MButton buyPremiumBtn = new MButton("Upgrade to Pro edition", clickEvent -> UI.getCurrent().addWindow(new AdWindow())).withIcon(FontAwesome.SHOPPING_CART) .withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } LicenseResolver licenseResolver = AppContextUtil.getSpringBean(LicenseResolver.class); if (licenseResolver != null) { LicenseInfo licenseInfo = licenseResolver.getLicenseInfo(); if (licenseInfo != null) { if (licenseInfo.isExpired()) { MButton buyPremiumBtn = new MButton(AppContext.getMessage(LicenseI18nEnum.EXPIRE_NOTIFICATION), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } else if (licenseInfo.isTrial()) { Duration dur = new Duration(new DateTime(), new DateTime(licenseInfo.getExpireDate())); int days = dur.toStandardDays().getDays(); MButton buyPremiumBtn = new MButton( AppContext.getMessage(LicenseI18nEnum.TRIAL_NOTIFICATION, days), clickEvent -> UI.getCurrent().addWindow(new BuyPremiumSoftwareWindow())) .withIcon(FontAwesome.SHOPPING_CART).withStyleName("ad"); accountLayout.addComponent(buyPremiumBtn); } } } NotificationComponent notificationComponent = new NotificationComponent(); accountLayout.addComponent(notificationComponent); if (StringUtils.isBlank(AppContext.getUser().getAvatarid())) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new RequestUploadAvatarNotification())); } if (!SiteConfiguration.isDemandEdition()) { ExtMailService mailService = AppContextUtil.getSpringBean(ExtMailService.class); if (!mailService.isMailSetupValid()) { EventBusFactory.getInstance() .post(new ShellEvent.NewNotification(this, new SmtpSetupNotification())); } SimpleUser user = AppContext.getUser(); GregorianCalendar tenDaysAgo = new GregorianCalendar(); tenDaysAgo.add(Calendar.DATE, -10); if (Boolean.TRUE.equals(user.getRequestad()) && user.getRegisteredtime().before(tenDaysAgo.getTime())) { UI.getCurrent().addWindow(new AdRequestWindow(user)); } } Resource userAvatarRes = UserAvatarControlFactory.createAvatarResource(AppContext.getUserAvatarId(), 24); final PopupButton accountMenu = new PopupButton(""); accountMenu.setIcon(userAvatarRes); accountMenu.setDescription(AppContext.getUserDisplayName()); OptionPopupContent accountPopupContent = new OptionPopupContent(); MButton myProfileBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_PROFILE), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "preview" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.PROFILE)); accountPopupContent.addOption(myProfileBtn); MButton userMgtBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_USERS_AND_ROLES), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "user", "list" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.USERS)); accountPopupContent.addOption(userMgtBtn); MButton generalSettingBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETTING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "general" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.GENERAL_SETTING)); accountPopupContent.addOption(generalSettingBtn); MButton themeCustomizeBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_THEME), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setting", "theme" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.THEME_CUSTOMIZE)); accountPopupContent.addOption(themeCustomizeBtn); if (!SiteConfiguration.isDemandEdition()) { MButton setupBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_SETUP), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "setup" })); }).withIcon(FontAwesome.WRENCH); accountPopupContent.addOption(setupBtn); } accountPopupContent.addSeparator(); MButton helpBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_HELP)) .withIcon(FontAwesome.MORTAR_BOARD); ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/meet-mycollab/"); BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes); helpOpener.extend(helpBtn); accountPopupContent.addOption(helpBtn); MButton supportBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SUPPORT)) .withIcon(FontAwesome.LIFE_SAVER); ExternalResource supportRes = new ExternalResource("http://support.mycollab.com/"); BrowserWindowOpener supportOpener = new BrowserWindowOpener(supportRes); supportOpener.extend(supportBtn); accountPopupContent.addOption(supportBtn); MButton translateBtn = new MButton(AppContext.getMessage(GenericI18Enum.ACTION_TRANSLATE)) .withIcon(FontAwesome.PENCIL); ExternalResource translateRes = new ExternalResource( "https://community.mycollab.com/docs/developing-mycollab/translating/"); BrowserWindowOpener translateOpener = new BrowserWindowOpener(translateRes); translateOpener.extend(translateBtn); accountPopupContent.addOption(translateBtn); if (!SiteConfiguration.isCommunityEdition()) { MButton myAccountBtn = new MButton(AppContext.getMessage(AdminI18nEnum.VIEW_BILLING), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance() .post(new ShellEvent.GotoUserAccountModule(this, new String[] { "billing" })); }).withIcon(SettingAssetsManager.getAsset(SettingUIConstants.BILLING)); accountPopupContent.addOption(myAccountBtn); } accountPopupContent.addSeparator(); MButton aboutBtn = new MButton("About MyCollab", clickEvent -> { accountMenu.setPopupVisible(false); Window aboutWindow = ViewManager.getCacheComponent(AbstractAboutWindow.class); UI.getCurrent().addWindow(aboutWindow); }).withIcon(FontAwesome.INFO_CIRCLE); accountPopupContent.addOption(aboutBtn); Button releaseNotesBtn = new Button("Release Notes"); ExternalResource releaseNotesRes = new ExternalResource( "https://community.mycollab.com/docs/hosting-mycollab-on-your-own-server/releases/"); BrowserWindowOpener releaseNotesOpener = new BrowserWindowOpener(releaseNotesRes); releaseNotesOpener.extend(releaseNotesBtn); releaseNotesBtn.setIcon(FontAwesome.BULLHORN); accountPopupContent.addOption(releaseNotesBtn); MButton signoutBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_SIGNOUT), clickEvent -> { accountMenu.setPopupVisible(false); EventBusFactory.getInstance().post(new ShellEvent.LogOut(this, null)); }).withIcon(FontAwesome.SIGN_OUT); accountPopupContent.addSeparator(); accountPopupContent.addOption(signoutBtn); accountMenu.setContent(accountPopupContent); accountLayout.addComponent(accountMenu); return accountLayout; }
From source file:com.save.client.promodeals.PDDataContainer.java
public PDDataContainer(int clientId) { this.clientId = clientId; addContainerProperty("sn", Integer.class, null); addContainerProperty("promo items", String.class, null); addContainerProperty("amount", Double.class, null); addContainerProperty("quantity", Double.class, null); addContainerProperty("product", String.class, null); addContainerProperty("view", String.class, null); addContainerProperty("edit", String.class, null); addContainerProperty("del", String.class, null); for (PromoDeals p : pds.getPromoDealsByClientId(getClientId())) { Item item = getItem(addItem());//from www . j av a2 s . c o m item.getItemProperty("sn").setValue(p.getPromoId()); item.getItemProperty("promo items").setValue(p.getPromoItem()); item.getItemProperty("amount").setValue(p.getPromoAmount()); item.getItemProperty("quantity").setValue(p.getQuantity()); item.getItemProperty("product").setValue(p.getProductItem()); item.getItemProperty("view").setValue(FontAwesome.PRINT.getHtml()); item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml()); item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml()); } }
From source file:com.save.employee.maintenance.MRDataContainer.java
public MRDataContainer(int employeeId) { this.employeeId = employeeId; addContainerProperty("plate no.", String.class, null); addContainerProperty("amount", Double.class, null); addContainerProperty("date", String.class, null); addContainerProperty("type", String.class, null); addContainerProperty("edit", String.class, null); addContainerProperty("del", String.class, null); addContainerProperty("id", String.class, null); for (MaintenanceReimbursement mr : mrs.getMaintenanceReimbursementByEmployee(getEmployeeId())) { Item item = getItem(addItem());//from ww w.j a v a 2s . co m item.getItemProperty("plate no.").setValue(mr.getPlateNo()); item.getItemProperty("amount").setValue(mr.getAmount()); item.getItemProperty("date") .setValue(CommonUtilities.convertDateWithFormat(mr.getDateCovered().toString(), "yyyy-MMM-dd")); item.getItemProperty("type").setValue(mr.getFormType()); item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml()); item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml()); item.getItemProperty("id").setValue(String.valueOf(mr.getMaintenanceId())); } }
From source file:com.save.employee.request.RLDataContainer.java
public RLDataContainer(int employeeId) { this.employeeId = employeeId; addContainerProperty("control no.", String.class, null); addContainerProperty("reimbursement", Double.class, null); // addContainerProperty("area", Integer.class, null); addContainerProperty("activity", String.class, null); addContainerProperty("date", String.class, null); addContainerProperty("venue", String.class, null); addContainerProperty("edit", String.class, null); addContainerProperty("liquidate", String.class, null); addContainerProperty("view", String.class, null); addContainerProperty("del", String.class, null); addContainerProperty("id", Integer.class, null); for (LiquidationForm lf : rls.getAllRLByEmployeeId(getEmployeeId())) { Item item = getItem(addItem());/*w ww.ja va 2 s.co m*/ item.getItemProperty("control no.").setValue(lf.getControlNo()); item.getItemProperty("reimbursement").setValue(lf.getReimbursedAmount()); // item.getItemProperty("area").setValue(lf.getAreaCode()); item.getItemProperty("activity").setValue(lf.getActivity()); item.getItemProperty("date").setValue( CommonUtilities.convertDateWithFormat(lf.getDateOfActivity().toString(), "yyyy-MMM-dd")); item.getItemProperty("venue").setValue(lf.getVenue()); item.getItemProperty("edit").setValue(FontAwesome.PENCIL.getHtml()); item.getItemProperty("liquidate").setValue(FontAwesome.LEAF.getHtml()); item.getItemProperty("view").setValue(FontAwesome.EYE.getHtml()); item.getItemProperty("del").setValue(FontAwesome.TRASH_O.getHtml()); item.getItemProperty("id").setValue(lf.getRequestId()); } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.BiologicalSamplesComponent.java
License:Open Source License
/** * //from w ww . java 2 s . co m * @param id */ public void updateUI(String id) { currentID = id; sampleBioGrid = new Grid(); sampleEntityGrid = new Grid(); sampleEntityGrid.addSelectionListener(new SelectionListener() { @Override public void select(SelectionEvent event) { BeanItem<BiologicalEntitySampleBean> selectedBean = samplesEntity .getItem(sampleEntityGrid.getSelectedRow()); if (selectedBean == null) { TextField filterField = (TextField) sampleBioGrid.getHeaderRow(1).getCell("biologicalEntity") .getComponent(); filterField.setValue(""); } else { TextField filterField = (TextField) sampleBioGrid.getHeaderRow(1).getCell("biologicalEntity") .getComponent(); filterField.setValue(selectedBean.getBean().getCode()); // samplesBio.addContainerFilter("biologicalEntity", // selectedBean.getBean().getSecondaryName(), false, false); } } }); if (id == null) return; BeanItemContainer<BiologicalSampleBean> samplesBioContainer = new BeanItemContainer<BiologicalSampleBean>( BiologicalSampleBean.class); BeanItemContainer<BiologicalEntitySampleBean> samplesEntityContainer = new BeanItemContainer<BiologicalEntitySampleBean>( BiologicalEntitySampleBean.class); List<Sample> allSamples = datahandler.getOpenBisClient() .getSamplesWithParentsAndChildrenOfProjectBySearchService(id); List<VocabularyTerm> terms = null; Map<String, String> termsMap = new HashMap<String, String>(); for (Sample sample : allSamples) { if (sample.getSampleTypeCode().equals(sampleTypes.Q_BIOLOGICAL_ENTITY.toString())) { Map<String, String> sampleProperties = sample.getProperties(); BiologicalEntitySampleBean newEntityBean = new BiologicalEntitySampleBean(); newEntityBean.setCode(sample.getCode()); newEntityBean.setId(sample.getIdentifier()); newEntityBean.setType(sample.getSampleTypeCode()); newEntityBean.setAdditionalInfo(sampleProperties.get("Q_ADDITIONAL_INFO")); newEntityBean.setExternalDB(sampleProperties.get("Q_EXTERNALDB_ID")); newEntityBean.setSecondaryName(sampleProperties.get("Q_SECONDARY_NAME")); String organismID = sampleProperties.get("Q_NCBI_ORGANISM"); newEntityBean.setOrganism(organismID); if (terms != null) { if (termsMap.containsKey(organismID)) { newEntityBean.setOrganismName(termsMap.get(organismID)); } else { for (VocabularyTerm term : terms) { if (term.getCode().equals(organismID)) { newEntityBean.setOrganismName(term.getLabel()); break; } } } } else { for (Vocabulary vocab : datahandler.getOpenBisClient().getFacade().listVocabularies()) { if (vocab.getCode().equals("Q_NCBI_TAXONOMY")) { terms = vocab.getTerms(); for (VocabularyTerm term : vocab.getTerms()) { if (term.getCode().equals(organismID)) { newEntityBean.setOrganismName(term.getLabel()); termsMap.put(organismID, term.getLabel()); break; } } break; } } } newEntityBean.setProperties(sampleProperties); newEntityBean.setGender(sampleProperties.get("Q_GENDER")); samplesEntityContainer.addBean(newEntityBean); // for (Sample child : datahandler.getOpenBisClient().getChildrenSamples(sample)) { for (Sample realChild : sample.getChildren()) { if (realChild.getSampleTypeCode().equals(sampleTypes.Q_BIOLOGICAL_SAMPLE.toString())) { // Sample realChild = // datahandler.getOpenBisClient().getSampleByIdentifier(child.getIdentifier()); Map<String, String> sampleBioProperties = realChild.getProperties(); BiologicalSampleBean newBean = new BiologicalSampleBean(); newBean.setCode(realChild.getCode()); newBean.setId(realChild.getIdentifier()); newBean.setType(realChild.getSampleTypeCode()); newBean.setPrimaryTissue(sampleBioProperties.get("Q_PRIMARY_TISSUE")); newBean.setTissueDetailed(sampleBioProperties.get("Q_TISSUE_DETAILED")); newBean.setBiologicalEntity(sample.getCode()); newBean.setAdditionalInfo(sampleBioProperties.get("Q_ADDITIONAL_INFO")); newBean.setExternalDB(sampleBioProperties.get("Q_EXTERNALDB_ID")); newBean.setSecondaryName(sampleBioProperties.get("Q_SECONDARY_NAME")); newBean.setProperties(sampleBioProperties); samplesBioContainer.addBean(newBean); } } } } numberOfBioSamples = samplesBioContainer.size(); numberOfEntitySamples = samplesEntityContainer.size(); samplesBio = samplesBioContainer; samplesEntity = samplesEntityContainer; sampleEntityGrid.removeAllColumns(); final GeneratedPropertyContainer gpcEntity = new GeneratedPropertyContainer(samplesEntity); gpcEntity.removeContainerProperty("id"); gpcEntity.removeContainerProperty("type"); gpcEntity.removeContainerProperty("organismName"); gpcEntity.removeContainerProperty("organism"); sampleEntityGrid.setContainerDataSource(gpcEntity); sampleEntityGrid.setColumnReorderingAllowed(true); gpcEntity.addGeneratedProperty("Organism", new PropertyValueGenerator<String>() { @Override public Class<String> getType() { return String.class; } @Override public String getValue(Item item, Object itemId, Object propertyId) { String ncbi = String.format( "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Undef&name=%s&lvl=0&srchmode=1&keep=1&unlock' target='_blank'>%s</a>", item.getItemProperty("organism").getValue(), item.getItemProperty("organismName").getValue()); String link = String.format("<a href='%s", ncbi); return link; } }); sampleEntityGrid.getColumn("Organism").setRenderer(new HtmlRenderer()); final GeneratedPropertyContainer gpcBio = new GeneratedPropertyContainer(samplesBio); gpcBio.removeContainerProperty("id"); gpcBio.removeContainerProperty("type"); sampleBioGrid.setContainerDataSource(gpcBio); sampleBioGrid.setColumnReorderingAllowed(true); sampleBioGrid.setColumnOrder("secondaryName", "code"); gpcEntity.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); gpcBio.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); sampleEntityGrid.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { BeanItem selected = (BeanItem) samplesEntity.getItem(event.getItemId()); BiologicalEntitySampleBean selectedExp = (BiologicalEntitySampleBean) 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("sample"); state.notifyObservers(message); } }); sampleEntityGrid.getColumn("edit").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { BeanItem selected = (BeanItem) samplesEntity.getItem(event.getItemId()); BiologicalEntitySampleBean selectedSample = (BiologicalEntitySampleBean) 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.setIcon(FontAwesome.PENCIL); subWindow.setHeight("75%"); subWindow.addCloseListener(new CloseListener() { /** * */ private static final long serialVersionUID = -1329152609834711109L; @Override public void windowClose(CloseEvent e) { updateUI(currentID); } }); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(subWindow); } })); sampleEntityGrid.getColumn("edit").setWidth(70); sampleEntityGrid.getColumn("edit").setHeaderCaption(""); sampleEntityGrid.setColumnOrder("edit", "secondaryName", "Organism", "properties", "code", "additionalInfo", "gender", "externalDB"); sampleBioGrid.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { BeanItem selected = (BeanItem) samplesBio.getItem(event.getItemId()); BiologicalSampleBean selectedExp = (BiologicalSampleBean) 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("sample"); state.notifyObservers(message); } }); sampleBioGrid.getColumn("edit").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { BeanItem selected = (BeanItem) samplesBio.getItem(event.getItemId()); try { BiologicalSampleBean selectedSample = (BiologicalSampleBean) selected.getBean(); Window subWindow = new Window(); 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.setResizable(false); subWindow.addCloseListener(new CloseListener() { /** * */ private static final long serialVersionUID = -1329152609834711109L; @Override public void windowClose(CloseEvent e) { updateUI(currentID); } }); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(subWindow); } catch (NullPointerException e) { System.err.println("NullPointerException while trying to set metadata: " + e.getMessage()); } } })); sampleBioGrid.getColumn("edit").setWidth(70); sampleBioGrid.getColumn("edit").setHeaderCaption(""); sampleBioGrid.setColumnOrder("edit", "secondaryName", "primaryTissue", "properties", "tissueDetailed", "code", "additionalInfo", "biologicalEntity", "externalDB"); sampleBioGrid.getColumn("biologicalEntity").setHeaderCaption("Source"); helpers.GridFunctions.addColumnFilters(sampleBioGrid, gpcBio); helpers.GridFunctions.addColumnFilters(sampleEntityGrid, gpcEntity); if (fileDownloaderSources != null) exportSources.removeExtension(fileDownloaderSources); StreamResource srSource = Utils.getTSVStream(Utils.containerToString(samplesEntityContainer), String.format("%s_%s_", id.substring(1).replace("/", "_"), "sample_sources")); fileDownloaderSources = new FileDownloader(srSource); fileDownloaderSources.extend(exportSources); if (fileDownloaderSamples != null) exportSamples.removeExtension(fileDownloaderSamples); StreamResource srSamples = Utils.getTSVStream(Utils.containerToString(samplesBioContainer), String.format("%s_%s_", id.substring(1).replace("/", "_"), "extracted_samples")); fileDownloaderSamples = new FileDownloader(srSamples); fileDownloaderSamples.extend(exportSamples); this.buildLayout(); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ExperimentComponent.java
License:Open Source License
public void updateUI(ProjectBean currentBean) { projectBean = currentBean;//from ww w . ja v a 2 s . co m 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.ExperimentView.java
License:Open Source License
/** * init this view. builds the layout skeleton Menubar Description and others Statisitcs Experiment * Table Graph//from w w w . j av a2s .c om */ void initView() { setWidth(100, Unit.PERCENTAGE); setResponsive(true); expview_content = new VerticalLayout(); expview_content.setResponsive(true); expview_content.setMargin(new MarginInfo(true, true, false, false)); expview_tab = new TabSheet(); expview_tab.setWidth(100, Unit.PERCENTAGE); expview_tab.setResponsive(true); expview_tab.addStyleName(ValoTheme.TABSHEET_EQUAL_WIDTH_TABS); expview_tab.addStyleName(ValoTheme.TABSHEET_FRAMED); expview_tab.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR); expview_content.addComponent(expview_tab); expview_tab.addTab(initDescription(), "General Information").setIcon(FontAwesome.INFO_CIRCLE); // expview_tab.addTab(initStatistics(), "Statistics").setIcon(FontAwesome.CHECK_CIRCLE); expview_tab.addTab(initProperties(), "Metadata").setIcon(FontAwesome.LIST_UL); expview_tab.addTab(initTable(), "Samples").setIcon(FontAwesome.TINT); initNoteComponent(); expview_tab.addTab(innerNotesComponent).setIcon(FontAwesome.PENCIL); expview_content.setWidth(100, Unit.PERCENTAGE); this.addComponent(expview_content); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.LevelComponent.java
License:Open Source License
public void updateUI(String type, String id, String filterFor) { sampleGrid = new Grid(); typeString = type;/*from w w w. j a va2s. c o m*/ idString = id; filterString = filterFor; if (id == null) return; try { HierarchicalContainer datasetContainer = new HierarchicalContainer(); datasetContainer.addContainerProperty("Select", CheckBox.class, null); datasetContainer.addContainerProperty("Project", String.class, null); datasetContainer.addContainerProperty("Sample", String.class, null); datasetContainer.addContainerProperty("Description", String.class, null); // datasetContainer.addContainerProperty("Sample Type", String.class, null); datasetContainer.addContainerProperty("File Name", String.class, null); datasetContainer.addContainerProperty("File Type", String.class, null); datasetContainer.addContainerProperty("Dataset Type", String.class, null); datasetContainer.addContainerProperty("Registration Date", String.class, null); datasetContainer.addContainerProperty("Validated", Boolean.class, null); datasetContainer.addContainerProperty("File Size", String.class, null); datasetContainer.addContainerProperty("file_size_bytes", Long.class, null); datasetContainer.addContainerProperty("dl_link", String.class, null); datasetContainer.addContainerProperty("isDirectory", Boolean.class, null); datasetContainer.addContainerProperty("CODE", String.class, null); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> retrievedDatasetsAll = null; List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> retrievedDatasets = new ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet>(); Map<String, ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet>> datasetFilter = new HashMap<String, ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet>>(); // clear download queue for new view PortletSession portletSession = ((QbicmainportletUI) UI.getCurrent()).getPortletSession(); portletSession.setAttribute("qbic_download", new HashMap<String, AbstractMap.SimpleEntry<String, Long>>(), PortletSession.APPLICATION_SCOPE); Map<String, Sample> checkedTestSamples = new HashMap<String, Sample>(); switch (type) { case "project": String projectIdentifier = id; retrievedDatasetsAll = datahandler.getOpenBisClient() .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : retrievedDatasetsAll) { ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> values = datasetFilter .get(ds.getSampleIdentifierOrNull()); if (values == null) { values = new ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet>(); datasetFilter.put(ds.getSampleIdentifierOrNull(), values); } values.add(ds); } if (filterFor.equals("measured")) { BeanItemContainer<TestSampleBean> samplesContainer = new BeanItemContainer<TestSampleBean>( TestSampleBean.class); // List<Sample> allSamples = // datahandler.getOpenBisClient() // .getSamplesOfProjectBySearchService(projectIdentifier); List<Sample> allSamples = datahandler.getOpenBisClient() .getSamplesWithParentsAndChildrenOfProjectBySearchService(id); for (Sample sample : allSamples) { checkedTestSamples.put(sample.getCode(), sample); if (sample.getSampleTypeCode().equals("Q_TEST_SAMPLE")) { // samplesContainer.addBean(new SampleBean(sample.getIdentifier(), sample.getCode(), // sample.getSampleTypeCode(), null, null, null, sample.getProperties(), null, // null)); Map<String, String> sampleProperties = sample.getProperties(); TestSampleBean newBean = new TestSampleBean(); newBean.setCode(sample.getCode()); newBean.setId(sample.getIdentifier()); newBean.setType(sample.getSampleTypeCode()); newBean.setSampleType(sampleProperties.get("Q_SAMPLE_TYPE")); newBean.setAdditionalInfo(sampleProperties.get("Q_ADDITIONAL_INFO")); newBean.setExternalDB(sampleProperties.get("Q_EXTERNALDB_ID")); newBean.setSecondaryName(sampleProperties.get("Q_SECONDARY_NAME")); newBean.setProperties(sampleProperties); samplesContainer.addBean(newBean); ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> foundDataset = datasetFilter .get(sample.getIdentifier()); if (foundDataset != null) { retrievedDatasets.addAll(foundDataset); } for (Sample child : sample.getChildren()) { foundDataset = datasetFilter.get(child.getIdentifier()); if (foundDataset != null) { retrievedDatasets.addAll(foundDataset); } } } else if (sample.getSampleTypeCode().equals("Q_MHC_LIGAND_EXTRACT")) { // samplesContainer.addBean(new SampleBean(sample.getIdentifier(), sample.getCode(), // sample.getSampleTypeCode(), null, null, null, sample.getProperties(), null, // null)); Map<String, String> sampleProperties = sample.getProperties(); TestSampleBean newBean = new TestSampleBean(); newBean.setCode(sample.getCode()); newBean.setId(sample.getIdentifier()); newBean.setType(sample.getSampleTypeCode()); newBean.setSampleType(sampleProperties.get("Q_MHC_CLASS")); newBean.setAdditionalInfo(sampleProperties.get("Q_ANTIBODY")); newBean.setExternalDB(sampleProperties.get("Q_EXTERNALDB_ID")); newBean.setSecondaryName(sampleProperties.get("Q_SECONDARY_NAME")); newBean.setProperties(sampleProperties); samplesContainer.addBean(newBean); ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> foundDataset = datasetFilter .get(sample.getIdentifier()); if (foundDataset != null) { retrievedDatasets.addAll(foundDataset); } for (Sample child : sample.getChildren()) { foundDataset = datasetFilter.get(child.getIdentifier()); if (foundDataset != null) { retrievedDatasets.addAll(foundDataset); } } } } numberOfSamples = samplesContainer.size(); samples = samplesContainer; final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(samples); gpc.removeContainerProperty("id"); gpc.removeContainerProperty("type"); sampleGrid.setContainerDataSource(gpc); sampleGrid.setColumnReorderingAllowed(true); gpc.addGeneratedProperty("edit", new PropertyValueGenerator<String>() { @Override public String getValue(Item item, Object itemId, Object propertyId) { return "Edit"; } @Override public Class<String> getType() { return String.class; } }); sampleGrid.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { BeanItem selected = (BeanItem) samples.getItem(event.getItemId()); TestSampleBean selectedExp = (TestSampleBean) 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("sample"); state.notifyObservers(message); } }); sampleGrid.getColumn("edit").setRenderer(new ButtonRenderer(new RendererClickListener() { @Override public void click(RendererClickEvent event) { BeanItem selected = (BeanItem) samples.getItem(event.getItemId()); TestSampleBean selectedSample = (TestSampleBean) 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.setIcon(FontAwesome.PENCIL); subWindow.setHeight("75%"); subWindow.setResizable(false); subWindow.addCloseListener(new CloseListener() { /** * */ private static final long serialVersionUID = -1329152609834711109L; @Override public void windowClose(CloseEvent e) { updateUI(typeString, idString, filterString); } }); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(subWindow); } })); sampleGrid.getColumn("edit").setHeaderCaption(""); sampleGrid.getColumn("edit").setWidth(70); sampleGrid.setColumnOrder("edit", "secondaryName", "sampleType", "code", "properties", "additionalInfo", "externalDB"); helpers.GridFunctions.addColumnFilters(sampleGrid, gpc); numberOfSamples = samplesContainer.size(); sampleGrid.setCaption("Measured Samples"); this.datasetTable.setCaption("Raw Data"); numberOfDatasets = retrievedDatasets.size(); this.datasetTable.setPageLength(Math.max(3, Math.min(numberOfDatasets, 10))); // sampleGrid.setHeightMode(HeightMode.ROW); // sampleGrid.setHeightByRows(numberOfSamples); } else if (filterFor.equals("results")) { BeanItemContainer<TestSampleBean> samplesContainer = new BeanItemContainer<TestSampleBean>( TestSampleBean.class); List<Sample> allSamples = datahandler.getOpenBisClient() .getSamplesWithParentsAndChildrenOfProjectBySearchService(projectIdentifier); for (Sample sample : allSamples) { checkedTestSamples.put(sample.getCode(), sample); if (!sample.getSampleTypeCode().equals("Q_TEST_SAMPLE") && !sample.getSampleTypeCode().equals("Q_MICROARRAY_RUN") && !sample.getSampleTypeCode().equals("Q_MS_RUN") && !sample.getSampleTypeCode().equals("Q_BIOLOGICAL_SAMPLE") && !sample.getSampleTypeCode().equals("Q_BIOLOGICAL_ENTITY") && !sample.getSampleTypeCode().equals("Q_NGS_SINGLE_SAMPLE_RUN")) { Map<String, String> sampleProperties = sample.getProperties(); TestSampleBean newBean = new TestSampleBean(); newBean.setCode(sample.getCode()); newBean.setId(sample.getIdentifier()); newBean.setType(prettyNameMapper.getPrettyName(sample.getSampleTypeCode())); newBean.setAdditionalInfo(sampleProperties.get("Q_ADDITIONAL_INFO")); newBean.setSecondaryName(sampleProperties.get("Q_SECONDARY_NAME")); newBean.setProperties(sampleProperties); samplesContainer.addBean(newBean); ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> foundDataset = datasetFilter .get(sample.getIdentifier()); if (foundDataset != null) { for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet ds : foundDataset) { // we don't want to show project data or log files in the results tab if (ds.getDataSetTypeCode().equals("Q_PROJECT_DATA")) { if (ds.getProperties().get("Q_ATTACHMENT_TYPE").equals("INFORMATION")) { continue; } else { retrievedDatasets.add(ds); } } else if (ds.getDataSetTypeCode().contains("LOGS")) { continue; } else { retrievedDatasets.add(ds); } } // retrievedDatasets.addAll(foundDataset); } } } // numberOfSamples = samplesContainer.size(); samples = samplesContainer; final GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(samples); gpc.removeContainerProperty("id"); gpc.removeContainerProperty("sampleType"); sampleGrid.setContainerDataSource(gpc); sampleGrid.setColumnReorderingAllowed(true); sampleGrid.setColumnOrder("secondaryName", "type", "code", "properties"); numberOfSamples = samplesContainer.size(); // sampleGrid.setHeightMode(HeightMode.ROW); // sampleGrid.setHeightByRows(numberOfSamples); sampleGrid.setCaption("Workflow Runs"); helpers.GridFunctions.addColumnFilters(sampleGrid, gpc); this.datasetTable.setCaption("Result Files"); datasetTable.setColumnHeader("Sample", "Workflow Run"); sampleGrid.addItemClickListener(new ItemClickListener() { @Override public void itemClick(ItemClickEvent event) { BeanItem selected = (BeanItem) samples.getItem(event.getItemId()); TestSampleBean selectedExp = (TestSampleBean) 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("sample"); state.notifyObservers(message); } }); numberOfDatasets = retrievedDatasets.size(); this.datasetTable.setPageLength(Math.max(3, Math.min(numberOfDatasets, 10))); } break; case "experiment": String experimentIdentifier = id; retrievedDatasets = datahandler.getOpenBisClient() .getDataSetsOfExperimentByCodeWithSearchCriteria(experimentIdentifier); break; case "sample": String sampleIdentifier = id; String sampleCode = sampleIdentifier.split("/")[2]; retrievedDatasets = datahandler.getOpenBisClient().getDataSetsOfSample(sampleCode); break; default: retrievedDatasets = new ArrayList<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet>(); break; } BeanItemContainer<DatasetBean> forExport = new BeanItemContainer(DatasetBean.class); numberOfDatasets = retrievedDatasets.size(); if (numberOfDatasets == 0 & filterFor.equals("measured")) { descriptionLabel = new Label(String.format( "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", numberOfSamples, 0), ContentMode.HTML); helpers.Utils.Notification("No raw data available.", "No raw data is available for this project. Please contact the project manager if this is not expected.", "warning"); } else if (numberOfDatasets == 0 & filterFor.equals("results")) { descriptionLabel = new Label(String.format("This project contains %s result datasets.", 0), ContentMode.HTML); helpers.Utils.Notification("No results available.", "No result data is available for this project. Please contact the project manager if this is not expected.", "warning"); } else { Map<String, String> samples = new HashMap<String, String>(); // project same for all datasets String projectCode = retrievedDatasets.get(0).getExperimentIdentifier().split("/")[2]; for (ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet dataset : retrievedDatasets) { samples.put(dataset.getCode(), dataset.getSampleIdentifierOrNull().split("/")[2]); } List<DatasetBean> dsBeans = datahandler.queryDatasetsForFolderStructure(retrievedDatasets); for (DatasetBean d : dsBeans) { Date date = d.getRegistrationDate(); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm a"); String dateString = sd.format(date); // Timestamp ts = Timestamp.valueOf(dateString); String sampleID = samples.get(d.getCode()); forExport.addBean(d); Sample dsSample = checkedTestSamples.get(sampleID); String secNameDS = d.getProperties().get("Q_SECONDARY_NAME"); String secName = datahandler.getSecondaryName(dsSample, secNameDS); registerDatasetInTable(d, datasetContainer, projectCode, sampleID, dateString, null, secName); } if (filterFor.equals("measured")) { descriptionLabel = new Label(String.format( "This project contains %s measured samples for which %s raw data dataset(s) have been registered.", numberOfSamples, dsBeans.size()), ContentMode.HTML); } else if (filterFor.equals("results")) { descriptionLabel = new Label( String.format("This project contains %s result datasets.", dsBeans.size()), ContentMode.HTML); } } this.setContainerDataSource(datasetContainer); if (fileDownloaderData != null) this.exportData.removeExtension(fileDownloaderData); StreamResource srData = Utils.getTSVStream(Utils.containerToString(forExport), String.format("%s_%s_", id.substring(1).replace("/", "_"), datasetTable.getCaption().replace(" ", "_"))); fileDownloaderData = new FileDownloader(srData); fileDownloaderData.extend(exportData); if (fileDownloaderSamples != null) this.exportSamples.removeExtension(fileDownloaderSamples); StreamResource srSamples = Utils.getTSVStream(Utils.containerToString(samples), String.format("%s_%s_", id.substring(1).replace("/", "_"), sampleGrid.getCaption().replaceAll(" ", "_"))); fileDownloaderSamples = new FileDownloader(srSamples); fileDownloaderSamples.extend(exportSamples); } catch (Exception e) { e.printStackTrace(); LOGGER.error(String.format("getting dataset failed for dataset %s %s", type, id), e.getStackTrace()); } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ProjInformationComponent.java
License:Open Source License
private void initUI() { vert = new VerticalLayout(); descHorz = new HorizontalLayout(); // horz = new HorizontalLayout(); statusPanel = new Panel(); descriptionPanel = new Panel(); datasetTable = buildFilterTable();/*ww w. j av a2 s .c o m*/ peopleInCharge = new Accordion(); setResponsive(true); vert.setResponsive(true); descHorz.setResponsive(true); statusPanel.setResponsive(true); descriptionPanel.setResponsive(true); vert.setMargin(new MarginInfo(true, true, false, false)); setSizeFull(); vert.setSizeFull(); descHorz.setSizeFull(); statusPanel.setSizeFull(); descriptionPanel.setSizeFull(); investigator = new Label("", ContentMode.HTML); contactPerson = new Label("", ContentMode.HTML); projectManager = new Label("", ContentMode.HTML); final VerticalLayout layoutI = new VerticalLayout(investigator); final VerticalLayout layoutC = new VerticalLayout(contactPerson); final VerticalLayout layoutP = new VerticalLayout(projectManager); layoutI.setMargin(true); layoutC.setMargin(true); layoutP.setMargin(true); peopleInCharge.addTab(layoutI, "Investigator"); peopleInCharge.addTab(layoutC, "Contact Person"); peopleInCharge.addTab(layoutP, "Project Manager"); descEdit = new Button("Edit"); descEdit.setIcon(FontAwesome.PENCIL); descEdit.setStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); descEdit.setResponsive(true); descEdit.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { changeMetadata.updateUI(projectBean); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subContent.addComponent(changeMetadata); Window subWindow = new Window("Edit Metadata"); subWindow.setContent(subContent); // Center it in the browser window subWindow.center(); subWindow.setModal(true); subWindow.setIcon(FontAwesome.PENCIL); subWindow.setHeight("75%"); subWindow.setResizable(false); // subWindow.setSizeFull(); subWindow.addCloseListener(new CloseListener() { /** * */ private static final long serialVersionUID = -1329152609834711109L; @Override public void windowClose(CloseEvent e) { ProjectBean updatedBean = datahandler.getProjectFromDB(projectBean.getId()); updateUI(updatedBean, projectType); } }); QbicmainportletUI ui = (QbicmainportletUI) UI.getCurrent(); ui.addWindow(subWindow); } }); // horz.addComponent(descEdit); // horz.setComponentAlignment(descEdit, Alignment.TOP_RIGHT); // horz.setExpandRatio(investigator, 0.4f); // horz.setExpandRatio(contactPerson, 0.4f); // horz.setExpandRatio(descEdit, 0.2f); contact = new Label("", ContentMode.HTML); patientInformation = new Label("No patient information provided.", ContentMode.HTML); experimentLabel = new Label(""); statusContent = new VerticalLayout(); hlaTypeLabel = new Label("Not available.", ContentMode.HTML); hlaTypeLabel.setStyleName("patientview"); this.setCompositionRoot(vert); // this.setCompositionRoot(mainLayout); }