Package chemaxon.marvin.space
Class MSpaceEasy
java.lang.Object
chemaxon.marvin.space.MSpaceEasy
- All Implemented Interfaces:
chemaxon.marvin.util.CallbackIface
Easy-to-use functions of MarvinSpace, customizable gui for applets and
applications. Reaching basic functions, loading molecules from files,
setting the draw properties of MarvinSpace.
- Since:
- Marvin 4.0.2
-
Field Summary
Modifier and TypeFieldDescriptionprotected JFrame
protected JSplitPane
protected chemaxon.marvin.space.gui.JMSpaceMenuBar
Deprecated, for removal: This API element is subject to removal in a future version.protected chemaxon.marvin.space.gui.JMSpaceOptionsDialog
Deprecated, for removal: This API element is subject to removal in a future version.protected chemaxon.marvin.space.gui.JMSpacePopupMenu
protected chemaxon.marvin.space.gui.JMSpaceProgressBar
Deprecated, for removal: This API element is subject to removal in a future version.protected chemaxon.marvin.space.gui.JMSpaceTree
protected chemaxon.marvin.space.gui.JMSpaceToolBar
Deprecated, for removal: This API element is subject to removal in a future version.protected static boolean
-
Constructor Summary
ConstructorDescriptionCreates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container.MSpaceEasy
(boolean install) Deprecated, for removal: This API element is subject to removal in a future version.MSpaceEasy
(boolean install, boolean verbose, URL codebase) Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy()
andsetVerbose(boolean)
instead.MSpaceEasy
(int rowCount, int columnCount) Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container.MSpaceEasy
(int rowCount, int columnCount, boolean install) Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy(int, int)
instead.MSpaceEasy
(int rowCount, int columnCount, boolean install, boolean verboseMsg, URL codebase) Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy(int, int)
andsetVerbose(boolean)
instead. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the basic MarvinSpace viewer to the container.void
addMenuBar
(RootPaneContainer frame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.addMolecule
(Molecule mol) Adds aMolecule
object to the actual cell of the viewer.Reads the molecule file, and adds molecule component(s) to the actual cell of the viewer.addMoleculeTo
(Molecule mol, int cellIndex) Makes the given cell to be the active cell, and adds the molecule to it.Adds the molecule to the next empty cell, or creates a new empty cell if all existing cell contains at least 1 component.Reads the molecule, and adds molecule(s) to the next empty cell of the viewer, creating new cell if necessary.addMoleculeWithoutChange
(Molecule mol, boolean reset) Adds aMolecule
object to the actual cell of the viewer and resets the view only if required.void
Loads a pdb file from the RCSB Protein Data Bank (http://www.rcsb.org/)void
Adds the basic MarvinSpace popup menu to the JPanel.void
addPopupMenu
(JPopupMenu popup) void
addSelectionPanel
(RootPaneContainer appletOrFrame) Adds the basic MarvinSpace selection panel to the container.void
addSelectionPanelAndProgressBar
(RootPaneContainer appletOrFrame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.void
addToolBar
(RootPaneContainer appletOrFrame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Deprecated, for removal: This API element is subject to removal in a future version.Call the appropriate methods directly.Activates the container cell of theMoleculeVisualizer
, and computes its Connolly surface.computeSurface
(String type) Computes the given type of surface in the active cell of the viewer.createSelectionPanel
(int maxSize) Adds the basic MarvinSpace selection panel to the container.Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.chemaxon.marvin.space.MSpaceEventHandler
Returns the actual event handler of MarvinSpace.Returns theGraphicScene
of MarvinSpace to be able to explicitly set more advanced features.static InputStream
Creates anInputStream
from the givenString
.static MolInputStream
Creates aMolInputStream
from the givenString
to be able to manually add molecules to the event handler.static String
getRCSBLink
(String pdbId) Returns the URL of the RCSB databasestatic String
getRCSBLink
(String pdbId, boolean compressed) Returns the URL of the RCSB databasestatic boolean
Tells whether the given path is an URL (Uniform Resource Locator) or not.void
mapPropertyFile
(String filename, float min, float max) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Closes all components from the viewer, and reads the molecule(s).void
processArguments
(int maxMolCount, ArrayList infileName, ArrayList molecules, boolean readStdIn, boolean multicell, boolean singleCell, Properties sceneProperties, String displayQuality) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.void
Reads a protein given as String.void
readPropertyFile
(String filename) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.void
refresh()
Makes all unprocessed event to be processed and makes the graphic canvas redraw.void
Removes all components from the scene.void
Activates the container cell of the component, removes it from the scene, and also from the selection panel if that exists.void
resetAll()
Resets view settings of all cells including rotation, zoom and shifting.void
setCellProperty
(String propertyName, String propertyValue) Sets a draw property of MarvinSpace that will affect the active cell only.void
setComponentProperty
(Object component, String propertyName, String propertyValue) Sets a draw property of MarvinSpace that will affect only the given component.static void
setIconImage
(JFrame frame) Sets the MarvinSpace icon to the frame.void
setLayout
(int rowCount, int columnCount) Sets the number of rows and columns of cells the viewport is sepearted to.void
setProperty
(String propertyName, String propertyValue) Sets a draw property of MarvinSpace.void
setSize
(int w, int h) Sets the physical size of the graphic canvas.void
setVerbose
(boolean flag) Sets whether writing technical details to console is enabled or not.
-
Field Details
-
toolbar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected chemaxon.marvin.space.gui.JMSpaceToolBar toolbarDeprecated, for removal: This API element is subject to removal in a future version. -
popup
protected chemaxon.marvin.space.gui.JMSpacePopupMenu popup -
selectionBar
protected chemaxon.marvin.space.gui.JMSpaceTree selectionBar -
progressBar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected chemaxon.marvin.space.gui.JMSpaceProgressBar progressBarDeprecated, for removal: This API element is subject to removal in a future version. -
jSplitPane1
-
optionsDialog
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) protected chemaxon.marvin.space.gui.JMSpaceOptionsDialog optionsDialogDeprecated, for removal: This API element is subject to removal in a future version. -
containerFrame
-
verbose
protected static boolean verbose
-
Constructor Details
-
MSpaceEasy
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Throws:
Exception
- on installation failure
-
MSpaceEasy
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public MSpaceEasy(boolean install) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy()
instead. The "install" argument is ignored.Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Parameters:
install
- should Jogl libraries be loaded or they are already loaded- Throws:
Exception
- on installation failure
-
MSpaceEasy
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public MSpaceEasy(int rowCount, int columnCount, boolean install) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy(int, int)
instead. The "install" argument is ignored.Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Parameters:
rowCount
- number of cells of the viewer in vertical directioncolumnCount
- number of cells of the viewer in horizontal directioninstall
- should Jogl libraries be loaded or they are already loaded- Throws:
Exception
- on installation failure
-
MSpaceEasy
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public MSpaceEasy(boolean install, boolean verbose, URL codebase) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy()
andsetVerbose(boolean)
instead. The "install" and "codebase" arguments are ignored.Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Parameters:
install
- should Jogl libraries be loaded or they are already loadedverbose
- should technical details be writed to the console or notcodebase
- in case of applets codebase is required for installing- Throws:
Exception
- on installation failure
-
MSpaceEasy
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public MSpaceEasy(int rowCount, int columnCount, boolean install, boolean verboseMsg, URL codebase) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.UseMSpaceEasy(int, int)
andsetVerbose(boolean)
instead. The "install" and "codebase" arguments are ignored.Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Parameters:
rowCount
- number of cells of the viewer in vertical directioncolumnCount
- number of cells of the viewer in horizontal directioninstall
- should Jogl libraries be loaded or they are already loadedverboseMsg
- should technical details be written to the console or notcodebase
- in case of applets codebase is required for installing- Throws:
Exception
- on installation failure
-
MSpaceEasy
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any swing container. SeeaddSelectionPanel(javax.swing.RootPaneContainer)
,addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,addCanvas(java.awt.Container)
.- Parameters:
rowCount
- number of cells of the viewer in vertical directioncolumnCount
- number of cells of the viewer in horizontal direction- Throws:
Exception
- on installation failure
-
-
Method Details
-
isURL
Tells whether the given path is an URL (Uniform Resource Locator) or not.- Parameters:
path
- String to be recognized as an URL expression- Returns:
- true if the given string starts with a specific expression
-
setIconImage
Sets the MarvinSpace icon to the frame.- Parameters:
frame
- a JFrame to set mspace icon to
-
setLayout
Sets the number of rows and columns of cells the viewport is sepearted to.- Parameters:
rowCount
- number of cells of the viewer in vertical directioncolumnCount
- number of cells of the viewer in horizontal direction- Throws:
Exception
- if the graphic canvas couldn't be initialized
-
setVerbose
public void setVerbose(boolean flag) Sets whether writing technical details to console is enabled or not.- Parameters:
flag
- verbosing is enabled or not
-
setSize
public void setSize(int w, int h) Sets the physical size of the graphic canvas.- Parameters:
w
- width of the panel in pixelsh
- height of the panel in pixels
-
addMenuBar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void addMenuBar(RootPaneContainer frame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Adds the basic MarvinSpace menubar to the container. Note that the menubar itself is not customizable yet.- Parameters:
frame
- the container swing component of the JPanel
-
addToolBar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void addToolBar(RootPaneContainer appletOrFrame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Adds the basic MarvinSpace toolbar to the container. Note that the toolbar itself is not customizable yet.- Parameters:
appletOrFrame
- the container swing component of the JPanel
-
addPopupMenu
public void addPopupMenu()Adds the basic MarvinSpace popup menu to the JPanel. Note that the popup menu itself is not customizable yet. -
addPopupMenu
-
addSelectionPanel
Adds the basic MarvinSpace selection panel to the container. The viewer itself is a JPanel with the OpenGL2 canvas. The viewer and the selection panel will be embedded in a JSplitPane. // * Note that for technical reasons the selection panel is essential to add now.- Parameters:
appletOrFrame
- the container swing component of the JPanel
-
addSelectionPanelAndProgressBar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void addSelectionPanelAndProgressBar(RootPaneContainer appletOrFrame) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Adds the basic MarvinSpace selection panel to the container. The viewer itself is a JPanel with the OpenGL2 canvas. The viewer and the selection panel will be embedded in a JSplitPane. // * Note that for technical reasons the selection panel is essential to add now.- Parameters:
appletOrFrame
- the container swing component of the JPanel
-
createSelectionPanel
Adds the basic MarvinSpace selection panel to the container. The viewer itself is a JPanel with the OpenGL2 canvas. The viewer and the selection panel will be added directly on graphicScene.- Returns:
- JPanel containing the canvas and the selection panel
-
createSelectionPanelAndProgressBar
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public JPanel createSelectionPanelAndProgressBar()Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Adds the basic MarvinSpace selection panel to the container. The viewer itself is a JPanel with the OpenGL2 canvas. The viewer and the selection panel will be embedded in a JSplitPane.- Returns:
- JPanel containing the canvas and the selection panel in a JSplitPane
-
addCanvas
Adds the basic MarvinSpace viewer to the container. The viewer itself is a JPanel with the OpenGL2 canvas.- Parameters:
container
- the container swing component of the JPanel
-
setProperty
Sets a draw property of MarvinSpace. To see available properties, value ranges and default values, please visit this page.- Parameters:
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as aString
-
setCellProperty
Sets a draw property of MarvinSpace that will affect the active cell only. To see available properties, value ranges and default values, please visit this page.- Parameters:
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as aString
-
setComponentProperty
Sets a draw property of MarvinSpace that will affect only the given component. To see available properties, value ranges and default values, please visit this page.- Parameters:
component
- this must be aUsableObject
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as aString
-
addPDB
Loads a pdb file from the RCSB Protein Data Bank (http://www.rcsb.org/)- Parameters:
pdbId
- PDB ID used by the RSCB PDB- Throws:
IOException
- if connecting RCSB failsException
-
readPDB
Reads a protein given as String.- Parameters:
s
- String content of a PDB file- Throws:
Exception
- when reading or adding component fails
-
getRCSBLink
Returns the URL of the RCSB database- Parameters:
pdbId
- the 4 letter id of a protein, e.g. 1AID- Returns:
- the full URL to the required protein
-
getRCSBLink
Returns the URL of the RCSB database- Parameters:
pdbId
- the 4 letter id of a protein, e.g. 1AIDcompressed
- whether the protein is required in gzipped format- Returns:
- the full URL to the required protein
-
addMolecule
Reads the molecule file, and adds molecule component(s) to the actual cell of the viewer.- Parameters:
s
- url or filename or molecule as String- Returns:
- list of read molecules
- Throws:
Exception
- when reading file or adding component fails
-
addMoleculeToEmptyCell
Reads the molecule, and adds molecule(s) to the next empty cell of the viewer, creating new cell if necessary.- Parameters:
s
- url or filename or molecule as String- Returns:
- list of read molecules
- Throws:
Exception
- when reading adding component fails
-
openMolecule
Closes all components from the viewer, and reads the molecule(s).- Parameters:
s
- url or filename or molecule as String- Returns:
- list of read molecules
- Throws:
Exception
- when reading or adding component fails
-
addMolecule
Adds aMolecule
object to the actual cell of the viewer.- Parameters:
mol
-Molecule
object that will be cleaned and hydrogenized if necessary.- Returns:
MoleculeComponent
that is the visualizer component of the molecule.- Throws:
Exception
- if adding component fails
-
addMoleculeWithoutChange
Adds aMolecule
object to the actual cell of the viewer and resets the view only if required.- Parameters:
mol
-Molecule
object that won't be cleaned, hydrogenized or aromatized.reset
- whether resetting the view is required, seeresetAll()
.- Returns:
MoleculeComponent
that is the visualizer component of the molecule- Throws:
Exception
- if adding component fails
-
addMoleculeToEmptyCell
Adds the molecule to the next empty cell, or creates a new empty cell if all existing cell contains at least 1 component.- Parameters:
mol
-Molecule
object that will be cleaned and hydrogenized if it is necessary.- Returns:
MoleculeComponent
that is the visualizer component of the molecule- Throws:
Exception
- if adding component fails
-
addMoleculeTo
Makes the given cell to be the active cell, and adds the molecule to it.- Parameters:
mol
-Molecule
object that will be cleaned and hydrogenized if it is necessary.cellIndex
- internal index of the cell- Returns:
MoleculeComponent
that is the visualizer component of the molecule- Throws:
Exception
- if adding component fails
-
removeComponent
Activates the container cell of the component, removes it from the scene, and also from the selection panel if that exists.- Parameters:
gc
- component to remove
-
removeAllComponents
public void removeAllComponents()Removes all components from the scene. -
computeSurface
Activates the container cell of theMoleculeVisualizer
, and computes its Connolly surface.- Parameters:
mv
- seeMacroMoleculeComponent.MoleculeVisualizer
- Returns:
MolecularSurfaceComponent
that is the visualizer component of molecular surface.
-
computeSurface
Computes the given type of surface in the active cell of the viewer. Note that spaces and other delimiters are allowed in the parameter.- Parameters:
type
- "van der Waals", "Solvent-accessible", "Connolly", "Blobby"- Returns:
- the computed surface
-
readPropertyFile
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void readPropertyFile(String filename) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature. -
mapPropertyFile
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void mapPropertyFile(String filename, float min, float max) Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Maps the given property file (Gaussian or Charmm) to a previously read or computed molecular surface and sets minimum and maximum values as visualization setting of the surface coloring. This function is equivalent of the following:eventHandler.readPropertyFile( filename ); graphicScene.processEvent("Palette.Minimum", ""+min); graphicScene.processEvent("Palette.Maximum", ""+max); eventHandler.refresh();
- Parameters:
filename
- url of the property file to be mappedmin
- values less than the minimum will be colored by the color of the minimum valuemax
- values greater than the maximum will be colored by the color of the maximum value
-
refresh
public void refresh()Makes all unprocessed event to be processed and makes the graphic canvas redraw.- Since:
- Marvin 4.1
-
resetAll
public void resetAll()Resets view settings of all cells including rotation, zoom and shifting. Takes effect at the next redraw because of threading issues.- Since:
- Marvin 4.1
-
processArguments
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void processArguments(int maxMolCount, ArrayList infileName, ArrayList molecules, boolean readStdIn, boolean multicell, boolean singleCell, Properties sceneProperties, String displayQuality) throws Exception Deprecated, for removal: This API element is subject to removal in a future version.No longer supported feature.Processes the command line arguments of MarvinSpace listed below.- Parameters:
maxMolCount
- maximum number of molecules that can be displayed at a timeinfileName
- list of molecule files that should be readmolecules
- molecule objects to be readreadStdIn
- if input molecules should be read from the standard inputmulticell
- whether the read molecules should be put in different cells or asksingleCell
- whether the read molecules should be put in one cells or asksceneProperties
- a set of drawing propertiesdisplayQuality
- requires display quality, can be "High", "Medium" or "Low"- Throws:
Exception
- if processing an argument fails
-
getMolInputStream
Creates aMolInputStream
from the givenString
to be able to manually add molecules to the event handler.- Parameters:
s
- url or absolute filename or a molecule as String- Returns:
- MolInputStream to read the molecules from
- Throws:
IOException
- if an I/O exception occurs- Since:
- Marvin 4.0.3
-
getInputStream
Creates anInputStream
from the givenString
. TheInputStream
is either aMonitorableInputStream
orFileInputStream
orByteArrayInputStream
.- Parameters:
s
- url or absolute filename or String- Returns:
- InputStream
- Throws:
IOException
- if an I/O exception occurs
-
getEventHandler
public chemaxon.marvin.space.MSpaceEventHandler getEventHandler()Returns the actual event handler of MarvinSpace.- Returns:
- handler of advanced events
- Since:
- Marvin 4.1
-
getGraphicScene
Returns theGraphicScene
of MarvinSpace to be able to explicitly set more advanced features. It is necessary if features given byMSpaceEasy
is not enough for the required action.- Returns:
- the top level visualizer class
- Since:
- Marvin 4.1
-
callback
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public Object callback(String method, Object arg) Deprecated, for removal: This API element is subject to removal in a future version.Call the appropriate methods directly.Callback function to make avoiding direct calls easier.- Specified by:
callback
in interfacechemaxon.marvin.util.CallbackIface
- Parameters:
method
- name ofMSpaceEasy
methodarg
-Object[]
orObject
ornull
- Returns:
- the return object of the function or the Exception if there is any
-
MSpaceEasy()
instead.