<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.5.0_09) on Tue Aug 07 16:57:29 CEST 2007 --> <TITLE> QtPropertyManager </TITLE> <META NAME="keywords" CONTENT="com.trolltech.qt.QtPropertyManager class"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="QtPropertyManager"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/trolltech/qt/QtPropertyDesignable.html" title="annotation in com.trolltech.qt"><B>PREV CLASS</B></A> <A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/trolltech/qt/QtPropertyManager.html" target="_top"><B>FRAMES</B></A> <A HREF="QtPropertyManager.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.trolltech.qt</FONT> <BR> Class QtPropertyManager</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.trolltech.qt.QtPropertyManager</B> </PRE> <HR> <DL> <DT><PRE>public class <B>QtPropertyManager</B><DT>extends java.lang.Object</DL> </PRE> <P> 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: <p> <ul> <li>It has a read method. This must always exist.</li> <li>A write method; this is optional.</li> <li>A reset method that sets the property back to a default state. This is also optional</li> <li>It usually stores its value.</li> <li>It has a "designable" attribute that indicates whether it makes sense to edit the property in a GUI builder (e.g, the Qt Designer).</li> </ul> <p> 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. <p> <center> <table border="1"> <tr> <th>Annotation</th> <th>Propety Method</th> </tr> <tr> <td>QtPropertyReader</td> <td>The property read method.</td>. </tr> <tr> <td>QtPropertyWriter</td> <td>The property write method.</td> </tr> <tr> <td>QtPropertyResetter</td> <td>The property reset method.</td> </tr> <tr> <td>QtPropertyDesignable</td> <td>Decides whether the property is suitable for editing in a GUI builder.</td> </tr> <tr> <td>QtPropertyOrder</td> <td>Gives a value that can be used for sorting properties.</td> </tr> </table> </center> <p> The following table describe the property method naming scheme. The names are given for a property with name <b>x</b> and type <b>T</b>. Note that resetter methods can only be specified with the QtPropertyResetter annotation. <p> <center> <table border="1"> <tr> <th>Method Name</th> <th>Property Method</th> </tr> <tr> <td>T getX() or T x() - for boolean values also T isX() or T hasX()</td> <td>Property reader</td> </tr> <tr> <td>setX(T)</td> <td>Property writer</td> </tr> </table> </center> <p> 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. <P> <P> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <A NAME="nested_class_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Nested Class Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt">QtPropertyManager.Entry</A></B></CODE> <BR> The Entry class is used to keep information about a property.</TD> </TR> </TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#QtPropertyManager()">QtPropertyManager</A></B>()</CODE> <BR> </TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.util.HashMap<java.lang.String,<A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt">QtPropertyManager.Entry</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#findProperties(java.lang.Class)">findProperties</A></B>(java.lang.Class cl)</CODE> <BR> Returns the properties of class <tt>cl</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.util.HashMap<java.lang.String,<A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt">QtPropertyManager.Entry</A>></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#findPropertiesRecursive(java.lang.Class)">findPropertiesRecursive</A></B>(java.lang.Class cl)</CODE> <BR> Returns a HashMap of properties declared by <tt>cl</tt> and its ancestors.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.Object</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#readProperty(java.lang.Object, java.lang.String)">readProperty</A></B>(java.lang.Object object, java.lang.String name)</CODE> <BR> Returns the value of the proprty <tt>name</tt> of <tt>object</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#resetProperty(java.lang.Object, java.lang.String)">resetProperty</A></B>(java.lang.Object object, java.lang.String name)</CODE> <BR> Resets the property <tt>name</tt> in <tt>object</tt>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/trolltech/qt/QtPropertyManager.html#writeProperty(java.lang.Object, java.lang.String, java.lang.Object)">writeProperty</A></B>(java.lang.Object object, java.lang.String name, java.lang.Object value)</CODE> <BR> Sets the <tt>value</tt> of the property <tt>name</tt> in <tt>object</tt>.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="QtPropertyManager()"><!-- --></A><H3> QtPropertyManager</H3> <PRE> public <B>QtPropertyManager</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="findPropertiesRecursive(java.lang.Class)"><!-- --></A><H3> findPropertiesRecursive</H3> <PRE> public static java.util.HashMap<java.lang.String,<A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt">QtPropertyManager.Entry</A>> <B>findPropertiesRecursive</B>(java.lang.Class cl)</PRE> <DL> <DD>Returns a HashMap of properties declared by <tt>cl</tt> and its ancestors. The map keys are the property names. If two properties have the same name, it is the most direct ancestor (including <tt>cl</tt> itself) that is stored. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="findProperties(java.lang.Class)"><!-- --></A><H3> findProperties</H3> <PRE> public static java.util.HashMap<java.lang.String,<A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt">QtPropertyManager.Entry</A>> <B>findProperties</B>(java.lang.Class cl)</PRE> <DL> <DD>Returns the properties of class <tt>cl</tt>. The properties are returned in a HashMap using the property names as keys. The Entry class keeps all information available for a property. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="readProperty(java.lang.Object, java.lang.String)"><!-- --></A><H3> readProperty</H3> <PRE> public static java.lang.Object <B>readProperty</B>(java.lang.Object object, java.lang.String name)</PRE> <DL> <DD>Returns the value of the proprty <tt>name</tt> of <tt>object</tt>. It returns null if the property could not be read. If <tt>name</tt> is not a property of <tt>object</tt>, a QPropertyException is thrown. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="writeProperty(java.lang.Object, java.lang.String, java.lang.Object)"><!-- --></A><H3> writeProperty</H3> <PRE> public static void <B>writeProperty</B>(java.lang.Object object, java.lang.String name, java.lang.Object value)</PRE> <DL> <DD>Sets the <tt>value</tt> of the property <tt>name</tt> in <tt>object</tt>. It throws QPropertyException if the property is not defined for <tt>object</tt> or the property is not writeable. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="resetProperty(java.lang.Object, java.lang.String)"><!-- --></A><H3> resetProperty</H3> <PRE> public static void <B>resetProperty</B>(java.lang.Object object, java.lang.String name)</PRE> <DL> <DD>Resets the property <tt>name</tt> in <tt>object</tt>. It throws QPropertyException if the property <tt>name</tt> is undefined or the propety cannot be reset. <P> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/trolltech/qt/QtPropertyDesignable.html" title="annotation in com.trolltech.qt"><B>PREV CLASS</B></A> <A HREF="../../../com/trolltech/qt/QtPropertyManager.Entry.html" title="class in com.trolltech.qt"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/trolltech/qt/QtPropertyManager.html" target="_top"><B>FRAMES</B></A> <A HREF="QtPropertyManager.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>