net.sourceforge.spedit.core
Class XMLInformation

java.lang.Object
  |
  +--net.sourceforge.spedit.core.XMLInformation

public class XMLInformation
extends Object

The XMLInformation class stores information related to a specific element. This information is used by the application to know:


Field Summary
protected  Vector attachedViewClasses
          The list of views supported by this element.
protected  Hashtable attachedViewParameters
          A hash that maps a set of attributes, expressed as an array of objects, to a the class of a View object.
protected  Vector children
           
protected  Class defaultViewClass
           
protected  String name
           
protected  org.jdom.Namespace namespace
           
protected  boolean strip
           
protected  Styleable.StyleSheet styleSheet
           
 
Constructor Summary
XMLInformation(String name)
          Creates a new element information for the given element name.
 
Method Summary
 void addChild(String element)
           
 void addView(Class view, Vector params)
          Adds a view and its constructor attributes to this element information object.
 Enumeration getChildren()
          Returns the possible children of this elements, as strings.
 String getName()
          Returns the name of the element.
 org.jdom.Namespace getNamespace()
          Returns the namespace of the element.
 View getNewDefaultView(Element elt)
          Instanciate a new View object that has been set as the default view for this kind of element.
 Styleable.StyleSheet getStyleSheet()
           
 boolean hasStrip()
           
protected  void init()
          This method is used by the constructors.
protected  View instanciateView(Element elt, Class viewClass)
          Instanciates the given viewClass.
 boolean isElementAllowed(org.jdom.Element source, String name)
          Tells wether or not the given element is allowed as a child of the current element.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name

namespace

protected org.jdom.Namespace namespace

children

protected Vector children

attachedViewClasses

protected Vector attachedViewClasses
The list of views supported by this element. The defaultViewClass is not parto of this list.

attachedViewParameters

protected Hashtable attachedViewParameters
A hash that maps a set of attributes, expressed as an array of objects, to a the class of a View object.

defaultViewClass

protected Class defaultViewClass

styleSheet

protected Styleable.StyleSheet styleSheet

strip

protected boolean strip
Constructor Detail

XMLInformation

public XMLInformation(String name)
Creates a new element information for the given element name.
Method Detail

init

protected void init()
This method is used by the constructors. It should not be called outside of the constructors.

getName

public String getName()
Returns the name of the element.
Returns:
A String containing the element name.

getNamespace

public org.jdom.Namespace getNamespace()
Returns the namespace of the element.
Returns:
The Namespace of the element, which can be set to null.

getStyleSheet

public Styleable.StyleSheet getStyleSheet()

isElementAllowed

public boolean isElementAllowed(org.jdom.Element source,
                                String name)
Tells wether or not the given element is allowed as a child of the current element. The element is supposed to be in the same namespace as the source element.
Parameters:
source - is the element in which the other element should be added.
name - is the name of the element to be added.
Returns:
true if the element is allowed, otherwise false. null.

addChild

public void addChild(String element)

getChildren

public Enumeration getChildren()
Returns the possible children of this elements, as strings.

addView

public void addView(Class view,
                    Vector params)
Adds a view and its constructor attributes to this element information object.

getNewDefaultView

public View getNewDefaultView(Element elt)
Instanciate a new View object that has been set as the default view for this kind of element.

instanciateView

protected View instanciateView(Element elt,
                               Class viewClass)
Instanciates the given viewClass. This class has to be part of the views associated to the element.
Parameters:
viewClass - the class of the view that has to be instanciated and configured. This class has to be either the defaultViewClass or to be part of the attachedViewClasses
Returns:
Returns null in case the viewClass was bad. Otherwise returns a new, properly configured, instance of the view class.

hasStrip

public boolean hasStrip()

toString

public String toString()
Overrides:
toString in class Object