org.scopemvc.view.swing
Class STable

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JTable
                          |
                          +--org.scopemvc.view.swing.STable
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.CellEditorListener, java.util.EventListener, java.awt.image.ImageObserver, javax.swing.event.ListSelectionListener, ListSelectionParent, java.awt.MenuContainer, java.awt.event.MouseListener, Refreshable, javax.swing.Scrollable, java.io.Serializable, javax.swing.event.TableColumnModelListener, javax.swing.event.TableModelListener, View

public class STable
extends javax.swing.JTable
implements View, Refreshable, java.awt.event.MouseListener, ListSelectionParent

A JTable bound to a list property of a model. The table shows a list of rows from the bound property (see setSelector(org.scopemvc.core.Selector)). If the rows are model objects, the properties shown for each column are set using setColumnSelectors(org.scopemvc.core.Selector[]). See also setColumnNames(java.lang.String[]).

STable uses STableModel and so the contents can be sorted using setSorted(boolean) or setSorted(Comparator).

STable uses a standard (non-bound) Swing ListSelectionModel unless a selection Selector is set using setSelectionSelector(org.scopemvc.core.Selector) or setSelectionSelectorString(java.lang.String) in which case a bound SListSelectionModel is used. This allows both single-selection and an as-yet-limited multiselection (contiguous only) using a HashSet property to hold the selected objects. See SListSelectionModel, which is used by STable to maintain bound selections.

Version:
$Revision: 1.22 $ $Date: 2002/09/13 17:04:41 $
Author:
Daniel Michalik
, Steve Meyfroidt
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTable
javax.swing.JTable.AccessibleJTable
 
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  java.util.HashMap editors
          TODO: describe of the Field
 
Fields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
 
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
STable()
          Constructor for the STable object
 
Method Summary
protected  javax.swing.table.TableModel createDefaultDataModel()
          STables create their own STableModel by default.
protected  void createDefaultEditors()
          TODO: document the method
protected  void createDefaultRenderers()
          Sets default Scope table cell renderers.
 javax.swing.JToolTip createToolTip()
          TODO: document the method
 java.lang.Object findElementAt(int inIndex)
          TODO: document the method
 int findIndexFor(java.lang.Object inValue)
          TODO: document the method
 java.lang.Object getBoundModel()
          Gets the bound model
 java.lang.String getChangeSelectionControlID()
          Get the Control ID for the Control that will be issued when the selection is changed.
 Controller getController()
          Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.
 javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class columnClass)
          Gets the default editor
 javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
          Gets the default renderer
 java.lang.String getDoubleClickControlID()
          Get the Control ID for the Control that will be issued when the List is double-clicked.
 Selector getSelectionSelector()
          Gets the selection selector
 Selector getSelector()
          Gets the selector
 void issueChangeSelectionControl()
          TODO: document the method
 void issueControl(Control inControl)
          Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.
 void mouseClicked(java.awt.event.MouseEvent e)
          TODO: document the method
 void mouseEntered(java.awt.event.MouseEvent e)
          TODO: document the method
 void mouseExited(java.awt.event.MouseEvent e)
          TODO: document the method
 void mousePressed(java.awt.event.MouseEvent e)
          TODO: document the method
 void mouseReleased(java.awt.event.MouseEvent e)
          TODO: document the method
 void refresh()
          TODO: document the method
 void refreshSelection()
          TODO: document the method
 void setBoundModel(java.lang.Object inModel)
          Sets the bound model
 void setChangeSelectionControlID(java.lang.String inControlID)
          Set the Control ID for the Control that will be issued when the selection is changed.
 void setColumnNames(java.lang.String[] inNames)
          Set up the column names.
 void setColumnSelectors(Selector[] inSelectors)
          Set up the column selectors.
 void setColumnSelectorStrings(java.lang.String[] inSelectorStrings)
          Set up the column selectors.
 void setController(Controller inController)
          Don't assign a Controller to this component, instead delegate to the containing SwingView that has a parent Controller.
 void setDoubleClickControlID(java.lang.String inControlID)
          Set the Control ID for the Control that will be issued when the List is double-clicked.
 void setSelectionSelector(Selector inSelector)
          Set the Selector for the list selection: this property will be bound to the list's single selection.
 void setSelectionSelectorString(java.lang.String inSelectorString)
          Set the Selector for the list selection: this property will be bound to the list's single selection.
 void setSelector(Selector inSelector)
          Set the Selector for the table data.
 void setSelectorString(java.lang.String inSelectorString)
          Set the Selector for the table data.
 void validationFailed(java.lang.Exception inException)
          TODO: document the method
 void validationSuccess()
          TODO: document the method
 
Methods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, 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, 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, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, 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, 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
 
Methods inherited from interface org.scopemvc.view.swing.ListSelectionParent
setEnabled
 

Field Detail

editors

protected java.util.HashMap editors
TODO: describe of the Field

Constructor Detail

STable

public STable()
Constructor for the STable object

Method Detail

getBoundModel

public final java.lang.Object getBoundModel()
Gets the bound model

Specified by:
getBoundModel in interface View
Returns:
The boundModel value

getSelector

public final Selector getSelector()
Gets the selector

Returns:
The selector value

getSelectionSelector

public final Selector getSelectionSelector()
Gets the selection selector

Returns:
The selectionSelector value

issueChangeSelectionControl

public void issueChangeSelectionControl()
TODO: document the method

Specified by:
issueChangeSelectionControl in interface ListSelectionParent

getChangeSelectionControlID

public java.lang.String getChangeSelectionControlID()
Get the Control ID for the Control that will be issued when the selection is changed.

Returns:
The changeSelectionControlID value

getDoubleClickControlID

public java.lang.String getDoubleClickControlID()
Get the Control ID for the Control that will be issued when the List is double-clicked.

Returns:
The doubleClickControlID value

getController

public Controller getController()
Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.

Specified by:
getController in interface View
Returns:
The controller value

issueControl

public void issueControl(Control inControl)
Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.

Specified by:
issueControl in interface View
Parameters:
inControl - TODO: Describe the Parameter

getDefaultEditor

public javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class columnClass)
Gets the default editor

Overrides:
getDefaultEditor in class javax.swing.JTable
Parameters:
columnClass - TODO: Describe the Parameter
Returns:
The defaultEditor value

getDefaultRenderer

public javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
Gets the default renderer

Overrides:
getDefaultRenderer in class javax.swing.JTable
Parameters:
columnClass - TODO: Describe the Parameter
Returns:
The defaultRenderer value

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Sets the bound model

Specified by:
setBoundModel in interface View
Parameters:
inModel - The new boundModel value

setSelector

public final void setSelector(Selector inSelector)
Set the Selector for the table data. Should be a java.util.List or an Object[] or have a "size" property and properties accessible by an IntIndexedSelector.

Parameters:
inSelector - The new selector value

setSelectorString

public final void setSelectorString(java.lang.String inSelectorString)
Set the Selector for the table data. Should be a java.util.List or an Object[] or have a "size" property and properties accessible by an IntIndexedSelector.

Parameters:
inSelectorString - The new selectorString value

setSelectionSelector

public final void setSelectionSelector(Selector inSelector)
Set the Selector for the list selection: this property will be bound to the list's single selection.

Parameters:
inSelector - The new selectionSelector value

setSelectionSelectorString

public final void setSelectionSelectorString(java.lang.String inSelectorString)
Set the Selector for the list selection: this property will be bound to the list's single selection.

Parameters:
inSelectorString - The new selectionSelectorString value

setChangeSelectionControlID

public final void setChangeSelectionControlID(java.lang.String inControlID)
Set the Control ID for the Control that will be issued when the selection is changed. If null no Control will be issued.

Parameters:
inControlID - The new changeSelectionControlID value

setDoubleClickControlID

public final void setDoubleClickControlID(java.lang.String inControlID)
Set the Control ID for the Control that will be issued when the List is double-clicked. If null no Control will be issued.

Parameters:
inControlID - The new doubleClickControlID value

setColumnSelectors

public void setColumnSelectors(Selector[] inSelectors)
Set up the column selectors.

Parameters:
inSelectors - The new columnSelectors value

setColumnSelectorStrings

public void setColumnSelectorStrings(java.lang.String[] inSelectorStrings)
Set up the column selectors.

Parameters:
inSelectorStrings - The new columnSelectorStrings value

setColumnNames

public void setColumnNames(java.lang.String[] inNames)
Set up the column names.

Parameters:
inNames - The new columnNames value

setController

public void setController(Controller inController)
Don't assign a Controller to this component, instead delegate to the containing SwingView that has a parent Controller.

Specified by:
setController in interface View
Parameters:
inController - The new controller value

refresh

public void refresh()
TODO: document the method

Specified by:
refresh in interface Refreshable

refreshSelection

public void refreshSelection()
TODO: document the method


findIndexFor

public int findIndexFor(java.lang.Object inValue)
Description copied from interface: ListSelectionParent
TODO: document the method

Specified by:
findIndexFor in interface ListSelectionParent
Parameters:
inValue - TODO: Describe the Parameter
Returns:
-1 if not found.

findElementAt

public java.lang.Object findElementAt(int inIndex)
Description copied from interface: ListSelectionParent
TODO: document the method

Specified by:
findElementAt in interface ListSelectionParent
Parameters:
inIndex - TODO: Describe the Parameter
Returns:
null if not found.

validationFailed

public void validationFailed(java.lang.Exception inException)
TODO: document the method

Specified by:
validationFailed in interface ListSelectionParent
Parameters:
inException - TODO: Describe the Parameter

validationSuccess

public void validationSuccess()
TODO: document the method

Specified by:
validationSuccess in interface ListSelectionParent

createToolTip

public javax.swing.JToolTip createToolTip()
TODO: document the method

Overrides:
createToolTip in class javax.swing.JComponent
Returns:
TODO: Describe the Return Value

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
TODO: document the method

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - TODO: Describe the Parameter

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
TODO: document the method

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - TODO: Describe the Parameter

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
TODO: document the method

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - TODO: Describe the Parameter

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
TODO: document the method

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

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
TODO: document the method

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

createDefaultDataModel

protected javax.swing.table.TableModel createDefaultDataModel()
STables create their own STableModel by default.

Overrides:
createDefaultDataModel in class javax.swing.JTable
Returns:
TODO: Describe the Return Value

createDefaultRenderers

protected void createDefaultRenderers()
Sets default Scope table cell renderers. They use Scope's StringConverters.

Overrides:
createDefaultRenderers in class javax.swing.JTable

createDefaultEditors

protected void createDefaultEditors()
TODO: document the method

Overrides:
createDefaultEditors in class javax.swing.JTable


Copyright © 2000-2002 The Scope Team. All Rights Reserved.