Package chemaxon.marvin.beans
Class MViewParams
java.lang.Object
chemaxon.marvin.beans.MViewParams
MViewParams is a helper tool to generate parameter string to MViewPane.
Note that only molecules and labels are supported yet, buttons and images are not.
Example of typical usage:
Note that only molecules and labels are supported yet, buttons and images are not.
Example of typical usage:
MViewParams mvpw = new MViewParams(); mvpw.setRowCount(rows); mvpw.setColumnCount(cols); mvpw.setVisibleRows(actualVisibleRows); mvpw.setHeaderCellSize(2, 1); mvpw.addMolecule(1, 0, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, 1, 1); mvpw.addLabel(0, 0, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, 0, 1); mvpw.setMoleculeCellSize(200, 200); mvpw.setLabelProperty(10, true, false); viewPane.setParams(mvpw.getMViewParam());This equals with the following parameter setting:
String layout = (size > 1) ? ("layout0=:2:1:M:1:0:1:1:c:b:1:1:L:0:0:1:1:c:n:0:1\n" + "param0=:M:200:200:L:10b\n") : ""; viewPane.setParams("rows=" + rows + "\n" + "cols=" + cols + "\n" + "visibleRows=" + actualVisibleRows + "\n" + layout + "\n");
- Since:
- Marvin 5.1.3
-
Constructor Summary
ConstructorDescriptionFor each new parameter generation a new MViewParams instance is necessary to be created. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLabel
(int startRow, int startColumn, int rows, int columns) Defines a label component inside the MarvinView table.void
addLabel
(int startRow, int startColumn, int rows, int columns, int anchor, int fill, int weightx, int weighty) Defines a label component inside the MarvinView table.void
addMolecule
(int startRow, int startColumn, int rows, int columns) Defines a molecule viewer component inside the MarvinView table.void
addMolecule
(int startRow, int startColumn, int rows, int columns, int anchor, int fill, int weighty, int weightx) Defines a molecule viewer component inside the MarvinView table.Generates the parameter string that can be set to MViewPane.void
setColumnCount
(int i) Sets the nuber of columns.void
setHeaderCellSize
(int row, int column) Sets a logical cell extent by interpreting rows and columns as part of a sub-table.void
setLabelProperty
(int fontSize, boolean bold, boolean italics) Defines properties for cells containing label components.void
setMoleculeCellSize
(int width, int height) Sets the preferred size of the cells containing molecules.void
setRowCount
(int i) Sets the total nuber of rows.void
setVisibleRows
(int i) Sets the nuber of visible rows.
-
Constructor Details
-
MViewParams
public MViewParams()For each new parameter generation a new MViewParams instance is necessary to be created.
-
-
Method Details
-
getMViewParam
Generates the parameter string that can be set to MViewPane.- Returns:
- parameters as correcty formatted string
-
setRowCount
public void setRowCount(int i) Sets the total nuber of rows.- Parameters:
i
- maximum number of rows
-
setColumnCount
public void setColumnCount(int i) Sets the nuber of columns. This equals with the number of visible columns.- Parameters:
i
- number of rows
-
setVisibleRows
public void setVisibleRows(int i) Sets the nuber of visible rows. If this is less then the total number of rows, then a srollpane is available.- Parameters:
i
- number of visible rows less or equal than the total number of rows
-
setHeaderCellSize
public void setHeaderCellSize(int row, int column) Sets a logical cell extent by interpreting rows and columns as part of a sub-table. For example when having labels in odd rows and molecules in even rows the cell size should be declared with 2 rows and 1 column to be handled properly at scrolling.- Parameters:
row
- number of rows in the sub-tablecolumn
- number of columns in the sub-table
-
addLabel
public void addLabel(int startRow, int startColumn, int rows, int columns) Defines a label component inside the MarvinView table.- Parameters:
startRow
- uppermost row of the labelstartColumn
- leftmost column of the labelrows
- number of rows to occupycolumns
- number of columns to occupy
-
addMolecule
public void addMolecule(int startRow, int startColumn, int rows, int columns) Defines a molecule viewer component inside the MarvinView table.- Parameters:
startRow
- uppermost row of the viewerstartColumn
- leftmost column of the viewerrows
- number of rows to occupycolumns
- number of columns to occupy
-
addLabel
public void addLabel(int startRow, int startColumn, int rows, int columns, int anchor, int fill, int weightx, int weighty) Defines a label component inside the MarvinView table.- Parameters:
startRow
- uppermost row of the labelstartColumn
- leftmost column of the labelrows
- number of rows to occupycolumns
- number of columns to occupyanchor
- GridBagConstraints#anchorfill
- GridBagConstraints#fillweightx
- GridBagConstraints#weightxweighty
- GridBagConstraints#weighty
-
addMolecule
public void addMolecule(int startRow, int startColumn, int rows, int columns, int anchor, int fill, int weighty, int weightx) Defines a molecule viewer component inside the MarvinView table.- Parameters:
startRow
- uppermost row of the viewerstartColumn
- leftmost column of the viewerrows
- number of rows to occupycolumns
- number of columns to occupyanchor
- GridBagConstraints#anchorfill
- GridBagConstraints#fillweighty
- GridBagConstraints#weightyweightx
- GridBagConstraints#weightx
-
setMoleculeCellSize
public void setMoleculeCellSize(int width, int height) Sets the preferred size of the cells containing molecules.- Parameters:
width
- width of viewer cells in pixelsheight
- height of viewer cells in pixels
-
setLabelProperty
public void setLabelProperty(int fontSize, boolean bold, boolean italics) Defines properties for cells containing label components.- Parameters:
fontSize
- size of the used fontbold
- whether to set the font to bold or notitalics
- whether to set the font to italics or not
-