Quaqua 7.4.2 2011-07-05

ch.randelshofer.quaqua
Class QuaquaListUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ListUI
          extended by javax.swing.plaf.basic.BasicListUI
              extended by ch.randelshofer.quaqua.QuaquaListUI

public class QuaquaListUI
extends javax.swing.plaf.basic.BasicListUI

QuaquaListUI for Java 1.4.

Version:
$Id: QuaquaListUI.java 361 2010-11-21 11:19:20Z wrandelshofer $
Author:
Werner Randelshofer

Nested Class Summary
 class QuaquaListUI.FocusHandler
          This inner class is marked "public" due to a compiler bug.
protected  class QuaquaListUI.ListDataHandler
           
 class QuaquaListUI.MouseInputHandler
          Mouse input, and focus handling for JList.
 class QuaquaListUI.PropertyChangeHandler
          The PropertyChangeListener that's added to the JList at installUI time.
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicListUI
javax.swing.plaf.basic.BasicListUI.ListSelectionHandler
 
Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
 
Constructor Summary
QuaquaListUI()
          Creates a new instance.
 
Method Summary
protected  java.awt.event.FocusListener createFocusListener()
           
protected  javax.swing.event.ListDataListener createListDataListener()
           
protected  javax.swing.event.MouseInputListener createMouseInputListener()
          Creates a delegate that implements MouseInputListener.
protected  java.beans.PropertyChangeListener createPropertyChangeListener()
          Creates an instance of PropertyChangeHandler that's added to the JList by installUI().
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent list)
          Returns a new instance of QuaquaListUI.
protected  void installDefaults()
          Initialize JList properties, e.g.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paint the rows that intersect the Graphics objects clipRect.
protected  void paintCell(java.awt.Graphics g, int row, java.awt.Rectangle rowBounds, javax.swing.ListCellRenderer cellRenderer, javax.swing.ListModel dataModel, javax.swing.ListSelectionModel selModel, int leadIndex)
          Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use the CellRendererPane to paint it.
 void paintStripes(java.awt.Graphics g, javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicListUI
convertRowToY, convertYToRow, createListSelectionListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installKeyboardActions, installListeners, installUI, locationToIndex, maybeUpdateLayoutState, selectNextIndex, selectPreviousIndex, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, updateLayoutState
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuaquaListUI

public QuaquaListUI()
Creates a new instance.

Method Detail

paintStripes

public void paintStripes(java.awt.Graphics g,
                         javax.swing.JComponent c)

paintCell

protected void paintCell(java.awt.Graphics g,
                         int row,
                         java.awt.Rectangle rowBounds,
                         javax.swing.ListCellRenderer cellRenderer,
                         javax.swing.ListModel dataModel,
                         javax.swing.ListSelectionModel selModel,
                         int leadIndex)
Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use the CellRendererPane to paint it. Subclasses may want to override this method rather than paint().

Overrides:
paintCell in class javax.swing.plaf.basic.BasicListUI
See Also:
paint(java.awt.Graphics, javax.swing.JComponent)

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paint the rows that intersect the Graphics objects clipRect. This method calls paintCell as necessary. Subclasses may want to override these methods.

Overrides:
paint in class javax.swing.plaf.basic.BasicListUI
See Also:
paintCell(java.awt.Graphics, int, java.awt.Rectangle, javax.swing.ListCellRenderer, javax.swing.ListModel, javax.swing.ListSelectionModel, int)

installDefaults

protected void installDefaults()
Initialize JList properties, e.g. font, foreground, and background, and add the CellRendererPane. The font, foreground, and background properties are only set if their current value is either null or a UIResource, other properties are set if the current value is null.

Overrides:
installDefaults in class javax.swing.plaf.basic.BasicListUI
See Also:
BasicListUI.uninstallDefaults(), BasicListUI.installUI(javax.swing.JComponent), CellRendererPane

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent list)
Returns a new instance of QuaquaListUI. QuaquaListUI delegates are allocated one per JList.

Returns:
A new ListUI implementation for the Windows look and feel.

createMouseInputListener

protected javax.swing.event.MouseInputListener createMouseInputListener()
Creates a delegate that implements MouseInputListener. The delegate is added to the corresponding java.awt.Component listener lists at installUI() time. Subclasses can override this method to return a custom MouseInputListener, e.g.
 class MyListUI extends QuaquaListUI {
    protected MouseInputListener createMouseInputListener() {
        return new MyMouseInputHandler();
    }
    public class MyMouseInputHandler extends MouseInputHandler {
        public void mouseMoved(MouseEvent e) {
            // do some extra work when the mouse moves
            super.mouseMoved(e);
        }
    }
 }
 

Overrides:
createMouseInputListener in class javax.swing.plaf.basic.BasicListUI
See Also:
QuaquaListUI.MouseInputHandler, BasicListUI.installUI(javax.swing.JComponent)

createFocusListener

protected java.awt.event.FocusListener createFocusListener()
Overrides:
createFocusListener in class javax.swing.plaf.basic.BasicListUI

createListDataListener

protected javax.swing.event.ListDataListener createListDataListener()
Overrides:
createListDataListener in class javax.swing.plaf.basic.BasicListUI

createPropertyChangeListener

protected java.beans.PropertyChangeListener createPropertyChangeListener()
Creates an instance of PropertyChangeHandler that's added to the JList by installUI(). Subclasses can override this method to return a custom PropertyChangeListener, e.g.
 class MyListUI extends QuaquaListUI {
    protected PropertyChangeListener createPropertyChangeListener() {
        return new MyPropertyChangeListener();
    }
    public class MyPropertyChangeListener extends PropertyChangeHandler {
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName().equals("model")) {
                // do some extra work when the model changes
            }
            super.propertyChange(e);
        }
    }
 }
 

Overrides:
createPropertyChangeListener in class javax.swing.plaf.basic.BasicListUI
See Also:
PropertyChangeListener, BasicListUI.installUI(javax.swing.JComponent)

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.