public class GTable extends GComponent implements GDisplay, GReadWrite, MouseListener
GComponent.CopyPasteOperation, GComponent.DisplayIndicatorStatus, GComponent.ItemType, GComponent.Operation
NAME_ATTRIBUTE
Constructor and Description |
---|
GTable(double[][] data,
double[] absData,
double[] ordData,
GUnit rowHeaderUnit,
GUnit columnHeaderUnit,
GUnit dataUnit)
Constructor.
|
GTable(int numberOfRows,
int numberOfColums,
GUnit rowHeaderUnit,
GUnit columnHeaderUnit,
GUnit dataUnit)
Constructor.
|
GTable(String widgetId,
double[][] data,
double[] absData,
double[] ordData,
GUnit rowHeaderUnit,
GUnit columnHeaderUnit,
GUnit dataUnit)
Constructor.
|
GTable(String widgetId,
int numberOfRows,
int numberOfColums,
GUnit rowHeaderUnit,
GUnit columnHeaderUnit,
GUnit dataUnit,
Double rowHeaderDefaultValue,
Double columnHeaderDefaultValue,
Double dataDefaultValue)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(int columnTableIndex,
double[] newColumnValues,
double headerValue)
Method used to add a new column in the data table.
|
void |
addRow(int rowTableIndex,
double[] newRowValues,
double rowHeaderValue)
Method used to add a new row in the data table.
|
void |
clear()
Clear the table contents and units.
|
void |
deleteColumn(int columnTableIndex)
Method used to delete a specific column from the data table.
|
void |
deleteRow(int rowTableIndex)
Method used to delete a specific row from the data table.
|
void |
display()
Called when the element is to be displayed, so it can perform the actions required for its display, and
the display of its inmmediate descendants.
|
double[] |
getAbsValues()
Gets the array of column headers values.
|
Component |
getComponent()
Returns the low level Swing Component encapsulated by the class if any, otherwise returns
null.
|
double[] |
getOrdValues()
Gets the array of row headers values.
|
double[][] |
getValues()
Gets the data values.
|
void |
mouseClicked(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e) |
void |
read()
Implementaion of the routines that allow the component to be loaded from a configuration file.
|
void |
setColumnHeaderDefaultValue(double defaultValue)
Set the default value for the column header cells.
|
void |
setColumnHeaderFormat(GTableModel.Format newFormat)
Set the format of the column headers.
|
void |
setColumnHeaderFracDigits(int fracDigits)
Set the column header fractional digits.
|
void |
setColumnHeaderUnit(GUnit newUnit)
Set the unit of the column headers.
|
void |
setColumnHeaderValue(int columnIndex,
double value)
Sets a value into a column header cell.
|
void |
setColumnWidth(int columnIndex,
Integer minWidth,
Integer maxWidth,
Integer preferredWidth)
Set the minimum, maximum and preferred with of a column.
|
void |
setCurrentRowsColumns(Integer rowNumber,
Integer columnNumber)
Set the current number of rows and columns.
|
void |
setDataDefaultValue(double defaultValue)
Set the default value for the data cells.
|
void |
setDataFormat(GTableModel.Format newFormat)
Set the format of the data.
|
void |
setDataFracDigits(int fracDigits)
Set the data fractional digits.
|
void |
setDataUnit(GUnit newUnit)
Set the unit of the table data.
|
void |
setDataValue(int rowIndex,
int columnIndex,
double value)
Sets a value into a data cell.
|
void |
setGlobalColumnWidth(Integer minWidth,
Integer maxWidth,
Integer preferredWidth)
Set the minimum, maximum and preferred width of the columns of the table.
|
void |
setMinMaxRowsColumns(Integer minRows,
Integer maxRows,
Integer minColumns,
Integer maxColumns)
Set the minimum and maximum number of rows and columns.
|
void |
setRowHeaderDefaultValue(double defaultValue)
Set the default value for the row header cells.
|
void |
setRowHeaderFormat(GTableModel.Format newFormat)
Set the format of the row headers.
|
void |
setRowHeaderFracDigits(int fracDigits)
Set the row header fractional digits.
|
void |
setRowHeaderUnit(GUnit newUnit)
Set the unit of the row headers.
|
void |
setRowHeaderValue(int rowIndex,
double value)
Sets a value into a row header cell.
|
void |
setValues(double[][] data,
double[] columnHeaderValues,
double[] rowHeaderValues)
Set the values of the table.
|
int |
setWidth(int width)
Set the table width, this will resize the columns so the total size of the table matches the requested
width.
|
void |
write()
Implementaion of the routines that allow the component to be saved to a configuration file.
|
activateConstraintsByType, attachCopyPasteMenu, attachCopyPasteMenu, beginOfElement, beginOfElement, beginOfElement, beginOfElement, clearAllInnerDescendantConstraint, clearConstraint, clearInnerDescendantContraint, composeWidgetId, doDisplay, endOfElement, getCommentInConfigFile, getConstraint, getCurrentOperation, getDisplayIndicatorStatus, getDisplayIsModifiedIndicator, getElement, getGClassName, getGPanel, getGParent, getGUnitInConfigFile, getInnerDescendantConstraint, getName, getNameInConfigFile, getOperationSaveValue, getPathInConfigFile, getSimpleWidgetId, getStatus, getStringConstraint, getSubComponent, getWidgetId, handleCopyPasteEvent, handleCopyPasteEvent, handleProcessEventException, isCopyPasteEvent, isEnabled, isForcedStatus, isModified, launchInvalidPositionException, mouseWheelMoved, parseSimpleConstraint, processGEvent, processMouseWheelEvent, setBusyCursor, setCommentInConfigFile, setConstraint, setCopyPasteMenuEnabled, setCurrentOperation, setDataForConstraintsByType, setDefaultConstraints, setDisplayIsModifiedIndicator, setElement, setEnabled, setForcedStatus, setGPanel, setGParent, setGUnitInConfigFile, setInnerDescendantConstraint, setName, setNameAndCommentInConfigFile, setNameInConfigFile, setPathInConfigFile, setStatus, setStringConstraint, setToolTipText, setWidgetId, setWidth, setWindowBusyCursor, updateIsModifiedIndicator, writeCollection, writeCollection, writeCollection, writeCollection, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem, writeConfigItem
public GTable(int numberOfRows, int numberOfColums, GUnit rowHeaderUnit, GUnit columnHeaderUnit, GUnit dataUnit)
numberOfRows
- the initial number of rows used by the widget.numberOfColums
- the initial number of columns used by the widget.rowHeaderUnit
- unit for the row header or null if no unit is defined.columnHeaderUnit
- unit for the column header or null if no unit is defined.dataUnit
- unit for the data or null if no unit is defined.public GTable(String widgetId, int numberOfRows, int numberOfColums, GUnit rowHeaderUnit, GUnit columnHeaderUnit, GUnit dataUnit, Double rowHeaderDefaultValue, Double columnHeaderDefaultValue, Double dataDefaultValue)
widgetId
- widget identifier.numberOfRows
- the initial number of rows used by the widget.numberOfColums
- the initial number of columns used by the widget.rowHeaderUnit
- unit for the row header or null if no unit is defined.columnHeaderUnit
- unit for the column header or null if no unit is defined.dataUnit
- unit for the data or null if no unit is defined.rowHeaderDefaultValue
- default value for the row header cells.columnHeaderDefaultValue
- default value for the column header cells.dataDefaultValue
- default value for the data cells.public GTable(double[][] data, double[] absData, double[] ordData, GUnit rowHeaderUnit, GUnit columnHeaderUnit, GUnit dataUnit)
data
- the matrix containing the data values.absData
- the array with abscissa values.ordData
- the array with ordinates values.rowHeaderUnit
- unit for the row header or null if no unit is defined.columnHeaderUnit
- unit for the column header or null if no unit is defined.dataUnit
- unit for the data or null if no unit is defined.public GTable(String widgetId, double[][] data, double[] absData, double[] ordData, GUnit rowHeaderUnit, GUnit columnHeaderUnit, GUnit dataUnit)
widgetId
- widget identifier.data
- the matrix containing the data values.absData
- the array with abscissa values.ordData
- the array with ordinates values.rowHeaderUnit
- unit for the row header or null if no unit is defined.columnHeaderUnit
- unit for the column header or null if no unit is defined.dataUnit
- unit for the data or null if no unit is defined.public void setValues(double[][] data, double[] columnHeaderValues, double[] rowHeaderValues) throws GArithmeticException
data
- data values.columnHeaderValues
- column header values.rowHeaderValues
- row header values.GArithmeticException
- if any of the data, column header or row header values is NaN.public void addRow(int rowTableIndex, double[] newRowValues, double rowHeaderValue)
rowTableIndex
- the index of the new row.newRowValues
- the array of new values to insert into the new row.rowHeaderValue
- the value of the header for the new row.public void addColumn(int columnTableIndex, double[] newColumnValues, double headerValue)
columnTableIndex
- the index of the new column.newColumnValues
- the array of new values to insert into the new column.headerValue
- the value of the header for the new column.public void deleteRow(int rowTableIndex)
rowTableIndex
- the index of the row to be deleted.public void deleteColumn(int columnTableIndex)
columnTableIndex
- the index of the column to be deleted.public void setGlobalColumnWidth(Integer minWidth, Integer maxWidth, Integer preferredWidth)
minWidth
- value of the minimum allowed width, if null the minimum width of the columns is not
modified.maxWidth
- value of the maximum allowed width, if null the maximum width of the columns is not
modified.preferredWidth
- value of the preferred allowed width, if null the preferred width of the columsn is not
modified.public void setColumnWidth(int columnIndex, Integer minWidth, Integer maxWidth, Integer preferredWidth)
columnIndex
- index of the column.minWidth
- value of the minimum allowed width, if null the minimum width of the column is not modified.maxWidth
- value of the maximum allowed width, if null the maximum width of the column is not modified.preferredWidth
- value of the preferred allowed width, if null the preferred width of the column is not
modified.public int setWidth(int width)
width
- table width.public void setRowHeaderUnit(GUnit newUnit)
newUnit
- of the row headers.public void setColumnHeaderUnit(GUnit newUnit)
newUnit
- of the rowHeaders.public void setDataUnit(GUnit newUnit)
newUnit
- of the table data.public void setRowHeaderFracDigits(int fracDigits) throws GEntryRealException
fracDigits
- number of fractional digits.GEntryRealException
- in case the number of fractional digits is invalid (<0 or >15).public void setColumnHeaderFracDigits(int fracDigits) throws GEntryRealException
fracDigits
- number of fractional digits.GEntryRealException
- in case the number of fractional digits is invalid (<0 or >15).public void setDataFracDigits(int fracDigits) throws GEntryRealException
fracDigits
- number of fractional digits.GEntryRealException
- in case the number of fractional digits is invalid (<0 or >15).public void setRowHeaderFormat(GTableModel.Format newFormat)
newFormat
- the format of the row headers.public void setColumnHeaderFormat(GTableModel.Format newFormat)
newFormat
- the format of the column headers.public void setDataFormat(GTableModel.Format newFormat)
newFormat
- the format of the data.public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public Component getComponent()
getComponent
in class GComponent
public void display()
public void read() throws GException
read
in interface GReadWrite
GException
- in case of problem while reading the value from file.public void write() throws GException
write
in interface GReadWrite
GException
- in case of problem while writing the value to file.public double[] getOrdValues()
public double[][] getValues()
public double[] getAbsValues()
public void clear()
public void setRowHeaderValue(int rowIndex, double value) throws GArithmeticException
rowIndex
- row indexvalue
- to be set.GArithmeticException
- if value is NaNpublic void setColumnHeaderValue(int columnIndex, double value) throws GArithmeticException
columnIndex
- column indexvalue
- to be set.GArithmeticException
- if value is NaNpublic void setDataValue(int rowIndex, int columnIndex, double value) throws GArithmeticException
rowIndex
- row indexcolumnIndex
- column indexvalue
- to be set.GArithmeticException
- if value is NaNpublic void setRowHeaderDefaultValue(double defaultValue) throws GArithmeticException
defaultValue
- the default value for the row header cells.GArithmeticException
- if defaultValue is NaNpublic void setColumnHeaderDefaultValue(double defaultValue) throws GArithmeticException
defaultValue
- the default value for the column header cells.GArithmeticException
- if defaultValue is NaNpublic void setDataDefaultValue(double defaultValue) throws GArithmeticException
defaultValue
- the default value for the data cells.GArithmeticException
- if defaultValue is NaNpublic void setMinMaxRowsColumns(Integer minRows, Integer maxRows, Integer minColumns, Integer maxColumns)
minRows
- minimal number of rows.maxRows
- maxilam number of rows or -1 if not limited.minColumns
- minimal number of columns.maxColumns
- maximal number of columns or -1 if not limited.Copyright © 2024. All rights reserved.