org.springframework.richclient.list
Class AbstractListSelectionGuard

java.lang.Object
  extended by org.springframework.richclient.list.AbstractListSelectionGuard
All Implemented Interfaces:
PropertyChangeListener, EventListener
Direct Known Subclasses:
ListMultipleSelectionGuard, ListSingleSelectionGuard

public abstract class AbstractListSelectionGuard
extends Object
implements PropertyChangeListener

This class applies a guard to a Guarded object that enables the guarded object bsaed on the contents of the selection model value. Concrete subclasses must provide an implementation for shouldEnable(int[]).

Author:
Larry Streepy

Constructor Summary
AbstractListSelectionGuard(ValueModel selectionHolder, Guarded guarded)
          Constructor.
 
Method Summary
 Guarded getGuarded()
          Get the guarded object.
 ValueModel getSelectionHolder()
          Get the selection value holder.
 void propertyChange(PropertyChangeEvent evt)
          Handle a change in the selectionHolder value.
protected abstract  boolean shouldEnable(int[] selected)
          Determine if the guarded object should be enabled based on the contents of the current selection model value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractListSelectionGuard

public AbstractListSelectionGuard(ValueModel selectionHolder,
                                  Guarded guarded)
Constructor.

Parameters:
selectionHolder - ValueModel holding the list selection (value must be an array of int (int[]guarded - Object to guard
Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Handle a change in the selectionHolder value.

Specified by:
propertyChange in interface PropertyChangeListener

getGuarded

public Guarded getGuarded()
Get the guarded object.

Returns:
guarded object

getSelectionHolder

public ValueModel getSelectionHolder()
Get the selection value holder. The value of this value model will be an int array (int[]
Returns:
selection value holder

shouldEnable

protected abstract boolean shouldEnable(int[] selected)
Determine if the guarded object should be enabled based on the contents of the current selection model value.

Parameters:
selected - The array of selected rows
Returns:
boolean true if the guarded object should be enabled


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.