|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.action.ContextUtils
public class ContextUtils
A collection of static utility methods used to deal with Context
s.
Method Summary | ||
---|---|---|
static void |
add(JComponent owner,
Object element)
Add the given element to the appropriate context for the given UI component. |
|
static
|
bindBeanProperty(B bean,
String propertyName)
|
|
static
|
bindBeanProperty(Context ctx,
B bean,
String propertyName)
|
|
static void |
clear(JComponent owner)
Clear the context for the given UI component. |
|
static int |
count(JComponent owner,
Class<?> match)
Count the elements matching the given class in the context for the given UI component. |
|
static
|
findAll(Collection<? extends Object> args,
Class<T> clazz)
Find all elements matching the given class in the given collection. |
|
static
|
findAll(JComponent owner,
Class<T> match)
Find all elements matching the given class in the context for the given UI component. |
|
static
|
findFirst(Collection<? extends Object> args,
Class<T> clazz)
Find the first element matching the given class in the given collection. |
|
static
|
findFirst(JComponent owner,
Class<T> match)
Find the first element matching the given class in the context for the given UI component. |
|
static void |
remove(JComponent owner,
Object element)
Remove the given element from the appropriate context for the given UI component. |
|
static boolean |
removeByClass(Context ctx,
Class<? extends Object> matchClass)
Remove all non-context elements matching the given class. |
|
static
|
removeByClass(JComponent owner,
Class<T> match)
Remove all elements matching the given class from the context for the given UI component. |
|
static void |
replace(Context ctx,
Collection<? extends Object> c)
Replaces all non-Context entries in the current context objects collection with the elements of the given collection. |
|
static
|
replace(Context ctx,
Collection<? extends T> c,
Class<T> matchClass)
Replaces all non-Context entries in the current context objects collection that match the given class with the elements found in the given collection. |
|
static
|
replace(Context ctx,
T o,
Class<? super T> matchClass)
Replaces all non-Context entries in the current context objects collection that match the given class with the given item. |
|
static
|
replace(JComponent owner,
Collection<? extends T> elements,
Class<T> match)
Replace all current elements matching the given class of the context for the given UI component with the given collection of elements. |
|
static void |
replace(JComponent owner,
Collection<Object> elements)
Replace the contents of context for the given UI component with the given collection of elements. |
|
static
|
replace(JComponent owner,
T element,
Class<? super T> match)
Replace all current elements matching the given class of the context for the given UI component with the given object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void add(JComponent owner, Object element)
owner
- element
-
IllegalArgumentException
- if no Context can be found for the given owner.public static void remove(JComponent owner, Object element)
owner
- element
-
IllegalArgumentException
- if no Context can be found for the given owner.public static void clear(JComponent owner)
owner
-
IllegalArgumentException
- if no Context can be found for the given owner.public static void replace(JComponent owner, Collection<Object> elements)
owner
- elements
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> void replace(JComponent owner, Collection<? extends T> elements, Class<T> match)
owner
- elements
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> void replace(JComponent owner, T element, Class<? super T> match)
owner
- element
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> void removeByClass(JComponent owner, Class<T> match)
owner
- match
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> T findFirst(JComponent owner, Class<T> match)
owner
- match
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> Collection<T> findAll(JComponent owner, Class<T> match)
owner
- match
-
IllegalArgumentException
- if no Context can be found for the given owner.public static int count(JComponent owner, Class<?> match)
owner
- match
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> T findFirst(Collection<? extends Object> args, Class<T> clazz)
args
- clazz
-
IllegalArgumentException
- if no Context can be found for the given owner.public static <T> Collection<T> findAll(Collection<? extends Object> args, Class<T> clazz)
args
- clazz
-
IllegalArgumentException
- if no Context can be found for the given owner.public static boolean removeByClass(Context ctx, Class<? extends Object> matchClass)
matchClass
- Only elements of this class will be replaced
public static void replace(Context ctx, Collection<? extends Object> c)
c
- The new collection of context objects.public static <T> void replace(Context ctx, Collection<? extends T> c, Class<T> matchClass)
c
- The new collection (ideally containing only objects of the given class, since only
these objects will be replaced. Elements belonging to other classes will be ignored.)matchClass
- Only elements of this class will be replacedpublic static <T> void replace(Context ctx, T o, Class<? super T> matchClass)
o
- The new item (ideally being derived from the given class, since only these objects
will be replaced. Elements belonging to other classes will be ignored.)matchClass
- Only elements of this class will be replacedpublic static <B extends JComponent,V> Disposable bindBeanProperty(B bean, String propertyName)
public static <B,V> Disposable bindBeanProperty(Context ctx, B bean, String propertyName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |