swingwtx.swing
Class JList

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.swing.JList
All Implemented Interfaces:
java.util.EventListener, ImageObserver, ListDataListener, MenuContainer, Scrollable
Direct Known Subclasses:
List

public class JList
extends JComponent
implements Scrollable, ListDataListener


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected  ListCellRenderer cellRenderer
           
protected  ListModel listModel
           
protected  ListSelectionModel listSelectionModel
           
protected  org.eclipse.swt.widgets.Table ppeer
           
protected  int pSelectedIndex
           
protected  java.lang.String pText
           
 
Fields inherited from class swingwtx.swing.JComponent
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, peer, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JList()
           
JList(ListModel model)
           
JList(java.lang.Object[] items)
          Creates a list with the specified items.
JList(java.util.Vector items)
          Creates a list with the specified items.
 
Method Summary
 void addItem(java.lang.Object item)
           
 void addListSelectionListener(ListSelectionListener l)
           
protected  boolean checkIsDefault()
          Ensures the listmodel is an instance of DefaultListModel - returns false if it isn't.
 void clearSelection()
           
 void contentsChanged(ListDataEvent e)
           
 ListCellRenderer getCellRenderer()
           
 java.lang.Object getItemAt(int index)
           
 int getItemCount()
           
 ListModel getModel()
           
 Dimension getPreferredScrollableViewportSize()
           
 int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
           
 int getSelectedIndex()
           
 int[] getSelectedIndices()
           
 java.lang.Object getSelectedValue()
           
 java.lang.Object[] getSelectedValues()
           
 ListSelectionModel getSelectionModel()
           
protected  int indexOf(java.lang.Object value)
           
 void insertItemAt(java.lang.Object item, int index)
           
 void intervalAdded(ListDataEvent e)
           
 void intervalRemoved(ListDataEvent e)
           
protected  void loadData(java.lang.Object[] data)
           
protected  void loadData(java.util.Vector data)
           
 int locationToIndex(Point point)
           
protected  void registerSelectionEvents()
          Assigns events to the peer for selection so that we can update the ListSelectionModel for this component.
 void removeAllItems()
           
 void removeItem(java.lang.Object item)
           
 void removeItemAt(int index)
           
 void removeListSelectionListener(ListSelectionListener l)
           
 void replaceItemAt(java.lang.Object replacement, int index)
          Not a real Swing method - used to switch an already created item in the DefaultListModel.
 void setCellRenderer(ListCellRenderer r)
           
 void setListData(java.lang.Object[] listData)
          Fill list model from array
 void setListData(java.util.Vector listData)
          Fill list model from vector
 void setModel(ListModel l)
           
 void setSelectedIndex(int index)
           
 void setSelectedIndices(int[] selection)
           
 void setSelectedValue(int index)
           
 void setSelectedValue(java.lang.Object value, boolean shouldscroll)
           
 void setSelectionBackground(Color color)
          No way in SWT to set selection colour models
 void setSelectionForeground(Color color)
          No way in SWT to set selection colour models
 void setSelectionMode(int mode)
           
 void setSelectionModel(ListSelectionModel l)
           
 void setSwingWTParent(Container parent)
          Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.
 void setVisibleRowCount(int rows)
          Used to calculate preferred height
 void showSelection()
          Scrolls the list to the selected item.
protected  void updateList()
          Fills the table with the list items
 
Methods inherited from class swingwtx.swing.JComponent
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, dispose, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setBorder, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled
 
Methods inherited from class swingwt.awt.Container
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate
 
Methods inherited from class swingwt.awt.Component
add, addActionListener, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, calculatePreferredSize, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getActionCommand, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSize, getSWTPeer, getToolkit, getToolTipText, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, hide, imageUpdate, inside, isEnabled, isFocusable, isMinimumSizeSet, isShowing, isVisible, processActionEvent, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerActionEvents, registerComponentEvents, registerEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, requestFocus, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setBounds, setBounds, setCachedProperties, setComponentOrientation, setComponentRemoved, setCursor, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setToolTipText, setVisible, setWidth, show, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ppeer

protected org.eclipse.swt.widgets.Table ppeer

pText

protected java.lang.String pText

pSelectedIndex

protected int pSelectedIndex

cellRenderer

protected ListCellRenderer cellRenderer

listModel

protected ListModel listModel

listSelectionModel

protected ListSelectionModel listSelectionModel
Constructor Detail

JList

public JList()

JList

public JList(java.lang.Object[] items)
Creates a list with the specified items. WARNING:: SWT cannot store objects against the list like Swing can, so only the toString() method of your objects will be stored.


JList

public JList(java.util.Vector items)
Creates a list with the specified items. WARNING:: SWT cannot store objects against the list like Swing can, so only the toString() method of your objects will be stored.


JList

public JList(ListModel model)
Method Detail

addListSelectionListener

public void addListSelectionListener(ListSelectionListener l)

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener l)

clearSelection

public void clearSelection()

getSelectedValue

public java.lang.Object getSelectedValue()

setSelectedValue

public void setSelectedValue(int index)

indexOf

protected int indexOf(java.lang.Object value)

setSelectedValue

public void setSelectedValue(java.lang.Object value,
                             boolean shouldscroll)

getSelectionModel

public ListSelectionModel getSelectionModel()

setSelectionModel

public void setSelectionModel(ListSelectionModel l)

setSelectionMode

public void setSelectionMode(int mode)

getSelectedValues

public java.lang.Object[] getSelectedValues()

addItem

public void addItem(java.lang.Object item)

insertItemAt

public void insertItemAt(java.lang.Object item,
                         int index)

getSelectedIndex

public int getSelectedIndex()

getSelectedIndices

public int[] getSelectedIndices()

getItemAt

public java.lang.Object getItemAt(int index)

getItemCount

public int getItemCount()

showSelection

public void showSelection()
Scrolls the list to the selected item. This is not a Swing method


setSelectedIndex

public void setSelectedIndex(int index)

setSelectedIndices

public void setSelectedIndices(int[] selection)

removeAllItems

public void removeAllItems()

removeItem

public void removeItem(java.lang.Object item)

removeItemAt

public void removeItemAt(int index)

replaceItemAt

public void replaceItemAt(java.lang.Object replacement,
                          int index)
Not a real Swing method - used to switch an already created item in the DefaultListModel. This is handy for the replace functionality of the AWT list.


setVisibleRowCount

public void setVisibleRowCount(int rows)
Used to calculate preferred height


locationToIndex

public int locationToIndex(Point point)

setSelectionBackground

public void setSelectionBackground(Color color)
No way in SWT to set selection colour models


setSelectionForeground

public void setSelectionForeground(Color color)
No way in SWT to set selection colour models


updateList

protected void updateList()
Fills the table with the list items


setListData

public void setListData(java.lang.Object[] listData)
Fill list model from array


setListData

public void setListData(java.util.Vector listData)
Fill list model from vector


loadData

protected void loadData(java.util.Vector data)

loadData

protected void loadData(java.lang.Object[] data)

setCellRenderer

public void setCellRenderer(ListCellRenderer r)

getCellRenderer

public ListCellRenderer getCellRenderer()

getModel

public ListModel getModel()

setModel

public void setModel(ListModel l)

checkIsDefault

protected boolean checkIsDefault()
Ensures the listmodel is an instance of DefaultListModel - returns false if it isn't.


setSwingWTParent

public void setSwingWTParent(Container parent)
                      throws java.lang.Exception
Once a parent component receives an "add" call for a child, this being the child, this should be called to tell us to instantiate the peer and load in any cached properties.

Overrides:
setSwingWTParent in class JComponent
Throws:
java.lang.Exception

contentsChanged

public void contentsChanged(ListDataEvent e)
Specified by:
contentsChanged in interface ListDataListener

intervalAdded

public void intervalAdded(ListDataEvent e)
Specified by:
intervalAdded in interface ListDataListener

intervalRemoved

public void intervalRemoved(ListDataEvent e)
Specified by:
intervalRemoved in interface ListDataListener

registerSelectionEvents

protected void registerSelectionEvents()
Assigns events to the peer for selection so that we can update the ListSelectionModel for this component.


getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface Scrollable