Package com.chemaxon.calculations.gui
Class CalculatorPluginDisplay<P extends CalculatorPlugin>
java.lang.Object
chemaxon.marvin.plugin.CalculatorPluginService<P>
com.chemaxon.calculations.gui.CalculatorPluginDisplay<P>
@PublicApi
public class CalculatorPluginDisplay<P extends CalculatorPlugin>
extends CalculatorPluginService<P>
Common base class for calculator plugin displays.
Also provides default implementation for molecule display,
therefore plugins with molecule / atom data only may use
the base class itself.
- Since:
- Marvin 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe default viewer cell size.protected booleanDisplay in MarvinSpace is enabled or not.protected static final intProperty display type: display in html text.protected intThe viewer cell index (0 for sketcher).protected static final intProperty display type: display in label.protected static final intMaximum desired line length used to form multi-line text.protected static final intProperty display type: no property display.protected ComponentThe parent component.protected DPoint3[]The reaction arrow endpoints,nullif not a reaction.protected ArrayListThe result molecules to be displayed.protected ArrayListThe result values to be displayed in MarvinSpace.protected static final intProperty display type: display in text.protected StringThe result frame title.protected static final StringWord separators used to form multi-line text if the text is too long. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringappendpHText(String text) Appends the pH text.voidclear()Clears the display.protected ParameterPanelHandlerCreates the parameter panel.protected ResultViewcreateResultView(String title, chemaxon.marvin.common.swing.MolPanel mpan) protected ComponentcreateSpacePanel(Molecule[] mols) Creates space panel with given molecules, creates colored surface to each molecule.protected chemaxon.marvin.view.swing.ViewPanelcreateViewPanel(Molecule[] mols) Creates view panel with given molecules, places molecule properties in formatted texts.protected chemaxon.marvin.view.swing.ViewPanelcreateViewPanel(Molecule[] mols, int rows, int cols, int size, int propertyDisplayType) Creates view panel with given molecules, places molecule properties in formatted texts.Returns a component with the appropriate error message.protected ObjectgetHResult(int i) Returns the sum result of the H neighbours of the given atom.final String[]getLabels(double[] values) Returns formatted array.final ParameterPanelHandlerReturns the parameter panel.protected final PReturns the calculator plugin object.getProgressMonitor(Component parent) Creates a progress observer object to be used inCalculatorPlugin.setProgressMonitor(chemaxon.common.util.MProgressMonitor).protected StringgetPropertyText(Molecule mol) Returns molecule properties is text form.Returns the calculation remark.Returns the result component for display.protected final StringgetTableText(String header, String[] labels, double[][] values) Returns table in string form.getTitle()Returns the frame title.protected booleanReturns if mspace should display label only on heavy atoms.booleanReturnstrueif results for more molecules can be displayed in a single component,falseif each molecule should be displayed in a separate component.voidpop()Clears the last stored item from the display.final voidsetCellIndex(int icell) Sets the viewer cell index.voidsetParameters(Properties params) Sets parameters.final voidSets the parent component.voidsetPlugin(CalculatorPlugin plugin) Deprecated, for removal: This API element is subject to removal in a future version.voidsetPluginChecked(P plugin) Sets the plugin.voidsetReactionArrow(DPoint3[] reactionArrow) Sets the reaction arrow.voidSets the frame title.voidstore()Stores a new result item.
-
Field Details
-
CELLSIZE
protected static final int CELLSIZEThe default viewer cell size.- See Also:
-
NONE
protected static final int NONEProperty display type: no property display.- See Also:
-
LABEL
protected static final int LABELProperty display type: display in label.- See Also:
-
TEXT
protected static final int TEXTProperty display type: display in text.- See Also:
-
HTML
protected static final int HTMLProperty display type: display in html text.- See Also:
-
WORD_SEPARATORS
Word separators used to form multi-line text if the text is too long.- See Also:
-
MAX_LINE_LENGTH
protected static final int MAX_LINE_LENGTHMaximum desired line length used to form multi-line text.- See Also:
-
parent
The parent component. -
title
The result frame title. -
icell
protected int icellThe viewer cell index (0 for sketcher). -
displayInMarvinSpace
protected boolean displayInMarvinSpaceDisplay in MarvinSpace is enabled or not. -
resultMolList
The result molecules to be displayed. -
resultValues
The result values to be displayed in MarvinSpace. -
reactionArrow
The reaction arrow endpoints,nullif not a reaction.
-
-
Constructor Details
-
CalculatorPluginDisplay
public CalculatorPluginDisplay()
-
-
Method Details
-
setPlugin
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void setPlugin(CalculatorPlugin plugin) Deprecated, for removal: This API element is subject to removal in a future version.usesetPluginChecked(CalculatorPlugin)insteadSets the plugin.- Parameters:
plugin- is the plugin
-
setPluginChecked
Sets the plugin.- Parameters:
plugin- is the plugin
-
getPlugin
Description copied from class:CalculatorPluginServiceReturns the calculator plugin object.- Specified by:
getPluginin classCalculatorPluginService<P extends CalculatorPlugin>- Returns:
- the calculator plugin object
-
setParent
Sets the parent component.- Parameters:
parent- is the parent component
-
setCellIndex
public final void setCellIndex(int icell) Sets the viewer cell index.- Parameters:
icell- is the viewer cell index
-
setParameters
Sets parameters. The default implementation checks whether displaying in MarvinSpace is required and possible, descendant classes may fetch display parameters.- Parameters:
params- is the parameter table
-
setTitle
Sets the frame title.- Parameters:
title- is the frame title
-
getTitle
Returns the frame title.- Returns:
- the frame title
-
setReactionArrow
Sets the reaction arrow. If set then molecules stored bystore()will be taken as reaction components. The nextclear()resets this reaction mode.- Parameters:
reactionArrow- is the reaction arrow endpoint array
-
getProgressMonitor
Creates a progress observer object to be used inCalculatorPlugin.setProgressMonitor(chemaxon.common.util.MProgressMonitor). Short calculations do not need this object. The default implementation returnsnull, subclasses may returnMProgressMonitoror any other progress monitor implemetingMProgressMonitor.- Parameters:
parent- is the parent component (centralize relative to)- Returns:
- a progress observer object
-
getParameterPanel
Returns the parameter panel.- Returns:
- the parameter panel
- Throws:
PluginException- on error
-
createParameterPanel
Creates the parameter panel. The default implementation creates aParameterPanelobject from the<plugin class name>Parameters.xmlconfiguration XML read fromCalculatorPlugin.PLUGIN_DIRwith user parameter settings read from$HOME/chemaxon/<plugin class name>Parameters.properties(Windows), or$HOME/.chemaxon/<plugin class name>Parameters.properties(UNIX / Linux). Returnsnull(no paramter panel for this plugin) if the configuration XML is not found.- Returns:
- the parameter panel
- Throws:
PluginException- on error
-
isMultipleDisplay
public boolean isMultipleDisplay()Returnstrueif results for more molecules can be displayed in a single component,falseif each molecule should be displayed in a separate component. The default implementation returnstrue.- Returns:
trueif results for more molecules can be displayed in a single component
-
pop
public void pop()Clears the last stored item from the display. The default implemetation clears the top element inresultMolListand resetsreactionArrow. -
clear
public void clear()Clears the display. The default implemetation clearsresultMolListand resetsreactionArrow. -
store
Stores a new result item. The default implementation adds the current result molecule returned byCalculatorPlugin.getResultMolecule()toresultMolList.- Throws:
PluginException
-
getHResult
Returns the sum result of the H neighbours of the given atom.- Parameters:
i- index of the atom- Returns:
- result the result item for the specified index
- Throws:
PluginException- Since:
- Marvin 4.1
-
getResultComponent
Returns the result component for display. The default implementation places the molecules stored inresultMolListin a viewer and displays molecular results (stored in molecule properties) in text fields.- Returns:
- the result component
- Throws:
PluginException- on error- Since:
- Marvin 4.0
-
createResultView
protected ResultView createResultView(String title, chemaxon.marvin.common.swing.MolPanel mpan) throws PluginException - Throws:
PluginException
-
getErrorComponent
Returns a component with the appropriate error message. Relevant ifCalculatorPlugin.run(), or equivalentlyCalculatorPlugin.isOK()returnsfalse.- Returns:
- the error component
- Throws:
PluginException
-
getRemark
Returns the calculation remark.- Returns:
- the calculation remark
- Throws:
PluginException
-
createViewPanel
protected chemaxon.marvin.view.swing.ViewPanel createViewPanel(Molecule[] mols) throws PluginException Creates view panel with given molecules, places molecule properties in formatted texts. Fuses molecules if no properties to be displayed.- Parameters:
mols- is the molecule array- Returns:
- the view panel
- Throws:
PluginException
-
createViewPanel
protected chemaxon.marvin.view.swing.ViewPanel createViewPanel(Molecule[] mols, int rows, int cols, int size, int propertyDisplayType) Creates view panel with given molecules, places molecule properties in formatted texts. -
getPropertyText
Returns molecule properties is text form.- Parameters:
mol- is the molecule- Returns:
- molecule properties in text form
-
appendpHText
Appends the pH text.- Parameters:
text- is the text- Returns:
- the text + the pH text
-
isMSpaceDisplayLabelOnlyOnHeavyAtoms
protected boolean isMSpaceDisplayLabelOnlyOnHeavyAtoms()Returns if mspace should display label only on heavy atoms.- Since:
- Marvin 5.4
-
getLabels
Returns formatted array.- Parameters:
values- is the numerical array- Returns:
- the formatted array
-
getTableText
Returns table in string form.- Parameters:
header- is the header (the first char is the separator)labels- is the first columnvalues- is the value column array
-
createSpacePanel
Creates space panel with given molecules, creates colored surface to each molecule.- Parameters:
mols- is the molecule array- Returns:
- the space panel
- Throws:
PluginException- Since:
- Marvin 4.1
-
setPluginChecked(CalculatorPlugin)instead