Module org.jpo

Class GroupInfo

java.lang.Object
org.jpo.datamodel.GroupInfo
All Implemented Interfaces:
Serializable, GroupOrPicture

public class GroupInfo extends Object implements Serializable, GroupOrPicture
A GroupInfo object carries a description and its owning node can have zero or many GroupOrPicture carrying nodes.

This class must implement the Serializable interface or Drag and Drop will not work.

See Also:
  • Constructor Details

    • GroupInfo

      public GroupInfo(String description)
      Constructor to create a new GroupInfo object.
      Parameters:
      description - The description of the Group
  • Method Details

    • toString

      public String toString()
      toString method that returns the description of the group
      Overrides:
      toString in class Object
      Returns:
      description of the group
    • getGroupName

      public String getGroupName()
      Returns the description of the group.
      Returns:
      The description of the Group.
      See Also:
    • getGroupNameHtml

      public String getGroupNameHtml()
      Returns the description of the group with the HTML characters safely escaped.
      Returns:
      The description of the Group.
      See Also:
    • setGroupName

      public void setGroupName(String name)
      Set name of the GroupInfo
      Parameters:
      name - The new description of the GroupInfo
      See Also:
    • dumpToXml

      public void dumpToXml(BufferedWriter out, boolean rootNode, boolean protection) throws IOException
      this method writes all attributes of the group to the JPO xml data format with the highres locations passed in as parameters.
      Parameters:
      out - The BufferedWriter receiving the xml data. I use a BufferedWriter because it has a newLine method
      rootNode - The starting node
      protection - Whether the collection is protected or not
      Throws:
      IOException - If there was an IO error
    • endGroupXML

      public void endGroupXML(BufferedWriter out, boolean rootNode) throws IOException
      Closes the xml output
      Parameters:
      out - The output stream
      rootNode - true if this si the root node
      Throws:
      IOException - if something went wrong
    • sendWasSelectedEvent

      public void sendWasSelectedEvent()
      Creates a GroupInfoChangedEvent and sends it to inform listening objects that the node was selected. Strictly speaking this is not a GroupInfo level event but a node level event. However, because I have the GroupInfoChangeEvent structure in place this is a good place to put this notification.
    • sendWasUnselectedEvent

      public void sendWasUnselectedEvent()
      Creates a PictureChangedEvent and sends it to inform listening objects that the node was unselected. Strictly speaking this is not a PictureInfo level event but a node level event. However, because I have the PictureInfoChangeEvent structure in place this is a good place to put this notification.
    • addGroupInfoChangeListener

      public void addGroupInfoChangeListener(GroupInfoChangeListener groupInfoChangeListener)
      Adds a change listener
      Parameters:
      groupInfoChangeListener - The object that will receive notifications.
    • removeGroupInfoChangeListener

      public void removeGroupInfoChangeListener(GroupInfoChangeListener groupInfoChangeListener)
      Removes the change listener
      Parameters:
      groupInfoChangeListener - The listener that doesn't want to receive notifications.
    • getClone

      public GroupInfo getClone()
      Returns a new GroupInfo object which is identical to the current one.
      Returns:
      a clone of the current PictureInfo object.
    • compareTo

      public int compareTo(@NotNull @NotNull GroupInfo otherGroupInfo)
      Defines how GroupInfo objects compare themselves
      Parameters:
      otherGroupInfo - The other GroupInfo object
      Returns:
      negative number if this is less than other Zero if same or positive number if other is less than this
    • setOwningNode

      public void setOwningNode(SortableDefaultMutableTreeNode sortableDefaultMutableTreeNode)
      Description copied from interface: GroupOrPicture
      A GroupOrPicture must be able to remember the node that owns it to facilitate traversal
      Specified by:
      setOwningNode in interface GroupOrPicture
      Parameters:
      sortableDefaultMutableTreeNode - The owning node
    • getOwningNode

      public SortableDefaultMutableTreeNode getOwningNode()
      Description copied from interface: GroupOrPicture
      Returns the node that owns this object
      Specified by:
      getOwningNode in interface GroupOrPicture
      Returns:
      the node that owns this object