com.sas.servlet.tbeans.tableview
Class BaseColumnHeader

com.sas.servlet.tbeans.tableview.BaseColumnHeader
All Implemented Interfaces:
HoldInterface
Direct Known Subclasses:
ColumnHeader, ColumnHeader, ColumnHeader

public abstract class BaseColumnHeader
implements HoldInterface

A ColumnHeader manages the column header area of the TableView.

The defaultRenderer is to be used when no headerRenderer is defined by a TableColumn. If the default renderer is null then a new default renderer will created.

See Also:
BaseTableView.setColumnHeader(com.sas.servlet.tbeans.tableview.BaseColumnHeader), TableColumn.setHeaderRenderer(com.sas.servlet.tbeans.tableview.TableCellRenderer)

Constructor Summary
BaseColumnHeader()
          Constructs a ColumnHeader with a default TableColumnModel.
BaseColumnHeader(BaseTableView table)
          Constructs a ColumnHeader which is initialized with a TableView and a default TableColumnModel.
BaseColumnHeader(BaseTableView table, TableColumnModel cm)
          Constructs a ColumnHeader which is initialized with a TableView and a column model.
BaseColumnHeader(TableColumnModel cm)
          Constructs a ColumnHeader which is initialized with a column model.
 
Method Summary
 TableColumnModel createDefaultColumnModel()
          Returns the default column model object which is a DefaultTableColumnModel.
 TableColumnModel getColumnModel()
          Returns the TableColumnModel that contains all column information of this table header.
 java.util.List getHeldIndices()
          Returns a list of the indices that are being held.
 java.util.List getHeldIndices(int orientation)
          Returns a list of the indices that are being held for the given orientation.
 void hold(int modelIndex)
          "Holds" the given index using the default orientation.
 void hold(int modelIndex, int orientation)
          "Holds" the given index using the orientation specified.
 boolean isHeld(int modelIndex)
          Returns true if the given modelIndex is held for any orientation, false otherwise.
 boolean isHeld(int modelIndex, int orientation)
          Returns true if the given modelIndex is held for the given orientation, false otherwise.
 boolean isHoldingAllowed(int orientation)
          Returns true if holding for a given orientation is allowed or false otherwise.
 boolean isHoldingEnabled()
          Returns true is holding is enabled, should return false if holding is not allowed.
 void release(int modelIndex)
          Releases the given modelIndex from being held, so it will return to its original place in the view.
 void releaseAll()
          Releases all held indices and returns them to their previous location.
 void setColumnModel(TableColumnModel columnModel)
          Sets the column model for this table to newModel.
 void setHoldingEnabled(boolean enableHolding)
          Sets the state of whether holding of indices is enabled or not.
 
Methods inherited from class com.sas.servlet.tbeans.tableview.BaseHeader
createDefaultRenderer, getDefaultRenderer, getLocale, getTable, setDefaultRenderer, setLocale, setTable
 

Constructor Detail

BaseColumnHeader

public BaseColumnHeader()
Constructs a ColumnHeader with a default TableColumnModel.


BaseColumnHeader

public BaseColumnHeader(TableColumnModel cm)
Constructs a ColumnHeader which is initialized with a column model. If the column model is null this method will initialize the table header with a default TableColumnModel.

Parameters:
columnModel - the column model for the table

BaseColumnHeader

public BaseColumnHeader(BaseTableView table)
Constructs a ColumnHeader which is initialized with a TableView and a default TableColumnModel.

Parameters:
table - the tableview associated with the header

BaseColumnHeader

public BaseColumnHeader(BaseTableView table,
                        TableColumnModel cm)
Constructs a ColumnHeader which is initialized with a TableView and a column model. If the column model is null this method will initialize the table header with a default TableColumnModel.

Parameters:
table - the tableview associated with the header
columnModel - the column model for the table
Method Detail

setColumnModel

public void setColumnModel(TableColumnModel columnModel)
Sets the column model for this table to newModel.

Parameters:
columnModel - the new data source for this table
Throws:
java.lang.IllegalArgumentException - if newModel is null

getColumnModel

public TableColumnModel getColumnModel()
Returns the TableColumnModel that contains all column information of this table header.

Returns:
the columnModel property

createDefaultColumnModel

public TableColumnModel createDefaultColumnModel()
Returns the default column model object which is a DefaultTableColumnModel. A subclass can override this method to return a different column model object.

Returns:
the default column model object

getHeldIndices

public java.util.List getHeldIndices()
Description copied from interface: HoldInterface
Returns a list of the indices that are being held. This list will include all the indices for all the orientations. Modifications to this list will not be reflected in the held list, this list is a duplicate.

Specified by:
getHeldIndices in interface HoldInterface
Returns:
See Also:
HoldInterface.getHeldIndices(int)

getHeldIndices

public java.util.List getHeldIndices(int orientation)
Description copied from interface: HoldInterface
Returns a list of the indices that are being held for the given orientation. Modifications to this list will be reflected in the held list as this is the true list.

Specified by:
getHeldIndices in interface HoldInterface
Parameters:
orientation -
Returns:
See Also:
HoldInterface.getHeldIndices()

hold

public void hold(int modelIndex)
Description copied from interface: HoldInterface
"Holds" the given index using the default orientation. For example, on a table, the default held column location would be on the left side and for a row would be at the top. A held index is one that has been made non-scrollable and is thus always, space permitting, displayed; i.e. it is never scrolled out of view.

The order in which the indices are held controls the order in which they are displayed.

Should do nothing if the index is already held.

Specified by:
hold in interface HoldInterface
Parameters:
modelIndex -
See Also:
HoldInterface.hold(int, int), HoldInterface.release(int), HoldInterface.releaseAll()

hold

public void hold(int modelIndex,
                 int orientation)
Description copied from interface: HoldInterface
"Holds" the given index using the orientation specified. For example, on a table, a column could be held on the left or right and a row could be held on the top or bottom. A held index is one that has been made non-scrollable and is thus always, space permitting, displayed; i.e. it is never scrolled out of view.

The order in which the indices are held controls the order in which they are displayed.

Should do nothing if the index is already held.

Specified by:
hold in interface HoldInterface
Parameters:
modelIndex -
orientation -
See Also:
HoldInterface.hold(int), HoldInterface.release(int), HoldInterface.releaseAll()

isHeld

public boolean isHeld(int modelIndex)
Description copied from interface: HoldInterface
Returns true if the given modelIndex is held for any orientation, false otherwise.

Specified by:
isHeld in interface HoldInterface
Parameters:
modelIndex -
Returns:
See Also:
HoldInterface.isHeld(int, int)

isHeld

public boolean isHeld(int modelIndex,
                      int orientation)
Description copied from interface: HoldInterface
Returns true if the given modelIndex is held for the given orientation, false otherwise.

Specified by:
isHeld in interface HoldInterface
Parameters:
modelIndex -
orientation -
Returns:
See Also:
HoldInterface.isHeld(int)

isHoldingAllowed

public boolean isHoldingAllowed(int orientation)
Description copied from interface: HoldInterface
Returns true if holding for a given orientation is allowed or false otherwise. Holding must be enabled for this to return true.

Specified by:
isHoldingAllowed in interface HoldInterface
Parameters:
orientation -
Returns:

isHoldingEnabled

public boolean isHoldingEnabled()
Description copied from interface: HoldInterface
Returns true is holding is enabled, should return false if holding is not allowed.

Specified by:
isHoldingEnabled in interface HoldInterface
Returns:
See Also:
HoldInterface.setHoldingEnabled(boolean)

release

public void release(int modelIndex)
Description copied from interface: HoldInterface
Releases the given modelIndex from being held, so it will return to its original place in the view. If the modelIndex is not held, nothing is done.

Specified by:
release in interface HoldInterface
Parameters:
modelIndex -
See Also:
HoldInterface.hold(int), HoldInterface.hold(int, int), HoldInterface.releaseAll()

releaseAll

public void releaseAll()
Description copied from interface: HoldInterface
Releases all held indices and returns them to their previous location.

Specified by:
releaseAll in interface HoldInterface
See Also:
HoldInterface.hold(int), HoldInterface.hold(int, int), HoldInterface.release(int)

setHoldingEnabled

public void setHoldingEnabled(boolean enableHolding)
Description copied from interface: HoldInterface
Sets the state of whether holding of indices is enabled or not.

Specified by:
setHoldingEnabled in interface HoldInterface
Parameters:
enableHolding -
See Also:
HoldInterface.isHoldingEnabled()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.