Package org.nuiton.jaxx.runtime
Class JAXXUtil
- java.lang.Object
-
- org.nuiton.jaxx.runtime.JAXXUtil
-
-
Constructor Summary
Constructors Constructor Description JAXXUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyDataBinding(JAXXObject src, String... bindings)Convinient method to apply more than one binding on a JAXX ui.static voidapplyDataBinding(JAXXObject src, Collection<String> bindings)Convinient method to apply more than one binding on a JAXX ui.protected static <O> Class<List<O>>castList()protected static <K,V>
Class<Map<K,V>>castMap()static voidcheckJAXXContextEntries(JAXXContext context, JAXXContextEntryDef<?>... defs)Test if some entries exists in a given context and throw an IllegalArgumentException if not.static <T> TcheckJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def)Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.static voidcopyToClipBoard(String text)Copy to clipBoard the content of the given text.static JAXXObjectDescriptordecodeCompressedJAXXObjectDescriptor(String descriptor)static JAXXObjectDescriptordecodeJAXXObjectDescriptor(String descriptor)Decodes the serialized representation of a JAXXObjectDescriptor.static voiddestroy(Component component)Remove all listeners registred in givencomponent.static voiddestroy(PropertyChangeSupport pcs)Remove all listeners registred in givenpcs.static PropertyChangeListener[]findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners)detects all PropertychangedListener added by Jaxx uis (should be aDataBindingListenerstatic DataBindingUpdateListenergetDataBindingUpdateListener(JAXXObject object, String bindingName)static <E extends EventListener>
EgetEventListener(Class<E> listenerClass, Object methodContainer, String methodName)static <E extends EventListener>
EgetEventListener(Class<E> listenerClass, String listenerMethodName, Object methodContainer, String methodName)static StringgetStringValue(Object value)Compute the string representation of an object.static voidinitContext(JAXXObject ui, JAXXContext parentContext)Method to initialize the context of a ui.static <O> OinvokeConstructor(Class<O> type, Class<?>[] prototype, Object... parms)Overrides the commons method to have generict cast fiex.static <O> JAXXContextEntryDef<O>newContextEntryDef(Class<O> klass)static <O> JAXXContextEntryDef<O>newContextEntryDef(String name, Class<?> klass)static <O> JAXXContextEntryDef<List<O>>newListContextEntryDef()static <O> JAXXContextEntryDef<List<O>>newListContextEntryDef(String name)static <K,V>
JAXXContextEntryDef<Map<K,V>>newMapContextEntryDef(String name)static voidprocessDataBinding(JAXXObject src, String... bindings)Convinient method to process more than one binding on a JAXX ui.static voidreloadBinding(JAXXBinding binding)To reload a binding, the method will invokeJAXXBinding.removeDataBinding()JAXXBinding.applyDataBinding()static voidreloadBinding(JAXXObject src, String bindingId)Convinient method to reload a given binding by his id on a JAXX ui.static voidremoveAllDataBindings(JAXXObject src)Convinient method to remove all than one binding on a JAXX ui.static voidremoveDataBinding(JAXXObject src, String... bindings)Convinient method to remove more than one binding on a JAXX ui.
-
-
-
Field Detail
-
PARENT
public static final String PARENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
decodeJAXXObjectDescriptor
public static JAXXObjectDescriptor decodeJAXXObjectDescriptor(String descriptor)
Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField for the rationale behind this (admittedly ugly) approach.- Parameters:
descriptor- descriptor to decode- Returns:
- the dedoced descriptor
-
decodeCompressedJAXXObjectDescriptor
public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor)
-
newContextEntryDef
public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass)
-
newContextEntryDef
public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<?> klass)
-
newListContextEntryDef
public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef()
-
newListContextEntryDef
public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name)
-
newMapContextEntryDef
public static <K,V> JAXXContextEntryDef<Map<K,V>> newMapContextEntryDef(String name)
-
initContext
public static void initContext(JAXXObject ui, JAXXContext parentContext)
Method to initialize the context of a ui.- Parameters:
ui- the uiparentContext- the context to set in ui
-
getEventListener
public static <E extends EventListener> E getEventListener(Class<E> listenerClass, String listenerMethodName, Object methodContainer, String methodName)
-
getEventListener
public static <E extends EventListener> E getEventListener(Class<E> listenerClass, Object methodContainer, String methodName)
-
getDataBindingUpdateListener
public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName)
-
destroy
public static void destroy(PropertyChangeSupport pcs)
Remove all listeners registred in givenpcs.- Parameters:
pcs- the pcs to clean
-
destroy
public static void destroy(Component component)
Remove all listeners registred in givencomponent.- Parameters:
component- the pcs to clean
-
getStringValue
public static String getStringValue(Object value)
Compute the string representation of an object.Return empty string if given object is null
- Parameters:
value- the value to write- Returns:
- the string representation of the given object or an empty string if object is null.
-
checkJAXXContextEntries
public static void checkJAXXContextEntries(JAXXContext context, JAXXContextEntryDef<?>... defs) throws IllegalArgumentException
Test if some entries exists in a given context and throw an IllegalArgumentException if not.- Parameters:
context- the context to testdefs- the definitions of entries to seek in context- Throws:
IllegalArgumentException- if the entry is not found in context.
-
checkJAXXContextEntry
public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws IllegalArgumentException
Test if a type of entry exists in a given context and throw an IllegalArgumentException if not found.If entry is found, return his value in context.
- Type Parameters:
T- the type of required data- Parameters:
context- the context to testdef- the definition of the entry to seek in context- Returns:
- the value from the context
- Throws:
IllegalArgumentException- if the entry is not found in context.
-
reloadBinding
public static void reloadBinding(JAXXBinding binding)
To reload a binding, the method will invoke- Parameters:
binding- the binding to reload.- Since:
- 2.4.2
-
reloadBinding
public static void reloadBinding(JAXXObject src, String bindingId)
Convinient method to reload a given binding by his id on a JAXX ui.- Parameters:
src- the ui to treatebindingId- the id of binding to reload.- Since:
- 2.4.2
-
applyDataBinding
public static void applyDataBinding(JAXXObject src, String... bindings)
Convinient method to apply more than one binding on a JAXX ui.- Parameters:
src- the ui to treatebindings- the list of binding to process.
-
applyDataBinding
public static void applyDataBinding(JAXXObject src, Collection<String> bindings)
Convinient method to apply more than one binding on a JAXX ui.- Parameters:
src- the ui to treatebindings- the list of binding to process.
-
processDataBinding
public static void processDataBinding(JAXXObject src, String... bindings)
Convinient method to process more than one binding on a JAXX ui.- Parameters:
src- the ui to treatebindings- the list of binding to process.
-
removeDataBinding
public static void removeDataBinding(JAXXObject src, String... bindings)
Convinient method to remove more than one binding on a JAXX ui.- Parameters:
src- the ui to treatebindings- the list of binding to process.
-
removeAllDataBindings
public static void removeAllDataBindings(JAXXObject src)
Convinient method to remove all than one binding on a JAXX ui.- Parameters:
src- the ui to treate- Since:
- 2.10
-
findJaxxPropertyChangeListener
public static PropertyChangeListener[] findJaxxPropertyChangeListener(String[] propertyNames, PropertyChangeListener... listeners)
detects all PropertychangedListener added by Jaxx uis (should be aDataBindingListener- Parameters:
propertyNames- the array of property names to findlisteners- the array of listeners to filter- Returns:
- the filtered listeners
-
invokeConstructor
public static <O> O invokeConstructor(Class<O> type, Class<?>[] prototype, Object... parms) throws Exception
Overrides the commons method to have generict cast fiex.- Type Parameters:
O- type of object to create- Parameters:
type- the type of objet to instanciateprototype- prototype of the constructorparms- params to pass to constructor- Returns:
- the new object
- Throws:
Exception- if something wrong- Since:
- 2.1
-
copyToClipBoard
public static void copyToClipBoard(String text)
Copy to clipBoard the content of the given text.- Parameters:
text- text to copy to clipboard- Since:
- 2.17
-
-