Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.view.swing
Class STable  view STable download STable.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTable
                  extended byorg.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, org.scopemvc.core.View

public class STable
extends javax.swing.JTable
implements org.scopemvc.core.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) 55 ). If the rows are model objects, the properties shown for each column are set using setColumnSelectors(org.scopemvc.core.Selector[]) 55 . See also setColumnNames(java.lang.String[]) 55 .

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

STable uses a standard (non-bound) Swing ListSelectionModel unless a selection Selector is set using setSelectionSelector(org.scopemvc.core.Selector) 55 or setSelectionSelectorString(java.lang.String) 55 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.17 $ $Date: 2002/05/23 17:05:24 $

Nested Class Summary
(package private) static class STable.BooleanEditor
           
(package private) static class STable.BooleanRenderer
           
 
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
private  java.lang.String doubleClickControlID
          Control to issue on double click.
protected  java.util.HashMap editors
           
private static org.apache.commons.logging.Log LOG
           
protected  java.util.HashMap renderers
           
private  java.lang.String selectionControlID
          Control to issue on selection change.
private  ValidationHelper validationHelper
          Helper to manage validation state.
 
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.Container
 
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()
           
 
Method Summary
protected  javax.swing.table.TableModel createDefaultDataModel()
          STables create their own STableModel by default.
protected  void createDefaultEditors()
          Create the default editors for this table.
protected  void createDefaultRenderers()
          Sets default Scope table cell renderers.
 javax.swing.JToolTip createToolTip()
          Return the toolTip property of this component, creating it and setting it if it is currently null.
 java.lang.Object findElementAt(int inIndex)
           
 int findIndexFor(java.lang.Object inValue)
           
 java.lang.Object getBoundModel()
           
 java.lang.String getChangeSelectionControlID()
          Get the Control ID for the Control that will be issued when the selection is changed.
 org.scopemvc.core.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)
          Get the default editor for editing values of the given type (String, Boolean and so on).
 javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
          Get the default renderer for rendering the given data type.
 java.lang.String getDoubleClickControlID()
          Get the Control ID for the Control that will be issued when the List is double-clicked.
 void issueChangeSelectionControl()
           
 void issueControl(org.scopemvc.core.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)
          This method is called when the mouse is clicked (pressed and released in short succession) on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          This method is called when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          This method is called when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          This method is called when the mouse is pressed over a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          This method is called when the mouse is released over a component.
 void refresh()
          Update the widget with the current state of the bound model.
 void refreshSelection()
           
 void setBoundModel(java.lang.Object inModel)
           
 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(org.scopemvc.core.Selector[] inSelectors)
          Set up the column selectors.
 void setColumnSelectorStrings(java.lang.String[] inSelectorStrings)
          Set up the column selectors.
 void setController(org.scopemvc.core.Controller inController)
          Don't assign a direct Controller to List, 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(org.scopemvc.core.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(org.scopemvc.core.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)
           
 void validationSuccess()
           
 
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, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, prepareEditor, prepareRenderer, 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, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, 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, 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, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, 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

LOG

private static final org.apache.commons.logging.Log LOG

validationHelper

private ValidationHelper validationHelper
Helper to manage validation state.


selectionControlID

private java.lang.String selectionControlID
Control to issue on selection change.


doubleClickControlID

private java.lang.String doubleClickControlID
Control to issue on double click.


editors

protected java.util.HashMap editors

renderers

protected java.util.HashMap renderers
Constructor Detail

STable

public STable()
Method Detail

createDefaultDataModel

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


getBoundModel

public final java.lang.Object getBoundModel()
Specified by:
getBoundModel in interface org.scopemvc.core.View

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Specified by:
setBoundModel in interface org.scopemvc.core.View

setSelector

public final void setSelector(org.scopemvc.core.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.


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.


setColumnSelectors

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


setColumnSelectorStrings

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


setColumnNames

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


setSelectionSelector

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


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.


refresh

public void refresh()
Description copied from interface: Refreshable
Update the widget with the current state of the bound model. Probably something like this:
     Object propertyValue = boundModel.getPropertyValue();
     boolean propertyReadOnly = boundModel.getPropertyReadOnly();
     updateFromProperty(propertyValue, propertyReadOnly);
 

Specified by:
refresh in interface Refreshable

refreshSelection

public void refreshSelection()

findIndexFor

public int findIndexFor(java.lang.Object inValue)
Specified by:
findIndexFor in interface ListSelectionParent

findElementAt

public java.lang.Object findElementAt(int inIndex)
Specified by:
findElementAt in interface ListSelectionParent

validationFailed

public void validationFailed(java.lang.Exception inException)
Specified by:
validationFailed in interface ListSelectionParent

validationSuccess

public void validationSuccess()
Specified by:
validationSuccess in interface ListSelectionParent

createToolTip

public javax.swing.JToolTip createToolTip()
Description copied from class: javax.swing.JComponent
Return the toolTip property of this component, creating it and setting it if it is currently null. This method can be overridden in subclasses which wish to control the exact form of tooltip created.


issueChangeSelectionControl

public void issueChangeSelectionControl()
Specified by:
issueChangeSelectionControl in interface ListSelectionParent

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is clicked (pressed and released in short succession) on a component.

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is pressed over a component.

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse is released over a component.

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

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse enters a component.

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

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Description copied from interface: java.awt.event.MouseListener
This method is called when the mouse exits a component.

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

getChangeSelectionControlID

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


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.


getDoubleClickControlID

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


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.


setController

public void setController(org.scopemvc.core.Controller inController)
Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.

Specified by:
setController in interface org.scopemvc.core.View

getController

public org.scopemvc.core.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 org.scopemvc.core.View

issueControl

public void issueControl(org.scopemvc.core.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 org.scopemvc.core.View

getDefaultEditor

public javax.swing.table.TableCellEditor getDefaultEditor(java.lang.Class columnClass)
Description copied from class: javax.swing.JTable
Get the default editor for editing values of the given type (String, Boolean and so on).


getDefaultRenderer

public javax.swing.table.TableCellRenderer getDefaultRenderer(java.lang.Class columnClass)
Description copied from class: javax.swing.JTable
Get the default renderer for rendering the given data type.


createDefaultRenderers

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


createDefaultEditors

protected void createDefaultEditors()
Description copied from class: javax.swing.JTable
Create the default editors for this table. The default method creates the editor for Booleans. Other fields are edited as strings at the moment.