Class InterfaceDisplayPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mgui.interfaces.InterfacePanel
mgui.interfaces.InterfaceDisplayPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, AttributeListener, AttributeObject, DisplayListener, WindowContainer, WindowListener, InterfaceObject, CategoryObject, PopupMenuObject, NamedObject, ShapeModel3DListener, ShapeListener, SplitPanelListener, Toolable<Tool>, TreeObject, CleanableObject, XMLObject, IconObject
Direct Known Subclasses:
InterfaceTabbedDisplayPanel

public class InterfaceDisplayPanel
extends InterfacePanel
implements java.awt.event.ActionListener, XMLObject, Toolable<Tool>, WindowContainer, SplitPanelListener, ShapeModel3DListener
Main interface panel for displaying data graphically. Contains a hierarchical set of InterfaceGraphic objects which it displays in a particular order and size, based upon the number of current windows. The framework is a set of embedded InterfaceSplitPanes, each of which can contain further split panes. InterfaceDisplayPanel also has a reference to the 3D model shape set (ShapeSet3DInt modelSet), a list of data source shapeModels, a list of shape selection sets, and a tree containing nodes for all of these objects. InterfaceGraphic type-specific tools can also be set through this interface, affecting all relevant windows.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
See Also:
Serialized Form
  • Field Details

    • window

      protected InterfaceGraphicWindow window
    • titles

      protected java.util.ArrayList<javax.swing.JLabel> titles
    • currentTool

      protected Tool currentTool
    • toolLock

      public boolean toolLock
    • selectionIndex

      public java.util.ArrayList<mgui.interfaces.InterfaceDisplayPanel.SelIDRef> selectionIndex
    • excludeToSelection

      public boolean excludeToSelection
    • objectTree

      protected InterfaceTreePanel objectTree
    • currentSelection

      public ShapeSelectionSet currentSelection
    • mouse_listeners

      protected java.util.TreeSet<GraphicMouseListener> mouse_listeners
    • currentModel

      protected ShapeModel3D currentModel
    • displayPanelListeners

      protected java.util.ArrayList<DisplayPanelListener> displayPanelListeners
    • parentFrame

      public InterfaceFrame parentFrame
    • workspace

      protected InterfaceWorkspace workspace
    • last_added_panel

      protected transient InterfaceGraphic<?> last_added_panel
    • last_removed_panel

      protected transient InterfaceGraphic<?> last_removed_panel
    • parent_panel

      protected InterfaceDisplayPanel parent_panel
    • last_split_orientation

      protected int last_split_orientation
  • Constructor Details

    • InterfaceDisplayPanel

      public InterfaceDisplayPanel​(SessionFrame frame)
  • Method Details

    • init

      protected void init()
      Specified by:
      init in class InterfacePanel
    • 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 InterfacePanel
      Returns:
    • getObjectIcon

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

      public void addDisplayPanelListener​(DisplayPanelListener l)
    • removeDisplayPanelListener

      public void removeDisplayPanelListener​(DisplayPanelListener l)
    • getParentFrame

      public InterfaceFrame getParentFrame()
    • destroy

      public void destroy()
      Description copied from interface: InterfaceObject
      Destroy this object (prepare it to be removed from memory)
      Specified by:
      destroy in interface InterfaceObject
      Specified by:
      destroy in interface ShapeListener
      Overrides:
      destroy in class InterfacePanel
    • isDestroyed

      public boolean isDestroyed()
      Description copied from interface: InterfaceObject
      Test whether this object has been destroyed
      Specified by:
      isDestroyed in interface InterfaceObject
      Specified by:
      isDestroyed in interface ShapeListener
      Overrides:
      isDestroyed in class InterfacePanel
      Returns:
    • getWorkspace

      public InterfaceWorkspace getWorkspace()
    • getCurrentShapeModel

      public ShapeModel3D getCurrentShapeModel()
    • setCurrentShapeModel

      public void setCurrentShapeModel​(ShapeModel3D model)
    • shapeModelChanged

      public void shapeModelChanged​(ShapeModelEvent event)
      Description copied from interface: ShapeModel3DListener
      Fired when a ShapeModel3D is changed in some way. The specific change is indicated by the EventType of the ShapeModelEvent.
      Specified by:
      shapeModelChanged in interface ShapeModel3DListener
    • getCurrentShapeSet

      public ShapeSet3DInt getCurrentShapeSet()
    • addShapeListener

      public void addShapeListener​(ShapeListener s)
    • addShapeInt

      public boolean addShapeInt​(Shape3DInt thisShape)
    • splitPanelChanged

      public void splitPanelChanged​(SplitPanelEvent e)
      Description copied from interface: SplitPanelListener
      The split pane has changed. The SplitPanelEvent will provide information about the nature of the change.
      Specified by:
      splitPanelChanged in interface SplitPanelListener
    • getWindows

      public java.util.ArrayList<InterfaceGraphicWindow> getWindows()
      Returns a list of the windows contained in this display panel. Breadth-first, if this panel contains split panels.
      Returns:
    • getWindowsDepthFirst

      public java.util.ArrayList<InterfaceGraphicWindow> getWindowsDepthFirst()
      Returns a list of the windows contained in this display panel. Depth-first, if this panel contains split panels.
      Returns:
    • addGraphicMouseListener

      public void addGraphicMouseListener​(GraphicMouseListener s)
    • removeGraphicMouseListener

      public void removeGraphicMouseListener​(GraphicMouseListener s)
    • paintComponent

      public void paintComponent​(java.awt.Graphics g)
      Overrides:
      paintComponent in class javax.swing.JComponent
    • getLastAddedPanel

      public InterfaceGraphic<?> getLastAddedPanel()
      Retrieves the last added panel
      Returns:
    • getLastRemovedPanel

      public InterfaceGraphic<?> getLastRemovedPanel()
      Retrieves the last removed panel
      Returns:
    • getNextSplitPanel

      protected InterfaceSplitPanel getNextSplitPanel​(InterfaceGraphicWindow new_window)
      Returns a new split panel, determined as the first non-split window encountered, searching through the nested stack of split panels. This ensures that the highest-level window is always the next to be split by default.
      Returns:
    • addWindow

      public boolean addWindow​(InterfaceGraphicWindow new_window)
    • addWindow

      public boolean addWindow​(InterfaceGraphicWindow new_window, java.lang.String title)
      Adds a panel to this display panel, using the default split position, which depends on the previous addition. The convention for this is horizontal, then vertical, etc.
      Parameters:
      window -
      title -
    • isValidTitle

      public boolean isValidTitle​(java.lang.String title)
    • getValidTitle

      public java.lang.String getValidTitle​(java.lang.String desired_title)
      Returns a valid title for a new window in this display panel. If no window by the name desired_name exists, returns the same name. Otherwise, Returns that name with "-{n}" appended, where n is an integer indicating the number of additional names encountered.
      Parameters:
      desired_title -
      Returns:
    • splitWindow

      public InterfaceSplitPanel splitWindow​(InterfaceGraphicWindow window_to_split, InterfaceGraphicWindow window_to_add, int orientation, boolean is_left)
      Adds a new split panel to this display panel, in place of window_to_split, which must already be a child of this display panel.
      Parameters:
      window_to_split - Window to be replaced by a split panel
      window_to_add - New window to share the new split panel
      orientation - One of JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT
      is_left - If true, window_to_split goes on the left/top; opposite if false.
      Returns:
      The new split panel, or null if process failed
    • fireDisplayPanelChanged

      protected void fireDisplayPanelChanged​(DisplayPanelEvent e)
    • addColourMap

      public void addColourMap​(ColourMap map)
    • getColourMaps

      public java.util.ArrayList<ColourMap> getColourMaps()
    • getNameMaps

      public java.util.ArrayList<NameMap> getNameMaps()
    • updatePanels

      public void updatePanels()
      Instructs this display panel to regenerate based on its current state.
    • getCurrentTool2D

      public Tool2D getCurrentTool2D()
    • getCurrentTool3D

      public Tool3D getCurrentTool3D()
    • getCurrentToolGraph

      public ToolGraph getCurrentToolGraph()
    • setCurrentTool

      public boolean setCurrentTool​(Tool tool)
      Specified by:
      setCurrentTool in interface Toolable<Tool>
    • setDefaultTool

      public boolean setDefaultTool​(Tool tool)
      Specified by:
      setDefaultTool in interface Toolable<Tool>
    • getCurrentTool

      public Tool getCurrentTool()
      Specified by:
      getCurrentTool in interface Toolable<Tool>
    • isToolable

      public boolean isToolable​(Tool tool)
      Description copied from interface: Toolable
      Tests whether this object is toolable by tool
      Specified by:
      isToolable in interface Toolable<Tool>
      Returns:
    • resetPanels

      public void resetPanels()
      Removes all panels from this display panel, and removes all mouse listeners registered on them.
    • removeWindow

      public boolean removeWindow​(java.lang.String name)
      Removes the panel associated with name, if it exists. Also removes all listeners on this panel.
      Parameters:
      name -
    • setCurrentSectionSet

      public void setCurrentSectionSet​(SectionSet3DInt thisSet)
    • getCurrentSectionSet

      public SectionSet3DInt getCurrentSectionSet()
    • setObjectTree

      public void setObjectTree​(InterfaceTreePanel treePanel)
    • getAllWindows

      public java.util.ArrayList<InterfaceGraphicWindow> getAllWindows()
    • getPanels

      public java.util.ArrayList<InterfaceGraphicWindow> getPanels()
      Deprecated.
      Use getWindows()
      Returns:
    • removeAllPanels

      public void removeAllPanels()
    • removeWindow

      public void removeWindow​(InterfaceGraphicWindow child)
      Description copied from interface: WindowContainer
      Remove child from this container, and notify listeners.
      Specified by:
      removeWindow in interface WindowContainer
    • removeWindow

      public void removeWindow​(InterfaceGraphicWindow child, boolean notify)
      Description copied from interface: WindowContainer
      Remove child from this container.
      Specified by:
      removeWindow in interface WindowContainer
      notify - Whether to notify listeners
    • shapeUpdated

      public void shapeUpdated​(ShapeEvent e)
      Description copied from interface: ShapeListener
      A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.
      Specified by:
      shapeUpdated in interface ShapeListener
      Overrides:
      shapeUpdated in class InterfacePanel
    • updateDisplay

      public void updateDisplay()
      Description copied from class: InterfacePanel
      Requests this panel to update its display.
      Specified by:
      updateDisplay in interface DisplayListener
      Overrides:
      updateDisplay in class InterfacePanel
    • updateDisplays

      public void updateDisplays()
      Overrides:
      updateDisplays in class InterfacePanel
    • resetSelectionIndex

      public void resetSelectionIndex()
    • getCurrentSelection

      public ShapeSelectionSet getCurrentSelection()
    • setCurrentSelection

      public void setCurrentSelection​(ShapeSelectionSet sel)
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode treeNode)
      Description copied from interface: TreeObject
      Sets the children for this node's InterfaceTreeNode.
      Specified by:
      setTreeNode in interface TreeObject
      Overrides:
      setTreeNode in class InterfacePanel
    • getPanelNodes

      public java.util.ArrayList<InterfaceTreeNode> getPanelNodes()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.awt.Component
    • getShapeSet2D

      public ShapeSet2DInt getShapeSet2D()
    • addShape2D

      public void addShape2D​(Shape2DInt thisShape)
    • setShapeSet2D

      public void setShapeSet2D()
    • addSelectionSet

      public ShapeSelectionSet addSelectionSet​(ShapeSelectionSet thisSet, ShapeModel3D model)
    • addSelectionSet

      @Deprecated public ShapeSelectionSet addSelectionSet​(ShapeSelectionSet thisSet, ShapeModel3D model, boolean listeners)
      Deprecated.
      call model directly
      Parameters:
      thisSet -
      model -
      listeners -
      Returns:
    • setStatusBar

      public void setStatusBar​(InterfaceStatusBarPanel p)
      Overrides:
      setStatusBar in class InterfacePanel
    • registerProgressBar

      public void registerProgressBar​(InterfaceProgressBar bar)
    • deregisterProgressBar

      public void deregisterProgressBar()
    • setCurrentSection

      public void setCurrentSection​(SectionSet3DInt thisSect, int section)
    • getPopupMenu

      public InterfacePopupMenu getPopupMenu()
      Description copied from interface: PopupMenuObject
      Produces and returns a popup menu for this object.
      Specified by:
      getPopupMenu in interface PopupMenuObject
      Overrides:
      getPopupMenu in class InterfacePanel
      Returns:
    • handlePopupEvent

      public void handlePopupEvent​(java.awt.event.ActionEvent e)
      Description copied from interface: PopupMenuObject
      Handles an event on this object's popup menu.
      Specified by:
      handlePopupEvent in interface PopupMenuObject
      Overrides:
      handlePopupEvent in class InterfacePanel
    • getToolLock

      public boolean getToolLock()
    • setToolLock

      public void setToolLock​(boolean val)
    • toggleExpandedWindow

      public int toggleExpandedWindow​(java.lang.String name)
      Toggles the expansion state of the window specified by name.
      Parameters:
      name -
      Returns:
    • actionPerformed

      public void actionPerformed​(java.awt.event.ActionEvent e)
      Specified by:
      actionPerformed in interface java.awt.event.ActionListener
    • close

      public void close()
      Called when this display panel is closed
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • handleXMLElementEnd

      public void handleXMLElementEnd​(java.lang.String localName)
      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
    • handleXMLElementStart

      public void handleXMLElementStart​(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
      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
    • handleXMLString

      public void handleXMLString​(java.lang.String s)
      Description copied from interface: XMLObject
      Handles a string within an XML element.
      Specified by:
      handleXMLString in interface XMLObject
      Parameters:
      s - String to handle
    • 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, 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) 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
    • windowUpdated

      public void windowUpdated​(WindowEvent e)
      Specified by:
      windowUpdated in interface WindowListener
    • windowSourceChanged

      public void windowSourceChanged​(WindowEvent e)
      Specified by:
      windowSourceChanged in interface WindowListener