uk.ac.ic.doc.y2002.tool.editor
Class ClassManager
java.lang.Object
|
+--uk.ac.ic.doc.y2002.tool.editor.ClassManager
- public class ClassManager
- extends java.lang.Object
The ClassManager provides extensibility to the application,
by selecting the classes that should be used to represent a
particular type of net. One ClassManager is loaded for each
display pane opened, and each determines the necessary classes
on its creation. It is given the type of the net being
displayed, and loads in the file "nettypes.xml" which defines the
net type hierarchy and the corresponding classes. This XML file may
be modified by the user to include support for new net types
and/or new *Label classes.
Another level of extensibility is managed by the Label classes
themselves - upon initialisation, each Label may specify a subclass
of the Right-click menu (context menu) and/or the PropertiesBox
which should be used.
- See Also:
DisplayPane.makeLabels()
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassManager
public ClassManager(java.lang.String nettype)
- Parameters:
nettype
- the net type of the petri net being displayed.
eg in , "ptNet" should be passed.
loadHierarchy
public void loadHierarchy(java.lang.String nettype)
- function which loads in the XML file specifying the nettype hierarchy,
and discovers a path through the hierarchy to the given nettype.
When the nettype is found, upon the return path later function pick
up the classes.
- Parameters:
nettype
- the net type (eg "ptNet") to search for.- See Also:
findType(String thetype, Element root)
findType
protected boolean findType(java.lang.String thetype,
org.jdom.Element root)
- Recursive function which searches the tree for the given type.
When it finds the type, it gets the classes, from the leaf first
and picks up other classes as it returns to the root.
- Parameters:
thetype
- the type to search forroot
- the Element at the root of the tree: - See Also:
getClasses(Element e)
getClasses
protected void getClasses(org.jdom.Element e)
- This function extracts classes from a element.
It stores each class if one for that type hasn't yet been found.
- Parameters:
e
- the element e to search for classes- See Also:
getClass(Element e, String elementname, Class eclass)
getClass
protected java.lang.Class getClass(org.jdom.Element e,
java.lang.String elementname,
java.lang.Class eclass)
- Extracts and returns a Class object from the hierarchy, given parameters.
- Parameters:
e
- the Element which may contain class nameselementname
- the sub-element's name, eg eclass
- the Class object in ClassManager which keeps track of this type of class (eg a Place class)- Returns:
- a Class object for the class requested, or null if a) this particular type of class has already been specified, or b) class not defined (element 'elementname' not found)
newPNLabel
protected java.lang.Object newPNLabel(org.jdom.Element e,
java.lang.Class c)
- Used by the more specific new*Label functions.
newPlaceLabel
public PlaceLabel newPlaceLabel(org.jdom.Element e)
- Call this function whenever a new PlaceLabel needs to be created.
It returns an object nominally of class PlaceLabel, but it may actually be
a more specific subclass of PlaceLabel, determined by the ClassManager.
newTransitionLabel
public TransitionLabel newTransitionLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newArcLabel
public ArcLabel newArcLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newSubnetLabel
public SubnetLabel newSubnetLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newReferencePlaceLabel
public ReferencePlaceLabel newReferencePlaceLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newImportPlaceLabel
public ImportPlaceLabel newImportPlaceLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newExportPlaceLabel
public ExportPlaceLabel newExportPlaceLabel(org.jdom.Element e)
- See Also:
newPlaceLabel(Element e)
newPlaceElement
public org.jdom.Element newPlaceElement(java.lang.Object[] arguments)
newReferencePlaceElement
public org.jdom.Element newReferencePlaceElement(java.lang.Object[] arguments)
newTransitionElement
public org.jdom.Element newTransitionElement(java.lang.Object[] arguments)
newSubnetElement
public org.jdom.Element newSubnetElement(java.lang.Object[] arguments)
newArcElement
public org.jdom.Element newArcElement(java.lang.Object[] arguments)
newElement
public org.jdom.Element newElement(java.lang.Object[] arguments,
java.lang.Class c)
newAnimator
public PNAnimator newAnimator(DisplayPane display)
- See Also:
newPlaceLabel(Element e)