Class SwingTableColumnWidthListener
- java.lang.Object
-
- java.awt.event.ComponentAdapter
-
- net.sf.jguiraffe.gui.platform.swing.builder.components.table.SwingTableColumnWidthListener
-
- All Implemented Interfaces:
ComponentListener,EventListener,TableColumnModelListener
public class SwingTableColumnWidthListener extends ComponentAdapter implements TableColumnModelListener
A specialized event listener class for keeping track of and resizing the columns of a table.
This class plays an important role in the Swing-specific implementation of tables with relative column widths. An instance is associated with a
TableColumnWidthControllerobject and registered as listener for certain events at a table component. In this constellation this class performs the following tasks:- When the table component is resized, it ensures that the widths of the columns are correctly set. This is especially important for columns with a percent width: the space available is distributed to the columns based on their relative width.
- When the user manually resizes a column the
TableColumnWidthControlleris updated so that it is notified about the new column width.
This class is used internally by the Swing-specific table implementation. If a table has columns with a percent width, the component manager implementation creates an instance and registers it at the table. It is not intended to be used by applications directly.
- Version:
- $Id: SwingTableColumnWidthListener.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description SwingTableColumnWidthListener(JTable tab, net.sf.jguiraffe.gui.builder.components.tags.table.TableColumnWidthController ctrl)Creates a new instance ofSwingTableColumnWidthListenerand initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcolumnAdded(TableColumnModelEvent e)Dummy implementation of this method of theTableColumnModelListenerinterface.voidcolumnMarginChanged(ChangeEvent e)The width of a column has been changed.voidcolumnMoved(TableColumnModelEvent e)Dummy implementation of this method of theTableColumnModelListenerinterface.voidcolumnRemoved(TableColumnModelEvent e)Dummy implementation of this method of theTableColumnModelListenerinterface.voidcolumnSelectionChanged(ListSelectionEvent e)Dummy implementation of this method of theTableColumnModelListenerinterface.voidcomponentResized(ComponentEvent e)The table monitored by this listener has been resized.-
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentMoved, componentShown
-
-
-
-
Constructor Detail
-
SwingTableColumnWidthListener
public SwingTableColumnWidthListener(JTable tab, net.sf.jguiraffe.gui.builder.components.tags.table.TableColumnWidthController ctrl)
Creates a new instance ofSwingTableColumnWidthListenerand initializes it.- Parameters:
tab- the table to be monitoredctrl- the associatedTableColumnWidthController
-
-
Method Detail
-
componentResized
public void componentResized(ComponentEvent e)
The table monitored by this listener has been resized. This implementation adjusts the column widths according to their specifications.- Specified by:
componentResizedin interfaceComponentListener- Overrides:
componentResizedin classComponentAdapter- Parameters:
e- the event
-
columnAdded
public void columnAdded(TableColumnModelEvent e)
Dummy implementation of this method of theTableColumnModelListenerinterface.- Specified by:
columnAddedin interfaceTableColumnModelListener- Parameters:
e- the event
-
columnMarginChanged
public void columnMarginChanged(ChangeEvent e)
The width of a column has been changed. This implementation notifies theTableColumnWidthControllerabout this change. Note that this event is only processed if a column is currently resized. This is due to the fact that events of this type are also triggered by the automatic resizing mechanism.- Specified by:
columnMarginChangedin interfaceTableColumnModelListener- Parameters:
e- the change event
-
columnMoved
public void columnMoved(TableColumnModelEvent e)
Dummy implementation of this method of theTableColumnModelListenerinterface.- Specified by:
columnMovedin interfaceTableColumnModelListener- Parameters:
e- the event
-
columnRemoved
public void columnRemoved(TableColumnModelEvent e)
Dummy implementation of this method of theTableColumnModelListenerinterface.- Specified by:
columnRemovedin interfaceTableColumnModelListener- Parameters:
e- the event
-
columnSelectionChanged
public void columnSelectionChanged(ListSelectionEvent e)
Dummy implementation of this method of theTableColumnModelListenerinterface.- Specified by:
columnSelectionChangedin interfaceTableColumnModelListener- Parameters:
e- the event
-
-