com.groiss.gui.component
Class TableContainer

java.lang.Object
  extended by com.groiss.gui.AbstractComponent
      extended by com.groiss.gui.AbstractContainer
          extended by com.groiss.gui.component.TableContainer
All Implemented Interfaces:
Component, Container, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.event.TableModelListener

public class TableContainer
extends AbstractContainer
implements javax.swing.event.TableModelListener

TableContainer component

See Also:
Serialized Form

Field Summary
protected  boolean colouredRows
           
protected  int counter
           
protected  java.util.List headerNames
           
protected  javax.swing.table.TableModel tm
           
 
Fields inherited from class com.groiss.gui.AbstractContainer
components
 
Fields inherited from class com.groiss.gui.AbstractComponent
actions, 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, outputter, parent, parentElem, READONLY, root, viewMode
 
Constructor Summary
TableContainer()
          constructs a new empty tablecontainer
TableContainer(java.util.List headers, javax.swing.table.TableModel t)
          constructs a new tablecontainer
TableContainer(java.lang.String id)
          Constructs a new empty table-container.
TableContainer(java.lang.String className, java.lang.String width, boolean colored)
           
TableContainer(java.lang.String id, javax.swing.table.TableModel t)
          constructs a new tablecontainer
TableContainer(javax.swing.table.TableModel t)
          constructs a new tablecontainer
 
Method Summary
 void addColspanRow(java.util.List rowData, boolean add, int from, int length)
          adds a new row with colspan
 void addHeader(java.util.List rowData)
           
 void addRow(java.util.List rowData)
          adds a new row at the end of the table with the content of the vector
 void addRow(java.util.List rowData, boolean isHeader)
           
 void addRow(java.util.List rowData, java.util.List dataprops)
          adds a new row with the specified dataproperties
 void addRow(java.util.List rowData, java.util.List rowprops, java.util.List dataprops)
          adds a new row with the properties in the vector if the row is a systemstep row, the row is always red!!
 void addRow(java.util.List rowData, java.lang.String id, java.util.List rowprops, java.util.List dataprops)
          Adds a new Row with a row id.
 void addRow(java.util.List rowData, java.lang.String id, java.util.List rowprops, java.util.List dataprops, boolean isHeader)
          Add a row to the table.
 void addRow(java.lang.Object[] row)
           
 void addRow(java.lang.Object[] row, java.lang.String id, java.util.List rowprops, java.util.List dataprops, boolean isHeader)
           
protected  void addRow(javax.swing.table.TableModel src, int first, int last)
          adds a new row with the content of tablemodel
protected  void build()
          builds the table with the elements of the TableModel.
protected  void dataChanged(javax.swing.table.TableModel src)
          builds the tree in a new order (moveRow)
 java.util.List getCellAttributes(int rowIndex, int colIndex)
          returns a vector of attributes of the chosen cell
 java.util.List getColumnAttributes(int colIndex)
           
 int getColumnWidth(int colIndex)
          returns the width of a specified column
 Component getComponentAt(int rowIndex, int colIndex)
          returns the component at the specified position
 java.lang.Object getContent()
          Returns null.
 java.util.List getHeaderContent()
          returns the content of the column header (first row)
 java.util.List getHeaderNames()
          returns the names of the columns
 javax.swing.table.TableModel getModel()
           
 java.util.List getRows(boolean isHeader)
           
 java.util.List getTableAttributes()
          returns a vector of pairs (names, attributes) of the table element
 java.lang.String getValueAt(int rowIndex, int colIndex)
          returns a string representation of the component at the specified position
protected  java.lang.Object removeRow(int index)
          removes the rows at the specified position INDEX from the table
 void setCellAttribute(int rowIndex, int colIndex, java.lang.String name, java.lang.String value)
          sets the attribute in the specified cell
protected  void setCellValue(org.jdom.Element cell, java.lang.Object data, java.util.List cellprops, int colindex)
           
 void setColouredRows(boolean coloured)
          sets whether every second row is coloured or not sets the counter for counting the number of rows 0
 void setColumnAlign(int colIndex, java.lang.String align)
          sets the attribute, which controls whether the text is aligned to the left to the right or in the center
 void setColumnAttribute(int colIndex, java.lang.String name, java.lang.String value)
          sets the specified attribute in the whole column
 void setColumnHeight(int colIndex, int height)
          sets the height of a specified column
 void setColumnValign(int colIndex, java.lang.String valign)
          sets the attribute, which controls whether the text is vertical aligned to the to the top, middle bottom or in the baseline
 void setColumnWidth(int colIndex, int width)
          sets the width of a specified column
 void setComponent(int colIndex, java.lang.Class 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(java.lang.Object o)
          Initialize the table with the given tabel model.
 void setHeaderAttribute(java.lang.String name, java.lang.String value)
          sets an attribute of the column header (first row)
 void setHeaderName(int index, java.lang.String name)
          sets the columnname of a specified column
 void setModel(javax.swing.table.TableModel t)
           
 void setRowAttribute(int rowIndex, java.lang.String name, java.lang.String value)
          sets the specified attribute in the whole row
 void setUseTableBody(boolean use)
           
 void setValueAt(java.lang.Object o, int rowIndex, int colIndex)
          sets a new value (a new component) to the specified position in the table
 java.lang.String showRows()
           
 void tableChanged(javax.swing.event.TableModelEvent event)
          method which handles the incoming events
 
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
clone, create, getActionListener, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getRootName, getStyle, getViewMode, init, init, removeAttribute, setActionListener, setAttribute, setEncoding, setExpandEmptyElements, setId, setIndenting, setLabel, setName, setNewLines, setParent, setParentElement, setRootName, setStyle, setViewMode, show, show, 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
clone, getActionListener, getAttribute, getBrowserMode, getId, getLabel, getName, getParent, getParentElement, getRoot, getStyle, getViewMode, init, removeAttribute, setActionListener, setAttribute, setId, setLabel, setName, setParent, setParentElement, setStyle, setViewMode, show, show, toString
 

Field Detail

tm

protected javax.swing.table.TableModel tm

headerNames

protected java.util.List headerNames

colouredRows

protected boolean colouredRows

counter

protected int counter
Constructor Detail

TableContainer

public TableContainer()
constructs a new empty tablecontainer


TableContainer

public TableContainer(java.lang.String id)
Constructs a new empty table-container.

Parameters:
id - id of the table element

TableContainer

public TableContainer(java.lang.String className,
                      java.lang.String width,
                      boolean colored)

TableContainer

public TableContainer(java.lang.String id,
                      javax.swing.table.TableModel t)
constructs a new tablecontainer

Parameters:
id - - the id
t - - the tablemodel

TableContainer

public TableContainer(javax.swing.table.TableModel t)
constructs a new tablecontainer

Parameters:
t - - the tablemodel

TableContainer

public TableContainer(java.util.List headers,
                      javax.swing.table.TableModel t)
constructs a new tablecontainer

Parameters:
t - - the tablemodel
Method Detail

setUseTableBody

public void setUseTableBody(boolean use)

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent event)
method which handles the incoming events

Specified by:
tableChanged in interface javax.swing.event.TableModelListener
Parameters:
event - - the event (-1, 0, 1)

setModel

public void setModel(javax.swing.table.TableModel t)

dataChanged

protected void dataChanged(javax.swing.table.TableModel src)
builds the tree in a new order (moveRow)

Parameters:
src - - the new sorted TableModel

setValueAt

public void setValueAt(java.lang.Object o,
                       int rowIndex,
                       int colIndex)
sets a new value (a new component) to the specified position in the table

Parameters:
o - - the new component
rowIndex - - the row index of the new component
colIndex - - the column index of the new component

addRow

public void addRow(java.util.List rowData)
adds a new row at the end of the table with the content of the vector

Parameters:
rowData -

addRow

public void addRow(java.util.List rowData,
                   boolean isHeader)

addRow

public void addRow(java.util.List rowData,
                   java.util.List dataprops)
adds a new row with the specified dataproperties

Parameters:
rowData - the data of the new row
dataprops - the properties of each data in the row

addRow

public void addRow(java.util.List rowData,
                   java.util.List rowprops,
                   java.util.List 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 row
rowprops - the properties of the row (Pairs)
dataprops - the properties of each cell in the row (Pairs)

addRow

public void addRow(java.util.List rowData,
                   java.lang.String id,
                   java.util.List rowprops,
                   java.util.List dataprops)
Adds a new Row with a row id.

Parameters:
rowData - the data of the new row
id - id of row
rowprops - the properties of the row (Pairs)
dataprops - the properties of each cell in the row (Pairs)

addHeader

public void addHeader(java.util.List rowData)

getRows

public java.util.List getRows(boolean isHeader)

addRow

public void addRow(java.lang.Object[] row)

addRow

public void addRow(java.lang.Object[] row,
                   java.lang.String id,
                   java.util.List rowprops,
                   java.util.List dataprops,
                   boolean isHeader)

addRow

public void addRow(java.util.List rowData,
                   java.lang.String id,
                   java.util.List rowprops,
                   java.util.List dataprops,
                   boolean isHeader)
Add a row to the table.

Parameters:
rowData - a list of row data
id - id of the row
rowprops - list of row properties
dataprops - list of properties for each table cell
isHeader - true if the row is a header row (TH elements)

setCellValue

protected void setCellValue(org.jdom.Element cell,
                            java.lang.Object data,
                            java.util.List cellprops,
                            int colindex)

addRow

protected void addRow(javax.swing.table.TableModel src,
                      int first,
                      int last)
adds a new row with the content of tablemodel

Parameters:
src - - the tablemodel
first - - the rowindex of the first changed row
last - - the rowindex of the last changed row

removeRow

protected java.lang.Object removeRow(int index)
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

public java.util.List getTableAttributes()
returns a vector of pairs (names, attributes) of the table element


getHeaderContent

public java.util.List getHeaderContent()
returns the content of the column header (first row)


setHeaderName

public void setHeaderName(int index,
                          java.lang.String name)
sets the columnname of a specified column

Parameters:
index - - the specified column
name - - the new name of the column

getHeaderNames

public java.util.List getHeaderNames()
returns the names of the columns


setHeaderAttribute

public void setHeaderAttribute(java.lang.String name,
                               java.lang.String value)
sets an attribute of the column header (first row)

Parameters:
name - - the attribute name
value - - the attribute value

setCellAttribute

public void setCellAttribute(int rowIndex,
                             int colIndex,
                             java.lang.String name,
                             java.lang.String value)
sets the attribute in the specified cell

Parameters:
rowIndex - - the row index of the specified cell
colIndex - - the column index of the specified cell
name - - the name of the attribute
value - - the value of the attribute

getCellAttributes

public java.util.List getCellAttributes(int rowIndex,
                                        int colIndex)
returns a vector of attributes of the chosen cell

Parameters:
rowIndex - - the row index of the specified cell
colIndex - - 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 index
width - - the width

setColumnHeight

public void setColumnHeight(int colIndex,
                            int height)
sets the height of a specified column

Parameters:
colIndex - - the column index
height - - the height

setColumnAlign

public void setColumnAlign(int colIndex,
                           java.lang.String align)
sets the attribute, which controls whether the text is aligned to the left to the right or in the center

Parameters:
colIndex - - the specified column
align - - center, left or right

setColumnValign

public void setColumnValign(int colIndex,
                            java.lang.String valign)
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 column
valign - - top, middle, bottom or baseline

getColumnWidth

public int getColumnWidth(int colIndex)
                   throws org.jdom.DataConversionException
returns the width of a specified column

Parameters:
colIndex - - the column index
Returns:
- the width in int
Throws:
org.jdom.DataConversionException

setColumnAttribute

public void setColumnAttribute(int colIndex,
                               java.lang.String name,
                               java.lang.String value)
sets the specified attribute in the whole column

Parameters:
colIndex - - the column
name - - the attribute name
value - - the attribute value

setRowAttribute

public void setRowAttribute(int rowIndex,
                            java.lang.String name,
                            java.lang.String value)
sets the specified attribute in the whole row

Parameters:
rowIndex - - the row
name - - the attribute name
value - - the attribute value

getColumnAttributes

public java.util.List getColumnAttributes(int colIndex)

setComponent

public void setComponent(int colIndex,
                         java.lang.Class cl)
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 column
cl - - the specified component as class

getComponentAt

public Component getComponentAt(int rowIndex,
                                int colIndex)
returns the component at the specified position

Parameters:
rowIndex - - the row index
colIndex - - the column index
Returns:
- the component

getValueAt

public java.lang.String getValueAt(int rowIndex,
                                   int colIndex)
returns a string representation of the component at the specified position

Parameters:
rowIndex - - the row index
colIndex - - the column index
Returns:
- the string representation of the component

build

protected void build()
builds the table with the elements of the TableModel.


getModel

public javax.swing.table.TableModel getModel()

setContent

public void setContent(java.lang.Object o)
Initialize the table with the given tabel model.

Specified by:
setContent in interface Component
Overrides:
setContent in class AbstractComponent
Parameters:
o - a table model

getContent

public java.lang.Object getContent()
Returns null.

Specified by:
getContent in interface Component
Overrides:
getContent in class AbstractComponent
Returns:
null

showRows

public java.lang.String 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

public void addColspanRow(java.util.List rowData,
                          boolean add,
                          int from,
                          int length)
adds a new row with colspan

Parameters:
rowData - the data of the row
add - specifies whether the row is an comment (true) or not
from - the number of the cell, where the colspan starts
length - the size of the colspan


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.