net.sf.dc.console
Class TablePanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bynet.sf.dc.console.DCPanel
                      extended bynet.sf.dc.console.TablePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
QueryPanel, TableInsertPanel, TableSearchPanel

public abstract class TablePanel
extends DCPanel

Base panel for all panels which contain a JTable This class facilities most of the functions needed to fill / clear / update tables. It also provides a popup menu for the table and action buttons.

Since:
1.3
Version:
0.50
Author:
Robert-Jan van der Waals
See Also:
Serialized Form

Nested Class Summary
 class TablePanel.AddRowAction
          Adds an empty row to the table
 class TablePanel.CancelAction
          Removes a row (or multiple rows) from the table
 class TablePanel.ClearButtonAction
          Clears the table
 class TablePanel.CreatePdfReport
          Opens the PDF creation dialog
 class TablePanel.FieldSelectorAction
          Opens the hidden / visible fields selector dialog
 class TablePanel.OpenItemFormAction
          Opens an item
 class TablePanel.PopupMenu
          Menu shown when the user performs a right click on a table.
 class TablePanel.RemoveRowAction
          Removes a row (or multiple rows) from the table
 class TablePanel.TableActionsPanel
          Panel which holds all buttons and their actions for tables.
 class TablePanel.UpdateAllAction
          Opens the dialog for updating all the values of one (or more) columns in the UI table
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  TablePanel.TableActionsPanel panelTableActions
           
protected  TablePanel.PopupMenu popupMenu
           
protected  DCTable table
           
protected  net.sf.dc.console.TablePanel.TableMouseListener tableMouseListener
           
protected  DataTask task
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TablePanel(DCModule module, java.lang.String title, javax.swing.ImageIcon icon)
          Initializes this panel
 
Method Summary
 void addObject(DCObject dco)
           
abstract  void addObjects(java.util.Collection objects)
           
 void allowActions()
          (Re-) enables the save and clear buttons.
 void cancelEdit()
          Tries to apply the current editing of the table cell.
 void cancelTask()
          Cancels the currently running data task
 void clearTable()
          Clears this table of all data
abstract  void createPdfReport()
           
 void denyActions()
          Disables the save and clear buttons.
 void fillTable(java.util.Collection objects)
          Fills the table with a list of data crow objects
protected  DCModule getChildModule()
          Returns the child module (or null if it does not exist)
protected  DCModule getModule()
          Retrieves the module to which this panel belongs
 DCObject[] getObjects()
          Returns all rows in the UI table as Data Crow objects.
protected  boolean hasChild()
          Indicates whether thids panel has a child panel
protected  boolean isTaskRunning()
          Indicates whether there is a data task running at this moment
abstract  void openItemForm()
           
 void openItemForm(DCObject dco, boolean update)
          Opens the item form for the selected item
 void removeHiddenFields(int[] indices)
          Removes hidden fields from the search table.
 void removeRows(java.lang.String[] ids)
          Remove the rows from the table with the given indices
 void removeSelectedRows()
           
 void setRequiredFields()
          Mark fields as being required
 void showFieldSelector()
           
 void startAmazonUpdate()
          Starts the Amazon internet update.
 void startIMDBUpdate()
          Starts the IMDB internet update.
 void updateRow(java.lang.String id, DCObject dco, boolean overwrite, boolean allowDeletes)
          Updates the row with the given ID with the data (values)
 void updateRowAt(int rowNumber, DCObject dco, boolean overWrite, boolean allowDeletes)
          Deprecated.  
 
Methods inherited from class net.sf.dc.console.DCPanel
getHelpIndex, getIcon, getStatusPanel, getTitle, initProgressBar, setBackground, setHelpIndex, setStatus, updateProgressBar
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

table

protected DCTable table

panelTableActions

protected TablePanel.TableActionsPanel panelTableActions

popupMenu

protected TablePanel.PopupMenu popupMenu

tableMouseListener

protected final net.sf.dc.console.TablePanel.TableMouseListener tableMouseListener

task

protected DataTask task
Constructor Detail

TablePanel

public TablePanel(DCModule module,
                  java.lang.String title,
                  javax.swing.ImageIcon icon)
Initializes this panel

Parameters:
module - the module for which this panel is created
title - the title of this panel
icon - the icon of this panel
Method Detail

getChildModule

protected DCModule getChildModule()
Returns the child module (or null if it does not exist)


hasChild

protected boolean hasChild()
Indicates whether thids panel has a child panel


getModule

protected DCModule getModule()
Retrieves the module to which this panel belongs


isTaskRunning

protected boolean isTaskRunning()
Indicates whether there is a data task running at this moment


showFieldSelector

public void showFieldSelector()

fillTable

public void fillTable(java.util.Collection objects)
Fills the table with a list of data crow objects


setRequiredFields

public void setRequiredFields()
Mark fields as being required


removeHiddenFields

public void removeHiddenFields(int[] indices)
Removes hidden fields from the search table.


updateRow

public void updateRow(java.lang.String id,
                      DCObject dco,
                      boolean overwrite,
                      boolean allowDeletes)
Updates the row with the given ID with the data (values)


updateRowAt

public void updateRowAt(int rowNumber,
                        DCObject dco,
                        boolean overWrite,
                        boolean allowDeletes)
Deprecated.  

Updates the row data for the given row

Parameters:
rowNumber - to be update row index
overWrite - indicates whether existing values should be overwritten

denyActions

public void denyActions()
Disables the save and clear buttons. Denies the popupmenu to appear


allowActions

public void allowActions()
(Re-) enables the save and clear buttons. Alles the popupmenu to (re-) appear


openItemForm

public void openItemForm(DCObject dco,
                         boolean update)
Opens the item form for the selected item


removeSelectedRows

public void removeSelectedRows()

removeRows

public void removeRows(java.lang.String[] ids)
Remove the rows from the table with the given indices


cancelTask

public void cancelTask()
Cancels the currently running data task


getObjects

public DCObject[] getObjects()
Returns all rows in the UI table as Data Crow objects. Use carefully! In case of thousands of objects a huge amount of memory is used. Make sure that getting the cached items only isn't enough!


clearTable

public void clearTable()
Clears this table of all data


cancelEdit

public void cancelEdit()
Tries to apply the current editing of the table cell. If the current value cannot be applied, the editing is simply cancelled (changes are discarded)


startAmazonUpdate

public void startAmazonUpdate()
Starts the Amazon internet update. The job is run in a seperate thread


startIMDBUpdate

public void startIMDBUpdate()
Starts the IMDB internet update. The job is run in a seperate thread


openItemForm

public abstract void openItemForm()

createPdfReport

public abstract void createPdfReport()

addObjects

public abstract void addObjects(java.util.Collection objects)

addObject

public void addObject(DCObject dco)