org.fopps.ui
Class TableController

java.lang.Object
  |
  +--org.fopps.ui.TableController
All Implemented Interfaces:
Controller, java.util.EventListener, java.awt.ItemSelectable, javax.swing.event.ListSelectionListener, java.awt.event.MouseListener, javax.swing.event.TableModelListener
Direct Known Subclasses:
AttachmentTableController, ProjectContainerTableController

public class TableController
extends java.lang.Object
implements javax.swing.event.TableModelListener, javax.swing.event.ListSelectionListener, java.awt.ItemSelectable, java.awt.event.MouseListener, Controller

TableController is a generic controller for tables. It listens to table events and notfies the registered item listeners.

After selection events the controller picks up the object in the significant column for each selected row and put it into the selection list. If this column contains a string, @see TableController#getSelectedObjects() returns an array of strings. Note There may be a column which represents the whole row data.


Constructor Summary
TableController(EnhancedTable pTable)
           
 
Method Summary
 void addItemListener(java.awt.event.ItemListener pListener)
          Adds a new item listener
 java.lang.Object getContainerObject()
           
 int getObjectColumn()
           
 java.lang.Object[] getSelectedObjects()
          Returns the selected items or empty list if no items are selected.
 java.util.List getSelectedObjectsAsList()
          Returns the selected items or empty list if no items are selected.
 EnhancedTable getTable()
           
 ViewActionReceiver[] getViews()
          Returns the corresponding view(s) of the controller
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
 void notifyListeners(java.awt.event.ItemEvent pEvent)
          Notifies all item listeners
 void removeAllItemListener()
          Removes all item listeners
 void removeItemListener(java.awt.event.ItemListener pListener)
          Removes a item listener
 void setContainerObject(java.lang.Object containerObject)
           
 void setObjectColumn(int objectColumn)
          Sets the column which contains the item that should occur in the selection list.
 void tableChanged(javax.swing.event.TableModelEvent e)
          This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.
 void valueChanged(javax.swing.event.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
 

Constructor Detail

TableController

public TableController(EnhancedTable pTable)
Method Detail

getTable

public EnhancedTable getTable()

getObjectColumn

public int getObjectColumn()

setObjectColumn

public void setObjectColumn(int objectColumn)
Sets the column which contains the item that should occur in the selection list. If set to -1, the contents of the whole row is put into the selection list.

Parameters:
objectColumn - The column index which represents the whole row

getContainerObject

public java.lang.Object getContainerObject()

setContainerObject

public void setContainerObject(java.lang.Object containerObject)

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.

Specified by:
tableChanged in interface javax.swing.event.TableModelListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Called whenever the value of the selection changes.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
e - the event that characterizes the change.

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Returns the selected items or empty list if no items are selected.

Specified by:
getSelectedObjects in interface java.awt.ItemSelectable

getSelectedObjectsAsList

public java.util.List getSelectedObjectsAsList()
Returns the selected items or empty list if no items are selected.


mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. Triggers popup menu

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

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. Triggers popup menu

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

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

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

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

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

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

addItemListener

public void addItemListener(java.awt.event.ItemListener pListener)
Adds a new item listener

Specified by:
addItemListener in interface java.awt.ItemSelectable
Parameters:
pListener - Listener to add

removeItemListener

public void removeItemListener(java.awt.event.ItemListener pListener)
Removes a item listener

Specified by:
removeItemListener in interface java.awt.ItemSelectable
Parameters:
pListener - Listener to remove

removeAllItemListener

public void removeAllItemListener()
Removes all item listeners


notifyListeners

public void notifyListeners(java.awt.event.ItemEvent pEvent)
Notifies all item listeners


getViews

public ViewActionReceiver[] getViews()
Returns the corresponding view(s) of the controller

Specified by:
getViews in interface Controller


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.