|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QtPropertyManager
public class QtPropertyManager
The QtPropertyManager class implements the Qt Jambi Property system. To the outer world, a property appears to be similar to a data member; however, a property has features that distinguishes it from a normal data member:
When Qt Jambi resolves the properties of a class, it identifies them by their read, write, and reset property methods. The methods of a property are identified by annotations or by compliance with a method naming scheme. A property is set as designable with an annotation. We take a look at the annotations before we examine the scheme. For detailed usage of the annotations, see their javadoc.
Annotation | Propety Method |
---|---|
QtPropertyReader | The property read method. | .
QtPropertyWriter | The property write method. |
QtPropertyResetter | The property reset method. |
QtPropertyDesignable | Decides whether the property is suitable for editing in a GUI builder. |
QtPropertyOrder | Gives a value that can be used for sorting properties. |
The following table describe the property method naming scheme. The names are given for a property with name x and type T. Note that resetter methods can only be specified with the QtPropertyResetter annotation.
Method Name | Property Method |
---|---|
T getX() or T x() - for boolean values also T isX() or T hasX() | Property reader |
setX(T) | Property writer |
The propery system is provided for convenience and provides the same functionality as the native Qt system, which has advantages over using ordinary data members and Java Reflection to access them by name. The code required to set, get, and reset properties are already implemented. You can set and get a property's value without knowing the method names, and the naming of property methods needs not follow a specific naming scheme. You can also query a property for whether it is designable, readable, or writeable.
Nested Class Summary | |
---|---|
static class |
QtPropertyManager.Entry
The Entry class is used to keep information about a property. |
Constructor Summary | |
---|---|
QtPropertyManager()
This is a JambiDoclet generated javadoc comment for com.trolltech.qt.QtPropertyManager. |
Method Summary | |
---|---|
static java.util.HashMap<java.lang.String,QtPropertyManager.Entry> |
findProperties(java.lang.Class cl)
Returns the properties of class cl. |
static java.util.HashMap<java.lang.String,QtPropertyManager.Entry> |
findPropertiesRecursive(java.lang.Class cl)
Returns a HashMap of properties declared by cl and its ancestors. |
static java.lang.Object |
readProperty(java.lang.Object object,
java.lang.String name)
Returns the value of the proprty name of object. |
static void |
resetProperty(java.lang.Object object,
java.lang.String name)
Resets the property name in object. |
static void |
writeProperty(java.lang.Object object,
java.lang.String name,
java.lang.Object value)
Sets the value of the property name in object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public QtPropertyManager()
Method Detail |
---|
public static java.util.HashMap<java.lang.String,QtPropertyManager.Entry> findPropertiesRecursive(java.lang.Class cl)
public static java.util.HashMap<java.lang.String,QtPropertyManager.Entry> findProperties(java.lang.Class cl)
public static java.lang.Object readProperty(java.lang.Object object, java.lang.String name)
public static void writeProperty(java.lang.Object object, java.lang.String name, java.lang.Object value)
public static void resetProperty(java.lang.Object object, java.lang.String name)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |