com.alee.laf.list
Class WebListUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ListUI
          extended by javax.swing.plaf.basic.BasicListUI
              extended by com.alee.laf.list.WebListUI

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

Custom UI for JList component.

Author:
Mikle Garin

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicListUI
javax.swing.plaf.basic.BasicListUI.FocusHandler, javax.swing.plaf.basic.BasicListUI.ListDataHandler, javax.swing.plaf.basic.BasicListUI.ListSelectionHandler, javax.swing.plaf.basic.BasicListUI.MouseInputHandler, javax.swing.plaf.basic.BasicListUI.PropertyChangeHandler
 
Field Summary
protected  boolean autoScrollToSelection
           
protected  boolean decorateSelection
          Style settings.
protected  boolean highlightRolloverCell
           
protected  java.awt.event.MouseAdapter mouseAdapter
          List listeners.
protected  int rolloverIndex
          Runtime variables.
protected  java.awt.Color selectionBackgroundColor
           
protected  java.awt.Color selectionBorderColor
           
protected  javax.swing.event.ListSelectionListener selectionListener
           
protected  int selectionRound
           
protected  int selectionShadeWidth
           
protected  boolean webColoredSelection
           
 
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
WebListUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebListUI for the specified component.
 java.awt.Color getSelectionBackgroundColor()
          Returns selection background color.
 java.awt.Color getSelectionBorderColor()
          Returns selection border color.
 int getSelectionRound()
          Returns cells selection rounding.
 int getSelectionShadeWidth()
          Returns cells selection shade width.
protected  ToolTipProvider<? extends WebList> getToolTipProvider()
          Returns custom WebLaF tooltip provider.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isAutoScrollToSelection()
          Returns whether to scroll list down to selection automatically or not.
 boolean isDecorateSelection()
          Returns whether should decorate selected and rollover cells or not.
 boolean isHighlightRolloverCell()
          Returns whether should highlight rollover cell or not.
 boolean isWebColoredSelection()
          Returns whether selection should be web-colored or not.
protected  void paintCell(java.awt.Graphics g, int index, 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 setAutoScrollToSelection(boolean autoScrollToSelection)
          Sets whether to scroll list down to selection automatically or not.
 void setDecorateSelection(boolean decorateSelection)
          Sets whether should decorate selected and rollover cells or not.
 void setHighlightRolloverCell(boolean highlightRolloverCell)
          Sets whether should highlight rollover cell or not.
 void setSelectionBackgroundColor(java.awt.Color color)
          Sets selection background color.
 void setSelectionBorderColor(java.awt.Color color)
          Sets selection border color.
 void setSelectionRound(int selectionRound)
          Sets cells selection rounding.
 void setSelectionShadeWidth(int selectionShadeWidth)
          Sets cells selection shade width.
 void setWebColoredSelection(boolean webColored)
          Sets whether selection should be web-colored or not.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 
Methods inherited from class javax.swing.plaf.basic.BasicListUI
convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, createPropertyChangeListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installDefaults, installKeyboardActions, installListeners, locationToIndex, maybeUpdateLayoutState, paint, selectNextIndex, selectPreviousIndex, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, 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
 

Field Detail

decorateSelection

protected boolean decorateSelection
Style settings.


highlightRolloverCell

protected boolean highlightRolloverCell

selectionRound

protected int selectionRound

selectionShadeWidth

protected int selectionShadeWidth

webColoredSelection

protected boolean webColoredSelection

selectionBorderColor

protected java.awt.Color selectionBorderColor

selectionBackgroundColor

protected java.awt.Color selectionBackgroundColor

autoScrollToSelection

protected boolean autoScrollToSelection

mouseAdapter

protected java.awt.event.MouseAdapter mouseAdapter
List listeners.


selectionListener

protected javax.swing.event.ListSelectionListener selectionListener

rolloverIndex

protected int rolloverIndex
Runtime variables.

Constructor Detail

WebListUI

public WebListUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebListUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebListUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicListUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicListUI
Parameters:
c - component with this UI

getToolTipProvider

protected ToolTipProvider<? extends WebList> getToolTipProvider()
Returns custom WebLaF tooltip provider.

Returns:
custom WebLaF tooltip provider

isDecorateSelection

public boolean isDecorateSelection()
Returns whether should decorate selected and rollover cells or not.

Returns:
true if should decorate selected and rollover cells, false otherwise

setDecorateSelection

public void setDecorateSelection(boolean decorateSelection)
Sets whether should decorate selected and rollover cells or not.

Parameters:
decorateSelection - whether should decorate selected and rollover cells or not

isHighlightRolloverCell

public boolean isHighlightRolloverCell()
Returns whether should highlight rollover cell or not.

Returns:
true if rollover cell is being highlighted, false otherwise

setHighlightRolloverCell

public void setHighlightRolloverCell(boolean highlightRolloverCell)
Sets whether should highlight rollover cell or not.

Parameters:
highlightRolloverCell - whether should highlight rollover cell or not

getSelectionRound

public int getSelectionRound()
Returns cells selection rounding.

Returns:
cells selection rounding

setSelectionRound

public void setSelectionRound(int selectionRound)
Sets cells selection rounding.

Parameters:
selectionRound - new cells selection rounding

getSelectionShadeWidth

public int getSelectionShadeWidth()
Returns cells selection shade width.

Returns:
cells selection shade width

setSelectionShadeWidth

public void setSelectionShadeWidth(int selectionShadeWidth)
Sets cells selection shade width.

Parameters:
selectionShadeWidth - new cells selection shade width

isWebColoredSelection

public boolean isWebColoredSelection()
Returns whether selection should be web-colored or not. In case it is not web-colored selectionBackgroundColor value will be used as background color.

Returns:
true if selection should be web-colored, false otherwise

setWebColoredSelection

public void setWebColoredSelection(boolean webColored)
Sets whether selection should be web-colored or not. In case it is not web-colored selectionBackgroundColor value will be used as background color.

Parameters:
webColored - whether selection should be web-colored or not

getSelectionBorderColor

public java.awt.Color getSelectionBorderColor()
Returns selection border color.

Returns:
selection border color

setSelectionBorderColor

public void setSelectionBorderColor(java.awt.Color color)
Sets selection border color.

Parameters:
color - selection border color

getSelectionBackgroundColor

public java.awt.Color getSelectionBackgroundColor()
Returns selection background color. It is used only when webColoredSelection is set to false.

Returns:
selection background color

setSelectionBackgroundColor

public void setSelectionBackgroundColor(java.awt.Color color)
Sets selection background color. It is used only when webColoredSelection is set to false.

Parameters:
color - selection background color

isAutoScrollToSelection

public boolean isAutoScrollToSelection()
Returns whether to scroll list down to selection automatically or not.

Returns:
true if list is being automatically scrolled to selection, false otherwise

setAutoScrollToSelection

public void setAutoScrollToSelection(boolean autoScrollToSelection)
Sets whether to scroll list down to selection automatically or not.

Parameters:
autoScrollToSelection - whether to scroll list down to selection automatically or not

paintCell

protected void paintCell(java.awt.Graphics g,
                         int index,
                         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
Parameters:
g - graphics context
index - cell index
rowBounds - cell bounds
cellRenderer - cell renderer
dataModel - list model
selModel - list selection model
leadIndex - lead cell index
See Also:
BasicListUI.paint(java.awt.Graphics, javax.swing.JComponent)