org.kde.qt
Class qtjava

java.lang.Object
  extended by org.kde.qt.qtjava

public class qtjava
extends java.lang.Object

The 'Run the Qt Java library' class'. Various utility methods to manage the mapping between C++ and java instances. Used in conjunction the C++ methods in QtSupport.cpp and JavaSlot.cpp.


Field Summary
static WeakValueMap qtKeyToJavaMap
          Uses a C++ key to retrieve the corresponding Java instance
static java.util.HashMap qtSignalDictionary
          Allows a JavaSignal proxy instance to be retrieved for a given Java instance/Signal name combination
static java.util.HashMap qtSlotDictionary
          Allows a JavaSlot proxy instance to be retrieved for a given Java instance/Slot name combination
 
Constructor Summary
qtjava()
           
 
Method Summary
static void initialize()
           
static java.lang.Object objectForQtKey(long qt, java.lang.String className, boolean allocatedInJavaWorld)
          Retrieves a corresponding Java instance for a given C++ instance.
static void qtKeyDeleted(long qt)
          When a C++ instance has been deleted.
static void removeObjectForQtKey(long qt)
          Remove a 'C++ qt instance key/Java instance value' pair from the map.
static void setObjectForQtKey(java.lang.Object obj, long qt)
          Add a 'C++ qt instance key/Java instance value' pair to the map
static long signalForSender(long qt, java.lang.String signal)
          Looks up a 'qt instance/signal name' key and returns the corresponding JavaSignal instance
static long slotForReceiver(long qt, QObject receiver, java.lang.String slot)
          Looks up a 'qt instance/slot name' key and returns the corresponding JavaSlot instance
static java.lang.String toFullyQualifiedClassName(java.lang.String className)
          Converts any unqualified class names in a signal or slot string to the fully qualified versions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qtKeyToJavaMap

public static WeakValueMap qtKeyToJavaMap
Uses a C++ key to retrieve the corresponding Java instance


qtSignalDictionary

public static java.util.HashMap qtSignalDictionary
Allows a JavaSignal proxy instance to be retrieved for a given Java instance/Signal name combination


qtSlotDictionary

public static java.util.HashMap qtSlotDictionary
Allows a JavaSlot proxy instance to be retrieved for a given Java instance/Slot name combination

Constructor Detail

qtjava

public qtjava()
Method Detail

setObjectForQtKey

public static void setObjectForQtKey(java.lang.Object obj,
                                     long qt)
Add a 'C++ qt instance key/Java instance value' pair to the map


removeObjectForQtKey

public static void removeObjectForQtKey(long qt)
Remove a 'C++ qt instance key/Java instance value' pair from the map. Normally an entry would be removed when its map value is the last reference left to the java instance, and it becomes a weak reference to be reaped. But C++ can reuse a heap address for a C++ ref without giving the java runtime a chance to do any garbage collection and tidy up the corresponding entry in the qtKeyToJavaMap (tricky!). So it is useful to be able to force the early removal of an entry, when the C++ instance has a known lifetime (eg a QEvent after its event handler has returned).


objectForQtKey

public static java.lang.Object objectForQtKey(long qt,
                                              java.lang.String className,
                                              boolean allocatedInJavaWorld)
Retrieves a corresponding Java instance for a given C++ instance. Allocates the Java instance if it doesn't already exist.


qtKeyDeleted

public static void qtKeyDeleted(long qt)
When a C++ instance has been deleted. Retrieves a corresponding Java instance for a given C++ instance. Sets the '_allocatedInJavaWorld' flag to false.


toFullyQualifiedClassName

public static java.lang.String toFullyQualifiedClassName(java.lang.String className)
Converts any unqualified class names in a signal or slot string to the fully qualified versions


signalForSender

public static long signalForSender(long qt,
                                   java.lang.String signal)
Looks up a 'qt instance/signal name' key and returns the corresponding JavaSignal instance


slotForReceiver

public static long slotForReceiver(long qt,
                                   QObject receiver,
                                   java.lang.String slot)
Looks up a 'qt instance/slot name' key and returns the corresponding JavaSlot instance


initialize

public static void initialize()