org.favabeans.base
Class BeanColumn

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--org.favabeans.base.BeanColumn
All Implemented Interfaces:
Collection, Column, Faceted, Feature, List

public class BeanColumn
extends AbstractList
implements Column, Faceted


Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BeanColumn(Object target, Class elementClass, String propertyName)
          Create a new BeanColumn.
BeanColumn(Object target, PropertyDescriptor descriptor)
          Create a new BeanColumn.
 
Method Summary
 void add(int i, Object o)
           
 void addListDataListener(ListDataListener l)
           
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
           
protected  void fireContentsChanged()
           
 Object get(int i)
           
 int[] getAscendingSort()
          Obtain a permutation on this Column (and its associated Folder) representing an ascending total ordering of its contents.
 Facet getFacet(Type facetType)
          Obtain a Facet of the requested Type for this object.
 Object getTarget()
          Obtain the target of this Feature.
 Class getValueClass()
          Determine the most general Java class of the objects which are values of this Property.
 boolean isEnabled()
          Determine whether this Column is enabled.
 boolean isSortable()
          Determine whether the elements of the collection from which this Column is derived can be sorted based on the values of this Column.
 boolean isValueSettable()
          Determine whether the values of this Column can be set.
 boolean isValueSettable(int i, Object value)
          Check if the given value is an allowable argument to setValue(int,Object).
 PropertyEditor newEditor(int i)
          Obtain a PropertyEditor instance suitable for editing one of the values of ths Property object.
 Object remove(int i)
           
 void removeListDataListener(ListDataListener l)
           
 void removePropertyChangeListener(PropertyChangeListener l)
           
 void removePropertyChangeListener(String propertyName, PropertyChangeListener l)
           
 Object set(int i, Object o)
           
 void setValue(int i, Object value)
          Set a value of the Column.
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray
 

Constructor Detail

BeanColumn

public BeanColumn(Object target,
                  Class elementClass,
                  String propertyName)
Create a new BeanColumn.
Parameters:
target - the target collection.
elementClass - the common superclass or a common super-interface of all the elements in the target collection.
propertyName - the name of the Bean property (of class elementClass) which this BeanColumn will represent.

BeanColumn

public BeanColumn(Object target,
                  PropertyDescriptor descriptor)
Create a new BeanColumn.
Parameters:
target - the target collection.
propertyDescriptor - a Bean property descriptor applicable to the common superclass or a common super-interface of all the elements of the target collection.
Method Detail

getFacet

public Facet getFacet(Type facetType)
Description copied from interface: Faceted
Obtain a Facet of the requested Type for this object.
Specified by:
getFacet in interface Faceted
Following copied from interface: org.favabeans.base.Faceted
Parameters:
type - the Type of Facet requested for this object.
Returns:
a Facet, or null if none can be created as requested.

getTarget

public Object getTarget()
Description copied from interface: Feature
Obtain the target of this Feature.
Specified by:
getTarget in interface Feature
Following copied from interface: org.favabeans.base.Feature
Returns:
the target.

size

public int size()
Specified by:
size in interface List
Overrides:
size in class AbstractCollection

get

public Object get(int i)
Specified by:
get in interface List
Overrides:
get in class AbstractList

set

public Object set(int i,
                  Object o)
Specified by:
set in interface List
Overrides:
set in class AbstractList

add

public void add(int i,
                Object o)
Specified by:
add in interface List
Overrides:
add in class AbstractList

remove

public Object remove(int i)
Specified by:
remove in interface List
Overrides:
remove in class AbstractList

getValueClass

public Class getValueClass()
Description copied from interface: Column
Determine the most general Java class of the objects which are values of this Property. As a minimum, this operation should return Object.
Specified by:
getValueClass in interface Column
Following copied from interface: org.favabeans.base.Column
Returns:
the appropriate class.

isEnabled

public boolean isEnabled()
Description copied from interface: Column
Determine whether this Column is enabled. a "disabled" property is one which should be displayed in UI elements, but in a state which indicates that it is non-functional and/or non-applicable (e.g., by "graying out").
Specified by:
isEnabled in interface Column
Following copied from interface: org.favabeans.base.Column
Returns:
true if this Column is enabled; false if it is disabled.

newEditor

public PropertyEditor newEditor(int i)
Description copied from interface: Column
Obtain a PropertyEditor instance suitable for editing one of the values of ths Property object.
Specified by:
newEditor in interface Column
Following copied from interface: org.favabeans.base.Column
Parameters:
i - the index of the column value for which to obtain a PropertyEditor.
Returns:
a suitable PropertyEditor.

isValueSettable

public boolean isValueSettable()
Description copied from interface: Column
Determine whether the values of this Column can be set. If this method returns false, calls to setValue will return silently with no effect.
Specified by:
isValueSettable in interface Column
Following copied from interface: org.favabeans.base.Column
Returns:
true if the values can be set; false otherwise.

isValueSettable

public boolean isValueSettable(int i,
                               Object value)
Description copied from interface: Column
Check if the given value is an allowable argument to Column.setValue(int,Object). This should be overridden to provide end-user feedback regarding the correctness of a value, where such information is available to the implementation.

The default behavior of this method is to return true, and throw an exception in setValue(Object) if necessary.

Specified by:
isValueSettable in interface Column
Following copied from interface: org.favabeans.base.Column
Parameters:
i - the index at which to set the candidate column value.
value - the candidate column value.
Returns:
false if the candidate value is known to be unacceptable; true otherwise.

setValue

public void setValue(int i,
                     Object value)
              throws PropertyValueException
Description copied from interface: Column
Set a value of the Column.
Specified by:
setValue in interface Column
Following copied from interface: org.favabeans.base.Column
Parameters:
i - the index at which to set the column value.
value - the desired new column value.
Throws:
PropertyValueException - if there was a problem setting the value, or if the value was not acceptable.

isSortable

public boolean isSortable()
Description copied from interface: Column
Determine whether the elements of the collection from which this Column is derived can be sorted based on the values of this Column.
Specified by:
isSortable in interface Column
Following copied from interface: org.favabeans.base.Column
Returns:
true if sorting is supported; false otherwise.

getAscendingSort

public int[] getAscendingSort()
Description copied from interface: Column
Obtain a permutation on this Column (and its associated Folder) representing an ascending total ordering of its contents. A descending ordering is by definition simply the reverse of this permutation.

To use this permutation to gain access to the elements in ascending order, given Column c, we would do --

for (int i = 0; i < c.size(); i++)
   System.out.println(c.get(c.getAscendingSort()[i]));

and, in descending order --

for (int i = c.size(); i-- > 0; )
   System.out.println(c.get(c.getAscendingSort()[i]));
Specified by:
getAscendingSort in interface Column
Following copied from interface: org.favabeans.base.Column
Returns:
a permutation (as an array of integers).

addListDataListener

public void addListDataListener(ListDataListener l)
Specified by:
addListDataListener in interface Column

removeListDataListener

public void removeListDataListener(ListDataListener l)
Specified by:
removeListDataListener in interface Column

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface Column

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface Column

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener l)
Specified by:
addPropertyChangeListener in interface Column

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener l)
Specified by:
removePropertyChangeListener in interface Column

fireContentsChanged

protected void fireContentsChanged()


Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.