Class Bio7Grid
java.lang.Object
com.eco.bio7.rbridge.Bio7Grid
This class gives access to the Table component (based on the Nebula Grid
Widget) of Bio7.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.eclipse.nebula.widgets.grid.GridItem[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcolumnName(int index) Returns the title of a column of a sheet like in a spreadsheet: A, B, ..., Z, AA, AB, ...static voidcreateColumn(int index, int width, String titel) static voidcreateRow(int index, int height) Creates a row in the current grid.static voidcreateSheet(int columns, int rows, String name) Creates a new sheet from the specified columns, rows.static voidfitColumns(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 intReturns the amount of columns.static org.eclipse.nebula.widgets.grid.GridgetGrid()Returns the current Bio7 table component for a custom sheet.static intReturns the amount of rows.static String[]Returns the selection as a String array of the active sheet.static StringgetValue(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 booleanisFitted(org.eclipse.nebula.widgets.grid.Grid grid) Returns true if the columns of a sheet are fitted to the content (see fitColumns).static voidsetColor(int row, int column, int r, int g, int b) Sets the background colors in the current active sheet.static voidsetImage(int row, int column, org.eclipse.swt.graphics.Image image) Creates an image in the selected grid cell.static voidSet the value at the specified item (row, column).static voidSets the values in the current active sheet.static voidCreates a new grid and fills the grid with the given 2d array.static org.eclipse.swt.graphics.ImagetoSWTImage(BufferedImage bufferedImage) Creates a SWT image from a Java BufferedImage.
-
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
-
createSheet
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
Sets the values in the current active sheet.- Parameters:
val- a 2d-array of type String.
-
getValues
Returns the values of the current active sheet.- Returns:
- the sheet values of type String.
-
setValue
Set the value at the specified item (row, column).- Parameters:
row- the row.column- the column.val- the value of type String
-
getValue
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 rowcolumn- the columnr- r the red component.g- g the green component.b- b the blue component.
-
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
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 sheetfit- true fits the columns, false restores the widths before
-
createColumn
-
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
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.
-