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