Class Bio7Grid

java.lang.Object
com.eco.bio7.rbridge.Bio7Grid

public class Bio7Grid extends Object
This class gives access to the Table component (based on the Nebula Grid Widget) of Bio7.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static org.eclipse.nebula.widgets.grid.GridItem[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    columnName(int index)
    Returns the title of a column of a sheet like in a spreadsheet: A, B, ..., Z, AA, AB, ...
    static void
    createColumn(int index, int width, String titel)
     
    static void
    createRow(int index, int height)
    Creates a row in the current grid.
    static void
    createSheet(int columns, int rows, String name)
    Creates a new sheet from the specified columns, rows.
    static void
    fitColumns(org.eclipse.nebula.widgets.grid.Grid grid, boolean fit)
    Fits the widths of the columns of a sheet to the content (the widest text of a column and its title, at most 600 points) or restores the widths before (in the user interface thread).
    static int
    Returns the amount of columns.
    static org.eclipse.nebula.widgets.grid.Grid
    Returns the current Bio7 table component for a custom sheet.
    static int
    Returns the amount of rows.
    static String[]
    Returns the selection as a String array of the active sheet.
    static String
    getValue(int row, int column)
    Returns the sheet value from the specified item (row, column).
    static String[][]
    Returns the values of the current active sheet.
    static boolean
    isFitted(org.eclipse.nebula.widgets.grid.Grid grid)
    Returns true if the columns of a sheet are fitted to the content (see fitColumns).
    static void
    setColor(int row, int column, int r, int g, int b)
    Sets the background colors in the current active sheet.
    static void
    setImage(int row, int column, org.eclipse.swt.graphics.Image image)
    Creates an image in the selected grid cell.
    static void
    setValue(int row, int column, String val)
    Set the value at the specified item (row, column).
    static void
    setValues(String[][] val)
    Sets the values in the current active sheet.
    static void
    setValues(String[][] val, String name)
    Creates a new grid and fills the grid with the given 2d array.
    static org.eclipse.swt.graphics.Image
    toSWTImage(BufferedImage bufferedImage)
    Creates a SWT image from a Java BufferedImage.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • items

      protected static org.eclipse.nebula.widgets.grid.GridItem[] items
  • Constructor Details

    • Bio7Grid

      public Bio7Grid()
  • Method Details

    • getGrid

      public static org.eclipse.nebula.widgets.grid.Grid getGrid()
      Returns the current Bio7 table component for a custom sheet.
      Returns:
      a grid component.
    • setValues

      public static void setValues(String[][] val, String name)
      Creates a new grid and fills the grid with the given 2d array.
      Parameters:
      val - a 2d-array of type String.
      name - the name of the grid.
    • createSheet

      public static void createSheet(int columns, int rows, String name)
      Creates a new sheet from the specified columns, rows.
      Parameters:
      columns - the amount of columns.
      rows - the amount of rows.
      name - the name of the sheet.
    • setValues

      public static void setValues(String[][] val)
      Sets the values in the current active sheet.
      Parameters:
      val - a 2d-array of type String.
    • getValues

      public static String[][] getValues()
      Returns the values of the current active sheet.
      Returns:
      the sheet values of type String.
    • setValue

      public static void setValue(int row, int column, String val)
      Set the value at the specified item (row, column).
      Parameters:
      row - the row.
      column - the column.
      val - the value of type String
    • getValue

      public static String getValue(int row, int column)
      Returns the sheet value from the specified item (row, column).
      Parameters:
      row - the row index.
      column - the column index.
      Returns:
      the value.
    • getColumnCount

      public static int getColumnCount()
      Returns the amount of columns.
      Returns:
      an integer value.
    • getItemCount

      public static int getItemCount()
      Returns the amount of rows.
      Returns:
      an integer value.
    • setColor

      public static void setColor(int row, int column, int r, int g, int b)
      Sets the background colors in the current active sheet.
      Parameters:
      row - the row
      column - the column
      r - r the red component.
      g - g the green component.
      b - b the blue component.
    • getSelection

      public static String[] getSelection()
      Returns the selection as a String array of the active sheet.
      Returns:
      a String array.
    • createRow

      public static void createRow(int index, int height)
      Creates a row in the current grid.
      Parameters:
      index - the index of the row.
      height - the height of the row.
    • columnName

      public static String columnName(int index)
      Returns the title of a column of a sheet like in a spreadsheet: A, B, ..., Z, AA, AB, ... (the title of the columns of the Bio7 table, e.g., for ranges of cells like B2:B51).
      Parameters:
      index - the index of the column (0 based)
      Returns:
      the title
    • isFitted

      public static boolean isFitted(org.eclipse.nebula.widgets.grid.Grid grid)
      Returns true if the columns of a sheet are fitted to the content (see fitColumns).
    • fitColumns

      public static void fitColumns(org.eclipse.nebula.widgets.grid.Grid grid, boolean fit)
      Fits the widths of the columns of a sheet to the content (the widest text of a column and its title, at most 600 points) or restores the widths before (in the user interface thread). For large sheets the texts with the most characters of each column are measured.
      Parameters:
      grid - the sheet
      fit - true fits the columns, false restores the widths before
    • createColumn

      public static void createColumn(int index, int width, String titel)
    • setImage

      public static void setImage(int row, int column, org.eclipse.swt.graphics.Image image)
      Creates an image in the selected grid cell.
      Parameters:
      row - the row.
      column - the column.
      image - the SWT image.
    • toSWTImage

      public static org.eclipse.swt.graphics.Image toSWTImage(BufferedImage bufferedImage)
      Creates a SWT image from a Java BufferedImage.
      Parameters:
      bufferedImage - the image.
      Returns:
      returns a SWT image. If the image is set in the grid with setImage(...) it is disposed by the grid, else it must be disposed by the caller.