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

Quick Search    Search Deep

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

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JList
                  extended byorg.scopemvc.view.swing.SList
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, ListSelectionParent, java.awt.MenuContainer, java.awt.event.MouseListener, Refreshable, javax.swing.Scrollable, java.io.Serializable, org.scopemvc.core.View

public class SList
extends javax.swing.JList
implements org.scopemvc.core.View, java.awt.event.MouseListener, Refreshable, ListSelectionParent

A JList that uses a SListModel to bind to model properties, and a SListSelectionModel to bind the selected item to a property. Uses a SListCellRenderer to draw items in the list.

SList can issue Controls on selection changes and on double-click.

SList doesn't itself bind to a model: it delegates all binding to its SListModel and SListSelectionModel.

Version:
$Revision: 1.8 $ $Date: 2002/01/26 09:46:20 $

Nested Class Summary
 
Nested classes inherited from class javax.swing.JList
javax.swing.JList.AccessibleJList
 
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.
private static org.apache.commons.logging.Log LOG
           
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.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
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
SList()
           
 
Method Summary
protected  javax.swing.ListSelectionModel createSelectionModel()
          Creates the default ListSelectionModel.
 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)
          Null if not found.
 int findIndexFor(java.lang.Object inValue)
          -1 if not found.
 java.lang.Object getBoundModel()
           
 org.scopemvc.core.Controller getController()
          Don't assign a direct Controller to List, instead delegate to the containing SwingView that has a parent Controller.
 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 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 setListModel(java.lang.Object inModel)
          Can use this to specify a static list model for the contents of the list rather than binding to a dynamic property of some view model.
 void setModel(javax.swing.ListModel model)
          Sets the value of the JList.model>JList.model 55 property.
 void setRendererIconSelector(org.scopemvc.core.Selector inSelector)
          Set the Selector for the list cell renderer to get an Icon: this is the property that will be shown as an Icon in a list cell.
 void setRendererIconSelectorString(java.lang.String inSelectorString)
          Set the Selector for the list cell renderer to get an Icon: this is the property that will be shown as an Icon in a list cell.
 void setRendererSelector(org.scopemvc.core.Selector inSelector)
          Set the Selector for the list cell renderer: this is the property that will be shown in a list cell (converted to a String).
 void setRendererSelectorString(java.lang.String inSelectorString)
          Set the Selector for the list cell renderer: this is the property that will be shown in a list cell (converted to a String).
 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 list data.
 void setSelectorString(java.lang.String inSelectorString)
          Set the Selector for the list data.
 void setSizeSelector(org.scopemvc.core.Selector inSelector)
          Can specify that the list's size comes from a bound property.
 void setSizeSelectorString(java.lang.String inSelectorString)
          Can specify that the list's size comes from a bound property.
 void validationFailed(java.lang.Exception inException)
           
 void validationSuccess()
           
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, doLayout, 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

selectionControlID

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


doubleClickControlID

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


validationHelper

private ValidationHelper validationHelper
Helper to manage validation state.

Constructor Detail

SList

public SList()
Method Detail

setModel

public void setModel(javax.swing.ListModel model)
Description copied from class: javax.swing.JList
Sets the value of the JList.model>JList.model 55 property. The list's JList.listListener>JList.listListener 55 is unsubscribed from the existing model, if it exists, and re-subscribed to the new model.


createSelectionModel

protected javax.swing.ListSelectionModel createSelectionModel()
Description copied from class: javax.swing.JList
Creates the default ListSelectionModel.


findIndexFor

public int findIndexFor(java.lang.Object inValue)
-1 if not found.

Specified by:
findIndexFor in interface ListSelectionParent

findElementAt

public java.lang.Object findElementAt(int inIndex)
Null if not found.

Specified by:
findElementAt in interface ListSelectionParent

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

setListModel

public void setListModel(java.lang.Object inModel)
Can use this to specify a static list model for the contents of the list rather than binding to a dynamic property of some view model.


setSizeSelector

public void setSizeSelector(org.scopemvc.core.Selector inSelector)
Can specify that the list's size comes from a bound property. This is very useful for JavaBeans indexed properties for which the size is not accessible in any other way.


setSizeSelectorString

public void setSizeSelectorString(java.lang.String inSelectorString)
Can specify that the list's size comes from a bound property. This is very useful for JavaBeans indexed properties for which the size is not accessible in any other way.


setSelector

public final void setSelector(org.scopemvc.core.Selector inSelector)
Set the Selector for the list 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 list data. Should be a java.util.List or an Object[] or have a "size" property and properties accessible by an IntIndexedSelector.


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.


setRendererSelector

public final void setRendererSelector(org.scopemvc.core.Selector inSelector)
Set the Selector for the list cell renderer: this is the property that will be shown in a list cell (converted to a String).


setRendererIconSelector

public final void setRendererIconSelector(org.scopemvc.core.Selector inSelector)
Set the Selector for the list cell renderer to get an Icon: this is the property that will be shown as an Icon in a list cell.


setRendererSelectorString

public final void setRendererSelectorString(java.lang.String inSelectorString)
Set the Selector for the list cell renderer: this is the property that will be shown in a list cell (converted to a String).


setRendererIconSelectorString

public final void setRendererIconSelectorString(java.lang.String inSelectorString)
Set the Selector for the list cell renderer to get an Icon: this is the property that will be shown as an Icon in a list cell.


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

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.


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

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()

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.