|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.util.SharedClassObject org.openide.options.SystemOption
Base class for all system options. Provides methods for adding and working with property change and guarantees that all instances of the same class will share these listeners.
When a new option is created, it should subclass
SystemOption
, add static variables to it that will hold
the values of properties, and write non-static setters/getters that will
notify all listeners about property changes via
firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)
.
JavaBeans introspection is used to find the properties,
so it is possible to use BeanInfo
.
Constructor Summary | |
SystemOption()
Default constructor. |
Method Summary | |
protected boolean |
clearSharedData()
Indicate whether the shared data of the last existing instance of this class should be cleared when that instance is finalized. |
abstract String |
displayName()
Get the display name of this system option. |
protected void |
firePropertyChange(String name,
Object oldValue,
Object newValue)
Fire a property change event to all listeners. |
HelpCtx |
getHelpCtx()
Get context help for this system option. |
String |
getName()
Get the name of this system option. |
protected boolean |
isReadExternal()
Allows subclasses to test whether the change of a property is invoked from readExternal method or by external change invoked by any other program. |
protected boolean |
isWriteExternal()
Allows subclasses to test whether the getter of a property is invoked from writeExternal method or by any other part of the program. |
void |
readExternal(ObjectInput in)
Read all properties of this object (or subclasses) from an object input. |
protected void |
reset()
Implements the reset by setting back all properties that were modified. |
void |
writeExternal(ObjectOutput out)
Write all properties of this object (or subclasses) to an object output. |
Methods inherited from class org.openide.util.SharedClassObject |
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, getLock, getProperty, hashCode, initialize, putProperty, putProperty, removeNotify, removePropertyChangeListener, writeReplace |
Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SystemOption()
Method Detail |
protected void firePropertyChange(String name, Object oldValue, Object newValue)
firePropertyChange
in class SharedClassObject
name
- the name of the propertyoldValue
- the old valuenewValue
- the new valueprotected void reset()
PropertyChangeEvent
with
non-null name and non-null old value. The name and value are
remembered and this method sets them back to original value.
Subclasses are free to override this method and reimplement the reset by themselves.
reset
in class SharedClassObject
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class SharedClassObject
out
- the output stream
IOException
- on errorpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class SharedClassObject
in
- the input stream
IOException
- on error
ClassNotFound
- if a class used to restore the system option is not found
ClassNotFoundException
protected boolean clearSharedData()
SharedClassObject
SharedClassObject.finalize()
.
The default implementation returns true
.
Classes which have precious shared data may want to return false
, so that
all instances may be finalized, after which new instances will pick up the same shared variables
without requiring a recalculation.
clearSharedData
in class SharedClassObject
true
if all shared data should be cleared,
false
if it should stay in memorypublic final String getName()
display name
.
public abstract String displayName()
public HelpCtx getHelpCtx()
getHelpCtx
in interface HelpCtx.Provider
protected final boolean isReadExternal()
protected final boolean isWriteExternal()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |