Package mgui.interfaces
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InterfaceWorkspace.CollectionTreeNode
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected InterfaceComboPanel
comboPanel
protected AttributeDialogBox
current_attribute_dialog
protected AttributeDialogBox
current_shape_attribute_dialog
protected ShapeModel3D
current_shape_model
protected java.util.ArrayList<DataSource>
dataSources
protected InterfaceDisplayPanel
display_panel
protected java.util.ArrayList<InterfaceAbstractGraph>
graphs
protected java.util.ArrayList<DataInputStream<?>>
input_streams
protected java.util.ArrayList<InterfaceAbstractModel>
models
protected InterfaceTreePanel
objectTree
protected java.util.ArrayList<DataOutputStream<?>>
output_streams
protected java.util.HashMap<java.lang.String,InterfacePipeline>
pipelines
protected InterfaceTreeNode
pipelinesNode
protected java.util.ArrayList<InterfacePlot<?>>
plots
protected java.util.HashMap<java.lang.String,InterfaceProject>
projects
protected java.util.ArrayList<InterfaceQuery>
queries
protected InterfaceTreeNode
queriesNode
protected java.util.ArrayList<ShapeSelectionSet>
selectionSets
protected java.util.ArrayList<ShapeModel3D>
shape_models
protected java.util.ArrayList<VariableInt<?>>
variables
protected InterfaceTreeNode
variablesNode
protected java.util.TreeSet<Video>
videos
protected java.util.TreeSet<View3D>
views3D
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description InterfaceWorkspace()
-
Method Summary
Modifier and Type Method Description boolean
addDataSource(DataSource ds)
void
addDynamicModel(InterfaceAbstractModel model)
void
addGraph(InterfaceAbstractGraph graph)
void
addInputStream(DataInputStream<?> s)
void
addModel(InterfaceAbstractModel model)
void
addOutputStream(DataOutputStream<?> s)
boolean
addPipeline(InterfacePipeline pipeline)
Adds a pipeline to this workspace.void
addPlot(InterfacePlot<?> p)
void
addProject(InterfaceProject project)
void
addQuery(InterfaceQuery q)
boolean
addShapeModel(ShapeModel3D model, boolean set_current)
Addsmodel
to thisboolean
addShapeModel(ShapeModel3D model, boolean set_current, boolean rename)
Addsmodel
to thisvoid
addVariable(VariableInt<?> v)
void
addVideo(Video video)
View3D
addView3D(View3D view)
void
endSession()
InterfaceObject
findInterfaceObjectForName(java.lang.String object_name, java.lang.String object_class)
Searches all InterfaceObjects in this panel for one which matchesobject_name
andobject_class
; returns the first instance, or null if not found (or some exception is encountered)java.util.ArrayList<AttributeObject>
getAttributeObjects()
Returns a list of all the attribute objects contained in this workspace.java.util.ArrayList<DataSource>
getConnectedDataSources()
Returns a list of all connected data sources associated with this workspace.AttributeDialogBox
getCurrentAttributeDialog()
AttributeDialogBox
getCurrentShapeAttributeDialog()
ShapeModel3D
getCurrentShapeModel()
Returns the current shape model for this Workspace, ornull
if there is no current model.DataSource
getDataSource(java.lang.String ds)
InterfaceTreeNode
getDataSourceNode()
java.util.ArrayList<DataSource>
getDataSources()
Returns a list of all data sources associated with this workspace.InterfaceDisplayPanel
getDisplayPanel()
java.lang.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationInterfaceTreeNode
getDynamicModelNode()
java.util.ArrayList<InterfaceAbstractModel>
getDynamicModels()
InterfaceTreeNode
getGraphNode()
java.util.ArrayList<InterfaceAbstractGraph>
getGraphs()
java.util.ArrayList<InterfacePanel>
getInterfacePanels()
java.lang.String
getLocalName()
Returns the local name associated with this XML object.InterfaceTreeNode
getNameMapNode()
javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfacePipeline
getPipeline(java.lang.String name)
Returns the pipeline with the given name.java.util.ArrayList<InterfacePipeline>
getPipelines()
Returns a list of the pipelines contained in this workspace.InterfaceTreeNode
getPipelinesNode()
java.util.ArrayList<InterfacePlot<?>>
getPlots()
InterfaceProject
getProject(java.lang.String name)
java.util.ArrayList<InterfaceProject>
getProjects()
InterfaceTreeNode
getProjectsNode()
java.util.ArrayList<InterfaceQuery>
getQueries()
InterfaceTreeNode
getQueriesNode()
java.util.ArrayList<ShapeSelectionSet>
getSelectionSets()
Returns a list of all selection sets currently in this workspace.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.ShapeModel3D
getShapeModel(java.lang.String name)
Returns the model with the given name, if it exists; returnsnull
otherwise.InterfaceTreeNode
getShapeModelNode()
java.util.ArrayList<ShapeModel3D>
getShapeModels()
java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.VariableInt<?>
getVariableByName(java.lang.String name)
Returns the variable in this workspace corresponding to the given name.java.util.ArrayList<VariableObject>
getVariableObjects()
Returns a list of all objects in this workspace which are instances ofVariableObject
.java.util.ArrayList<VariableInt<?>>
getVariables()
Returns a list of all variables currently in this workspace.InterfaceTreeNode
getVariablesNode()
java.util.ArrayList<Video>
getVideos()
java.util.ArrayList<Video3D>
getVideos3D()
View3D
getView3D(java.lang.String name)
java.util.ArrayList<View3D>
getViews3D()
java.lang.String
getXML()
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.java.lang.String
getXMLSchema()
Returns the XML schema for this object's XML representationvoid
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.boolean
modelExists(ShapeModel3D model)
void
pipelineUpdated(StaticPipelineEvent event)
Called when a static change is made to a pipeline.void
populateShapeCombo(javax.swing.JComboBox combo_box)
void
populateShapeSetCombo(javax.swing.JComboBox combo_box)
void
populateShapeTypeCombo(javax.swing.JComboBox combo_box, Shape3DInt shape)
void
removeDataSource(DataSource ds)
void
removeDynamicModel(InterfaceAbstractModel model)
void
removeGraph(InterfaceAbstractGraph graph)
void
removeModel(InterfaceAbstractModel model)
void
removePipeline(InterfacePipeline pipeline)
void
removePlot(InterfacePlot<?> v)
void
removeQuery(InterfaceQuery q)
void
removeShapeModel(ShapeModel3D model)
void
removeVariable(VariableInt<?> v)
void
removeVideo(Video video)
void
removeView3D(View3D view)
void
setComboPanel(InterfaceComboPanel panel)
boolean
setCurrentShapeModel(java.lang.String name)
Sets the current shape model for this Workspace.void
setDisplayPanel(InterfaceDisplayPanel display_panel)
void
setObjectTree(InterfaceTreePanel treePanel)
void
setTreeNode(InterfaceTreeNode treeNode)
Sets the children for this node'sInterfaceTreeNode
.void
shapeModelChanged(ShapeModelEvent event)
Fired when aShapeModel3D
is changed in some way.void
showAttributeDialog(AttributeObject object)
void
tabbedDisplayChanged(TabbedDisplayEvent e)
Fires aTabbedDisplayEvent
for each loaded graphics windowjava.lang.String
toString()
void
updateDataSourceNode()
void
updateObjectTree()
void
updateTreeNodes()
void
writeXML(int tab, java.io.Writer writer)
Writes the XML representation of this object to file.void
writeXML(int tab, java.io.Writer writer, ProgressUpdater progressBar)
Writes the XML representation of this object to file, asXMLType.Normal
.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progressBar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getName, getTreeLabel, isDestroyed, issueTreeNode, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
display_panel
-
graphs
-
models
-
input_streams
-
output_streams
-
plots
-
variables
-
queries
-
views3D
-
videos
-
dataSources
-
selectionSets
-
shape_models
-
projects
-
pipelines
-
variablesNode
-
queriesNode
-
pipelinesNode
-
objectTree
-
comboPanel
-
current_attribute_dialog
-
current_shape_attribute_dialog
-
current_shape_model
-
-
Constructor Details
-
InterfaceWorkspace
public InterfaceWorkspace()
-
-
Method Details
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
getCurrentAttributeDialog
-
getCurrentShapeAttributeDialog
-
showAttributeDialog
-
getInterfacePanels
-
setComboPanel
-
populateShapeSetCombo
public void populateShapeSetCombo(javax.swing.JComboBox combo_box) -
populateShapeTypeCombo
-
populateShapeCombo
public void populateShapeCombo(javax.swing.JComboBox combo_box) -
getDisplayPanel
-
setDisplayPanel
-
addDataSource
-
removeDataSource
-
getDataSources
Returns a list of all data sources associated with this workspace.- Returns:
-
getConnectedDataSources
Returns a list of all connected data sources associated with this workspace.- Returns:
-
getDataSource
-
getVariableObjects
Returns a list of all objects in this workspace which are instances ofVariableObject
.- Returns:
-
getAttributeObjects
Returns a list of all the attribute objects contained in this workspace. NB. currently only returns all instances ofInterfaceShape
- Returns:
-
addModel
-
removeModel
-
addShapeModel
Addsmodel
to this- Parameters:
model
- The model to addset_current
- Whether to set this as the current model
-
addShapeModel
Addsmodel
to this- Parameters:
model
-set_current
-rename
- Whether to rename this model if one already exists with this name (iffalse
, this method will returnfalse
-
getCurrentShapeModel
Returns the current shape model for this Workspace, ornull
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
-
modelExists
-
getShapeModels
-
shapeModelChanged
Description copied from interface:ShapeModel3DListener
Fired when aShapeModel3D
is changed in some way. The specific change is indicated by theEventType
of the ShapeModelEvent.- Specified by:
shapeModelChanged
in interfaceShapeModel3DListener
-
getShapeForName
Searches the workspace for a shape with the given full name (i.e., {model}.{sets}.{shape_name}), and returns it if found. Otherwise returnsnull
.- Parameters:
full_name
-- Returns:
-
getShapeModel
Returns the model with the given name, if it exists; returnsnull
otherwise.- Parameters:
name
-- Returns:
-
getDynamicModels
-
addDynamicModel
-
removeDynamicModel
-
addGraph
-
removeGraph
-
getGraphs
-
addVariable
-
removeVariable
-
getVariables
Returns a list of all variables currently in this workspace.- Returns:
-
getVariableByName
Returns the variable in this workspace corresponding to the given name.- Parameters:
name
-- Returns:
-
getSelectionSets
Returns a list of all selection sets currently in this workspace. -
addQuery
-
removeQuery
-
getQueries
-
addInputStream
-
addOutputStream
-
addPlot
-
removePlot
-
getPlots
-
addProject
-
getProject
-
getViews3D
-
getView3D
-
addView3D
-
removeView3D
-
getVideos3D
-
getVideos
-
addVideo
-
removeVideo
-
setObjectTree
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
-
getProjectsNode
-
getProjects
-
getPipelinesNode
-
getPipelines
Returns a list of the pipelines contained in this workspace.- Returns:
-
getPipeline
Returns the pipeline with the given name.- Parameters:
name
-- Returns:
-
addPipeline
Adds a pipeline to this workspace.- Parameters:
pipeline
-- Returns:
false
if a pipeline with the same name already exists.
-
removePipeline
-
pipelineUpdated
Description copied from interface:StaticPipelineListener
Called when a static change is made to a pipeline.- Specified by:
pipelineUpdated
in interfaceStaticPipelineListener
-
getDynamicModelNode
-
getShapeModelNode
-
getNameMapNode
-
getDataSourceNode
-
getGraphNode
-
getVariablesNode
-
getQueriesNode
-
updateDataSourceNode
public void updateDataSourceNode() -
updateTreeNodes
public void updateTreeNodes()- Overrides:
updateTreeNodes
in classAbstractInterfaceObject
-
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 matchesobject_name
andobject_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 classjava.lang.Object
-
tabbedDisplayChanged
Fires aTabbedDisplayEvent
for each loaded graphics window- Specified by:
tabbedDisplayChanged
in interfaceTabbedDisplayListener
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObject
Returns the Data Type Declaration (DTD) for this object's XML representationSee http://en.wikipedia.org/wiki/Document_Type_Definition for a description.
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- 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 interfaceXMLObject
- 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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
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 theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file. -
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObject
Returns the XML schema for this object's XML representation- Specified by:
getXMLSchema
in interfaceXMLObject
- 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 interfaceXMLObject
- 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 interfaceXMLObject
- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
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 interfaceXMLObject
- Parameters:
s
- String to handle
-
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progressBar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file, asXMLType.Normal
. The default format ofXMLFormat.Ascii
will be used. The basic contract for this method is that it should not write a newline character at its start or end. -
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progressBar) throws java.io.IOExceptionDescription 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 ofXMLFormat.Ascii
will be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription 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 ofXMLFormat.Ascii
will be used.
-