oracle.ide.inspector
Interface Extension
- All Known Subinterfaces:
- CmtExtension
- public interface Extension
The Extension interface is used when registering a concrete implementation of an interface for a given property type for use by the InspectorWindow. For example; an Extension might be written to represent a concrete class named MyBorder which implements javax.swing.border.Border such that the user may set the border property of a Swing control to a new instance of MyBorder directly from the InspectorWindow without first having to hand code the declaration such that it would appear in the PropertyEditor list of available Border instances.
Method Summary |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a PropertyChangeListener such that it will be notified of any change made to the value originally set upon this Extension. |
java.awt.Component |
getCustomEditor()
Get a custom editor instance for use by the Property Inspector Window when editing a property whose value is an instance of an implementation class represented by this Extension, or when the user has selected a tag provided by this Extension. |
java.lang.String |
getDisplayString()
Get a possibly abbreviated string representation of the value for display in the PropertyEditor when the value of a given property is an inline expression resulting in an instance of one of the implementation classes represented by this Extension. |
java.lang.Class[] |
getImplementationClasses()
Get the one or more concrete implementation classes being represented by this Extension. |
java.lang.String |
getInitializer()
Get the expression to be generated as the initializer of a new data member, a reference to which is to be generated as the argument of the property setting. |
java.lang.String |
getJavaInitializationString()
Get the java source code to be generated verbatim as the argument of the property setting. |
java.lang.String[] |
getTags()
Get an array of Strings to be presented to the user as selectable values from the Property Inspector Window. |
java.lang.Object |
getValue()
Get the value to be set upon the property. |
boolean |
isInline()
Determine whether or not a data member should be declared and initialized. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a PropertyChangeListener from this Extension. |
void |
setSelectedTag(java.lang.String tag)
Set the tag selected by the user via the InspectorWindow. |
void |
setValue(java.lang.Object value)
Receive the current value of the property. |
boolean |
supportsCustomEditor()
Determine whether or not a custom editor is available to the Property Inspector Window for custom editing when the property value is currently set to an inline instance of an implementation class represented by this Extension, or when the user has selected a tag provided by this Extension. |
isInline
public boolean isInline()
- Determine whether or not a data member should be declared and initialized. A value of true means that no data member is needed and the result of getJavaInitializationString in its entirety should be generated as the argument to the property setting. A value of false means that a new data member initialized to the result of getInitializer should be generated and that only the name of that new member should be generated as the argument to the property setting.
-
- Returns:
- true if no data member declaration is required.
- See Also:
getInitializer()
, getJavaInitializationString()
getInitializer
public java.lang.String getInitializer()
- Get the expression to be generated as the initializer of a new data member, a reference to which is to be generated as the argument of the property setting. This method should only be called upon when isInline returns false;
-
- Returns:
- a code snippet for use as data member initialization.
- See Also:
isInline()
getJavaInitializationString
public java.lang.String getJavaInitializationString()
- Get the java source code to be generated verbatim as the argument of the property setting. This method should only be called upon when isInline returns true.
-
- Returns:
- a code snippet for use as the property setting argument.
- See Also:
isInline()
getDisplayString
public java.lang.String getDisplayString()
- Get a possibly abbreviated string representation of the value for display in the PropertyEditor when the value of a given property is an inline expression resulting in an instance of one of the implementation classes represented by this Extension. By default should return elipses "...".
-
- Returns:
- a textual representation of an inline value.
- See Also:
isInline()
getTags
public java.lang.String[] getTags()
- Get an array of Strings to be presented to the user as selectable values from the Property Inspector Window. Generally, tags should be of the form "<cls_name>[...]" where cls_name is the name of the implementation class represented by this Extension and the elipses are provided only if a custom editor is supported for that implementation class (e.g. "TitledBorder..."). Alternatively, if the Extension represents multiple implementation classes but wishes to display only a single tag for all, then cls_name above should be replaced by a descriptive categorization (e.g. "Swing Border...").
-
- Returns:
- An array of String.
- See Also:
getImplementationClasses()
setSelectedTag
public void setSelectedTag(java.lang.String tag)
- Set the tag selected by the user via the InspectorWindow. Tag provided should be one of the tags returned from getTags.
-
- Parameters:
tag
- the selected tag.
- See Also:
getTags()
supportsCustomEditor
public boolean supportsCustomEditor()
- Determine whether or not a custom editor is available to the Property Inspector Window for custom editing when the property value is currently set to an inline instance of an implementation class represented by this Extension, or when the user has selected a tag provided by this Extension. This method should only ever be called when isInline returns true or the user has selected one of the Extension's tags, and then only after a call is first made to either setValue or setSelectedTag respectively, thereby allowing the Extension to vary the result based on the current value or selected tag. Non inline values (i.e. members) are expected to be loaded into the Property Inspector Window on their own for editing.
-
- Returns:
- true if a custom editor is supported.
- See Also:
getTags()
, isInline()
, setSelectedTag(java.lang.String)
, setValue(java.lang.Object)
getCustomEditor
public java.awt.Component getCustomEditor()
- Get a custom editor instance for use by the Property Inspector Window when editing a property whose value is an instance of an implementation class represented by this Extension, or when the user has selected a tag provided by this Extension. This method should only ever be called when isInline returns true or the user has selected one of the Extension's tags, and then only after a call is first made to either setValue or setSelectedTag respectively, thereby allowing the Extension to vary the result based on the current value or selected tag. Non inline values (i.e. members) are expected to be loaded into the Property Inspector Window on their own for editing.
-
- Returns:
- a custom editor.
- See Also:
getTags()
, setSelectedTag(java.lang.String)
, setValue(java.lang.Object)
getValue
public java.lang.Object getValue()
- Get the value to be set upon the property. Should return an instance of one of the classes returned from getImplementationClasses
-
- Returns:
- the value to set upon the property.
- See Also:
getImplementationClasses()
setValue
public void setValue(java.lang.Object value)
- Receive the current value of the property. Value provided should be an instance of one of the classes returned from getImplementationClasses.
-
- Parameters:
value
- the current value of the property.
- See Also:
getImplementationClasses()
getImplementationClasses
public java.lang.Class[] getImplementationClasses()
- Get the one or more concrete implementation classes being represented by this Extension. A single Extension may represent multiple implementation classes. For example; a single Extension might be designed to represent all the Swing javax.swing.border.Border concrete implementations.
-
- Returns:
- an array of represented Class instances.
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
- Add a PropertyChangeListener such that it will be notified of any change made to the value originally set upon this Extension. The PropertyChangeEvent fired should specify a null value for the property name and this Extension as the source.
-
- Parameters:
l
- the listener to add.
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
- Remove a PropertyChangeListener from this Extension.
-
- Parameters:
l
- this listener to remove.
Copyright © 1997, 2004, Oracle. All rights reserved.