de.jaret.util.ui.table.model
Class AbstractColumn

java.lang.Object
  extended by de.jaret.util.ui.table.model.AbstractColumn
All Implemented Interfaces:
IColumn, java.util.Comparator<IRow>
Direct Known Subclasses:
HierarchyColumn, IndexColumn, PropCol, SimpleColumn

public abstract class AbstractColumn
extends java.lang.Object
implements IColumn

Abstract base implemenation of an IColumn.

Version:
$Id: AbstractColumn.java 180 2007-01-07 18:44:01Z olk $
Author:
Peter Kliem

Field Summary
protected  java.util.List<IColumnListener> _listeners
          column listeners.
 
Constructor Summary
AbstractColumn()
           
 
Method Summary
 void addColumnListener(IColumnListener cl)
          Add a listener to listen on changes on the column.
 boolean displayHeader()
          Header display always defaults to true.
protected  void fireValueChanged(IRow row, IColumn column, java.lang.Object oldValue, java.lang.Object newValue)
          Inform listeners about a value change.
 java.lang.Class<?> getContentClass(IRow row)
          Default implementation: no difference to getContentClass().
 boolean isEditable()
          Deafult: cols are aditable.
 boolean isEditable(IRow row)
          Default: delegate to isEditable.
 void remColumnListener(IColumnListener cl)
          Remove a column listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jaret.util.ui.table.model.IColumn
getContentClass, getHeaderLabel, getId, getValue, setValue, supportsSorting
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Field Detail

_listeners

protected java.util.List<IColumnListener> _listeners
column listeners.

Constructor Detail

AbstractColumn

public AbstractColumn()
Method Detail

fireValueChanged

protected void fireValueChanged(IRow row,
                                IColumn column,
                                java.lang.Object oldValue,
                                java.lang.Object newValue)
Inform listeners about a value change.

Parameters:
row - row
column - column
oldValue - old value
newValue - new value

addColumnListener

public void addColumnListener(IColumnListener cl)
Add a listener to listen on changes on the column.

Specified by:
addColumnListener in interface IColumn
Parameters:
cl - listener to add

remColumnListener

public void remColumnListener(IColumnListener cl)
Remove a column listener.

Specified by:
remColumnListener in interface IColumn
Parameters:
cl - listener to remove

getContentClass

public java.lang.Class<?> getContentClass(IRow row)
Default implementation: no difference to getContentClass(). To specify a content class per row this method may be implemented to reflect the appropriate class.

Specified by:
getContentClass in interface IColumn
Parameters:
row - row of which to get the content class
Returns:
contained class or null if the information is not available.

displayHeader

public boolean displayHeader()
Header display always defaults to true. Should return true for a header to be painted. Note that this ia a small violation of the separation between viewstate and data. However this can be tolerated.

Specified by:
displayHeader in interface IColumn
Returns:
true when a header should be painted

isEditable

public boolean isEditable()
Deafult: cols are aditable.

Specified by:
isEditable in interface IColumn
Returns:
true

isEditable

public boolean isEditable(IRow row)
Default: delegate to isEditable. Check whether a a specific cell of the column can be edited.

Specified by:
isEditable in interface IColumn
Parameters:
row - row specifying the cell in the column
Returns:
true if the ell can be changed


Copyright © 2012. All Rights Reserved.