站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.0

Node.Property (NetBeans Nodes API) - NetBeans API Javadoc 5.5.0

org.openide.nodes 6.7.22

org.openide.nodes
Class Node.Property

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by org.openide.nodes.Node.Property
Direct Known Subclasses:
Node.IndexedProperty, PropertySupport, PropertySupport.Reflection
Enclosing class:
Node

public abstract static class Node.Property
extends FeatureDescriptor

Description of a Bean property on a node, and operations on it.

You may associate context help with this object, if desired, by setting a custom property with the name helpID and value of type String giving a help ID. Normally this is unnecessary as help for the whole Node will be used by default.

Important: the code name you use for the property is relevant not only for making properties of a node unique, but also for firing property changes.


Constructor Summary
Node.Property(Class valueType)
          Constructor.
 
Method Summary
abstract  boolean canRead()
          Test whether the property is readable.
abstract  boolean canWrite()
          Test whether the property is writable.
 boolean equals(Object property)
           
 String getHtmlDisplayName()
          Return a variant of the display name containing HTML markup conforming to the limited subset of font-markup HTML supported by the lightweight HTML renderer org.openide.awt.HtmlRenderer (font color, bold, italic and strikethrough supported; font colors can be UIManager color keys if they are prefixed with a ! character, i.e.
 PropertyEditor getPropertyEditor()
          Get a property editor for this property.
abstract  Object getValue()
          Get the value.
 Class getValueType()
          Get the value type.
 int hashCode()
           
 boolean isDefaultValue()
          This method indicates whether the current value is the same as the value that would otherwise be restored by calling restoreDefaultValue() (if supportsDefaultValue() returns true).
 void restoreDefaultValue()
          Restore this property to its default value, if supported.
abstract  void setValue(Object val)
          Set the value.
 boolean supportsDefaultValue()
          Test whether the property had a default value.
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node.Property

public Node.Property(Class valueType)
Constructor.

Parameters:
valueType - type of the property
Method Detail

getValueType

public Class getValueType()
Get the value type. This is the representation class of the property. Remember that e.g. Boolean.class means that values are Boolean objects; to specify the primitive type, use e.g. Boolean.TYPE. In the latter case, getValue() and setValue(java.lang.Object) will still operate on the wrapper object.

Returns:
the type

canRead

public abstract boolean canRead()
Test whether the property is readable.

Returns:
true if it is

getValue

public abstract Object getValue()
                         throws IllegalAccessException,
                                InvocationTargetException
Get the value.

Returns:
the value of the property
Throws:
IllegalAccessException - cannot access the called method
InvocationTargetException - an exception during invocation

canWrite

public abstract boolean canWrite()
Test whether the property is writable.

Returns:
true if the read of the value is supported

setValue

public abstract void setValue(Object val)
                       throws IllegalAccessException,
                              IllegalArgumentException,
                              InvocationTargetException
Set the value.

Parameters:
val - the new value of the property
Throws:
IllegalAccessException - cannot access the called method
IllegalArgumentException - wrong argument
InvocationTargetException - an exception during invocation

supportsDefaultValue

public boolean supportsDefaultValue()
Test whether the property had a default value.

Returns:
true if it does (false by default)

restoreDefaultValue

public void restoreDefaultValue()
                         throws IllegalAccessException,
                                InvocationTargetException
Restore this property to its default value, if supported. In the default implementation, does nothing. Typically you would just call e.g. setValue(default). Note that it is not permitted for this call to throw IllegalArgumentException, though the other two exceptions from setValue(java.lang.Object) may be passed through.

Throws:
IllegalAccessException - cannot access the called method
InvocationTargetException - an exception during invocation

isDefaultValue

public boolean isDefaultValue()
This method indicates whether the current value is the same as the value that would otherwise be restored by calling restoreDefaultValue() (if supportsDefaultValue() returns true). The default implementation returns true and it is recommended to also return true when supportsDefaultValue() returns false (if we do not support default value any value can be considered as the default). If supportsDefaultValue() returns false this method will not be called by the default implementation of property sheet.

Since:
3.19

getPropertyEditor

public PropertyEditor getPropertyEditor()
Get a property editor for this property. The default implementation tries to use PropertyEditorManager.

Returns:
the property editor, or null if there is no editor

equals

public boolean equals(Object property)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getHtmlDisplayName

public String getHtmlDisplayName()
Return a variant of the display name containing HTML markup conforming to the limited subset of font-markup HTML supported by the lightweight HTML renderer org.openide.awt.HtmlRenderer (font color, bold, italic and strikethrough supported; font colors can be UIManager color keys if they are prefixed with a ! character, i.e. <font color=&'controlShadow'>). Enclosing html tags are not needed.

This method should return either an HTML display name or null; it should not return the non-html display name.

Returns:
a String containing conformant, legal HTML markup which represents the display name, or null. The default implementation returns null.
Since:
4.30
See Also:
HtmlRenderer

org.openide.nodes 6.7.22

Built on May 28 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.