Package org.jdesktop.swingx.plaf.synth
Class SynthXListUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ListUI
-
- javax.swing.plaf.basic.BasicListUI
-
- org.jdesktop.swingx.plaf.basic.core.BasicXListUI
-
- org.jdesktop.swingx.plaf.synth.SynthXListUI
-
- All Implemented Interfaces:
javax.swing.plaf.synth.SynthConstants
,SynthUI
public class SynthXListUI extends BasicXListUI implements javax.swing.plaf.synth.SynthConstants, SynthUI
TODO add type doc
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jdesktop.swingx.plaf.basic.core.BasicXListUI
BasicXListUI.FocusHandler, BasicXListUI.ListDataHandler, BasicXListUI.ListSelectionHandler, BasicXListUI.MouseInputHandler, BasicXListUI.PropertyChangeHandler
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.plaf.synth.SynthStyle
style
private boolean
useListColors
private boolean
useUIBorder
-
Fields inherited from class org.jdesktop.swingx.plaf.basic.core.BasicXListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
-
-
Constructor Summary
Constructors Constructor Description SynthXListUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 SynthXListUI.private int
getComponentState()
Returns the current component state for the controlled list.private javax.swing.plaf.synth.SynthContext
getContext()
Returns the context based on current state.private javax.swing.plaf.synth.SynthContext
getContext(int state)
Returns a Context with the given component state.javax.swing.plaf.synth.SynthContext
getContext(javax.swing.JComponent c)
private javax.swing.plaf.synth.Region
getRegion()
private javax.swing.plaf.synth.SynthStyle
getStyle()
Returns the style for this component from the style factory.protected void
installDefaults()
Initialize JList properties, e.g.protected void
installSynthBorder()
Installs a SynthBorder from the current style, if ui-installable.void
paintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)
Paints border with the context's style's painter.protected void
uninstallDefaults()
Set the JList properties that haven't been explicitly overridden to null.void
update(java.awt.Graphics g, javax.swing.JComponent c)
private void
updateStyle()
-
Methods inherited from class org.jdesktop.swingx.plaf.basic.core.BasicXListUI
checkBaselinePrecondition, convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, getBaseline, getBaselineResizeBehavior, getCellBounds, getElementAt, getElementCount, getPreferredSize, getRowHeight, getSortUI, getViewModel, indexToLocation, installKeyboardActions, installListeners, installSortUI, installUI, invalidateCellSizeCache, loadActionMap, locationToIndex, maybeUpdateLayoutState, paint, paintCell, processedBySortUI, processedBySortUI, selectNextIndex, selectPreviousIndex, uninstallKeyboardActions, uninstallListeners, uninstallSortUI, uninstallUI, updateLayoutState, updateSortUI
-
-
-
-
Method Detail
-
createUI
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent list)
Returns a new instance of SynthXListUI. SynthXListUI delegates are allocated one per JList.- Returns:
- A new ListUI implementation for the Synth look and feel.
-
update
public void update(java.awt.Graphics g, javax.swing.JComponent c)
Overridden to fill background, Synth-style.
- Overrides:
update
in classjavax.swing.plaf.ComponentUI
-
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 BasicXListUI { 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); } } }
Overridden to update style if appropriate.
- Overrides:
createPropertyChangeListener
in classBasicXListUI
- See Also:
PropertyChangeListener
,BasicXListUI.installUI(javax.swing.JComponent)
-
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.Overridden to install properties, Synth-style.
- Overrides:
installDefaults
in classBasicXListUI
- See Also:
BasicXListUI.uninstallDefaults()
,BasicXListUI.installUI(javax.swing.JComponent)
,CellRendererPane
-
updateStyle
private void updateStyle()
-
installSynthBorder
protected void installSynthBorder()
Installs a SynthBorder from the current style, if ui-installable.- Parameters:
context
- the context
-
uninstallDefaults
protected void uninstallDefaults()
Set the JList properties that haven't been explicitly overridden to null. A property is considered overridden if its current value is not a UIResource.Overridden to uninstall properties, Synth-style, after calling super.
- Overrides:
uninstallDefaults
in classBasicXListUI
- See Also:
BasicXListUI.installDefaults()
,BasicXListUI.uninstallUI(javax.swing.JComponent)
,CellRendererPane
-
paintBorder
public void paintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)
Paints border with the context's style's painter. Implemented for SynthUI interface.- Specified by:
paintBorder
in interfaceSynthUI
-
getContext
public javax.swing.plaf.synth.SynthContext getContext(javax.swing.JComponent c)
Returns a context for the component's current state. Implemented for SynthUI interface.
PENDING JW: not entirely sure if allowed ... but need to replace SynthUI anyway?.
- Specified by:
getContext
in interfaceSynthUI
- Throws:
java.lang.IllegalArgumentException
- if the component is not controlled by this delegate
-
getContext
private javax.swing.plaf.synth.SynthContext getContext()
Returns the context based on current state.- Returns:
-
getComponentState
private int getComponentState()
Returns the current component state for the controlled list.- Returns:
-
getContext
private javax.swing.plaf.synth.SynthContext getContext(int state)
Returns a Context with the given component state.- Parameters:
state
-- Returns:
-
getRegion
private javax.swing.plaf.synth.Region getRegion()
-
getStyle
private javax.swing.plaf.synth.SynthStyle getStyle()
Returns the style for this component from the style factory.- Returns:
-
-