List of usage examples for com.vaadin.server Page getCurrent
public static Page getCurrent()
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.PortletUriFragmentUtility.java
License:Apache License
/** * Initialisiert die Listener, die auf die TabChange events reagieren. *///from w w w .j a v a 2s. co m final void initialize() { eventBus.addHandler(TabChangeEvent.class, new TabChangeEventHandler() { private static final long serialVersionUID = 42L; @Override public void onTabChange(TabChangeEvent event) { String fragmentID = buildTabStatus(); Page.getCurrent().setUriFragment(fragmentID, false); } }); Page.getCurrent().addUriFragmentChangedListener(this); }
From source file:de.unioninvestment.eai.portal.portlet.crud.mvp.views.ui.PortletUriFragmentUtility.java
License:Apache License
/** * Setzt initial per Javascript das Fragment mit den aktuell aktiven Tabs. */ public void setInitialFragment() { Page.getCurrent().setUriFragment(buildTabStatus()); }
From source file:de.unioninvestment.eai.portal.portlet.crud.scripting.domain.NotificationProvider.java
License:Apache License
/** * Zeigt entweder eine Warnung, einen Fehler oder eine Info im Window fr * die entsprechende Anzeige/*from w w w .j a va 2 s.c o m*/ * * @param description * Der anzuzeigende Text der Notification */ public void doCall(String description) { if (type == Type.ERROR) { Notification.show(Type.ERROR.value, description, Notification.Type.ERROR_MESSAGE); } else if (type == Type.WARNING) { Notification.show(Type.WARNING.value, description, Notification.Type.WARNING_MESSAGE); } else { Notification notification = new Notification(Type.INFO.value, description, Notification.Type.HUMANIZED_MESSAGE); notification.setDelayMsec(1500); notification.show(Page.getCurrent()); } }
From source file:de.unioninvestment.eai.portal.support.vaadin.PortletUtils.java
License:Apache License
/** * Gibt dem Browser die Information, zu einer alternativen Ansicht des * Portlets zu wechseln.//w w w. jav a 2 s .c om * * @param targetMode * der Ziel-Modus * @return <code>true</code>, falls ein Wechsel erfolgen kann */ public static boolean switchPortletMode(PortletMode targetMode) { try { PortletResponse response = VaadinPortletService.getCurrentResponse().getPortletResponse(); if (response instanceof MimeResponse) { PortletURL url = ((MimeResponse) response).createRenderURL(); url.setPortletMode(targetMode); Page.getCurrent().setLocation(url.toString()); return true; } else if (response instanceof StateAwareResponse) { ((StateAwareResponse) response).setPortletMode(targetMode); return true; } else { LOGGER.error("Portlet mode can only be changed from a portlet request"); return false; } } catch (IllegalStateException e) { // not in portlet: then don't switch back return false; } catch (PortletModeException e) { // not allowed: then don't switch back return false; } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeExperimentMetadataComponent.java
License:Open Source License
private void initUI() { propLayout = new VerticalLayout(); propLayout.setWidth(100.0f, Unit.PERCENTAGE); propLayout.setMargin(new MarginInfo(true, false, true, true)); propLayout.setSpacing(true);/* w w w .j a v a 2 s . c o m*/ this.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.8f, Unit.PIXELS); this.setCompositionRoot(propLayout); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeMetadataComponent.java
License:Open Source License
private void initUI() { properties = new VerticalLayout(); properties.setWidth(100.0f, Unit.PERCENTAGE); properties.setMargin(new MarginInfo(true, false, true, true)); properties.setSpacing(true);/*from w w w. j ava 2s . c o m*/ this.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.8f, Unit.PIXELS); this.setCompositionRoot(properties); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.ChangeProjectMetadataComponent.java
License:Open Source License
private void initUI() { properties = new VerticalLayout(); properties.setWidth(100.0f, Unit.PERCENTAGE); properties.setMargin(new MarginInfo(true, false, true, true)); properties.setSpacing(true);/*from w w w .j a v a 2 s .c om*/ this.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.8f, Unit.PIXELS); this.setCompositionRoot(properties); }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.DatasetView.java
License:Open Source License
@Override public void enter(ViewChangeEvent event) { Map<String, String> map = getMap(event.getParameters()); if (map == null) return;/*from w w w .java 2 s. com*/ 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("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", Timestamp.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("CODE", String.class, null); List<ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSet> retrievedDatasets = null; switch (map.get("type")) { case "project": String projectIdentifier = map.get("id"); retrievedDatasets = datahandler.getOpenBisClient() .getDataSetsOfProjectByIdentifierWithSearchCriteria(projectIdentifier); break; case "experiment": String experimentIdentifier = map.get("id"); retrievedDatasets = datahandler.getOpenBisClient() .getDataSetsOfExperimentByCodeWithSearchCriteria(experimentIdentifier); break; case "sample": String sampleIdentifier = map.get("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; } numberOfDatasets = retrievedDatasets.size(); if (numberOfDatasets == 0) { new Notification("No datasets available.", "<br/>Please contact the project manager.", Type.WARNING_MESSAGE, true).show(Page.getCurrent()); } 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:ss"); String dateString = sd.format(date); Timestamp ts = Timestamp.valueOf(dateString); String sampleID = samples.get(d.getCode()); registerDatasetInTable(d, datasetContainer, projectCode, sampleID, ts, null); } } this.setContainerDataSource(datasetContainer); } catch (Exception e) { e.printStackTrace(); LOGGER.error(String.format("getting dataset failed for dataset %s", map.toString()), e.getStackTrace()); } }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.MSHBiologicalSampleStateMachine.java
License:Open Source License
public boolean traverseToNextState(String sampleID) { // first, check if all conditions are met before traversing into next state String fromState = new String(currentState.name()); String toState = new String(currentState.nextState().name()); if (fromState.equals(toState)) { // nothing to do... however, we should notify the user Notification errorEndStateReached = new Notification( "The current process seems to have reached it's end state.", "<i>Skipping this transition with no changes performed...</i>", Type.WARNING_MESSAGE, true); errorEndStateReached.setHtmlContentAllowed(true); errorEndStateReached.show(Page.getCurrent()); return false; }//from w w w . j a v a 2 s .co m if (currentState.checkConditions()) { stateMachineLogging.debug("traversing from " + fromState + " to " + toState); // first check if OpenBIS is still in the currentState String mostRecentStateName = retrieveCurrentStateFromOpenBIS(); if (mostRecentStateName != null && !fromState.equals(mostRecentStateName)) { sampleViewRef.updateContent(); Notification errorStateMoved = new Notification("The sample's status has changed in the meantime!", "<i>Most likely, someone else in your group is working on the same data.</i>", Type.ERROR_MESSAGE, true); errorStateMoved.setHtmlContentAllowed(true); errorStateMoved.show(Page.getCurrent()); // this should redraw the current state //this.setState(mostRecentStateName); //this.buildCurrentInterface(); return false; } updateOpenBISCurrentProcessState(sampleID, toState); sampleViewRef.updateContent(); notifyUsersOfTransition(fromState, toState); return true; } return false; }
From source file:de.uni_tuebingen.qbic.qbicmainportlet.PatientStatusComponent.java
License:Open Source License
private void initUI() { status = new VerticalLayout(); status.setWidth(100.0f, Unit.PERCENTAGE); status.setMargin(new MarginInfo(true, false, false, true)); status.setSpacing(true);//from ww w. j av a 2 s . co m // status.setSizeFull(); VerticalLayout projectStatus = new VerticalLayout(); projectStatus.setMargin(new MarginInfo(true, false, true, true)); projectStatus.setSpacing(true); experiments = new Grid(); experiments.setReadOnly(true); experiments.setWidth(100.0f, Unit.PERCENTAGE); // experiments.setHeightMode(HeightMode.ROW); status.addComponent(experiments); ProgressBar progressBar = new ProgressBar(); progressBar.setValue(0f); status.addComponent(progressBar); projectStatus.addComponent(status); this.setWidth(Page.getCurrent().getBrowserWindowWidth() * 0.85f, Unit.PIXELS); this.setCompositionRoot(projectStatus); }