Package com.groiss.gui.component
Class TableContainer
java.lang.Object
com.groiss.gui.AbstractComponent
com.groiss.gui.AbstractContainer
com.groiss.gui.component.TableContainer
- All Implemented Interfaces:
Component
,Container
,Serializable
,Cloneable
Container for a HTML table.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected int
protected List<Serializable>
protected TableModel
Fields inherited from class com.groiss.gui.AbstractContainer
components
Fields inherited from class com.groiss.gui.AbstractComponent
ACTIVE, browserMode, DEFAULT, ID, IE, INVISIBLE, isSensitive, label, NS, ON_BLUR, ON_CHANGE, ON_CLICK, ON_DBLCLICK, ON_FOCUS, ON_KEY_DOWN, ON_KEY_PRESS, ON_KEY_UP, ON_LOAD, ON_MOUSE_DOWN, ON_MOUSE_MOVE, ON_MOUSE_OUT, ON_MOUSE_UP, ON_RESET, ON_SELECT, ON_SUBMIT, ON_UNLOAD, parent, parentElem, READONLY, root, viewMode
Fields inherited from interface com.groiss.gui.Component
LABELLEDBY
-
Constructor Summary
ConstructorDescriptionconstructs a new empty tablecontainerTableContainer
(String id) Constructs a new empty table-container.TableContainer
(String className, String width, boolean colored) TableContainer
(String id, TableModel t) constructs a new tablecontainerTableContainer
(List<Object> headers, TableModel t) constructs a new tablecontainerconstructs a new tablecontainer -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColspanRow
(List<?> rowData, boolean add, int from, int length) adds a new row with colspanvoid
void
void
addRow
(Object[] row, String id, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops, boolean isHeader) void
adds a new row at the end of the table with the content of the vectorvoid
void
addRow
(List<?> rowData, String id, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops) Adds a new Row with a row id.void
addRow
(List<?> rowData, String id, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops, boolean isHeader) Add a row to the table.void
adds a new row with the specified datapropertiesvoid
adds a new row with the properties in the vector if the row is a systemstep row, the row is always red!!protected void
build()
builds the table with the elements of the TableModel.protected void
dataChanged
(TableModel src) builds the tree in a new order (moveRow)getCellAttributes
(int rowIndex, int colIndex) returns a vector of attributes of the chosen cellgetColumnAttributes
(int colIndex) Deprecated.since 10.0int
getColumnWidth
(int colIndex) returns the width of a specified columngetComponentAt
(int rowIndex, int colIndex) returns the component at the specified positionReturns null.returns the content of the column header (first row)returns the names of the columnsgetModel()
getRows
(boolean isHeader) returns a vector of pairs (names, attributes) of the table elementgetValueAt
(int rowIndex, int colIndex) returns a string representation of the component at the specified positionremoveRow
(int index) removes the rows at the specified position INDEX from the tablevoid
setCellAttribute
(int rowIndex, int colIndex, String name, String value) sets the attribute in the specified cellprotected void
void
setColouredRows
(boolean coloured) sets whether every second row is coloured or not sets the counter for counting the number of rows 0void
setColumnAlign
(int colIndex, String align) sets the attribute, which controls whether the text is aligned to the left to the right or in the centervoid
setColumnAttribute
(int colIndex, String name, String value) sets the specified attribute in the whole columnvoid
setColumnHeight
(int colIndex, int height) sets the height of a specified columnvoid
setColumnValign
(int colIndex, String valign) sets the attribute, which controls whether the text is vertical aligned to the to the top, middle bottom or in the baselinevoid
setColumnWidth
(int colIndex, int width) sets the width of a specified columnvoid
setComponent
(int colIndex, Class<? extends Component> cl) sets a specified component in the chosen column sets the component for all elements except the first one (row 0 - header column!!!)void
setContent
(Object o) Initialize the table with the given tabel model.void
setHeaderAttribute
(String name, String value) sets an attribute of the column header (first row)void
setHeaderName
(int index, String name) sets the columnname of a specified columnvoid
void
setRowAttribute
(int rowIndex, String name, String value) sets the specified attribute in the whole rowvoid
setUseTableBody
(boolean use) void
setValueAt
(Object o, int rowIndex, int colIndex) sets a new value (a new component) to the specified position in the tableshowRows()
Methods inherited from class com.groiss.gui.AbstractContainer
add, get, getAll, getAll, getAllDeep, getByName, getComponents, getWithParent, init, remove, setBrowserMode, substitute
Methods inherited from class com.groiss.gui.AbstractComponent
addClass, clone, create, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getRootName, getStyle, getViewMode, init, init, removeAttribute, removeClass, setActionListener, setAttribute, setClass, setEncoding, setExpandEmptyElements, setId, setIndenting, setLabel, setName, setNewLines, setParent, setParentElement, setRootName, setStyle, setViewMode, show, show, toggleClass, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.groiss.gui.Component
addClass, clone, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getStyle, getViewMode, init, removeAttribute, removeClass, setActionListener, setAttribute, setClass, setId, setLabel, setName, setParent, setParentElement, setStyle, setViewMode, show, show, toggleClass, toString
-
Field Details
-
tm
-
headerNames
-
colouredRows
protected boolean colouredRows -
counter
protected int counter
-
-
Constructor Details
-
TableContainer
public TableContainer()constructs a new empty tablecontainer -
TableContainer
Constructs a new empty table-container.- Parameters:
id
- id of the table element
-
TableContainer
-
TableContainer
constructs a new tablecontainer- Parameters:
id
- - the idt
- - the tablemodel
-
TableContainer
constructs a new tablecontainer- Parameters:
t
- - the tablemodel
-
TableContainer
constructs a new tablecontainer- Parameters:
t
- - the tablemodel
-
-
Method Details
-
setUseTableBody
public void setUseTableBody(boolean use) -
setModel
-
dataChanged
builds the tree in a new order (moveRow)- Parameters:
src
- - the new sorted TableModel
-
setValueAt
sets a new value (a new component) to the specified position in the table- Parameters:
o
- - the new componentrowIndex
- - the row index of the new componentcolIndex
- - the column index of the new component
-
addRow
adds a new row at the end of the table with the content of the vector- Parameters:
rowData
-
-
addRow
-
addRow
adds a new row with the specified dataproperties- Parameters:
rowData
- the data of the new rowdataprops
- the properties of each data in the row
-
addRow
public void addRow(List<?> rowData, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops) adds a new row with the properties in the vector if the row is a systemstep row, the row is always red!!- Parameters:
rowData
- the data of the new rowrowprops
- the properties of the row (Pairs)dataprops
- the properties of each cell in the row (Pairs)
-
addRow
public void addRow(List<?> rowData, String id, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops) Adds a new Row with a row id.- Parameters:
rowData
- the data of the new rowid
- id of rowrowprops
- the properties of the row (Pairs)dataprops
- the properties of each cell in the row (Pairs)
-
addHeader
-
getRows
-
addRow
-
addRow
-
addRow
public void addRow(List<?> rowData, String id, List<Pair<String, String>> rowprops, List<Pair<String, String>> dataprops, boolean isHeader) Add a row to the table.- Parameters:
rowData
- a list of row dataid
- id of the rowrowprops
- list of row propertiesdataprops
- list of properties for each table cellisHeader
- true if the row is a header row (TH elements)
-
setCellValue
-
removeRow
removes the rows at the specified position INDEX from the table- Parameters:
index
- - the index of the first row- Returns:
- - vector of deleted objects (elements)
-
getTableAttributes
returns a vector of pairs (names, attributes) of the table element -
getHeaderContent
returns the content of the column header (first row) -
setHeaderName
sets the columnname of a specified column- Parameters:
index
- - the specified columnname
- - the new name of the column
-
getHeaderNames
returns the names of the columns -
setHeaderAttribute
sets an attribute of the column header (first row)- Parameters:
name
- - the attribute namevalue
- - the attribute value
-
setCellAttribute
sets the attribute in the specified cell- Parameters:
rowIndex
- - the row index of the specified cellcolIndex
- - the column index of the specified cellname
- - the name of the attributevalue
- - the value of the attribute
-
getCellAttributes
returns a vector of attributes of the chosen cell- Parameters:
rowIndex
- - the row index of the specified cellcolIndex
- - the column index of the specified cell
-
setColumnWidth
public void setColumnWidth(int colIndex, int width) sets the width of a specified column- Parameters:
colIndex
- - the column indexwidth
- - the width
-
setColumnHeight
public void setColumnHeight(int colIndex, int height) sets the height of a specified column- Parameters:
colIndex
- - the column indexheight
- - the height
-
setColumnAlign
sets the attribute, which controls whether the text is aligned to the left to the right or in the center- Parameters:
colIndex
- - the specified columnalign
- - center, left or right
-
setColumnValign
sets the attribute, which controls whether the text is vertical aligned to the to the top, middle bottom or in the baseline- Parameters:
colIndex
- - the specified columnvalign
- - top, middle, bottom or baseline
-
getColumnWidth
returns the width of a specified column- Parameters:
colIndex
- - the column index- Returns:
- - the width in int
- Throws:
DataConversionException
-
setColumnAttribute
sets the specified attribute in the whole column- Parameters:
colIndex
- - the columnname
- - the attribute namevalue
- - the attribute value
-
setRowAttribute
sets the specified attribute in the whole row- Parameters:
rowIndex
- - the rowname
- - the attribute namevalue
- - the attribute value
-
getColumnAttributes
Deprecated.since 10.0- Returns:
- always null
-
setComponent
sets a specified component in the chosen column sets the component for all elements except the first one (row 0 - header column!!!)- Parameters:
colIndex
- - the columncl
- - the specified component as class
-
getComponentAt
returns the component at the specified position- Parameters:
rowIndex
- - the row indexcolIndex
- - the column index- Returns:
- - the component
-
getValueAt
returns a string representation of the component at the specified position- Parameters:
rowIndex
- - the row indexcolIndex
- - the column index- Returns:
- - the string representation of the component
-
build
protected void build()builds the table with the elements of the TableModel. -
getModel
-
setContent
Initialize the table with the given tabel model.- Specified by:
setContent
in interfaceComponent
- Overrides:
setContent
in classAbstractComponent
- Parameters:
o
- a table model
-
getContent
Returns null.- Specified by:
getContent
in interfaceComponent
- Overrides:
getContent
in classAbstractComponent
- Returns:
- null
-
showRows
-
setColouredRows
public void setColouredRows(boolean coloured) sets whether every second row is coloured or not sets the counter for counting the number of rows 0- Parameters:
coloured
-
-
addColspanRow
adds a new row with colspan- Parameters:
rowData
- the data of the rowadd
- specifies whether the row is an comment (true) or notfrom
- the number of the cell, where the colspan startslength
- the size of the colspan
-