Class MViewParams


  • @PublicAPI
    public class MViewParams
    extends Object
    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:
     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

      Constructors 
      Constructor Description
      MViewParams()
      For each new parameter generation a new MViewParams instance is necessary to be created.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void 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.
      String getMViewParam()
      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 Detail

      • MViewParams

        public MViewParams()
        For each new parameter generation a new MViewParams instance is necessary to be created.
    • Method Detail

      • getMViewParam

        public String 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-table
        column - 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 label
        startColumn - leftmost column of the label
        rows - number of rows to occupy
        columns - 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 viewer
        startColumn - leftmost column of the viewer
        rows - number of rows to occupy
        columns - 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 label
        startColumn - leftmost column of the label
        rows - number of rows to occupy
        columns - number of columns to occupy
        anchor - GridBagConstraints#anchor
        fill - GridBagConstraints#fill
        weightx - GridBagConstraints#weightx
        weighty - 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 viewer
        startColumn - leftmost column of the viewer
        rows - number of rows to occupy
        columns - number of columns to occupy
        anchor - GridBagConstraints#anchor
        fill - GridBagConstraints#fill
        weighty - GridBagConstraints#weighty
        weightx - 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 pixels
        height - 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 font
        bold - whether to set the font to bold or not
        italics - whether to set the font to italics or not