]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
ae039710818a31b2b00aaae5d94b6b8b6846b545
[simantics/sysdyn.git] /
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.sysdyn.ui.properties;\r
13 \r
14 import java.util.Collection;\r
15 import java.util.Collections;\r
16 import java.util.HashMap;\r
17 import java.util.Map;\r
18 \r
19 import org.eclipse.core.runtime.IAdaptable;\r
20 import org.eclipse.jface.layout.GridDataFactory;\r
21 import org.eclipse.jface.layout.GridLayoutFactory;\r
22 import org.eclipse.jface.resource.JFaceResources;\r
23 import org.eclipse.jface.resource.LocalResourceManager;\r
24 import org.eclipse.jface.viewers.ISelectionProvider;\r
25 import org.eclipse.jface.viewers.IStructuredSelection;\r
26 import org.eclipse.jface.viewers.StructuredSelection;\r
27 import org.eclipse.swt.SWT;\r
28 import org.eclipse.swt.custom.ScrolledComposite;\r
29 import org.eclipse.swt.events.DisposeEvent;\r
30 import org.eclipse.swt.events.DisposeListener;\r
31 import org.eclipse.swt.events.SelectionAdapter;\r
32 import org.eclipse.swt.events.SelectionEvent;\r
33 import org.eclipse.swt.graphics.Point;\r
34 import org.eclipse.swt.widgets.Composite;\r
35 import org.eclipse.swt.widgets.Event;\r
36 import org.eclipse.swt.widgets.Group;\r
37 import org.eclipse.swt.widgets.Label;\r
38 import org.eclipse.swt.widgets.Listener;\r
39 import org.eclipse.swt.widgets.Tree;\r
40 import org.eclipse.swt.widgets.TreeItem;\r
41 import org.eclipse.ui.IWorkbenchSite;\r
42 import org.simantics.browsing.ui.BuiltinKeys;\r
43 import org.simantics.browsing.ui.Column;\r
44 import org.simantics.browsing.ui.Column.Align;\r
45 import org.simantics.browsing.ui.NodeContext;\r
46 import org.simantics.browsing.ui.common.ColumnKeys;\r
47 import org.simantics.browsing.ui.common.NodeContextBuilder.MapNodeContext;\r
48 import org.simantics.browsing.ui.swt.SingleSelectionInputSource;\r
49 import org.simantics.browsing.ui.swt.widgets.Button;\r
50 import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;\r
51 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
52 import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
53 import org.simantics.browsing.ui.swt.widgets.TrackedCombo;\r
54 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
55 import org.simantics.browsing.ui.swt.widgets.impl.ComboModifyListenerImpl;\r
56 import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
57 import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;\r
58 import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener;\r
59 import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
60 import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
61 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
62 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
63 import org.simantics.db.ReadGraph;\r
64 import org.simantics.db.Resource;\r
65 import org.simantics.db.WriteGraph;\r
66 import org.simantics.db.common.procedure.adapter.DisposableListener;\r
67 import org.simantics.db.common.utils.ListUtils;\r
68 import org.simantics.db.exception.DatabaseException;\r
69 import org.simantics.db.management.ISessionContext;\r
70 import org.simantics.db.request.Read;\r
71 import org.simantics.jfreechart.chart.properties.RangeComposite;\r
72 import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
73 import org.simantics.layer0.Layer0;\r
74 import org.simantics.layer0.utils.direct.GraphUtils;\r
75 import org.simantics.sysdyn.SysdynResource;\r
76 import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyFactory;\r
77 import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyModifier;\r
78 import org.simantics.sysdyn.ui.properties.widgets.sensitivity.DistributionPropertyWidget;\r
79 import org.simantics.sysdyn.ui.properties.widgets.sensitivity.ParameterChildRule;\r
80 import org.simantics.sysdyn.ui.properties.widgets.sensitivity.VariableNameModifier;\r
81 import org.simantics.sysdyn.ui.validation.ParameterExistsValidator;\r
82 import org.simantics.ui.SimanticsUI;\r
83 import org.simantics.utils.RunnableWithObject;\r
84 import org.simantics.utils.datastructures.ArrayMap;\r
85 import org.simantics.utils.ui.AdaptionUtils;\r
86 import org.simantics.utils.ui.validators.IntegerValidator;\r
87 \r
88 /**\r
89  * Tab for displaying sensitivity analysis experiment properties\r
90  * \r
91  * @author Tuomas Miettinen\r
92  *\r
93  */\r
94 public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributor implements Widget {\r
95 \r
96     private GraphExplorerComposite explorer;\r
97     private WidgetSupportImpl parameterSupport = new WidgetSupportImpl();\r
98     private ScrolledComposite propertyContainer;\r
99     private Composite parameterProperties;\r
100     private Composite content;\r
101     private Button remove;\r
102     private Resource experiment;\r
103     \r
104     private boolean dirty = false;\r
105     \r
106     private DisposableListener<Collection<Resource>> contentListener;\r
107 \r
108     @Override\r
109     public void createControls(Composite body, IWorkbenchSite site,\r
110             final ISessionContext context, WidgetSupport support) {\r
111         support.register(this);\r
112 \r
113         Composite composite = new RemoveFocusBeforeExperimentComposite(body, SWT.NONE);\r
114         GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
115         GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
116         \r
117         // Scrolled composite for displaying properties of a selection in explorer\r
118         propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
119         GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyContainer);\r
120         GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
121         propertyContainer.setExpandHorizontal(true);\r
122         propertyContainer.setExpandVertical(true);\r
123         \r
124         content = new Composite(propertyContainer, SWT.NONE);\r
125         GridDataFactory.fillDefaults().grab(true, true).applyTo(content);\r
126         GridLayoutFactory.fillDefaults().numColumns(2).applyTo(content);\r
127 \r
128         // Label\r
129         Composite labelComposite = new Composite(content, SWT.NONE);\r
130         GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(labelComposite);\r
131         GridLayoutFactory.fillDefaults().numColumns(6).applyTo(labelComposite);\r
132         Label label = new Label(labelComposite, SWT.NONE);\r
133         label.setText("Name");\r
134 \r
135         TrackedText name = new TrackedText(labelComposite, support, SWT.BORDER);\r
136         name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
137         name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
138         name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
139         name.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), name.getWidget())));\r
140         GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
141         \r
142         label = new Label(labelComposite, SWT.NONE);\r
143         label.setText("Number of runs");\r
144         \r
145         TrackedText n = new TrackedText(labelComposite, support, SWT.BORDER);\r
146         n.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_numberOfValues));\r
147         n.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_numberOfValues));\r
148         n.setInputValidator(new IntegerValidator());\r
149         n.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), n.getWidget())));\r
150         GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).applyTo(n.getWidget());\r
151         \r
152         label = new Label(labelComposite, SWT.NONE);\r
153         label.setText("Seed");\r
154         \r
155         TrackedText seed = new TrackedText(labelComposite, support, SWT.BORDER);\r
156         seed.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
157         seed.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
158         seed.setInputValidator(new IntegerValidator());\r
159         seed.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), seed.getWidget())));\r
160         GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).applyTo(seed.getWidget());\r
161 \r
162         // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
163         explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
164                 "displaySelectors", "displayFilter", "treeView").values(false, false, true), site, content, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
165         \r
166         explorer.setBrowseContexts(SysdynResource.URIs.SensitivityAnalysisExperiment_ParameterBrowseContext);\r
167         explorer.setInputSource(new SingleSelectionInputSource(\r
168                 Resource.class));\r
169         explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
170         explorer.setColumns( new Column[] { new Column(ColumnKeys.SINGLE, Align.LEFT, 0, "", true) });\r
171         explorer.finish();\r
172         \r
173         \r
174         ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
175             public void widgetSelected(SelectionEvent e) {\r
176                 updateSelection(context);\r
177             }\r
178         });\r
179 \r
180         /* Listener for displaying information of the first parameter during view initialization\r
181          * The view does not have focus, so normal selection listener mechanisms do not work. \r
182          * Need to do it the hard way. \r
183          */ \r
184         Listener listener = new Listener() {\r
185 \r
186             boolean flag = false;\r
187             @Override\r
188             public void handleEvent(Event event) {\r
189                 switch (event.type) {\r
190                     case SWT.Activate:\r
191                     case SWT.Show:\r
192                     case SWT.Paint:\r
193                     {\r
194                         if(!flag && ((Tree) event.widget).getItems().length > 0) {\r
195                             flag = true;\r
196                             TreeItem item = ((Tree) event.widget).getItems()[0];\r
197                             IAdaptable adaptable = (IAdaptable) item.getData();\r
198                             MapNodeContext nc = (MapNodeContext) adaptable.getAdapter(NodeContext.class);\r
199                             parameterSupport.fireInput(context, new StructuredSelection(nc.getConstant(BuiltinKeys.INPUT)));\r
200                             propertyContainer.setContent(content);\r
201                             Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
202                             propertyContainer.setMinSize(size);\r
203                         }\r
204                     }\r
205                 }\r
206             }\r
207         };\r
208 \r
209         Tree tree = explorer.getExplorerControl();\r
210         tree.addListener(SWT.Activate, listener);\r
211         tree.addListener(SWT.Show, listener);\r
212         tree.addListener(SWT.Paint,listener);\r
213         /* End listener for displaying information for first parameter during view initialization*/\r
214         \r
215         explorer.addDisposeListener(new DisposeListener() {\r
216             \r
217             @Override\r
218             public void widgetDisposed(DisposeEvent e) {\r
219                 if(contentListener != null)\r
220                     contentListener.dispose();              \r
221             }\r
222         });\r
223         \r
224         \r
225         GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
226 \r
227         Group parameterPropertyGroup = new Group(content, SWT.NONE);\r
228         GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterPropertyGroup);\r
229         GridLayoutFactory.fillDefaults().applyTo(parameterPropertyGroup);\r
230         \r
231         parameterProperties = new Composite(parameterPropertyGroup, SWT.NONE);\r
232         GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
233         GridLayoutFactory.fillDefaults().numColumns(2).applyTo(parameterProperties);\r
234 \r
235         // Label\r
236         label = new Label(parameterProperties, SWT.NONE);\r
237         label.setText("Variable:");\r
238         GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
239 \r
240         TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
241         variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
242         variable.addModifyListener(new VariableNameModifier(variable.getWidget(), parameterSupport, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_indexes));\r
243         variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
244         variable.setInputValidator(new ParameterExistsValidator(parameterSupport, variable));\r
245         GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
246         \r
247         label = new Label(parameterProperties, SWT.NONE);\r
248         label.setText("Range:");\r
249         GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
250         \r
251         RangeComposite rangeComposite = new RangeComposite(parameterProperties, context, parameterSupport, SWT.NONE) {\r
252             @Override\r
253             protected Resource getIndexRelation(ReadGraph graph) {\r
254                 return SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_indexes;\r
255             }\r
256         };\r
257         GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
258         \r
259 //        TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
260 //        variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
261 //        variable.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
262 //        variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
263 //        GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
264 \r
265         label = new Label(parameterProperties, SWT.NONE);\r
266         label.setText("Distribution:");\r
267         GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
268 \r
269         TrackedCombo distributionSelector = new TrackedCombo(parameterProperties, parameterSupport, SWT.DROP_DOWN);\r
270         distributionSelector.setItemFactory(new ReadFactoryImpl<Resource, Map<String,Object>>() {\r
271 \r
272             @Override\r
273             public Map<String, Object> perform(ReadGraph graph, Resource input) throws DatabaseException {\r
274                 SysdynResource SR = SysdynResource.getInstance(graph);\r
275                 Map<String, Object> items = new HashMap<String, Object>();\r
276 \r
277                 items.put("Normal", SR.NormalDistribution);\r
278                 items.put("Uniform", SR.UniformDistribution);\r
279                 items.put("Interval", SR.Interval);\r
280 \r
281                 return items;\r
282             }\r
283 \r
284         });\r
285 \r
286         distributionSelector.setSelectionFactory(new ReadFactoryImpl<Resource, String>() {\r
287 \r
288             @Override\r
289             public String perform(ReadGraph graph, Resource parameter) throws DatabaseException {\r
290                 SysdynResource SR = SysdynResource.getInstance(graph);\r
291                 Resource distribution = graph.getPossibleObject(parameter, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
292                 if(distribution == null)\r
293                     return null;\r
294                 \r
295                 if(graph.isInstanceOf(distribution, SR.UniformDistribution))\r
296                     return "Uniform";\r
297                 else if(graph.isInstanceOf(distribution, SR.NormalDistribution))\r
298                     return "Normal";\r
299                 else if(graph.isInstanceOf(distribution, SR.Interval))\r
300                     return "Interval";\r
301                 else\r
302                     return "";\r
303 \r
304             }\r
305         });\r
306 \r
307         distributionSelector.addModifyListener(new ComboModifyListenerImpl<Resource>() {\r
308 \r
309             @Override\r
310             public void applyText(WriteGraph graph, Resource input, String text)\r
311                     throws DatabaseException {\r
312                 if(text == null || text.isEmpty())\r
313                     return;\r
314 \r
315                 SysdynResource SR = SysdynResource.getInstance(graph);\r
316 \r
317                 Resource type = SR.UniformDistribution;\r
318 \r
319                 if("Normal".equals(text))\r
320                     type = SR.NormalDistribution;\r
321                 else if("Interval".equals(text))\r
322                     type = SR.Interval; \r
323 \r
324                 graph.deny(input, SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution);\r
325 \r
326                 GraphUtils.create2(graph, type,\r
327                         SR.SensitivityAnalysisExperiment_Parameter_propabilityDistribution_Inverse, input);\r
328 \r
329                 dirty = true;\r
330             }\r
331         });\r
332 \r
333         distributionSelector.addModifyListener(new TextModifyListener() {\r
334 \r
335             @Override\r
336             public void modifyText(TrackedModifyEvent e) {\r
337                 if(dirty) {\r
338                     parameterSupport.update();\r
339                     dirty = false;\r
340                     propertyContainer.setContent(content);\r
341                     Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
342                     propertyContainer.setMinSize(size);\r
343                 }\r
344             }\r
345         });\r
346 \r
347         label = new Label(parameterProperties, SWT.NONE);\r
348         \r
349         DistributionPropertyWidget dpw = new DistributionPropertyWidget(parameterProperties, context, parameterSupport, SWT.NONE);\r
350         GridDataFactory.fillDefaults().grab(true, true).applyTo(dpw);\r
351 \r
352         \r
353         Composite buttonComposite = new Composite(content, SWT.NONE);\r
354         GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
355         GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
356         \r
357         \r
358         Button addVariable = new Button(buttonComposite, support, SWT.NONE);\r
359         addVariable.setText("Add parameter");\r
360         addVariable.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
361 \r
362             @Override\r
363             public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
364                 SysdynResource sr = SysdynResource.getInstance(graph);\r
365                 Layer0 L0 = Layer0.getInstance(graph);\r
366                 \r
367                 Resource distribution = GraphUtils.create2(graph, sr.UniformDistribution,\r
368                         sr.UniformDistribution_minValue, 0.0,\r
369                         sr.UniformDistribution_maxValue, 10.0);\r
370                 \r
371                 Resource parameter = GraphUtils.create2(graph, sr.SensitivityAnalysisExperiment_Parameter,\r
372                         sr.SensitivityAnalysisExperiment_Parameter_propabilityDistribution, distribution,\r
373                         sr.SensitivityAnalysisExperiment_Parameter_variable, "<Write variable name>",\r
374                         L0.PartOf, input);\r
375                 \r
376                 Resource parameterList = graph.getPossibleObject(input, sr.SensitivityAnalysisExperiment_parameterList);\r
377                 ListUtils.insertBack(graph, parameterList, Collections.singleton(parameter));\r
378             }\r
379         });\r
380 \r
381         remove = new Button(buttonComposite, parameterSupport, SWT.NONE);\r
382         remove.setText("Remove");\r
383         remove.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
384 \r
385             @Override\r
386             public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
387                 if(input == null)\r
388                     return;\r
389                 \r
390                 SysdynResource sr = SysdynResource.getInstance(graph);\r
391                 Layer0 L0 = Layer0.getInstance(graph);\r
392                 \r
393                 Resource experiment = graph.getPossibleObject(input, L0.PartOf);\r
394                 Resource parameterList = graph.getPossibleObject(experiment, sr.SensitivityAnalysisExperiment_parameterList);\r
395                 \r
396                 if(ListUtils.toList(graph, parameterList).size() > 1)\r
397                     ListUtils.removeElement(graph, parameterList, input);\r
398  \r
399             }\r
400             \r
401         });\r
402         \r
403 \r
404         propertyContainer.setContent(content);\r
405         Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
406         propertyContainer.setMinSize(size);\r
407 \r
408     }\r
409 \r
410 \r
411     /**\r
412      * Updates the content of propertyContainer  \r
413      * @param context\r
414      */\r
415     private void updateSelection(ISessionContext context) {\r
416         ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
417         IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
418         parameterSupport.fireInput(context, selection);\r
419 \r
420         propertyContainer.setContent(content);\r
421         Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
422         propertyContainer.setMinSize(size);\r
423     }\r
424 \r
425 \r
426     @Override\r
427     public void setInput(ISessionContext context, Object input) {\r
428         experiment = AdaptionUtils.adaptToSingle(input, Resource.class);\r
429         if(contentListener == null) {\r
430             contentListener = new DisposableListener<Collection<Resource>>() {\r
431 \r
432                 @Override\r
433                 public void execute(Collection<Resource> result) {\r
434                     if(remove != null && !remove.getWidget().isDisposed() && result != null) {\r
435                         remove.getWidget().getDisplay().asyncExec(new RunnableWithObject(result) {\r
436                             @Override\r
437                             public void run() {\r
438                                 if(!remove.getWidget().isDisposed()) {\r
439                                     @SuppressWarnings("unchecked")\r
440                                     Collection<Resource> result = (Collection<Resource>) getObject();\r
441                                     if(result.size() > 1)\r
442                                         remove.getWidget().setEnabled(true);\r
443                                     else\r
444                                         remove.getWidget().setEnabled(false);\r
445                                 }\r
446                             }\r
447                         });\r
448 \r
449                     }\r
450                 }\r
451 \r
452                 @Override\r
453                 public void exception(Throwable t) {\r
454                     t.printStackTrace();\r
455                 }\r
456             };\r
457 \r
458             SimanticsUI.getSession().asyncRequest(new Read<Collection<Resource>> () {\r
459 \r
460                 @SuppressWarnings("unchecked")\r
461                 @Override\r
462                 public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
463                     return (Collection<Resource>) new ParameterChildRule().getChildren(graph, experiment);\r
464                 }\r
465 \r
466             }, contentListener);\r
467         }\r
468 \r
469         \r
470     }\r
471 \r
472 }\r