plugins.adufour.vars.lang
Class VarNumber<N extends java.lang.Number>

java.lang.Object
  extended by plugins.adufour.vars.lang.Var<N>
      extended by plugins.adufour.vars.lang.VarNumber<N>
All Implemented Interfaces:
icy.file.xml.XMLPersistent, java.lang.Comparable<N>, VarListener<N>
Direct Known Subclasses:
VarDouble, VarFloat, VarInteger

public abstract class VarNumber<N extends java.lang.Number>
extends Var<N>
implements java.lang.Comparable<N>

Class bringing support for variables handling comparable types

Author:
Alexandre Dufour

Field Summary
 
Fields inherited from class plugins.adufour.vars.lang.Var
listeners, NO_VALUE, type, XML_KEY_ID
 
Constructor Summary
VarNumber(java.lang.String name, java.lang.Class<N> type, N defaultValue)
           
VarNumber(java.lang.String name, VarEditorModel<N> model)
           
 
Method Summary
 VarEditor<N> createVarEditor()
          Creates a new VarEditor object that allows the user to graphically adjust the value of this variable.
 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
 
Methods inherited from class plugins.adufour.vars.lang.Var
addListener, createVarViewer, 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, setDefaultEditorModel, setEnabled, setOptional, setReference, setReferencingPolicy, setValue, toString, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

VarNumber

public VarNumber(java.lang.String name,
                 java.lang.Class<N> type,
                 N defaultValue)

VarNumber

public VarNumber(java.lang.String name,
                 VarEditorModel<N> model)
Method Detail

isAssignableFrom

public boolean isAssignableFrom(Var<?> source)
Description copied from class: Var
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

Overrides:
isAssignableFrom in class Var<N extends java.lang.Number>
Returns:
true if the source type is equal or wider than this variable's type, false otherwise (including if source has null type)

createVarEditor

public VarEditor<N> createVarEditor()
Description copied from class: Var
Creates a new 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.

Overrides:
createVarEditor in class Var<N extends java.lang.Number>
Returns:
the variable editor embarking the graphical component