|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jbbres.lib.actions.tools.elements.SimpleElement com.jbbres.lib.actions.tools.elements.SimpleVariable<C> com.jbbres.lib.actions.tools.elements.StorageVariable<C>
C
- - Class of the object that this variable can store.public abstract class StorageVariable<C>
This abstract class provides default implementations for most of the methods
in the Variable
interface.
Subclasses of StorageVariable
must be created if you are willing
to create your personalized storage variable. A storage variable is a
variable that can store specific data used by your application and/or
actions.
StorageVariable
is a parameterized abstract class with a single
type variable, representing the type of object that the variable can store.
For example, if your variable is designed to store a date object (
Date
), the content of your variable class file will look like
the following example:
package packageName; import java.text.*; import java.util.Date; import com.jbbres.lib.actions.elements.*; import com.jbbres.lib.actions.tools.elements.StorageVariable; import com.jbbres.lib.actions.workflow.Workflow; public class VStorage extends StorageVariable<Date> { private DateFormat dateFormat = new SimpleDateFormat("yyyymmdd"); public VStorage(Workflow workflow) { super(workflow); } public Parameters getParameters() { Parameters parameters = new Parameters(); String formattedValue = dateFormat.format(getValue()); parameters.setParameter("value", formattedValue); return parameters; } public void setParameters(Parameters parameters) throws InvalidParametersException { try { Date value = dateFormat.parse(parameters.getParameter("value")); this.setVariableValue(value); } catch (Exception e) { throw new InvalidParametersException(this, parameters); } } }The
Element.getParameters()
and
setParameters(Parameters)
methods are used by Action(s) to save and restore
the default value of the variable when saving and opening a workflow. The
default value can be defined by the user when he creates the workflow by
editing the variable within the variable table at the bottom of the workflow.
As a developer, you have to make sure that the getParameters()
method returns the value currently stored in your variable, and that the
setParameters(Parameters)
replaces the current value of the
variable by the one described in the
Parameters
argument.
Action(s) makes sure that the Parameters
argument
received by the setParameters(Parameters)
method is always
similar to the one that the getParameters()
method has produced.
Note: The default value setting functionality is not available in Action(s) 1.0 but will be added in an upcoming version.
Constructor Summary | |
---|---|
StorageVariable(Workflow workflow)
Instantiates a new storage variable. |
Method Summary | |
---|---|
javax.swing.table.TableCellEditor |
getEditor()
Returns the TableCellEditor used to edit the variable value. |
javax.swing.table.TableCellRenderer |
getRenderer()
Returns the TableCellRenderer used to render the variable
value. |
C |
getValue()
Returns the current value of the variable. |
boolean |
isEditable()
Defines if the value of the variable can be modified by using the setValue(C) method. |
void |
setVariableValue(C newValue)
Sets the variable value. |
Methods inherited from class com.jbbres.lib.actions.tools.elements.SimpleVariable |
---|
addVariableServiceListener, fireVariableInstanceNameChanges, fireVariableValueChanges, getDescription, getInstanceName, getService, getVariableListeners, isValidValueClass, removeVariableServiceListener, setInstanceName, setValue, valueClass |
Methods inherited from class com.jbbres.lib.actions.tools.elements.SimpleElement |
---|
getWorkflow |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.jbbres.lib.actions.elements.Element |
---|
getParameters, setParameters |
Constructor Detail |
---|
public StorageVariable(Workflow workflow)
workflow
- the workflowMethod Detail |
---|
public void setVariableValue(C newValue)
SimpleVariable
setVariableValue
in class SimpleVariable<C>
newValue
- the new variable valuepublic C getValue()
VariableService
VariableService.setValue(Object)
,
VariableService.valueClass()
public javax.swing.table.TableCellEditor getEditor()
Variable
TableCellEditor
used to edit the variable value.
This method is not used in Action(s) 1.0.
public javax.swing.table.TableCellRenderer getRenderer()
Variable
TableCellRenderer
used to render the variable
value.
This method is not used in Action(s) 1.0.
public boolean isEditable()
VariableService
setValue(C)
method.
If this methods returns true
, calling the
setValue(C)
method should have no effect.
true
if the value of the variable can be modified by
using the setValue(C)
method. false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |