Package jaxx.runtime
Class JAXXUtil
java.lang.Object
jaxx.runtime.JAXXUtil
- Direct Known Subclasses:
SwingUtil
public class JAXXUtil
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPARENT -
Constructor Summary
Constructors Constructor Description JAXXUtil() -
Method Summary
Modifier and Type Method Description static voidapplyDataBinding(JAXXObject src, java.lang.String... bindings)Convinient method to apply more than one binding on a JAXX ui.static voidapplyDataBinding(JAXXObject src, java.util.Collection<java.lang.String> bindings)Convinient method to apply more than one binding on a JAXX ui.static booleanassignment(boolean value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic byteassignment(byte value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic charassignment(char value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic doubleassignment(double value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic floatassignment(float value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic intassignment(int value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic longassignment(long value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic shortassignment(short value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedstatic java.lang.Objectassignment(java.lang.Object value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replacedprotected static <O> java.lang.Class<java.util.List<O>>castList()protected static <K, V> java.lang.Class<java.util.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(java.lang.String text)Copy to clipBoard the content of the given text.static JAXXObjectDescriptordecodeCompressedJAXXObjectDescriptor(java.lang.String descriptor)static JAXXObjectDescriptordecodeJAXXObjectDescriptor(java.lang.String descriptor)Decodes the serialized representation of a JAXXObjectDescriptor.static voiddestroy(java.awt.Component component)Remove all listeners registred in givencomponent.static voiddestroy(java.beans.PropertyChangeSupport pcs)Remove all listeners registred in givenpcs.static java.beans.PropertyChangeListener[]findJaxxPropertyChangeListener(java.lang.String[] propertyNames, java.beans.PropertyChangeListener... listeners)detects all PropertychangedListener added by Jaxx uis (should be aDataBindingListenerstatic DataBindingUpdateListenergetDataBindingUpdateListener(JAXXObject object, java.lang.String bindingName)static <E extends java.util.EventListener>
EgetEventListener(java.lang.Class<E> listenerClass, java.lang.Object methodContainer, java.lang.String methodName)static <E extends java.util.EventListener>
EgetEventListener(java.lang.Class<E> listenerClass, java.lang.String listenerMethodName, java.lang.Object methodContainer, java.lang.String methodName)static java.lang.StringgetStringValue(java.lang.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(java.lang.Class<O> type, java.lang.Class<?>[] prototype, java.lang.Object... parms)Overrides the commons method to have generict cast fiex.static <O> JAXXContextEntryDef<O>newContextEntryDef(java.lang.Class<O> klass)static <O> JAXXContextEntryDef<O>newContextEntryDef(java.lang.String name, java.lang.Class<?> klass)static <O> JAXXContextEntryDef<java.util.List<O>>newListContextEntryDef()static <O> JAXXContextEntryDef<java.util.List<O>>newListContextEntryDef(java.lang.String name)static <K, V> JAXXContextEntryDef<java.util.Map<K,V>>newMapContextEntryDef(java.lang.String name)static voidprocessDataBinding(JAXXObject src, java.lang.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, java.lang.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, java.lang.String... bindings)Convinient method to remove more than one binding on a JAXX ui.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
PARENT
public static final java.lang.String PARENT- See Also:
- Constant Field Values
-
-
Constructor Details
-
JAXXUtil
public JAXXUtil()
-
-
Method Details
-
decodeJAXXObjectDescriptor
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(java.lang.String descriptor) -
newContextEntryDef
-
newContextEntryDef
public static <O> JAXXContextEntryDef<O> newContextEntryDef(java.lang.String name, java.lang.Class<?> klass) -
newListContextEntryDef
-
newListContextEntryDef
public static <O> JAXXContextEntryDef<java.util.List<O>> newListContextEntryDef(java.lang.String name) -
newMapContextEntryDef
public static <K, V> JAXXContextEntryDef<java.util.Map<K,V>> newMapContextEntryDef(java.lang.String name) -
castMap
protected static <K, V> java.lang.Class<java.util.Map<K,V>> castMap() -
castList
protected static <O> java.lang.Class<java.util.List<O>> castList() -
initContext
Method to initialize the context of a ui.- Parameters:
ui- the uiparentContext- the context to set in ui
-
getEventListener
public static <E extends java.util.EventListener> E getEventListener(java.lang.Class<E> listenerClass, java.lang.String listenerMethodName, java.lang.Object methodContainer, java.lang.String methodName) -
getEventListener
public static <E extends java.util.EventListener> E getEventListener(java.lang.Class<E> listenerClass, java.lang.Object methodContainer, java.lang.String methodName) -
getDataBindingUpdateListener
public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, java.lang.String bindingName) -
destroy
public static void destroy(java.beans.PropertyChangeSupport pcs)Remove all listeners registred in givenpcs.- Parameters:
pcs- the pcs to clean
-
destroy
public static void destroy(java.awt.Component component)Remove all listeners registred in givencomponent.- Parameters:
component- the pcs to clean
-
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
Deprecated.since 2.4.2, never use, will not be replaced -
assignment
@Deprecated public static java.lang.Object assignment(java.lang.Object value, java.lang.String name, JAXXObject src)Deprecated.since 2.4.2, never use, will not be replaced -
getStringValue
public static java.lang.String getStringValue(java.lang.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 java.lang.IllegalArgumentExceptionTest 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:
java.lang.IllegalArgumentException- if the entry is not found in context.
-
checkJAXXContextEntry
public static <T> T checkJAXXContextEntry(JAXXContext context, JAXXContextEntryDef<T> def) throws java.lang.IllegalArgumentExceptionTest 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:
java.lang.IllegalArgumentException- if the entry is not found in context.
-
reloadBinding
To reload a binding, the method will invoke- Parameters:
binding- the binding to reload.- Since:
- 2.4.2
-
reloadBinding
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
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, java.util.Collection<java.lang.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
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
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
Convinient method to remove all than one binding on a JAXX ui.- Parameters:
src- the ui to treate- Since:
- 2.10
-
findJaxxPropertyChangeListener
public static java.beans.PropertyChangeListener[] findJaxxPropertyChangeListener(java.lang.String[] propertyNames, java.beans.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(java.lang.Class<O> type, java.lang.Class<?>[] prototype, java.lang.Object... parms) throws java.lang.ExceptionOverrides 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:
java.lang.Exception- if something wrong- Since:
- 2.1
-
copyToClipBoard
public static void copyToClipBoard(java.lang.String text)Copy to clipBoard the content of the given text.- Parameters:
text- text to copy to clipboard- Since:
- 2.17
-