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 classInterfaceWorkspace.CollectionTreeNodeNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected InterfaceComboPanelcomboPanelprotected AttributeDialogBoxcurrent_attribute_dialogprotected AttributeDialogBoxcurrent_shape_attribute_dialogprotected ShapeModel3Dcurrent_shape_modelprotected java.util.ArrayList<DataSource>dataSourcesprotected InterfaceDisplayPaneldisplay_panelprotected java.util.ArrayList<InterfaceAbstractGraph>graphsprotected java.util.ArrayList<DataInputStream<?>>input_streamsprotected java.util.ArrayList<InterfaceAbstractModel>modelsprotected InterfaceTreePanelobjectTreeprotected java.util.ArrayList<DataOutputStream<?>>output_streamsprotected java.util.HashMap<java.lang.String,InterfacePipeline>pipelinesprotected InterfaceTreeNodepipelinesNodeprotected java.util.ArrayList<InterfacePlot<?>>plotsprotected java.util.HashMap<java.lang.String,InterfaceProject>projectsprotected java.util.ArrayList<InterfaceQuery>queriesprotected InterfaceTreeNodequeriesNodeprotected java.util.ArrayList<ShapeSelectionSet>selectionSetsprotected java.util.ArrayList<ShapeModel3D>shape_modelsprotected java.util.ArrayList<VariableInt<?>>variablesprotected InterfaceTreeNodevariablesNodeprotected java.util.TreeSet<Video>videosprotected java.util.TreeSet<View3D>views3DFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description InterfaceWorkspace() -
Method Summary
Modifier and Type Method Description booleanaddDataSource(DataSource ds)voidaddDynamicModel(InterfaceAbstractModel model)voidaddGraph(InterfaceAbstractGraph graph)voidaddInputStream(DataInputStream<?> s)voidaddModel(InterfaceAbstractModel model)voidaddOutputStream(DataOutputStream<?> s)booleanaddPipeline(InterfacePipeline pipeline)Adds a pipeline to this workspace.voidaddPlot(InterfacePlot<?> p)voidaddProject(InterfaceProject project)voidaddQuery(InterfaceQuery q)booleanaddShapeModel(ShapeModel3D model, boolean set_current)Addsmodelto thisbooleanaddShapeModel(ShapeModel3D model, boolean set_current, boolean rename)Addsmodelto thisvoidaddVariable(VariableInt<?> v)voidaddVideo(Video video)View3DaddView3D(View3D view)voidendSession()InterfaceObjectfindInterfaceObjectForName(java.lang.String object_name, java.lang.String object_class)Searches all InterfaceObjects in this panel for one which matchesobject_nameandobject_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.AttributeDialogBoxgetCurrentAttributeDialog()AttributeDialogBoxgetCurrentShapeAttributeDialog()ShapeModel3DgetCurrentShapeModel()Returns the current shape model for this Workspace, ornullif there is no current model.DataSourcegetDataSource(java.lang.String ds)InterfaceTreeNodegetDataSourceNode()java.util.ArrayList<DataSource>getDataSources()Returns a list of all data sources associated with this workspace.InterfaceDisplayPanelgetDisplayPanel()java.lang.StringgetDTD()Returns the Data Type Declaration (DTD) for this object's XML representationInterfaceTreeNodegetDynamicModelNode()java.util.ArrayList<InterfaceAbstractModel>getDynamicModels()InterfaceTreeNodegetGraphNode()java.util.ArrayList<InterfaceAbstractGraph>getGraphs()java.util.ArrayList<InterfacePanel>getInterfacePanels()java.lang.StringgetLocalName()Returns the local name associated with this XML object.InterfaceTreeNodegetNameMapNode()javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfacePipelinegetPipeline(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.InterfaceTreeNodegetPipelinesNode()java.util.ArrayList<InterfacePlot<?>>getPlots()InterfaceProjectgetProject(java.lang.String name)java.util.ArrayList<InterfaceProject>getProjects()InterfaceTreeNodegetProjectsNode()java.util.ArrayList<InterfaceQuery>getQueries()InterfaceTreeNodegetQueriesNode()java.util.ArrayList<ShapeSelectionSet>getSelectionSets()Returns a list of all selection sets currently in this workspace.InterfaceShapegetShapeForName(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.ShapeModel3DgetShapeModel(java.lang.String name)Returns the model with the given name, if it exists; returnsnullotherwise.InterfaceTreeNodegetShapeModelNode()java.util.ArrayList<ShapeModel3D>getShapeModels()java.lang.StringgetShortXML(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.InterfaceTreeNodegetVariablesNode()java.util.ArrayList<Video>getVideos()java.util.ArrayList<Video3D>getVideos3D()View3DgetView3D(java.lang.String name)java.util.ArrayList<View3D>getViews3D()java.lang.StringgetXML()Returns this object's XML representation as a single string.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.java.lang.StringgetXMLSchema()Returns the XML schema for this object's XML representationvoidhandleXMLElementEnd(java.lang.String localName)Handles the end of an XML element.voidhandleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)Handles the start of an XML element.voidhandleXMLString(java.lang.String s)Handles a string within an XML element.booleanmodelExists(ShapeModel3D model)voidpipelineUpdated(StaticPipelineEvent event)Called when a static change is made to a pipeline.voidpopulateShapeCombo(javax.swing.JComboBox combo_box)voidpopulateShapeSetCombo(javax.swing.JComboBox combo_box)voidpopulateShapeTypeCombo(javax.swing.JComboBox combo_box, Shape3DInt shape)voidremoveDataSource(DataSource ds)voidremoveDynamicModel(InterfaceAbstractModel model)voidremoveGraph(InterfaceAbstractGraph graph)voidremoveModel(InterfaceAbstractModel model)voidremovePipeline(InterfacePipeline pipeline)voidremovePlot(InterfacePlot<?> v)voidremoveQuery(InterfaceQuery q)voidremoveShapeModel(ShapeModel3D model)voidremoveVariable(VariableInt<?> v)voidremoveVideo(Video video)voidremoveView3D(View3D view)voidsetComboPanel(InterfaceComboPanel panel)booleansetCurrentShapeModel(java.lang.String name)Sets the current shape model for this Workspace.voidsetDisplayPanel(InterfaceDisplayPanel display_panel)voidsetObjectTree(InterfaceTreePanel treePanel)voidsetTreeNode(InterfaceTreeNode treeNode)Sets the children for this node'sInterfaceTreeNode.voidshapeModelChanged(ShapeModelEvent event)Fired when aShapeModel3Dis changed in some way.voidshowAttributeDialog(AttributeObject object)voidtabbedDisplayChanged(TabbedDisplayEvent e)Fires aTabbedDisplayEventfor each loaded graphics windowjava.lang.StringtoString()voidupdateDataSourceNode()voidupdateObjectTree()voidupdateTreeNodes()voidwriteXML(int tab, java.io.Writer writer)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progressBar)Writes the XML representation of this object to file, asXMLType.Normal.voidwriteXML(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, setNameMethods 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:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin 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
Addsmodelto this- Parameters:
model- The model to addset_current- Whether to set this as the current model
-
addShapeModel
Addsmodelto 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, ornullif 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:
trueif successful
-
removeShapeModel
-
modelExists
-
getShapeModels
-
shapeModelChanged
Description copied from interface:ShapeModel3DListenerFired when aShapeModel3Dis changed in some way. The specific change is indicated by theEventTypeof the ShapeModelEvent.- Specified by:
shapeModelChangedin 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; returnsnullotherwise.- 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:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein 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:
falseif a pipeline with the same name already exists.
-
removePipeline
-
pipelineUpdated
Description copied from interface:StaticPipelineListenerCalled when a static change is made to a pipeline.- Specified by:
pipelineUpdatedin interfaceStaticPipelineListener
-
getDynamicModelNode
-
getShapeModelNode
-
getNameMapNode
-
getDataSourceNode
-
getGraphNode
-
getVariablesNode
-
getQueriesNode
-
updateDataSourceNode
public void updateDataSourceNode() -
updateTreeNodes
public void updateTreeNodes()- Overrides:
updateTreeNodesin 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_nameandobject_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:
toStringin classjava.lang.Object
-
tabbedDisplayChanged
Fires aTabbedDisplayEventfor each loaded graphics window- Specified by:
tabbedDisplayChangedin interfaceTabbedDisplayListener
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObjectReturns 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:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein interfaceXMLObject- Returns:
-
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObjectReturns a short XML representation of this object.- Specified by:
getShortXMLin interfaceXMLObject- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObjectReturns 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:XMLObjectReturns 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:XMLObjectReturns the XML schema for this object's XML representation- Specified by:
getXMLSchemain interfaceXMLObject- Returns:
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName)Description copied from interface:XMLObjectHandles the end of an XML element.- Specified by:
handleXMLElementEndin 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:XMLObjectHandles the start of an XML element.- Specified by:
handleXMLElementStartin interfaceXMLObject- Parameters:
localName- Local name of the elementattributes- Set of element attributestype- TheXMLTypeof this element
-
handleXMLString
public void handleXMLString(java.lang.String s)Description copied from interface:XMLObjectHandles a string within an XML element.- Specified by:
handleXMLStringin 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:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill 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:XMLObjectWrites 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.Asciiwill be used. -
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites 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.Asciiwill be used.
-