Class ProjectInstance

java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.projects.ProjectInstance
All Implemented Interfaces:
java.lang.Comparable<ProjectInstance>, AttributeListener, InterfaceObject, NamedObject, TreeObject, CleanableObject, XMLObject, IconObject

public class ProjectInstance
extends AbstractInterfaceObject
implements IconObject, AttributeListener, java.lang.Comparable<ProjectInstance>, XMLObject
Specifies an element instance in a project (e.g., a subject). The instance can be minimally specified by a name and a type, but other implementations can expand its attributes.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

  • Constructor Details

    • ProjectInstance

      public ProjectInstance​(java.lang.String name)
    • ProjectInstance

      public ProjectInstance​(java.lang.String name, java.lang.String type)
  • Method Details

    • setName

      public void setName​(java.lang.String name)
      Description copied from interface: NamedObject
      Sets the name for this object.
      Specified by:
      setName in interface NamedObject
      Overrides:
      setName in class AbstractInterfaceObject
    • getName

      public java.lang.String getName()
      Description copied from interface: NamedObject
      Gets the name for this object.
      Specified by:
      getName in interface NamedObject
      Overrides:
      getName in class AbstractInterfaceObject
      Returns:
    • setType

      public void setType​(java.lang.String type)
    • getType

      public java.lang.String getType()
    • attributeUpdated

      public void attributeUpdated​(AttributeEvent e)
      Description copied from interface: AttributeListener
      Called when an Attribute's value has been updated.
      Specified by:
      attributeUpdated in interface AttributeListener
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getTreeLabel

      public java.lang.String getTreeLabel()
      Description copied from interface: TreeObject
      Returns the label text to appear in a tree node.
      Specified by:
      getTreeLabel in interface TreeObject
      Overrides:
      getTreeLabel in class AbstractInterfaceObject
      Returns:
    • compareTo

      public int compareTo​(ProjectInstance instance)
      Specified by:
      compareTo in interface java.lang.Comparable<ProjectInstance>
    • getIconTypes

      public static java.util.HashMap<java.lang.String,​NamedIcon> getIconTypes()
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Returns:
    • getIcon

      protected static javax.swing.Icon getIcon​(java.lang.String name)
    • getInstanceIcon

      public static javax.swing.Icon getInstanceIcon()
    • getSubjectIcon

      public static javax.swing.Icon getSubjectIcon()
    • getDTD

      public java.lang.String getDTD()
      Description copied from interface: XMLObject
      Returns the Data Type Declaration (DTD) for this object's XML representation

      See http://en.wikipedia.org/wiki/Document_Type_Definition for a description.

      Specified by:
      getDTD in interface XMLObject
      Returns:
    • getXMLSchema

      public java.lang.String getXMLSchema()
      Description copied from interface: XMLObject
      Returns the XML schema for this object's XML representation

      See http://en.wikipedia.org/wiki/XML_schema.

      Specified by:
      getXMLSchema in interface XMLObject
      Returns:
    • getXML

      public java.lang.String getXML()
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Returns:
    • getXML

      public java.lang.String getXML​(int tab)
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the opening XML wrapper
      Returns:
    • handleXMLElementStart

      public void handleXMLElementStart​(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles the start of an XML element.
      Specified by:
      handleXMLElementStart in interface XMLObject
      Parameters:
      localName - Local name of the element
      attributes - Set of element attributes
      type - The XMLType of this element
      Throws:
      org.xml.sax.SAXException
    • handleXMLElementEnd

      public void handleXMLElementEnd​(java.lang.String localName) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles the end of an XML element.
      Specified by:
      handleXMLElementEnd in interface XMLObject
      Parameters:
      localName - Local name of the element
      Throws:
      org.xml.sax.SAXException
    • handleXMLString

      public void handleXMLString​(java.lang.String s) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles a string within an XML element.
      Specified by:
      handleXMLString in interface XMLObject
      Parameters:
      s - String to handle
      Throws:
      org.xml.sax.SAXException
    • getLocalName

      public java.lang.String getLocalName()
      Description copied from interface: XMLObject
      Returns the local name associated with this XML object.
      Specified by:
      getLocalName in interface XMLObject
      Returns:
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      options - XMLOutputOptions defining the write parameters
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file, as XMLType.Normal. The default format of XMLFormat.Ascii will be used. The basic contract for this method is that it should not write a newline character at its start or end.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format of XMLFormat.Ascii will be used.
      Specified by:
      writeXML in interface XMLObject
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      Throws:
      java.io.IOException
    • getShortXML

      public java.lang.String getShortXML​(int tab)
      Description copied from interface: XMLObject
      Returns a short XML representation of this object.
      Specified by:
      getShortXML in interface XMLObject
      Returns: