org.openide.src
Class Element

java.lang.Object
  |
  +--org.openide.src.Element
All Implemented Interfaces:
ElementProperties, Node.Cookie, Serializable
Direct Known Subclasses:
InitializerElement, MemberElement, SourceElement

public abstract class Element
extends Object
implements Serializable, ElementProperties, Node.Cookie

Base class for representations of elements in the Java language. All elements are items which are structural features of a class (or the class itself), rather than corresponding to bytecode (i.e. statements are not represented). The same representation is suited to any language using the Java VM.

See Also:
Serialized Form

Inner Class Summary
static interface Element.Impl
          Pluggable implementation of the storage of element properties.
static interface Element.Impl2
          Extended version of the implementation interface.
 
Field Summary
protected  Element.Impl impl
          Implementation
protected  Element.Impl2 impl2
          Implementation extension #2
 
Fields inherited from interface org.openide.src.ElementProperties
PROP_ALL_CLASSES, PROP_BODY, PROP_CLASS_OR_INTERFACE, PROP_CLASSES, PROP_CONSTRUCTORS, PROP_EXCEPTIONS, PROP_FIELDS, PROP_IMPORTS, PROP_INIT_VALUE, PROP_INITIALIZERS, PROP_INTERFACES, PROP_JAVADOC, PROP_MEMBERS, PROP_METHODS, PROP_MODIFIERS, PROP_NAME, PROP_PACKAGE, PROP_PARAMETERS, PROP_RETURN, PROP_STATIC, PROP_STATUS, PROP_SUPERCLASS, PROP_TYPE, PROP_VALID
 
Constructor Summary
protected Element(Element.Impl impl)
          Create a new element with the provided implementation.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Add a property change listener.
 void addVetoableChangeListener(VetoableChangeListener l)
          Attaches a VetoableChange listener to the element.
 Node.Cookie getCookie(Class type)
          Look for a cookie providing added behavior for this element.
 void markCurrent(boolean beforeAfter)
          Mark the current element in the context of this element.
abstract  void print(ElementPrinter printer)
          Print this element (and all its subelements) into an element printer.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a property change listener.
 void removeVetoableChangeListener(VetoableChangeListener l)
          Removes the vetoable listener from the element.
 String toString()
          Get a string representation of the element.
protected  Object writeReplace()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

impl

protected Element.Impl impl
Implementation

impl2

protected Element.Impl2 impl2
Implementation extension #2
Constructor Detail

Element

protected Element(Element.Impl impl)
Create a new element with the provided implementation. The implementation is responsible for storing all properties of the object.
Parameters:
impl - the implementation to use
Method Detail

addPropertyChangeListener

public final void addPropertyChangeListener(PropertyChangeListener l)
Add a property change listener.
Parameters:
l - the listener to add
See Also:
ElementProperties

removePropertyChangeListener

public final void removePropertyChangeListener(PropertyChangeListener l)
Remove a property change listener.
Parameters:
l - the listener to remove
See Also:
ElementProperties

addVetoableChangeListener

public final void addVetoableChangeListener(VetoableChangeListener l)
Attaches a VetoableChange listener to the element. The Listener will be notified about changes being done before the change is actually done.
Parameters:
l - instance of listener to attach.

removeVetoableChangeListener

public final void removeVetoableChangeListener(VetoableChangeListener l)
Removes the vetoable listener from the element.
Parameters:
l - listener to remove.

markCurrent

public void markCurrent(boolean beforeAfter)
Mark the current element in the context of this element. The current element means the position for inserting new elements.
Parameters:
beforeAfter - true means that new element is inserted before the specified element, false means after.

getCookie

public Node.Cookie getCookie(Class type)
Look for a cookie providing added behavior for this element. The request is delegated to the current implementation. Also note that Element implements Node.Cookie, and that if the implementation does not provide a cookie, but the requested cookie class is actually a superclass/interface of this element type, then the element itself may be returned as the cookie.
Parameters:
type - the cookie class to look for
Returns:
a cookie assignable to that class, or null if the cookie is not supported

writeReplace

protected Object writeReplace()

print

public abstract void print(ElementPrinter printer)
                    throws ElementPrinterInterruptException
Print this element (and all its subelements) into an element printer.
Parameters:
printer - the element printer
Throws:
ElementPrinterInterruptException - if the printer canceled the printing

toString

public String toString()
Get a string representation of the element.
Overrides:
toString in class Object
Returns:
the string
See Also:
print(org.openide.src.ElementPrinter), DefaultElementPrinter


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.