Class InterfaceWorkspace

java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.InterfaceWorkspace
All Implemented Interfaces:
InterfaceObject, NamedObject, ShapeModel3DListener, TabbedDisplayListener, TreeObject, CleanableObject, XMLObject, StaticPipelineListener, IconObject

public class InterfaceWorkspace
extends AbstractInterfaceObject
implements IconObject, TabbedDisplayListener, XMLObject, StaticPipelineListener, ShapeModel3DListener
A Workspace acts as a container for all data models and graphics windows.

TODO: maintain session history

Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

  • Constructor Details

    • InterfaceWorkspace

      public InterfaceWorkspace()
  • Method Details

    • 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:
    • getCurrentAttributeDialog

      public AttributeDialogBox getCurrentAttributeDialog()
    • getCurrentShapeAttributeDialog

      public AttributeDialogBox getCurrentShapeAttributeDialog()
    • showAttributeDialog

      public void showAttributeDialog​(AttributeObject object)
    • getInterfacePanels

      public java.util.ArrayList<InterfacePanel> getInterfacePanels()
    • setComboPanel

      public void setComboPanel​(InterfaceComboPanel panel)
    • populateShapeSetCombo

      public void populateShapeSetCombo​(javax.swing.JComboBox combo_box)
    • populateShapeTypeCombo

      public void populateShapeTypeCombo​(javax.swing.JComboBox combo_box, Shape3DInt shape)
    • populateShapeCombo

      public void populateShapeCombo​(javax.swing.JComboBox combo_box)
    • getDisplayPanel

      public InterfaceDisplayPanel getDisplayPanel()
    • setDisplayPanel

      public void setDisplayPanel​(InterfaceDisplayPanel display_panel)
    • addDataSource

      public boolean addDataSource​(DataSource ds)
    • removeDataSource

      public void removeDataSource​(DataSource ds)
    • getDataSources

      public java.util.ArrayList<DataSource> getDataSources()
      Returns a list of all data sources associated with this workspace.
      Returns:
    • getConnectedDataSources

      public java.util.ArrayList<DataSource> getConnectedDataSources()
      Returns a list of all connected data sources associated with this workspace.
      Returns:
    • getDataSource

      public DataSource getDataSource​(java.lang.String ds)
    • getVariableObjects

      public java.util.ArrayList<VariableObject> getVariableObjects()
      Returns a list of all objects in this workspace which are instances of VariableObject.
      Returns:
    • getAttributeObjects

      public java.util.ArrayList<AttributeObject> getAttributeObjects()
      Returns a list of all the attribute objects contained in this workspace. NB. currently only returns all instances of InterfaceShape
      Returns:
    • addModel

      public void addModel​(InterfaceAbstractModel model)
    • removeModel

      public void removeModel​(InterfaceAbstractModel model)
    • addShapeModel

      public boolean addShapeModel​(ShapeModel3D model, boolean set_current)
      Adds model to this
      Parameters:
      model - The model to add
      set_current - Whether to set this as the current model
    • addShapeModel

      public boolean addShapeModel​(ShapeModel3D model, boolean set_current, boolean rename)
      Adds model to this
      Parameters:
      model -
      set_current -
      rename - Whether to rename this model if one already exists with this name (if false, this method will return false
    • getCurrentShapeModel

      public ShapeModel3D getCurrentShapeModel()
      Returns the current shape model for this Workspace, or null if there is no current model.
      Returns:
    • setCurrentShapeModel

      public boolean setCurrentShapeModel​(java.lang.String name)
      Sets the current shape model for this Workspace. If a DisplayPanel is set, sets its current model as well.
      Parameters:
      name -
      Returns:
      true if successful
    • removeShapeModel

      public void removeShapeModel​(ShapeModel3D model)
    • modelExists

      public boolean modelExists​(ShapeModel3D model)
    • getShapeModels

      public java.util.ArrayList<ShapeModel3D> getShapeModels()
    • 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
    • getShapeForName

      public InterfaceShape getShapeForName​(java.lang.String full_name)
      Searches the workspace for a shape with the given full name (i.e., {model}.{sets}.{shape_name}), and returns it if found. Otherwise returns null.
      Parameters:
      full_name -
      Returns:
    • getShapeModel

      public ShapeModel3D getShapeModel​(java.lang.String name)
      Returns the model with the given name, if it exists; returns null otherwise.
      Parameters:
      name -
      Returns:
    • getDynamicModels

      public java.util.ArrayList<InterfaceAbstractModel> getDynamicModels()
    • addDynamicModel

      public void addDynamicModel​(InterfaceAbstractModel model)
    • removeDynamicModel

      public void removeDynamicModel​(InterfaceAbstractModel model)
    • addGraph

      public void addGraph​(InterfaceAbstractGraph graph)
    • removeGraph

      public void removeGraph​(InterfaceAbstractGraph graph)
    • getGraphs

      public java.util.ArrayList<InterfaceAbstractGraph> getGraphs()
    • addVariable

      public void addVariable​(VariableInt<?> v)
    • removeVariable

      public void removeVariable​(VariableInt<?> v)
    • getVariables

      public java.util.ArrayList<VariableInt<?>> getVariables()
      Returns a list of all variables currently in this workspace.
      Returns:
    • getVariableByName

      public VariableInt<?> getVariableByName​(java.lang.String name)
      Returns the variable in this workspace corresponding to the given name.
      Parameters:
      name -
      Returns:
    • getSelectionSets

      public java.util.ArrayList<ShapeSelectionSet> getSelectionSets()
      Returns a list of all selection sets currently in this workspace.
    • addQuery

      public void addQuery​(InterfaceQuery q)
    • removeQuery

      public void removeQuery​(InterfaceQuery q)
    • getQueries

      public java.util.ArrayList<InterfaceQuery> getQueries()
    • addInputStream

      public void addInputStream​(DataInputStream<?> s)
    • addOutputStream

      public void addOutputStream​(DataOutputStream<?> s)
    • addPlot

      public void addPlot​(InterfacePlot<?> p)
    • removePlot

      public void removePlot​(InterfacePlot<?> v)
    • getPlots

      public java.util.ArrayList<InterfacePlot<?>> getPlots()
    • addProject

      public void addProject​(InterfaceProject project)
    • getProject

      public InterfaceProject getProject​(java.lang.String name)
    • getViews3D

      public java.util.ArrayList<View3D> getViews3D()
    • getView3D

      public View3D getView3D​(java.lang.String name)
    • addView3D

      public View3D addView3D​(View3D view)
    • removeView3D

      public void removeView3D​(View3D view)
    • getVideos3D

      public java.util.ArrayList<Video3D> getVideos3D()
    • getVideos

      public java.util.ArrayList<Video> getVideos()
    • addVideo

      public void addVideo​(Video video)
    • removeVideo

      public void removeVideo​(Video video)
    • setObjectTree

      public void setObjectTree​(InterfaceTreePanel treePanel)
    • 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 AbstractInterfaceObject
    • getProjectsNode

      public InterfaceTreeNode getProjectsNode()
    • getProjects

      public java.util.ArrayList<InterfaceProject> getProjects()
    • getPipelinesNode

      public InterfaceTreeNode getPipelinesNode()
    • getPipelines

      public java.util.ArrayList<InterfacePipeline> getPipelines()
      Returns a list of the pipelines contained in this workspace.
      Returns:
    • getPipeline

      public InterfacePipeline getPipeline​(java.lang.String name)
      Returns the pipeline with the given name.
      Parameters:
      name -
      Returns:
    • addPipeline

      public boolean addPipeline​(InterfacePipeline pipeline)
      Adds a pipeline to this workspace.
      Parameters:
      pipeline -
      Returns:
      false if a pipeline with the same name already exists.
    • removePipeline

      public void removePipeline​(InterfacePipeline pipeline)
    • pipelineUpdated

      public void pipelineUpdated​(StaticPipelineEvent event)
      Description copied from interface: StaticPipelineListener
      Called when a static change is made to a pipeline.
      Specified by:
      pipelineUpdated in interface StaticPipelineListener
    • getDynamicModelNode

      public InterfaceTreeNode getDynamicModelNode()
    • getShapeModelNode

      public InterfaceTreeNode getShapeModelNode()
    • getNameMapNode

      public InterfaceTreeNode getNameMapNode()
    • getDataSourceNode

      public InterfaceTreeNode getDataSourceNode()
    • getGraphNode

      public InterfaceTreeNode getGraphNode()
    • getVariablesNode

      public InterfaceTreeNode getVariablesNode()
    • getQueriesNode

      public InterfaceTreeNode getQueriesNode()
    • updateDataSourceNode

      public void updateDataSourceNode()
    • updateTreeNodes

      public void updateTreeNodes()
      Overrides:
      updateTreeNodes in class AbstractInterfaceObject
    • updateObjectTree

      public void updateObjectTree()
    • findInterfaceObjectForName

      public InterfaceObject findInterfaceObjectForName​(java.lang.String object_name, java.lang.String object_class)
      Searches all InterfaceObjects in this panel for one which matches object_name and object_class; returns the first instance, or null if not found (or some exception is encountered)
      Parameters:
      object_name -
      object_class -
    • endSession

      public void endSession()
    • toString

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

      public void tabbedDisplayChanged​(TabbedDisplayEvent e)
      Fires a TabbedDisplayEvent for each loaded graphics window
      Specified by:
      tabbedDisplayChanged in interface TabbedDisplayListener
    • 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 progressBar) 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
      progressBar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progressBar) 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
      progressBar - 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