be.ugent.caagt.swirl.tables
Class TableColumnButton
java.lang.Object
be.ugent.caagt.swirl.tables.TableColumnButton
- Cloneable, TableColumnDecoration
public class TableColumnButton
extends java.lang.Object
Table column decoration that behaves like a button. Clients may
register action listeners with a prototype button which will then
fire for every clone made. The action listener can distinguish between
clones by the value returned by
getColumnIndex()
.
TableColumnButton(Icon icon, Icon iconRollover, Icon iconSelected) - Create a button with given icons.
|
TableColumnButton
public TableColumnButton(Icon icon,
Icon iconRollover,
Icon iconSelected)
Create a button with given icons. All parameters must have
the same dimensions. Parameters cannot be null, but it is allowed
for two or three parameters to be identical.
addActionListener
public void addActionListener(ActionListener l)
Adds an ActionListener
to the button. Action listeners
are shared by all clones.
copy
public TableColumnButton copy()
Makes a copy of this object. This is typically implemented as
(MyDecoration)super.clone()
where MyDecoration
is a class that implements this interface, surrounded by a try-catch
clause which caches the CloneNotSupportedException
.
- copy in interface TableColumnDecoration
createCloseButton
public static TableColumnButton createCloseButton()
Return a button with the look and feel of a 'close' button.
Convenience method which enables the use of standard icons.
fireActionPerformed
protected void fireActionPerformed()
getActionCommand
public String getActionCommand()
Return the action command for this button.
getColumnIndex
public int getColumnIndex()
Return the column index for this button. Only valid for clones,
the prototype returns -1.
getDecorationHeight
public int getDecorationHeight()
Return the height of this decoration. The dimensions of a decoration
determine its position on the column header and the bounds in which
mouse events are fired.
- getDecorationHeight in interface TableColumnDecoration
getDecorationWidth
public int getDecorationWidth()
Return the width of this decoration. The dimensions of a decoration
determine its position on the column header and the bounds in which
mouse events are fired.
- getDecorationWidth in interface TableColumnDecoration
mousePressed
public void mousePressed()
Signals that the mouse button was pressed inside the bounds
of this decoration.
- mousePressed in interface TableColumnDecoration
mouseReleased
public void mouseReleased()
Signals that the mouse button was released after being pressed
inside the bounds of this decoration.
- mouseReleased in interface TableColumnDecoration
removeActionListener
public void removeActionListener(ActionListener l)
Removes an ActionListener
from the button and all its clones.
setActionCommand
public void setActionCommand(String actionCommand)
Set the action command for this button. An action command set for
the prototype will be propagated to all clones.
setColumnIndex
public void setColumnIndex(int columnIndex)
Called to indicate that this decoration has been associated
with the given table column.
- setColumnIndex in interface TableColumnDecoration
columnIndex
- Column index in the data model.
toString
public String toString()