Module org.hdfgroup.hdfview
Package hdf.view.TableView

# Class DefaultBaseTableView

Object
hdf.view.TableView.DefaultBaseTableView

All Implemented Interfaces:
  `DataView`, `TableView`

Direct Known Subclasses:
  `DefaultCompoundDSTableView`, `DefaultScalarDSTableView`

public abstract class DefaultBaseTableView extends Object implements TableView
DefaultBaseTableView serves as the base class for a DataView that displays HDF data in a tabular format. This class is used for internal bookkeeping and as a place to store higher-level data manipulation functions, whereas its subclasses are responsible for setting up the actual GUI components.

Version:
  1.0 4/13/2018
Author:
  jhenderson

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `protected class`
  `DefaultBaseTableView.ColumnHeader`
  An implementation of the table's Column Header which adapts to the current font.
  `protected class`
  `DefaultBaseTableView.EditingGridLayer`
  An implementation of a GridLayer with support for column grouping and with editing triggered by a double click instead of a single click.
  `protected class`
  `DefaultBaseTableView.RefContextMenu`
  Context-menu for dealing with region and object references
  `protected class`
  `DefaultBaseTableView.RowHeader`
  An implementation of the table's Row Header which adapts to the current font.
  `protected class`
  `DefaultBaseTableView.RowHeaderDataProvider`
  Custom Row Header data provider to set row indices based on Index Base for both Scalar Datasets and Compound Datasets.
  `protected static enum`
  `DefaultBaseTableView.ViewType`
  the valid types of tableviews

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `binaryOrder`
  default binary order
  `protected BitSet`
  `bitmask`
  Used for bitmask operations on data
  `protected ViewProperties.BITMASK_OP`
  `bitmaskOP`
  Used for the type of bitmask operation
  `protected org.eclipse.swt.widgets.Label`
  `cellLabel`
  Label to indicate the current cell location
  `protected org.eclipse.swt.widgets.Text`
  `cellValueField`
  Text field to display the value of the currently selected table cell
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkBin`
  Checkbox menu item for binary default
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkCustomNotation`
  Checkbox menu item for Custom Notation default
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkEnum`
  Checkbox menu item for enum default
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkFixedDataLength`
  Checkbox menu item for Fixed Data Length default
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkHex`
  Checkbox menu item for hex default
  `protected org.eclipse.swt.widgets.MenuItem`
  `checkScientificNotation`
  Checkbox menu item for Scientific Notation default
  `protected org.eclipse.nebula.widgets.nattable.data.IDataProvider`
  `columnHeaderDataProvider`
  reference to the data provider for the column
  `protected org.eclipse.swt.graphics.Font`
  `curFont`
  The current font
  `protected DecimalFormat`
  `customFormat`
  custom format pattern
  `protected DataDisplayConverterFactory.HDFDisplayConverter`
  `dataDisplayConverter`
  reference to the display converter
  `protected org.eclipse.nebula.widgets.nattable.layer.DataLayer`
  `dataLayer`
  Keep references to the data layers for ease of access
  `protected final DataFormat`
  `dataObject`
  The data object to be displayed in the Table
  `protected DataProviderFactory.HDFDataProvider`
  `dataProvider`
  reference to the data provider
  `protected org.eclipse.nebula.widgets.nattable.NatTable`
  `dataTable`
  The reference to the NAT table used
  `protected Object`
  `dataValue`
  The data value of the data object
  `protected Object`
  `fillValue`
  The value used for fill
  `protected int`
  `fixedDataLength`
  size of default data length
  `protected int`
  `indexBase`
  The index base used for display row and column numbers of data
  `protected org.eclipse.swt.widgets.Group`
  `indexBaseGroup`
  Labeled Group to display the index base
  `protected boolean`
  `isDataTransposed`
  status if the data is transposed
  `protected boolean`
  `isDisplayTypeChar`
  status if the display type is a char
  `protected boolean`
  `isEnumConverted`
  status if the enums are to display converted
  `protected boolean`
  `isObjRef`
  reference status
  `protected boolean`
  `isReadOnly`
  status if file is read only
  `protected boolean`
  `isRegRef`
  reference status
  `protected boolean`
  `isStdRef`
  reference status
  `protected final NumberFormat`
  `normalFormat`
  the normal format to be used for numbers
  `protected NumberFormat`
  `numberFormat`
  the format to be used for numbers
  `protected org.eclipse.nebula.widgets.nattable.data.IDataProvider`
  `rowHeaderDataProvider`
  reference to the data provider for the row
  `protected final DecimalFormat`
  `scientificFormat`
  Changed to use normalized scientific notation (1 is less than coefficient is less than 10).
  `protected org.eclipse.nebula.widgets.nattable.selection.SelectionLayer`
  `selectionLayer`
  Keep references to the selection layers for ease of access
  `protected final org.eclipse.swt.widgets.Shell`
  `shell`
  The reference to the display shell used
  `protected boolean`
  `showAsBin`
  show data as status
  `protected boolean`
  `showAsHex`
  show data as status
  `protected final DataViewManager`
  `viewer`
  The main HDFView
  `protected DefaultBaseTableView.ViewType`
  `viewType`
  The type of view

  ### Fields inherited from interface hdf.view.DataView.DataView

  `DATAVIEW_IMAGE, DATAVIEW_TABLE, DATAVIEW_UNKNOWN`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultBaseTableView(DataViewManager theView)`
  Constructs a base TableView with no additional data properties.
  `DefaultBaseTableView(DataViewManager theView, HashMap dataPropertiesMap)`
  Constructs a base TableView with the specified data properties.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected org.eclipse.swt.widgets.Menu`
  `createMenuBar(org.eclipse.swt.widgets.Shell theShell)`
  Creates the menubar for the Shell.
  `protected abstract org.eclipse.nebula.widgets.nattable.NatTable`
  `createTable(org.eclipse.swt.widgets.Composite parent, DataFormat dataObject)`
  Create a data table for a data object.
  `protected abstract org.eclipse.nebula.widgets.nattable.config.IEditableRule`
  `getDataEditingRule(DataFormat dataObject)`
  Get the data editing rule for the object.
  `org.eclipse.nebula.widgets.nattable.layer.DataLayer`
  `getDataLayer()`
  `HObject`
  `getDataObject()`
  `int`
  `getSelectedColumnCount()`
  `int`
  `getSelectedRowCount()`
  `org.eclipse.nebula.widgets.nattable.selection.SelectionLayer`
  `getSelectionLayer()`
  `Object`
  `getTable()`
  `protected void`
  `importBinaryData()`
  Import data values from binary file.
  `protected void`
  `importTextData(String fname)`
  Import data values from text file.
  `protected void`
  `loadData(DataFormat dataObject)`
  Loads the data buffer of an object.
  `void`
  `refreshDataTable()`
  refresh the data table
  `protected void`
  `saveAsBinary()`
  Save data as binary.
  `protected void`
  `saveAsText()`
  Save data as text.
  `protected abstract void`
  `showObjRefData(byte[] ref)`
  Show the object reference data.
  `protected abstract void`
  `showRegRefData(byte[] reg)`
  Show the region reference data.
  `protected abstract void`
  `showStdRefData(byte[] reg)`
  Show the standard reference data.
  `protected void`
  `updateDataConversionSettings()`
  Update the display converters.
  `void`
  `updateValueInFile()`
  Update dataset's value in file.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface hdf.view.TableView.TableView

  `getSelectedData`

- ## Field Details

  - ### shell

    protected final org.eclipse.swt.widgets.Shell shell
    The reference to the display shell used

  - ### curFont

    protected org.eclipse.swt.graphics.Font curFont
    The current font

  - ### viewer

    protected final DataViewManager viewer
    The main HDFView

  - ### dataTable

    protected org.eclipse.nebula.widgets.nattable.NatTable dataTable
    The reference to the NAT table used

  - ### dataObject

    protected final DataFormat dataObject
    The data object to be displayed in the Table

  - ### dataValue

    protected Object dataValue
    The data value of the data object

  - ### fillValue

    protected Object fillValue
    The value used for fill

  - ### viewType

    protected DefaultBaseTableView.ViewType viewType
    The type of view

  - ### scientificFormat

    protected final DecimalFormat scientificFormat
    Changed to use normalized scientific notation (1 is less than coefficient is less than 10).

  - ### customFormat

    protected DecimalFormat customFormat
    custom format pattern

  - ### normalFormat

    protected final NumberFormat normalFormat
    the normal format to be used for numbers

  - ### numberFormat

    protected NumberFormat numberFormat
    the format to be used for numbers

  - ### bitmask

    protected BitSet bitmask
    Used for bitmask operations on data

  - ### bitmaskOP

    protected ViewProperties.BITMASK_OP bitmaskOP
    Used for the type of bitmask operation

  - ### indexBase

    protected int indexBase
    The index base used for display row and column numbers of data

  - ### fixedDataLength

    protected int fixedDataLength
    size of default data length

  - ### binaryOrder

    protected int binaryOrder
    default binary order

  - ### isReadOnly

    protected boolean isReadOnly
    status if file is read only

  - ### isEnumConverted

    protected boolean isEnumConverted
    status if the enums are to display converted

  - ### isDisplayTypeChar

    protected boolean isDisplayTypeChar
    status if the display type is a char

  - ### isDataTransposed

    protected boolean isDataTransposed
    status if the data is transposed

  - ### isRegRef

    protected boolean isRegRef
    reference status

  - ### isObjRef

    protected boolean isObjRef
    reference status

  - ### isStdRef

    protected boolean isStdRef
    reference status

  - ### showAsHex

    protected boolean showAsHex
    show data as status

  - ### showAsBin

    protected boolean showAsBin
    show data as status

  - ### selectionLayer

    protected org.eclipse.nebula.widgets.nattable.selection.SelectionLayer selectionLayer
    Keep references to the selection layers for ease of access

  - ### dataLayer

    protected org.eclipse.nebula.widgets.nattable.layer.DataLayer dataLayer
    Keep references to the data layers for ease of access

  - ### rowHeaderDataProvider

    protected org.eclipse.nebula.widgets.nattable.data.IDataProvider rowHeaderDataProvider
    reference to the data provider for the row

  - ### columnHeaderDataProvider

    protected org.eclipse.nebula.widgets.nattable.data.IDataProvider columnHeaderDataProvider
    reference to the data provider for the column

  - ### dataProvider

    protected DataProviderFactory.HDFDataProvider dataProvider
    reference to the data provider

  - ### dataDisplayConverter

    protected DataDisplayConverterFactory.HDFDisplayConverter dataDisplayConverter
    reference to the display converter

  - ### checkFixedDataLength

    protected org.eclipse.swt.widgets.MenuItem checkFixedDataLength
    Checkbox menu item for Fixed Data Length default

  - ### checkCustomNotation

    protected org.eclipse.swt.widgets.MenuItem checkCustomNotation
    Checkbox menu item for Custom Notation default

  - ### checkScientificNotation

    protected org.eclipse.swt.widgets.MenuItem checkScientificNotation
    Checkbox menu item for Scientific Notation default

  - ### checkHex

    protected org.eclipse.swt.widgets.MenuItem checkHex
    Checkbox menu item for hex default

  - ### checkBin

    protected org.eclipse.swt.widgets.MenuItem checkBin
    Checkbox menu item for binary default

  - ### checkEnum

    protected org.eclipse.swt.widgets.MenuItem checkEnum
    Checkbox menu item for enum default

  - ### indexBaseGroup

    protected org.eclipse.swt.widgets.Group indexBaseGroup
    Labeled Group to display the index base

  - ### cellValueField

    protected org.eclipse.swt.widgets.Text cellValueField
    Text field to display the value of the currently selected table cell

  - ### cellLabel

    protected org.eclipse.swt.widgets.Label cellLabel
    Label to indicate the current cell location

- ## Constructor Details

  - ### DefaultBaseTableView

    public DefaultBaseTableView(DataViewManager theView)
    Constructs a base TableView with no additional data properties.
    Parameters:
      `theView` - the main HDFView.

  - ### DefaultBaseTableView

    public DefaultBaseTableView(DataViewManager theView, HashMap dataPropertiesMap)
    Constructs a base TableView with the specified data properties.
    Parameters:
      `theView` - the main HDFView.
      `dataPropertiesMap` - the properties on how to show the data. The map is used to allow applications to pass properties on how to display the data, such as: transposing data, showing data as characters, applying a bitmask, and etc. Predefined keys are listed at ViewProperties.DATA_VIEW_KEY.

- ## Method Details

  - ### createMenuBar

    protected org.eclipse.swt.widgets.Menu createMenuBar(org.eclipse.swt.widgets.Shell theShell)
    Creates the menubar for the Shell.
    Parameters:
      `theShell` - the reference to the display shell
    Returns:
      the newly created menu

  - ### loadData

    protected void loadData(DataFormat dataObject) throws Exception
    Loads the data buffer of an object.
    Parameters:
      `dataObject` - the object that has the buffer for the data.
    Throws:
      `Exception` - if a failure occurred

  - ### createTable

    protected abstract org.eclipse.nebula.widgets.nattable.NatTable createTable(org.eclipse.swt.widgets.Composite parent, DataFormat dataObject)
    Create a data table for a data object.
    Parameters:
      `parent` - the parent object this table will be associated with.
      `dataObject` - the data object this table will be associated with.
    Returns:
      the newly created data table

  - ### showObjRefData

    protected abstract void showObjRefData(byte[] ref)
    Show the object reference data.
    Parameters:
      `ref` - the identifer for the object reference.

  - ### showRegRefData

    protected abstract void showRegRefData(byte[] reg)
    Show the region reference data.
    Parameters:
      `reg` - the identifier for the region reference.

  - ### showStdRefData

    protected abstract void showStdRefData(byte[] reg)
    Show the standard reference data.
    Parameters:
      `reg` - the identifier for the standard reference.

  - ### getDataEditingRule

    protected abstract org.eclipse.nebula.widgets.nattable.config.IEditableRule getDataEditingRule(DataFormat dataObject)
    Get the data editing rule for the object.
    Parameters:
      `dataObject` - the data object
    Returns:
      the rule

  - ### updateDataConversionSettings

    protected void updateDataConversionSettings()
    Update the display converters.

  - ### updateValueInFile

    public void updateValueInFile()
    Update dataset's value in file. The changes will go to the file.
    Specified by:
      `updateValueInFile` in interface `TableView`

  - ### getDataObject

    public HObject getDataObject()
    Specified by:
      `getDataObject` in interface `DataView`
    Returns:
      the data object displayed in this data viewer

  - ### getTable

    public Object getTable()
    Specified by:
      `getTable` in interface `TableView`
    Returns:
      the table

  - ### getSelectedRowCount

    public int getSelectedRowCount()
    Specified by:
      `getSelectedRowCount` in interface `TableView`
    Returns:
      array of selected row count

  - ### getSelectedColumnCount

    public int getSelectedColumnCount()
    Specified by:
      `getSelectedColumnCount` in interface `TableView`
    Returns:
      array of selected column count

  - ### getSelectionLayer

    public org.eclipse.nebula.widgets.nattable.selection.SelectionLayer getSelectionLayer()
    Returns:
      the selection layer

  - ### getDataLayer

    public org.eclipse.nebula.widgets.nattable.layer.DataLayer getDataLayer()
    Returns:
      the data layer

  - ### refreshDataTable

    public void refreshDataTable()
    refresh the data table
    Specified by:
      `refreshDataTable` in interface `TableView`

  - ### saveAsText

    protected void saveAsText() throws Exception
    Save data as text.
    Throws:
      `Exception` - if a failure occurred

  - ### saveAsBinary

    protected void saveAsBinary() throws Exception
    Save data as binary.
    Throws:
      `Exception` - if a failure occurred

  - ### importTextData

    protected void importTextData(String fname)
    Import data values from text file.
    Parameters:
      `fname` - the file to import text from

  - ### importBinaryData

    protected void importBinaryData()
    Import data values from binary file.