Package org.jdesktop.swingx.plaf
Class DefaultsList
- java.lang.Object
-
- org.jdesktop.swingx.plaf.DefaultsList
-
public final class DefaultsList extends java.lang.Object
A specialty "list" for working with UI defaults. Requires adds to be done using key/value pairs. The purpose of this list is to enforce additions as pairs.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.Object>
delegate
-
Constructor Summary
Constructors Constructor Description DefaultsList()
Creates aDefaultsList
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.Object key, java.lang.Object value)
Adds a key/value pair to the defaults list.void
add(java.lang.Object key, java.lang.Object value, boolean enableChecking)
Adds a key/value pair to the defaults list.private static <T> T
asUIResource(T value, java.lang.String message)
java.lang.Object[]
toArray()
Gets a copy of this list as an array.
-
-
-
Method Detail
-
add
public void add(java.lang.Object key, java.lang.Object value)
Adds a key/value pair to the defaults list. This implementation defers toadd(Object, Object, boolean)
withenableChecking
set totrue
.- Parameters:
key
- the key that will be used to queryUIDefaults
value
- the value associated with the key- Throws:
java.lang.NullPointerException
- ifkey
isnull
java.lang.IllegalArgumentException
- ifvalue
is a type that should be aUIResource
but is not. For instance, passing in aBorder
that is not aUIResource
will cause an exception. This checking must be enabled.
-
add
public void add(java.lang.Object key, java.lang.Object value, boolean enableChecking)
Adds a key/value pair to the defaults list. A pair with anull
value is treated specially. Anull
-value pair is never added to the list and, furthermore, if a key/value pair exists in this list with the same key as the newly added one, it is removed.- Parameters:
key
- the key that will be used to queryUIDefaults
value
- the value associated with the keyenableChecking
- iftrue
then the value is checked to ensure that it is aUIResource
, if appropriate- Throws:
java.lang.NullPointerException
- ifkey
isnull
java.lang.IllegalArgumentException
- ifvalue
is a type that should be aUIResource
but is not. For instance, passing in aBorder
that is not aUIResource
will cause an exception. This checking must be enabled.
-
asUIResource
private static <T> T asUIResource(T value, java.lang.String message)
-
toArray
public java.lang.Object[] toArray()
Gets a copy of this list as an array.- Returns:
- an array containing all of the key/value pairs added to this list
-
-