public class MSpaceEasy extends Object implements chemaxon.marvin.util.CallbackIface
Modifier and Type | Field and Description |
---|---|
protected JFrame |
containerFrame |
protected JSplitPane |
jSplitPane1 |
protected chemaxon.marvin.space.gui.JMSpaceMenuBar |
menubar |
protected chemaxon.marvin.space.gui.JMSpaceOptionsDialog |
optionsDialog |
protected chemaxon.marvin.space.gui.JMSpacePopupMenu |
popup |
protected chemaxon.marvin.space.gui.JMSpaceProgressBar |
progressBar |
protected chemaxon.marvin.space.gui.JMSpaceTree |
selectionBar |
protected chemaxon.marvin.space.gui.JMSpaceToolBar |
toolbar |
protected static boolean |
verbose |
Constructor and Description |
---|
MSpaceEasy(boolean install)
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any
swing container.
|
MSpaceEasy(boolean install,
boolean verbose,
URL codebase)
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any
swing container.
|
MSpaceEasy(int rowCount,
int columnCount,
boolean install)
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any
swing container.
|
MSpaceEasy(int rowCount,
int columnCount,
boolean install,
boolean verboseMsg,
URL codebase)
Creates the JPanel with the OpenGL2 canvas, but does not embed it in any
swing container.
|
Modifier and Type | Method and Description |
---|---|
void |
addCanvas(Container container)
Adds the basic MarvinSpace viewer to the container.
|
void |
addMenuBar(RootPaneContainer appletOrFrame)
Adds the basic MarvinSpace menubar to the container.
|
MoleculeComponent |
addMolecule(Molecule mol)
Adds a
Molecule object to the actual cell
of the viewer. |
ArrayList<Object> |
addMolecule(String s)
Reads the molecule file, and adds molecule component(s) to the actual cell of the viewer.
|
MoleculeComponent |
addMoleculeTo(Molecule mol,
int cellIndex)
Makes the given cell to be the active cell, and adds the molecule to it.
|
MoleculeComponent |
addMoleculeToEmptyCell(Molecule mol)
Adds the molecule to the next empty cell, or creates a new empty cell if all
existing cell contains at least 1 component.
|
ArrayList |
addMoleculeToEmptyCell(String s)
Reads the molecule, and adds molecule(s) to the next empty cell of the
viewer, creating new cell if necessary.
|
MoleculeComponent |
addMoleculeWithoutChange(Molecule mol,
boolean reset)
Adds a
Molecule object to the actual cell
of the viewer and resets the view only if required. |
void |
addPDB(String pdbId)
Loads a pdb file from the RCSB Protein Data Bank (http://www.rcsb.org/)
|
void |
addPopupMenu()
Adds the basic MarvinSpace popup menu to the JPanel.
|
void |
addSelectionPanel(RootPaneContainer appletOrFrame)
Adds the basic MarvinSpace selection panel to the container.
|
void |
addSelectionPanelAndProgressBar(RootPaneContainer appletOrFrame)
Adds the basic MarvinSpace selection panel to the container.
|
void |
addToolBar(RootPaneContainer appletOrFrame)
Adds the basic MarvinSpace toolbar to the container.
|
Object |
callback(String method,
Object arg)
Callback function to make avoiding direct calls easier.
|
MolecularSurfaceComponent |
computeSurface(MacroMoleculeComponent.MoleculeVisualizer mv)
Activates the container cell of the
MoleculeVisualizer , and
computes its Connolly surface. |
MolecularSurfaceComponent |
computeSurface(String type)
Computes the given type of surface in the active cell of the viewer.
|
JPanel |
createSelectionPanel(int maxSize)
Adds the basic MarvinSpace selection panel to the container.
|
JPanel |
createSelectionPanelAndProgressBar()
Adds the basic MarvinSpace selection panel to the container.
|
chemaxon.marvin.space.MSpaceEventHandler |
getEventHandler()
Returns the actual event handler of MarvinSpace.
|
GraphicScene |
getGraphicScene()
Returns the
GraphicScene of MarvinSpace to be able to explicitly
set more advanced features. |
static InputStream |
getInputStream(String s)
Creates an
InputStream from the given String . |
static MolInputStream |
getMolInputStream(String s)
Creates a
MolInputStream from the given String to
be able to manually add molecules to the event handler. |
static String |
getRCSBLink(String pdbId)
Returns the URL of the RCSB database
|
static String |
getRCSBLink(String pdbId,
boolean compressed)
Returns the URL of the RCSB database
|
static boolean |
isURL(String path)
Tells whether the given path is an URL (Uniform Resource Locator) or not.
|
void |
mapPropertyFile(String filename,
float min,
float max)
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.
|
ArrayList<Object> |
openMolecule(String s)
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)
Processes the command line arguments of MarvinSpace listed below.
|
void |
readPDB(String s)
Reads a protein given as String.
|
void |
readPropertyFile(String filename) |
void |
refresh()
Makes all unprocessed event to be processed and makes the graphic canvas redraw.
|
void |
removeAllComponents()
Removes all components from the scene.
|
void |
removeComponent(GraphicComponent gc)
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.
|
protected chemaxon.marvin.space.gui.JMSpaceMenuBar menubar
protected chemaxon.marvin.space.gui.JMSpaceToolBar toolbar
protected chemaxon.marvin.space.gui.JMSpacePopupMenu popup
protected chemaxon.marvin.space.gui.JMSpaceTree selectionBar
protected chemaxon.marvin.space.gui.JMSpaceProgressBar progressBar
protected JSplitPane jSplitPane1
protected chemaxon.marvin.space.gui.JMSpaceOptionsDialog optionsDialog
protected JFrame containerFrame
protected static boolean verbose
public MSpaceEasy(boolean install) throws Exception
addSelectionPanel(javax.swing.RootPaneContainer)
,
addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,
addCanvas(java.awt.Container)
.install
- should Jogl libraries be loaded or they are already loadedException
- on installation failurepublic MSpaceEasy(int rowCount, int columnCount, boolean install) throws Exception
addSelectionPanel(javax.swing.RootPaneContainer)
,
addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,
addCanvas(java.awt.Container)
.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 loadedException
- on installation failurepublic MSpaceEasy(boolean install, boolean verbose, URL codebase) throws Exception
addSelectionPanel(javax.swing.RootPaneContainer)
,
addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,
addCanvas(java.awt.Container)
.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 installingException
- on installation failurepublic MSpaceEasy(int rowCount, int columnCount, boolean install, boolean verboseMsg, URL codebase) throws Exception
addSelectionPanel(javax.swing.RootPaneContainer)
,
addSelectionPanelAndProgressBar(javax.swing.RootPaneContainer)
,
addCanvas(java.awt.Container)
.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 installingException
- on installation failurepublic static boolean isURL(String path)
path
- String to be recognized as an URL expressionpublic static void setIconImage(JFrame frame)
frame
- a JFrame to set mspace icon topublic void setLayout(int rowCount, int columnCount) throws Exception
rowCount
- number of cells of the viewer in vertical directioncolumnCount
- number of cells of the viewer in horizontal directionException
- if the graphic canvas couldn't be initializedpublic void setVerbose(boolean flag)
flag
- verbosing is enabled or notpublic void setSize(int w, int h)
w
- width of the panel in pixelsh
- height of the panel in pixelspublic void addMenuBar(RootPaneContainer appletOrFrame)
appletOrFrame
- the container swing component of the JPanelpublic void addToolBar(RootPaneContainer appletOrFrame)
appletOrFrame
- the container swing component of the JPanelpublic void addPopupMenu()
public void addSelectionPanel(RootPaneContainer appletOrFrame)
appletOrFrame
- the container swing component of the JPanelpublic void addSelectionPanelAndProgressBar(RootPaneContainer appletOrFrame)
appletOrFrame
- the container swing component of the JPanelpublic JPanel createSelectionPanel(int maxSize)
public JPanel createSelectionPanelAndProgressBar()
public void addCanvas(Container container)
container
- the container swing component of the JPanelpublic void setProperty(String propertyName, String propertyValue)
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as a String
public void setCellProperty(String propertyName, String propertyValue)
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as a String
public void setComponentProperty(Object component, String propertyName, String propertyValue)
component
- this must be a UsableObject
propertyName
- identifier of a draw propertypropertyValue
- value of the property to be set given as a String
public void addPDB(String pdbId) throws Exception
pdbId
- PDB ID used by the RSCB PDBIOException
- if connecting RCSB failsException
public void readPDB(String s) throws Exception
s
- String content of a PDB fileException
- when reading or adding component failspublic static String getRCSBLink(String pdbId)
pdbId
- the 4 letter id of a protein, e.g. 1AIDpublic static String getRCSBLink(String pdbId, boolean compressed)
pdbId
- the 4 letter id of a protein, e.g. 1AIDcompressed
- whether the protein is required in gzipped formatpublic ArrayList<Object> addMolecule(String s) throws Exception
s
- url or filename or molecule as StringException
- when reading file or adding component failspublic ArrayList addMoleculeToEmptyCell(String s) throws Exception
s
- url or filename or molecule as StringException
- when reading adding component failspublic ArrayList<Object> openMolecule(String s) throws Exception
s
- url or filename or molecule as StringException
- when reading or adding component failspublic MoleculeComponent addMolecule(Molecule mol) throws Exception
Molecule
object to the actual cell
of the viewer.mol
- Molecule
object that will be cleaned
and hydrogenized if necessary.MoleculeComponent
that is the visualizer
component of the molecule.Exception
- if adding component failspublic MoleculeComponent addMoleculeWithoutChange(Molecule mol, boolean reset) throws Exception
Molecule
object to the actual cell
of the viewer and resets the view only if required.mol
- Molecule
object that won't be cleaned,
hydrogenized or aromatized.reset
- whether resetting the view is required, see resetAll()
.MoleculeComponent
that is the visualizer
component of the moleculeException
- if adding component failspublic MoleculeComponent addMoleculeToEmptyCell(Molecule mol) throws Exception
mol
- Molecule
object that will be cleaned and hydrogenized
if it is necessary.MoleculeComponent
that is the visualizer component of the moleculeException
- if adding component failspublic MoleculeComponent addMoleculeTo(Molecule mol, int cellIndex) throws Exception
mol
- Molecule
object that will be cleaned and hydrogenized
if it is necessary.cellIndex
- internal index of the cellMoleculeComponent
that is the visualizer component of the moleculeException
- if adding component failspublic void removeComponent(GraphicComponent gc)
gc
- component to removepublic void removeAllComponents()
public MolecularSurfaceComponent computeSurface(MacroMoleculeComponent.MoleculeVisualizer mv)
MoleculeVisualizer
, and
computes its Connolly surface.mv
- see MacroMoleculeComponent.MoleculeVisualizer
MolecularSurfaceComponent
that is the visualizer component
of molecular surface.public MolecularSurfaceComponent computeSurface(String type)
type
- "van der Waals", "Solvent-accessible", "Connolly", "Blobby"public void readPropertyFile(String filename)
public void mapPropertyFile(String filename, float min, float max)
eventHandler.readPropertyFile( filename ); graphicScene.processEvent("Palette.Minimum", ""+min); graphicScene.processEvent("Palette.Maximum", ""+max); eventHandler.refresh();
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 valuepublic void refresh()
public void resetAll()
public void processArguments(int maxMolCount, ArrayList infileName, ArrayList molecules, boolean readStdIn, boolean multicell, boolean singleCell, Properties sceneProperties, String displayQuality) throws Exception
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"Exception
- if processing an argument failspublic static MolInputStream getMolInputStream(String s) throws IOException
MolInputStream
from the given String
to
be able to manually add molecules to the event handler.s
- url or absolute filename or a molecule as StringIOException
- if an I/O exception occurspublic static InputStream getInputStream(String s) throws IOException
InputStream
from the given String
.
The InputStream
is either a MonitorableInputStream
or
FileInputStream
or ByteArrayInputStream
.s
- url or absolute filename or StringIOException
- if an I/O exception occurspublic chemaxon.marvin.space.MSpaceEventHandler getEventHandler()
public GraphicScene getGraphicScene()
GraphicScene
of MarvinSpace to be able to explicitly
set more advanced features. It is necessary if features given by MSpaceEasy
is not enough for the required action.public Object callback(String method, Object arg)
callback
in interface chemaxon.marvin.util.CallbackIface
method
- name of MSpaceEasy
methodarg
- Object[]
or Object
or null