public class VizTableComponent extends VizObject
The TableComponent class is a Component that contains a set of Entries that are related to each other within a single row of a table and it can contain many rows. Each row of the table contains a set of Entries that only make sense when they are considered as a set, such as "Hostname," "Operating System" and "Install Path" for a particular executable application or script. The structure of the Table is defined by its "Row Template" that contains a default Entry for each column. So, if we wanted a table with a column for "Hostname," "Operating System" and "Install Path" we would set the row template on the TableComponent with a set of three Entries, one for each property, that describes the default configuration. The row template is the canonical row configuration of the TableComponent. Once the template is set it can not be changed, although it can be retrieved for reference. Adding a row to the table creates a copy of the template and assumes the default values, which can be edited after retrieving the row. Rows may be deleted and if a row is deleted it will result in the entire table being re-ordered to keep the row numbers sequential.
iComponentListener
Constructor and Description |
---|
VizTableComponent()
The constructor
|
Modifier and Type | Method and Description |
---|---|
int |
addRow()
This operation adds a row to the Table and returns the index of that row.
|
java.lang.Object |
clone()
This operation provides a deep copy of the TableComponent.
|
void |
copy(VizTableComponent otherTableComponent)
This operation performs a deep copy of the attributes of another
TableComponent into the current TableComponent.
|
boolean |
deleteRow(int index)
This operation will delete the row in the table with the specified index.
|
boolean |
equals(java.lang.Object otherTableComponent)
This operation is used to check equality between the TableComponent and
another TableComponent.
|
java.util.ArrayList<java.lang.String> |
getColumnNames()
This operation returns the names of the table's columns.
|
java.util.ArrayList<VizEntry> |
getRow(int index)
This operation retrieves an individual row from the Table.
|
java.util.ArrayList<java.lang.Integer> |
getRowIds()
This operation returns the set of integers that uniquely identify rows in
the table.
|
java.util.ArrayList<VizEntry> |
getRowTemplate()
This operation returns the row template for this TableComponent.
|
java.util.ArrayList<java.lang.Integer> |
getSelectedRows()
This operation returns an array of the row ids that have been marked as
selected in the table.
|
int |
hashCode()
This operation returns the hashcode value of the TableComponent.
|
int |
numberOfColumns()
This operation returns the number of columns that are stored in the
table.
|
int |
numberOfRows()
This operation returns the number of rows that are stored in the table.
|
void |
setRowTemplate(java.util.ArrayList<VizEntry> template)
This operation sets the collection of Entries which should be used as the
template for this table.
|
void |
setSelectedRows(java.util.ArrayList<java.lang.Integer> rows)
This operation sets the selected rows in the table.
|
copy, getDescription, getId, getName, register, setDescription, setId, setName, unregister, update
public int numberOfRows()
This operation returns the number of rows that are stored in the table.
The total number of rows in the table.
public int numberOfColumns()
This operation returns the number of columns that are stored in the table. This is exactly equal to the length of a single row since the TableComponent is built off of a row template.
The number of columns.
public java.util.ArrayList<VizEntry> getRow(int index)
This operation retrieves an individual row from the Table. The row is returned as a collection of Entries that represent each element in the row. The collection is a new collection, but the Entries are references of the values currently stored in the TableComponent. (This prevents the rows from being re-ordered.)
index
- The row's index or id in the table.
The set of Entries that represent the row in the table.
public int addRow()
This operation adds a row to the Table and returns the index of that row. The new row may be retrieved and its Entries may be edited by calling getRow() using the returned index. When a new row is added, the elements of that row are configured from the row template using its default values. If the Row Template has not yet been set for the TableComponent, this operation cannot add a row and it returns -1.
The index of the new row in the table.
public boolean deleteRow(int index)
This operation will delete the row in the table with the specified index. It will return true if it is success or false otherwise (like if it can not find a row with that index).
index
- The index of the row that should be deleted.
True if the row was deleted and false if some problem was encountered, like an incorrect row id.
public void setRowTemplate(java.util.ArrayList<VizEntry> template)
This operation sets the collection of Entries which should be used as the template for this table. This template will be used to create new rows and to determine the default values of elements and the names of columns. The row template may only be set once per TableComponent: changing the row template of a TableComponent can only be done by creating a new one.
template
- The set of Entries that represent the canonical row of this table.
public java.util.ArrayList<VizEntry> getRowTemplate()
This operation returns the row template for this TableComponent.
The set of Entries that represent the canonical row of this table.
public java.util.ArrayList<java.lang.Integer> getRowIds()
This operation returns the set of integers that uniquely identify rows in the table.
The set of ids or indices for the rows in the table.
public java.util.ArrayList<java.lang.String> getColumnNames()
This operation returns the names of the table's columns.
The names of the columns.
public void copy(VizTableComponent otherTableComponent)
This operation performs a deep copy of the attributes of another TableComponent into the current TableComponent.
otherTableComponent
- The TableComponent from which information should be copied.
public java.lang.Object clone()
This operation provides a deep copy of the TableComponent.
clone
in interface IVizObject
clone
in class VizObject
A clone of the TableComponent.
public boolean equals(java.lang.Object otherTableComponent)
This operation is used to check equality between the TableComponent and another TableComponent. It returns true if the TableComponents are equal and false if they are not.
equals
in interface IVizObject
equals
in class VizObject
otherTableComponent
- The TableComponent that should be checked for equality.
True if the TableComponents are equal, false if not
Identifiable#equals(Object otherObject)
public int hashCode()
This operation returns the hashcode value of the TableComponent.
hashCode
in interface IVizObject
hashCode
in class VizObject
The hashcode
Identifiable#hashCode()
public java.util.ArrayList<java.lang.Integer> getSelectedRows()
This operation returns an array of the row ids that have been marked as selected in the table.
The set of rows in the table that have been marked as selected or null if none have been selected.
public void setSelectedRows(java.util.ArrayList<java.lang.Integer> rows)
rows
- An array of the rows in the table that should be marked as
selected. If an id in this array is not also in the table then
it is ignored and will not be returned in a call to
getSelectedRows.