public class WidgetInstance
extends java.lang.Object
The corresponding widget instance, to store variable information until the current command is finished execution.
A widget instance is an object that stores the value of a widget past after the widget has been closed. This is useful for concurrency. Because more than one BioLegato PCD command can be run simultaneously, BioLegato needs to store the values used to run each command separately. For instance, if the user runs command A, then changing the value of a widget in A's parameter window should not affect the currently running job (i.e. command A). This is achieved through WidgetInstance objects.
In the case that a variable does not have any values (i.e. display only), such as TabbedWidget, if the widget does house other widgets (like TabbedWidget), then it should create a map object (by recursively calling each of its child widgets' getInstance functions) containing variable names as keys, and variable values as entries, where each entry corresponds to a child widget. This map object should then be passed to the WidgetInstance constructor, and then returned.
In the case that a variable does not have any values, and has no sub-widgets, then it should just return null (see CommandButton for an example of this.)
Constructor and Description |
---|
WidgetInstance(java.lang.Object value)
Creates a new widget instance for storing variable information
for the command (until command completion)
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Notifies the variable that the program has now completed successfully.
|
java.lang.Object |
getValue()
Returns the value stored by the WidgetInstance object.
|
public WidgetInstance(java.lang.Object value)
value
- the value for the new widget instance to store.public java.lang.Object getValue()
public void close()
Notifies the variable that the program has now completed successfully. This allowed the widget to perform operations based on no longer being visible.
A good example of such usage could be to release files held reference by the object. Another example could be to remove any references to no longer needed objects such as those representing its swing display (i.e. JComponents which are no longer visible and will likely not be reused). The latter example is recommended when possible, so as to conserve memory.
Copyright © 2008-2022 University of Manitoba.