Type: Fast Track
Target Milestone: Netbeans 6.5
/**
* Retreives the widgets resource table. If the widgets resource table is
* not set then the widgets parent resource table it retrieved.
*
* @return The resource table.
*/
public ResourceTable getResourceTable() {
ResourceTable retVal = resoruceTable;
if((retVal == null) && (getParentWidget() != null))
{
retVal = getParentWidget().getResourceTable();
}
return retVal;
}
The widget will have three additional methods that are used to set a widget's property via the resource table. The name of the methods are setBackgroundFromResource, setForegroundFromResource, and setFontFromResource. When a property is set from the resource table, the widget also adds a listener to the table to update when the property value changes. This approach keeps the graph library from having to retrieve the property value during the paint cycle. Therefore, the paint performance remains the same.
Three notify methods have been added to the widget. These methods are used to notify derived classes when a property has changed. The three new notify methods are notifyBackgroundChanged, notifyForegroundChanged, and notifyFontChanged.
The BorderFactory has been modified to allow users to create borders that use a ResourceTable to set the color properties.
<change>
<api name="general"/>
<summary>New Resource Table.</summary>
<version major="2" minor="14"/>
<date day="29" month="4" year="2008"/>
<author login="tspiva"/>
<compatibility addition="yes"/>
<description>
The resource table will allow for a central location for
properties like font, color and paint objects. The resource
table will help enforce an applications look and feel. When a
property is updated in the resource table, all interested
widgets will be notified of the change. The notification allows
widgets to update when a resource property changes.
</description>
<class package="org.netbeans.api.visual.widget" name="ResourceTable" link="yes"/>
<class package="org.netbeans.api.visual.widget" name="Widget" link="yes"/>
<class package="org.netbeans.api.visual.border" name="BorderFactory" link="yes"/>
<class package="org.netbeans.api.visual.border" name="Scene" link="yes"/>
<issue number="128348"/>
</change>