com.limegroup.gnutella.gui.tables
Class DefaultColumnPreferenceHandler

java.lang.Object
  extended bycom.limegroup.gnutella.gui.tables.DefaultColumnPreferenceHandler
All Implemented Interfaces:
ColumnPreferenceHandler, java.util.EventListener, java.awt.event.MouseListener, javax.swing.event.TableColumnModelListener

public class DefaultColumnPreferenceHandler
extends java.lang.Object
implements ColumnPreferenceHandler, javax.swing.event.TableColumnModelListener, java.awt.event.MouseListener

Handles column preferences through a settings file. This is the default implementation for ColumnPreferences.


Constructor Summary
DefaultColumnPreferenceHandler(LimeJTable t)
          Constructs a new DefaultColumnPreferences object for this table.
 
Method Summary
 void columnAdded(javax.swing.event.TableColumnModelEvent e)
          Triggered from a column being added.
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Triggered from a column's margin being changed.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Triggered from a column being moved.
 void columnRemoved(javax.swing.event.TableColumnModelEvent e)
          Triggered from a column being removed.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          From a column's selection changing.
 boolean isDefault()
          Determines whether the columns are already the default values.
 void mouseClicked(java.awt.event.MouseEvent e)
          The mouse was clicked on the table header.
 void mouseEntered(java.awt.event.MouseEvent e)
          The mouse entered the table header.
 void mouseExited(java.awt.event.MouseEvent e)
          The mouse exited the table header.
 void mousePressed(java.awt.event.MouseEvent e)
          The mouse pressed the table header.
 void mouseReleased(java.awt.event.MouseEvent e)
          The mouse released from the table header.
 void revertToDefault()
          Reverts this table's header preferences to their default values.
 void setOrder()
          Sets the headers to the correct order, depending on the user's preferences for this table.
 void setVisibility()
          Sets the headers so that some may be invisible, depending on the user's preferences for this table.
 void setWidths()
          Sets the headers to the correct widths, depending on the user's preferences for this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultColumnPreferenceHandler

public DefaultColumnPreferenceHandler(LimeJTable t)
Constructs a new DefaultColumnPreferences object for this table.

Method Detail

columnAdded

public void columnAdded(javax.swing.event.TableColumnModelEvent e)
Triggered from a column being added. The 'to' index of the TableColumnModelEvent is the index in the TableColumn of the newly added column.

Specified by:
columnAdded in interface javax.swing.event.TableColumnModelListener

columnMarginChanged

public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Triggered from a column's margin being changed. This is triggered whenever a table is made visible, whenever a scrollbar appears or disappears, and whenever the margins of the columns change. Currently does nothing.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener

columnMoved

public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Triggered from a column being moved. This triggers whenever a column is touched. The 'from' and 'to' indexes may be the same -- if they are, we ignore the event.

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener

columnRemoved

public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Triggered from a column being removed. The TableColumnModelEvent is supremely dumb here, not even giving us the TableColumn that was removed. So, we need to ask the table what the last removed column was.

Specified by:
columnRemoved in interface javax.swing.event.TableColumnModelListener

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
From a column's selection changing. Does nothing.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
The mouse was clicked on the table header.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
The mouse entered the table header.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
The mouse exited the table header.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
The mouse pressed the table header.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
The mouse released from the table header.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

revertToDefault

public void revertToDefault()
Reverts this table's header preferences to their default values.

Specified by:
revertToDefault in interface ColumnPreferenceHandler

isDefault

public boolean isDefault()
Determines whether the columns are already the default values.

Specified by:
isDefault in interface ColumnPreferenceHandler

setWidths

public void setWidths()
Sets the headers to the correct widths, depending on the user's preferences for this table. This will not set the table to exactly the user's widths, because the only way to set the width is to suggest it via setPreferredWidth.

Specified by:
setWidths in interface ColumnPreferenceHandler

setOrder

public void setOrder()
Sets the headers to the correct order, depending on the user's preferences for this table.

Specified by:
setOrder in interface ColumnPreferenceHandler

setVisibility

public void setVisibility()
Sets the headers so that some may be invisible, depending on the user's preferences for this table.

Specified by:
setVisibility in interface ColumnPreferenceHandler