|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sciapp.table.group.AbstractTreeTableColumnModelAdapter
public abstract class AbstractTreeTableColumnModelAdapter
AbstractTreeTableColumnModelAdapter is an implementation of a TreeTableColumnModelAdapter to serve as a basis for implementing a column model for a TreeTableHeader.
Field Summary | |
---|---|
protected ChangeEvent |
changeEvent
Change event (only one needed) |
protected SwingPropertyChangeSupport |
changeSupport
change support for the TREE_TABLE_COLUMN_MODEL_PROPERTY. |
protected int |
columnMargin
Width margin between each column |
protected boolean |
columnSelectionAllowed
Column selection allowed in this column model |
protected EventListenerList |
listenerList
List of TableColumnModelListener |
protected ListSelectionModel |
selectionModel
Model for keeping track of column selections |
protected int |
totalColumnWidth
A local cache of the combined width of all columns |
Fields inherited from interface com.sciapp.table.group.TreeTableColumnModelAdapter |
---|
TREE_PROPERTY, TREE_TABLE_COLUMN_MODEL_PROPERTY |
Constructor Summary | |
---|---|
AbstractTreeTableColumnModelAdapter()
Constructs an AbstractTreeTableColumnModelAdapter. |
Method Summary | |
---|---|
void |
addColumnModelListener(TableColumnModelListener x)
Adds a listener for table column model events. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list to be notified when the TreeTableColumnModel changes. |
void |
addVetoableColumnModelListener(VetoableTableColumnModelListener l)
Adds a listener that is notified when a table column is about to be added, moved or removed. |
protected ListSelectionModel |
createSelectionModel()
Creates a new default list selection model. |
protected void |
fireColumnAdded(TableColumnModelEvent e)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireColumnMarginChanged()
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireColumnMoved(TableColumnModelEvent e)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireColumnRemoved(TableColumnModelEvent e)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireColumnSelectionChanged(ListSelectionEvent e)
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireColumnWillBeAdded(TableColumnModelEvent e)
Notifies 'veto' listeners that a table column is about to be added. |
protected void |
fireColumnWillBeMoved(TableColumnModelEvent e)
Notifies 'veto' listeners that a table column is about to be moved. |
protected void |
fireColumnWillBeRemoved(TableColumnModelEvent e)
Notifies 'veto' listeners that a table column is about to be removed. |
int |
getColumnIndex(Object identifier)
Returns the index of the first column in the table whose identifier is equal to identifier ,
when compared using equals . |
int |
getColumnIndexAtX(int x)
Returns the index of the column that lies on the horizontal point, xPosition ;
or -1 if it lies outside the any of the column's bounds. |
int |
getColumnMargin()
Returns the width between the cells in each column. |
boolean |
getColumnSelectionAllowed()
Returns true if columns may be selected. |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the objects currently registered as the listener type upon this model. |
int |
getSelectedColumnCount()
Returns the number of selected columns. |
int[] |
getSelectedColumns()
Returns an array of indicies of all selected columns. |
ListSelectionModel |
getSelectionModel()
Returns the current selection model. |
int |
getTotalColumnWidth()
Returns the total width of all the columns. |
protected void |
invalidateWidthCache()
Invalidates the cached total column width. |
void |
propertyChange(PropertyChangeEvent evt)
This method gets called when a bound property is changed. |
protected void |
recalcWidthCache()
Recalculates the total combined width of all columns. |
void |
removeColumnModelListener(TableColumnModelListener x)
Removes a listener for table column model events. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list that is notified when the TreeTableColumnModel changes. |
void |
removeVetoableColumnModelListener(VetoableTableColumnModelListener l)
Removes a listener that is notified when a table column is about to be added, moved or removed. |
void |
setColumnMargin(int newMargin)
Sets the TableColumn 's column margin to
newMargin . |
void |
setColumnSelectionAllowed(boolean flag)
Sets whether the columns in this model may be selected. |
void |
setSelectionModel(ListSelectionModel newModel)
Sets the selection model. |
void |
valueChanged(ListSelectionEvent e)
Called whenever the value of the selection changes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sciapp.table.group.TreeTableColumnModelAdapter |
---|
getTree, getTreeTableColumnModel |
Methods inherited from interface javax.swing.table.TableColumnModel |
---|
addColumn, getColumn, getColumnCount, getColumns, moveColumn, removeColumn |
Methods inherited from interface javax.swing.table.TableColumnModel |
---|
addColumn, getColumn, getColumnCount, getColumns, moveColumn, removeColumn |
Field Detail |
---|
protected SwingPropertyChangeSupport changeSupport
protected ListSelectionModel selectionModel
protected int columnMargin
protected EventListenerList listenerList
protected transient ChangeEvent changeEvent
protected boolean columnSelectionAllowed
protected int totalColumnWidth
Constructor Detail |
---|
public AbstractTreeTableColumnModelAdapter()
Method Detail |
---|
public void addColumnModelListener(TableColumnModelListener x)
addColumnModelListener
in interface TableColumnModel
x
- a TableColumnModelListener
objectpublic void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface TreeTableColumnModelAdapter
listener
- the listener to add.public void addVetoableColumnModelListener(VetoableTableColumnModelListener l)
addVetoableColumnModelListener
in interface VetoableTableColumnModel
l
- the listener to be addedprotected ListSelectionModel createSelectionModel()
protected void fireColumnAdded(TableColumnModelEvent e)
e
- the event that is propagated to listenersprotected void fireColumnMarginChanged()
protected void fireColumnMoved(TableColumnModelEvent e)
e
- the event that is propagated to listenersprotected void fireColumnRemoved(TableColumnModelEvent e)
e
- the event that is propagated to listenersprotected void fireColumnSelectionChanged(ListSelectionEvent e)
e
- the event that is propagated to listenersprotected void fireColumnWillBeAdded(TableColumnModelEvent e) throws ColumnModelVetoException
e
- the event identifying the addition
ColumnModelVetoException
protected void fireColumnWillBeMoved(TableColumnModelEvent e) throws ColumnModelVetoException
e
- the event identifying the move
ColumnModelVetoException
protected void fireColumnWillBeRemoved(TableColumnModelEvent e) throws ColumnModelVetoException
e
- the event identifying the removal
ColumnModelVetoException
public int getColumnIndex(Object identifier)
identifier
,
when compared using equals
.
getColumnIndex
in interface TableColumnModel
identifier
- the identifier object
identifier
TableColumnModel.getColumn(int)
public int getColumnIndexAtX(int x)
xPosition
;
or -1 if it lies outside the any of the column's bounds.
In keeping with Swing's separable model architecture, a
TableColumnModel does not know how the table columns actually appear on
screen. The visual presentation of the columns is the responsibility
of the view/controller object using this model (typically JTable). The
view/controller need not display the columns sequentially from left to
right. For example, columns could be displayed from right to left to
accomodate a locale preference or some columns might be hidden at the
request of the user. Because the model does not know how the columns
are laid out on screen, the given xPosition
should not be
considered to be a coordinate in 2D graphics space. Instead, it should
be considered to be a width from the start of the first column in the
model. If the column index for a given X coordinate in 2D space is
required, JTable.columnAtPoint
can be used instead.
getColumnIndexAtX
in interface TableColumnModel
JTable.columnAtPoint(java.awt.Point)
public int getColumnMargin()
getColumnMargin
in interface TableColumnModel
public boolean getColumnSelectionAllowed()
getColumnSelectionAllowed
in interface TableColumnModel
TableColumnModel.setColumnSelectionAllowed(boolean)
public EventListener[] getListeners(Class listenerType)
listenerType
- the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
public int getSelectedColumnCount()
getSelectedColumnCount
in interface TableColumnModel
public int[] getSelectedColumns()
getSelectedColumns
in interface TableColumnModel
public ListSelectionModel getSelectionModel()
getSelectionModel
in interface TableColumnModel
ListSelectionModel
objectTableColumnModel.setSelectionModel(javax.swing.ListSelectionModel)
public int getTotalColumnWidth()
getTotalColumnWidth
in interface TableColumnModel
protected void invalidateWidthCache()
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
evt
- A PropertyChangeEvent object describing the event source
and the property that has changed.protected void recalcWidthCache()
public void removeColumnModelListener(TableColumnModelListener x)
removeColumnModelListener
in interface TableColumnModel
x
- a TableColumnModelListener
objectpublic void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface TreeTableColumnModelAdapter
listener
- the listener to remove.public void removeVetoableColumnModelListener(VetoableTableColumnModelListener l)
removeVetoableColumnModelListener
in interface VetoableTableColumnModel
l
- the listener to be removedpublic void setColumnMargin(int newMargin)
TableColumn
's column margin to
newMargin
. This method posts
a columnMarginChanged
event to its listeners.
setColumnMargin
in interface TableColumnModel
newMargin
- the width, in pixels, of the new column marginsTableColumnModel.getColumnMargin()
public void setColumnSelectionAllowed(boolean flag)
setColumnSelectionAllowed
in interface TableColumnModel
flag
- true if columns may be selected; otherwise falseTableColumnModel.getColumnSelectionAllowed()
public void setSelectionModel(ListSelectionModel newModel)
setSelectionModel
in interface TableColumnModel
newModel
- a ListSelectionModel
objectTableColumnModel.getSelectionModel()
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
e
- the event that characterizes the change.
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |