APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.swing.plaf

public Class DesktopProperty

extends Object
implements ActiveValue
Class Inheritance
All Implemented Interfaces
javax.swing.UIDefaults.ActiveValue
Known Direct Subclasses
javax.swing.plaf.metal.MetalFontDesktopProperty
Imports
java.awt.Color, .Font, .Frame, .Toolkit, .Window, java.beans.PropertyChangeEvent, .PropertyChangeListener, java.lang.ref.ReferenceQueue, .WeakReference, javax.swing.LookAndFeel, .SwingUtilities, .UIDefaults, .UIManager, javax.swing.plaf.ColorUIResource, .FontUIResource

Wrapper for a value from the desktop. The value is lazily looked up, and can be accessed using the UIManager.ActiveValue method createValue. If the underlying desktop property changes this will force the UIs to update all known Frames. You can invoke invalidate to force the value to be fetched again.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
DesktopProperty.WeakPCL

As there is typically only one Toolkit, the PropertyChangeListener is handled via a WeakReference so as not to pin down the DesktopProperty.

Field Summary

Modifier and TypeField and Description
private final Object
fallback

Fallback value in case we get null from desktop.

private final String
key

Key used to lookup value from desktop.

private DesktopProperty.WeakPCL
pcl

PropertyChangeListener attached to the Toolkit.

private static final ReferenceQueue<DesktopProperty>
queue

ReferenceQueue of unreferenced WeakPCLs.

private static volatile boolean
private Object
value

Value to return.

Constructor Summary

AccessConstructor and Description
public
DesktopProperty(String
Key used in looking up desktop value.
key
,
Object
Value used if desktop property is null.
fallback
)

Creates a DesktopProperty.

Method Summary

Modifier and TypeMethod and Description
protected Object
configureValue(Object value)

Configures the value as appropriate for a defaults property in the UIDefaults table.

public Object
createValue(UIDefaults table)

Implements javax.swing.UIDefaults.ActiveValue.createValue.

UIManager.LazyValue method, returns the value from the desktop or the fallback value if the desktop value is null.

public static void
flushUnreferencedProperties()

Cleans up any lingering state held by unrefeernced DesktopProperties.

protected Object
getDefaultValue()

Returns the value to use if the desktop property is null.

protected String
getKey()

Returns the key used to lookup the desktop properties value.

protected Object
getValueFromDesktop()

Returns the value from the desktop.

public void
invalidate(LookAndFeel
the LookAndFeel this DesktopProperty was created with
laf
)

Invalidates the current value.

public void
invalidate()

Invalidates the current value so that the next invocation of createValue will ask for the property again.

protected void
updateAllUIs()

Updates the UIs of all the known Frames.

protected void
updateUI()

Requests that all components in the GUI hierarchy be updated to reflect dynamic changes in this look&feel.; This update occurs by uninstalling and re-installing the UI objects.

private static void
updateWindowUI(Window window)

Updates the UI of the passed in window and all its children.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fallbackback to summary
private final Object fallback

Fallback value in case we get null from desktop.

keyback to summary
private final String key

Key used to lookup value from desktop.

pclback to summary
private DesktopProperty.WeakPCL pcl

PropertyChangeListener attached to the Toolkit.

queueback to summary
private static final ReferenceQueue<DesktopProperty> queue

ReferenceQueue of unreferenced WeakPCLs.

updatePendingback to summary
private static volatile boolean updatePending
valueback to summary
private Object value

Value to return.

Constructor Detail

DesktopPropertyback to summary
public DesktopProperty(String key, Object fallback)

Creates a DesktopProperty.

Parameters
key:String

Key used in looking up desktop value.

fallback:Object

Value used if desktop property is null.

Method Detail

configureValueback to summary
protected Object configureValue(Object value)

Configures the value as appropriate for a defaults property in the UIDefaults table.

createValueback to summary
public Object createValue(UIDefaults table)

Implements javax.swing.UIDefaults.ActiveValue.createValue.

UIManager.LazyValue method, returns the value from the desktop or the fallback value if the desktop value is null.

flushUnreferencedPropertiesback to summary
public static void flushUnreferencedProperties()

Cleans up any lingering state held by unrefeernced DesktopProperties.

getDefaultValueback to summary
protected Object getDefaultValue()

Returns the value to use if the desktop property is null.

getKeyback to summary
protected String getKey()

Returns the key used to lookup the desktop properties value.

getValueFromDesktopback to summary
protected Object getValueFromDesktop()

Returns the value from the desktop.

invalidateback to summary
public void invalidate(LookAndFeel laf)

Invalidates the current value.

Parameters
laf:LookAndFeel

the LookAndFeel this DesktopProperty was created with

invalidateback to summary
public void invalidate()

Invalidates the current value so that the next invocation of createValue will ask for the property again.

updateAllUIsback to summary
protected void updateAllUIs()

Updates the UIs of all the known Frames.

updateUIback to summary
protected void updateUI()

Requests that all components in the GUI hierarchy be updated to reflect dynamic changes in this look&feel. This update occurs by uninstalling and re-installing the UI objects. Requests are batched and collapsed into a single update pass because often many desktop properties will change at once.

updateWindowUIback to summary
private static void updateWindowUI(Window window)

Updates the UI of the passed in window and all its children.

sun.swing.plaf back to summary

private Class DesktopProperty.WeakPCL

extends WeakReference<DesktopProperty>
implements PropertyChangeListener
Class Inheritance
All Implemented Interfaces
java.beans.PropertyChangeListener, java.util.EventListener

As there is typically only one Toolkit, the PropertyChangeListener is handled via a WeakReference so as not to pin down the DesktopProperty.

Field Summary

Modifier and TypeField and Description
private String
private LookAndFeel

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public void
propertyChange(PropertyChangeEvent pce)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Field Detail

keyback to summary
private String key
lafback to summary
private LookAndFeel laf

Constructor Detail

WeakPCLback to summary
pack-priv WeakPCL(DesktopProperty target, String key, LookAndFeel laf)

Method Detail

disposeback to summary
pack-priv void dispose()
propertyChangeback to summary
public void propertyChange(PropertyChangeEvent pce)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.