cdx.scorebot.util.swing.binding.delegate
Class IntermediateFieldDelegate<TYPE>

java.lang.Object
  extended by cdx.scorebot.util.swing.binding.delegate.GenericDelegate<TYPE,TYPE>
      extended by cdx.scorebot.util.swing.binding.delegate.IntermediateFieldDelegate<TYPE>
All Implemented Interfaces:
BoundDelegateComponent, BoundDelegateContainer

public class IntermediateFieldDelegate<TYPE>
extends GenericDelegate<TYPE,TYPE>
implements BoundDelegateContainer

A delegate for an intermediate field of type TYPE.

Author:
David Underhill

Field Summary
protected  java.util.Vector<BoundComponent> components
          components whose bindings are contained within the objects contained in this list
protected  int primaryComponentIndex
          the index of the subcomponent which determines the names of the entries in the list (-1 [default] => number them instead)
 
Constructor Summary
IntermediateFieldDelegate(BoundComponent owner, IntermediateField compon)
          Instantiates an unbound ButtonGroup Delegate
IntermediateFieldDelegate(BoundComponent owner, IntermediateField compon, java.lang.Object boundItem, java.lang.String varName)
          Instantiates a bound ButtonGroup Delegate
IntermediateFieldDelegate(BoundComponent owner, IntermediateField compon, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName)
          Instantiates a bound ButtonGroup Delegate
IntermediateFieldDelegate(BoundComponent owner, IntermediateField compon, java.lang.String varName)
          Instantiates an unbound ButtonGroup Delegate
 
Method Summary
 void addBoundComponent(BoundComponent b)
          add bound component to this (b's parent will be set to this)
protected  void completeInit()
          does nothing
 java.util.Vector<BoundComponent> getBoundComponents()
          get bound components this contains
 int getPrimaryComponent()
          gets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets
protected  void handleValidationState()
          draw the border to reflect the specified validation state
 void load()
          refreshes subcomponents bindings
 void notifyBoundComponentChange(BoundComponent c)
          informs its parent
 void save()
          tells all subcomponents to save their current value
 void selectItem(int index)
          does nothing
 void setPrimaryComponent(int primComponIndex)
          sets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets
 java.lang.String toString()
           
 void updateSubcomponentBindings()
          update all components within this component
 
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.GenericDelegate
addBindingListener, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, getBinding, getBoundParent, getFormattedValidationErrorMsg, getMe, getOwner, getValidationErrorMsg, highlightOnError, isContainer, isValidated, notifyListenersOfBindingChanged, notifyListenersOfBindingChanging, notifyListenersOfBindingLoaded, removeBindingListener, setBoundParent, setHighlightOnError, setValidationError, setValidationError, validationError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cdx.scorebot.util.swing.binding.delegate.BoundDelegateComponent
addBindingListener, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, getBinding, getBoundParent, highlightOnError, isContainer, isValidated, notifyListenersOfBindingChanged, notifyListenersOfBindingChanging, removeBindingListener, setBoundParent, setHighlightOnError
 

Field Detail

components

protected java.util.Vector<BoundComponent> components
components whose bindings are contained within the objects contained in this list


primaryComponentIndex

protected int primaryComponentIndex
the index of the subcomponent which determines the names of the entries in the list (-1 [default] => number them instead)

Constructor Detail

IntermediateFieldDelegate

public IntermediateFieldDelegate(BoundComponent owner,
                                 IntermediateField compon)
Instantiates an unbound ButtonGroup Delegate

Parameters:
owner - the BoundComponent which this belongs to
compon - the component that this works for

IntermediateFieldDelegate

public IntermediateFieldDelegate(BoundComponent owner,
                                 IntermediateField compon,
                                 java.lang.String varName)
Instantiates an unbound ButtonGroup Delegate

Parameters:
owner - the BoundComponent which this belongs to
compon - the component that this works for
varName - the name of the variable; assumes the getter and setter name will be get and set followed by varName with its first letter capitalized (ex: if varName is "value" then the getter will be getValue).

IntermediateFieldDelegate

public IntermediateFieldDelegate(BoundComponent owner,
                                 IntermediateField compon,
                                 java.lang.Object boundItem,
                                 java.lang.String varName)
Instantiates a bound ButtonGroup Delegate

Parameters:
owner - the BoundComponent which this belongs to
compon - the component that this works for
boundItem - the object this is bound to (contains the value to be modified as specified by varName)
varName - the name of the variable; assumes the getter and setter name will be get and set followed by varName with its first letter capitalized (ex: if varName is "value" then the getter will be getValue).

IntermediateFieldDelegate

public IntermediateFieldDelegate(BoundComponent owner,
                                 IntermediateField compon,
                                 java.lang.Object boundItem,
                                 java.lang.String getterName,
                                 java.lang.String setterName)
Instantiates a bound ButtonGroup Delegate

Parameters:
owner - the BoundComponent which this belongs to
compon - the component that this works for
boundItem - the object this is bound to (contains the value to be modified as specified by the getter and setter name)
getterName - how to get the bound value from the bound object
setterName - how to set the bound value from the bound object
Method Detail

completeInit

protected void completeInit()
does nothing

Specified by:
completeInit in class GenericDelegate<TYPE,TYPE>

load

public void load()
refreshes subcomponents bindings

Specified by:
load in interface BoundDelegateComponent
Specified by:
load in class GenericDelegate<TYPE,TYPE>

save

public void save()
tells all subcomponents to save their current value

Specified by:
save in interface BoundDelegateComponent
Specified by:
save in class GenericDelegate<TYPE,TYPE>

handleValidationState

protected void handleValidationState()
draw the border to reflect the specified validation state

Specified by:
handleValidationState in class GenericDelegate<TYPE,TYPE>

addBoundComponent

public final void addBoundComponent(BoundComponent b)
add bound component to this (b's parent will be set to this)

Specified by:
addBoundComponent in interface BoundDelegateContainer

getBoundComponents

public final java.util.Vector<BoundComponent> getBoundComponents()
get bound components this contains

Specified by:
getBoundComponents in interface BoundDelegateContainer

updateSubcomponentBindings

public final void updateSubcomponentBindings()
update all components within this component

Specified by:
updateSubcomponentBindings in interface BoundDelegateContainer

notifyBoundComponentChange

public void notifyBoundComponentChange(BoundComponent c)
informs its parent

Specified by:
notifyBoundComponentChange in interface BoundDelegateContainer

selectItem

public void selectItem(int index)
does nothing

Specified by:
selectItem in interface BoundDelegateContainer

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPrimaryComponent

public final int getPrimaryComponent()
gets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets

Specified by:
getPrimaryComponent in interface BoundDelegateContainer

setPrimaryComponent

public final void setPrimaryComponent(int primComponIndex)
sets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets

Specified by:
setPrimaryComponent in interface BoundDelegateContainer
Parameters:
primComponIndex - index of the BoundComponent which is the primary component in the getBoundComponents() vector.