org.archiviststoolkit.mydomain
Class DomainTableWorkSurface

java.lang.Object
  extended by org.archiviststoolkit.mydomain.DomainTableWorkSurface
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.util.EventListener, WorkSurface
Direct Known Subclasses:
ResourceTableWorkSurface

public class DomainTableWorkSurface
extends java.lang.Object
implements WorkSurface, java.awt.event.MouseListener, java.awt.event.ActionListener

A worksurface which can display a domain table.


Nested Class Summary
protected  class DomainTableWorkSurface.DomainTableListEventListener
           
 
Field Summary
protected  DomainAccessObject access
           
protected  java.lang.Class clazz
          The class of this worksurface.
protected  DomainObject currentDomainObject
           
protected  java.util.List<DomainObject> currentObjectSublist
          event list that hosts the issues
protected  RecordLocks currentRecordLock
           
protected  DomainEditor dialog
          the sortable table model.
protected  DomainTableWorkSurface.DomainTableListEventListener eventListener
           
protected  javax.swing.JTextField filterField
           
protected  java.lang.String humanReadableSearchString
           
protected  java.util.Collection<DomainObject> resultSet
           
protected  javax.swing.JLabel resultSizeDisplay
           
protected  javax.swing.JPanel rootComponent
          The root component of this worksurface.
protected  javax.swing.JScrollPane scrollPane
           
protected  int selectedRow
           
static boolean showConfirmDialog
          Variable to see if to display the confirm dialog that comes up on save button press
protected  DomainSortableTable table
          The JTable used to render internally.
 
Constructor Summary
DomainTableWorkSurface()
           
DomainTableWorkSurface(java.lang.Class clazz, java.lang.String name, javax.swing.Icon icon)
          Constructor.
DomainTableWorkSurface(java.lang.Class clazz, java.lang.String name, javax.swing.Icon icon, DomainTableFormat tableFormat)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actionEvent)
          do something useful when an event occurs.
 void addRecordLock(DomainObject domainObject)
          Method to to set the record lock for this object
 void addToResultSet(DomainObject domainObject)
           
 void clearCurrentRecordLock()
          Method to clear the current record lock
 void closeLongSessionForPrinting()
           
 void exportEAD()
           
 void exportMARC()
           
 java.lang.Class getClazz()
           
 javax.swing.JComponent getComponent()
          Get the underlying component for this worksurface.
 DomainObject getCurrentDomainObject()
          Synchonized method to prevent a saved thread and on update thread from having simultanoues access to the current domain object
 DomainObject getCurrentDomainObjectFromDatabase()
          Method to return the currently selected domain object.
protected  void getCurrentDomainObjectFromDatabase(DomainObject domainObject)
           
 DomainEditor getDomainEditor()
          Method to return the domain editor for this worksurface.
 javax.swing.Icon getIcon()
          Get the icon associated with this worksurface.
 java.lang.String getName()
          Get the name of this worksurface.
 ConcreteAction getNewAction()
          get the action which creates.
 java.util.Collection getResultSet()
           
 java.util.ArrayList<DomainObject> getResultSetForPrinting(InfiniteProgressPanel progressPanel, ATReport report)
           
 int getSelectedRow()
          Method to return the selected row.
 int getSelectedRowCount()
           
 javax.swing.JTable getTable()
          Get the JTable used for this worksurface.
 DomainTableFormat getTableFormat()
           
 java.lang.String getTooltip()
          Get the tooltip string for this worksurface.
protected  void init(java.lang.Class clazz, java.lang.String name, javax.swing.Icon icon, DomainTableFormat tableFormat)
           
 void merge()
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Deals with a double click and therefore edit event on the table.
 void mouseEntered(java.awt.event.MouseEvent e)
          mouse has entered the component.
 void mouseExited(java.awt.event.MouseEvent e)
          mouse has left the component.
 void mousePressed(java.awt.event.MouseEvent evt)
          called when the mouse is pressed.
 void mouseReleased(java.awt.event.MouseEvent evt)
          called when the mouse is released.
 void onDelete()
           
 void onFindAll()
           
 void onInsert()
          on insert display a blank editor and insert the results.
 void onRemoveGroup(int[] selectedIndexes)
          onRemoveGroup delete a specific domain object.
 void onSearch()
           
 void onUpdate()
          onUpdate show the appropriate editor.
protected  void setCurrentDomainObject(DomainObject domainObject)
           
protected  void setFilteredListWithCurrentDomainObject()
           
 boolean setSelectedRow(int newSelectedRow)
          Method to set the new selected row.
protected  void setSublistWithCurrentDomainObject()
           
 void updateColumns()
           
protected  void updateListWithNewResultSet(java.util.Collection newResultSet)
           
protected  void updateRowCount()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showConfirmDialog

public static boolean showConfirmDialog
Variable to see if to display the confirm dialog that comes up on save button press


clazz

protected java.lang.Class clazz
The class of this worksurface.


filterField

protected javax.swing.JTextField filterField

table

protected DomainSortableTable table
The JTable used to render internally.


rootComponent

protected javax.swing.JPanel rootComponent
The root component of this worksurface.


scrollPane

protected javax.swing.JScrollPane scrollPane

eventListener

protected DomainTableWorkSurface.DomainTableListEventListener eventListener

resultSizeDisplay

protected javax.swing.JLabel resultSizeDisplay

humanReadableSearchString

protected java.lang.String humanReadableSearchString

dialog

protected DomainEditor dialog
the sortable table model.


access

protected DomainAccessObject access

currentDomainObject

protected DomainObject currentDomainObject

selectedRow

protected int selectedRow

resultSet

protected java.util.Collection<DomainObject> resultSet

currentObjectSublist

protected java.util.List<DomainObject> currentObjectSublist
event list that hosts the issues


currentRecordLock

protected RecordLocks currentRecordLock
Constructor Detail

DomainTableWorkSurface

public DomainTableWorkSurface(java.lang.Class clazz,
                              java.lang.String name,
                              javax.swing.Icon icon)
Constructor.

Parameters:
clazz - the domain model class
name - the name of this worksurface
icon - the icon of this worksurface

DomainTableWorkSurface

public DomainTableWorkSurface(java.lang.Class clazz,
                              java.lang.String name,
                              javax.swing.Icon icon,
                              DomainTableFormat tableFormat)
Constructor.

Parameters:
clazz - the domain model class
name - the name of this worksurface
icon - the icon of this worksurface
tableFormat - the table format to use for the domain table

DomainTableWorkSurface

public DomainTableWorkSurface()
Method Detail

init

protected void init(java.lang.Class clazz,
                    java.lang.String name,
                    javax.swing.Icon icon,
                    DomainTableFormat tableFormat)

getNewAction

public final ConcreteAction getNewAction()
get the action which creates.

Returns:
the action

mousePressed

public final void mousePressed(java.awt.event.MouseEvent evt)
called when the mouse is pressed.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
evt - the mouse event

mouseReleased

public final void mouseReleased(java.awt.event.MouseEvent evt)
called when the mouse is released.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
evt - the mouse event

mouseClicked

public final void mouseClicked(java.awt.event.MouseEvent e)
Deals with a double click and therefore edit event on the table.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseEntered

public final void mouseEntered(java.awt.event.MouseEvent e)
mouse has entered the component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the event

mouseExited

public final void mouseExited(java.awt.event.MouseEvent e)
mouse has left the component.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the event

getTable

public final javax.swing.JTable getTable()
Get the JTable used for this worksurface.

Returns:
the JTable

getIcon

public final javax.swing.Icon getIcon()
Get the icon associated with this worksurface.

Specified by:
getIcon in interface WorkSurface
Returns:
icon the icon

getName

public final java.lang.String getName()
Get the name of this worksurface.

Specified by:
getName in interface WorkSurface
Returns:
the name

getComponent

public final javax.swing.JComponent getComponent()
Get the underlying component for this worksurface.

Specified by:
getComponent in interface WorkSurface
Returns:
the root component

getTooltip

public final java.lang.String getTooltip()
Get the tooltip string for this worksurface.

Specified by:
getTooltip in interface WorkSurface
Returns:
the tooltip

updateRowCount

protected void updateRowCount()

actionPerformed

public final void actionPerformed(java.awt.event.ActionEvent actionEvent)
do something useful when an event occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
actionEvent - the event to process

setFilteredListWithCurrentDomainObject

protected void setFilteredListWithCurrentDomainObject()

setSublistWithCurrentDomainObject

protected void setSublistWithCurrentDomainObject()

onDelete

public void onDelete()

onUpdate

public final void onUpdate()
onUpdate show the appropriate editor.


onRemoveGroup

public final void onRemoveGroup(int[] selectedIndexes)
onRemoveGroup delete a specific domain object.

Parameters:
selectedIndexes - the indexes of the domain objects

onInsert

public final void onInsert()
on insert display a blank editor and insert the results.


addToResultSet

public void addToResultSet(DomainObject domainObject)

onSearch

public void onSearch()

onFindAll

public final void onFindAll()

updateListWithNewResultSet

protected void updateListWithNewResultSet(java.util.Collection newResultSet)

getResultSet

public java.util.Collection getResultSet()

getResultSetForPrinting

public java.util.ArrayList<DomainObject> getResultSetForPrinting(InfiniteProgressPanel progressPanel,
                                                                 ATReport report)
                                                          throws PersistenceException,
                                                                 LookupException,
                                                                 UnsupportedClassException,
                                                                 ReportExecutionException
Throws:
PersistenceException
LookupException
UnsupportedClassException
ReportExecutionException

getSelectedRowCount

public int getSelectedRowCount()

closeLongSessionForPrinting

public void closeLongSessionForPrinting()

getTableFormat

public DomainTableFormat getTableFormat()

getClazz

public java.lang.Class getClazz()

updateColumns

public void updateColumns()

exportMARC

public void exportMARC()

exportEAD

public void exportEAD()

merge

public void merge()

getCurrentDomainObjectFromDatabase

protected void getCurrentDomainObjectFromDatabase(DomainObject domainObject)
                                           throws LookupException
Throws:
LookupException

getCurrentDomainObject

public DomainObject getCurrentDomainObject()
Synchonized method to prevent a saved thread and on update thread from having simultanoues access to the current domain object

Returns:
The current domain object

setCurrentDomainObject

protected void setCurrentDomainObject(DomainObject domainObject)

getCurrentDomainObjectFromDatabase

public DomainObject getCurrentDomainObjectFromDatabase()
Method to return the currently selected domain object. Currently used for debuging purposes

Returns:
The currently selected domain object

addRecordLock

public void addRecordLock(DomainObject domainObject)
Method to to set the record lock for this object

Parameters:
domainObject - The record to add a lock for

clearCurrentRecordLock

public void clearCurrentRecordLock()
Method to clear the current record lock


setSelectedRow

public boolean setSelectedRow(int newSelectedRow)
Method to set the new selected row. This method is currently used for debuging purposes

Parameters:
newSelectedRow - The new selected row
Returns:
Whether the record for the selected row is locked already

getSelectedRow

public int getSelectedRow()
Method to return the selected row. Used mainly for debuging

Returns:
The currently selected row

getDomainEditor

public DomainEditor getDomainEditor()
Method to return the domain editor for this worksurface. Method is used by plugin which need to display the dialog.

Returns:
The domain editor for this worksurface