|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplugins.adufour.vars.lang.Var
plugins.adufour.vars.lang.VarMutable
public class VarMutable
Variable holding a value with mutable type, i.e. its type may be changed at runtime
Field Summary |
---|
Fields inherited from class plugins.adufour.vars.lang.Var |
---|
NO_VALUE, type, XML_KEY_ID |
Constructor Summary | |
---|---|
VarMutable(java.lang.String name,
java.lang.Class<?> initialType)
Constructs a new mutable variable with specified name and type. |
Method Summary | |
---|---|
void |
addTypeChangeListener(TypeChangeListener listener)
|
VarEditor |
createVarEditor()
Creates a new VarEditor object that allows the user to graphically adjust the value
of this variable. |
VarEditor |
createVarViewer()
Creates a new VarEditor object that allows the user to view the value of this
variable (but not necessarily modify it). |
boolean |
isAssignableFrom(Var source)
Checks whether the type of the given variable is equal or extends this variable's type. If the result is true, then the given variable can become a link source for this variable |
void |
removeTypeChangeListener(TypeChangeListener listener)
|
void |
setDefaultEditorModel(VarEditorModel model)
Sets a default VarEditorModel object which can be used to generate a graphical editor
for this variable. |
void |
setReference(Var variable)
Sets the current variable to reference the specified variable (or null to release the reference). |
void |
setType(java.lang.Class<?> newType)
|
void |
setValue(java.lang.Object newValue)
Sets the value of this variable and notify the listeners. |
Methods inherited from class plugins.adufour.vars.lang.Var |
---|
addListener, fireVariableChanged, fireVariableChanged, getDefaultEditorModel, getDefaultValue, getIterableReferrers, getName, getReference, getReferencingPolicy, getReferrers, getType, getTypeAsString, getValue, getValue, getValueAsString, getValueAsString, isEnabled, isOptional, isReferenced, loadFromXML, parse, prettyPrint, referenceChanged, removeListener, removeListeners, saveToXML, setEnabled, setOptional, setReferencingPolicy, toString, valueChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VarMutable(java.lang.String name, java.lang.Class<?> initialType)
name
- initialType
- the type of variable to handle (this can be changed via the
setType(Class)
methodMethod Detail |
---|
public VarEditor createVarEditor()
Var
VarEditor
object that allows the user to graphically adjust the value
of this variable. By default this editor is an empty label for generic types, but this method
can be overridden to provide a custom editor.
createVarEditor
in class Var
public VarEditor createVarViewer()
Var
VarEditor
object that allows the user to view the value of this
variable (but not necessarily modify it). By default this editor is an empty label for
generic types, but this method can be overridden to provide a custom viewer
createVarViewer
in class Var
public void addTypeChangeListener(TypeChangeListener listener)
addTypeChangeListener
in interface MutableType
public void removeTypeChangeListener(TypeChangeListener listener)
removeTypeChangeListener
in interface MutableType
public boolean isAssignableFrom(Var source)
Var
isAssignableFrom
in class Var
public void setDefaultEditorModel(VarEditorModel model)
Var
VarEditorModel
object which can be used to generate a graphical editor
for this variable. This default model is used by the Var.createVarEditor()
method is
overridden to provide a custom editor
setDefaultEditorModel
in class Var
model
- the model used by the Var.createVarEditor()
method to generate the
appropriate graphical componentVarEditorModel
public void setType(java.lang.Class<?> newType)
setType
in interface MutableType
public void setValue(java.lang.Object newValue)
Var
setValue
in class Var
public void setReference(Var variable) throws java.lang.ClassCastException
Var
Var.getValue()
method will disregard the
local value and return the value of the referenced variable
setReference
in class Var
variable
- the variable to reference
java.lang.ClassCastException
- if the two arguments are incompatible and cannot be linked
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |