com.alee.laf.combobox
Class WebComboBoxCellRenderer

java.lang.Object
  extended by com.alee.laf.combobox.WebComboBoxCellRenderer
All Implemented Interfaces:
javax.swing.ListCellRenderer
Direct Known Subclasses:
DefaultFileFilterListCellRenderer

public class WebComboBoxCellRenderer
extends java.lang.Object
implements javax.swing.ListCellRenderer

Custom cell renderer for JComboBox value and popup list and some other similar cases. It uses WebComboBoxElement as renderer which is being styled by a custom LabelPainter.

Author:
Mikle Garin
See Also:
WebComboBoxElement

Field Summary
protected  WebComboBoxElement boxRenderer
          Actual renderer components.
protected  WebComboBoxElement elementRenderer
           
protected  java.util.List<RendererListener> rendererListeners
          Renderer listeners.
 
Constructor Summary
WebComboBoxCellRenderer()
          Constructs new combo box renderer.
 
Method Summary
 void addRendererListener(RendererListener listener)
          Adds RendererListener to this renderer.
 void fireRepaint()
          Fires repaint event.
 void fireRevalidate()
          Fires revalidate event.
 WebComboBoxElement getBoxRenderer()
          Returns actual combo box value renderer.
 WebComboBoxElement getElementRenderer()
          Returns actual elements renderer.
 java.awt.Component getListCellRendererComponent(javax.swing.JList list, java.lang.Object value, int index, boolean isSelected, boolean cellHasFocus)
          
 void removeRendererListener(RendererListener listener)
          Removes RendererListener from this renderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rendererListeners

protected java.util.List<RendererListener> rendererListeners
Renderer listeners.


boxRenderer

protected WebComboBoxElement boxRenderer
Actual renderer components.


elementRenderer

protected WebComboBoxElement elementRenderer
Constructor Detail

WebComboBoxCellRenderer

public WebComboBoxCellRenderer()
Constructs new combo box renderer.

Method Detail

getBoxRenderer

public WebComboBoxElement getBoxRenderer()
Returns actual combo box value renderer.

Returns:
actual combo box value renderer

getElementRenderer

public WebComboBoxElement getElementRenderer()
Returns actual elements renderer.

Returns:
actual elements renderer

getListCellRendererComponent

public java.awt.Component getListCellRendererComponent(javax.swing.JList list,
                                                       java.lang.Object value,
                                                       int index,
                                                       boolean isSelected,
                                                       boolean cellHasFocus)

Specified by:
getListCellRendererComponent in interface javax.swing.ListCellRenderer

addRendererListener

public void addRendererListener(RendererListener listener)
Adds RendererListener to this renderer.

Parameters:
listener - RendererListener to add

removeRendererListener

public void removeRendererListener(RendererListener listener)
Removes RendererListener from this renderer.

Parameters:
listener - RendererListener to remove

fireRepaint

public void fireRepaint()
Fires repaint event.


fireRevalidate

public void fireRevalidate()
Fires revalidate event.