public class ExecutionTableItem
extends java.lang.Object
ExecutionTable
.
setCellObject(int, Object)
or use the cell object by id method (setCellObjectByID(int, Object)
)
to set the cell objects by column identifiers instead of column indices.setCellData(Map)
or setCellDataByID(Map)
.
setCellBackground(int, Color)
and setCellForeground(int, Color)
. Use setCellBackgroundByID(int, Color)
or setCellForegroundByID(int, Color)
if you only have the identifier of the column where you want to change the background or foreground.
setBorder(ExecutionTableBorder)
. With setCellBorder(int, Color)
or
setCellBorderByID(int, Color)
you can set a border color for a specific cell. If a cell has a border color then it is painted a 1px solid
border around the cell in the specified color.
ExecutionTable.add(ExecutionTableItem)
.
setDefaultInputParser(InputParser)
) and/or cell input parser (setCellInputParser(int, InputParser)
)
that the user input can be converted in correct cell objects.// create the columns ... // create the items ... // the user can edit the first and the third cell of the item second item table.getColumn(0).setEditable(true); table.getColumn(2).setEditable(true); // after that it is not possible yet to edit the cells table.getItem(1).setEditable(true); // now the user can input values for the cells 1 and 3
Modifier and Type | Class and Description |
---|---|
static interface |
ExecutionTableItem.InputParser<T>
Represents a parser for user input.
|
static class |
ExecutionTableItem.NumericInputParser
A default parser for numeric output.
|
static class |
ExecutionTableItem.StringInputParser
A default parser for string output.
|
Constructor and Description |
---|
ExecutionTableItem()
Creates a new item.
|
ExecutionTableItem(int id)
Creates a new item.
|
ExecutionTableItem(java.util.Map<java.lang.Integer,? extends java.lang.Object> cellData,
boolean dataByID)
Creates a new item.
|
ExecutionTableItem(java.util.Map<java.lang.Integer,? extends java.lang.Object> cellData,
boolean dataByID,
int id)
Creates a new item.
|
ExecutionTableItem(java.lang.Object[] cellObjects)
Creates a new item.
|
ExecutionTableItem(java.lang.Object[] cellObjects,
int id)
Creates a new item.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getBackground()
Gets the items's background color.
|
ExecutionTableBorder |
getBorder()
Gets the item's custom border.
|
java.awt.Color |
getCellBackground(int colIndex)
Gets the cell's background color.
|
javax.swing.border.Border |
getCellBorder(int colIndex)
Gets the cell's border.
|
java.awt.Color |
getCellForeground(int colIndex)
Gets the cell's foreground color.
|
ExecutionTableItem.InputParser<?> |
getCellInputParser(int colIndex)
Gets the cell's input parser.
|
java.lang.Object |
getCellObject(int colIndex)
Gets the cell's object of the specified column.
|
java.awt.Color |
getForeground()
Gets the items's foreground color.
|
int |
getID()
Gets the identifier of the item.
|
int |
getIndex()
Gets the index of the item in the list of all items of the table.
|
java.lang.Object |
getUserData()
Gets the user data of the item.
|
boolean |
isEditable()
Indicates whether the item is editable.
|
boolean |
isVisible()
Indicates whether the item is visible or not.
|
void |
setBackground(java.awt.Color color)
Sets the item's background color.
|
void |
setBorder(ExecutionTableBorder border)
Sets the item's custom border.
|
void |
setCellBackground(int colIndex,
java.awt.Color color)
Sets the cell's background color at the specified column.
|
void |
setCellBackgroundByID(int colID,
java.awt.Color color)
Sets the cell's background color at the specified column.
|
void |
setCellBorder(int colIndex,
javax.swing.border.Border border)
Sets the cell's border.
|
void |
setCellBorder(int colIndex,
java.awt.Color color)
Sets the cell's border.
|
void |
setCellBorder(int colIndex,
java.awt.Color color,
int width)
Sets the cell's border.
|
void |
setCellBorderByID(int colID,
javax.swing.border.Border border)
Sets the cell's border at the specified column.
|
void |
setCellBorderByID(int colID,
java.awt.Color color)
Sets the cell's border at the specified column.
|
void |
setCellBorderByID(int colID,
java.awt.Color color,
int width)
Sets the cell's border at the specified column.
|
<T> void |
setCellData(java.util.Map<java.lang.Integer,T> data)
Sets the cell data of the item.
|
<T> void |
setCellDataByID(java.util.Map<java.lang.Integer,T> data)
Sets the cell data of the item by column identifiers.
|
void |
setCellForeground(int colIndex,
java.awt.Color color)
Sets the cell's foreground color.
|
void |
setCellForegroundByID(int colID,
java.awt.Color color)
Sets the cell's foreground color at the specified column.
|
void |
setCellInputParser(int colIndex,
ExecutionTableItem.InputParser<?> parser)
Sets the cell's input parser.
|
<T> void |
setCellObject(int colIndex,
T object)
Sets the cell's object at the specified column.
|
<T> void |
setCellObjectByID(int colID,
T object)
Sets the cell's object at the specified column.
|
void |
setDefaultInputParser(ExecutionTableItem.InputParser<?> parser)
Sets the default input parser for the cells.
|
void |
setEditable(boolean editable)
Sets whether the item is editable.
|
void |
setForeground(java.awt.Color color)
Sets the item's foreground color.
|
void |
setUserData(java.lang.Object data)
Sets the user data of the item.
|
void |
setVisible(boolean visible)
Sets whether whether the item is visible or not.
|
public ExecutionTableItem()
public ExecutionTableItem(int id)
id
- the identifier or -1
if the item has no identifierpublic ExecutionTableItem(java.lang.Object[] cellObjects)
cellObjects
- the cell objects or null
if the item has no initial cell objectspublic ExecutionTableItem(java.lang.Object[] cellObjects, int id)
cellObjects
- the cell objects or null
if the item has no initial cell objectsid
- the identifier or -1
if the item has no identifierpublic ExecutionTableItem(java.util.Map<java.lang.Integer,? extends java.lang.Object> cellData, boolean dataByID)
cellData
- the data of the cells with the column index or the column identifier as the key and the cell's object as the associated valuedataByID
- true
if the column identifier is used as the data key or false
if the column index is used as the data keypublic ExecutionTableItem(java.util.Map<java.lang.Integer,? extends java.lang.Object> cellData, boolean dataByID, int id)
cellData
- the data of the cells with the column index or the column identifier as the key and the cell's object as the associated valuedataByID
- true
if the column identifier is used as the data key or false
if the column index is used as the data keyid
- the identifier or -1
if the item has no identifierpublic final int getID()
-1
if there is not specified an identifier for the itempublic java.awt.Color getBackground()
public void setBackground(java.awt.Color color) throws java.lang.IllegalArgumentException
ExecutionTable.setAutoRepaint(boolean)
)!color
- the background colorjava.lang.IllegalArgumentException
- public java.awt.Color getForeground()
public void setForeground(java.awt.Color color) throws java.lang.IllegalArgumentException
ExecutionTable.setAutoRepaint(boolean)
)!color
- the foreground colorjava.lang.IllegalArgumentException
- public java.lang.Object getCellObject(int colIndex)
colIndex
- the column indexnull
if the cell has no objectpublic <T> void setCellObject(int colIndex, T object)
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexobject
- the objectpublic <T> void setCellObjectByID(int colID, T object)
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columnobject
- the objectpublic <T> void setCellData(java.util.Map<java.lang.Integer,T> data) throws java.lang.IllegalArgumentException
ExecutionTable.setAutoRepaint(boolean)
)!data
- the data of the cells with the column index as the key and the cell's object as the associated valuejava.lang.IllegalArgumentException
- public <T> void setCellDataByID(java.util.Map<java.lang.Integer,T> data) throws java.lang.IllegalArgumentException
ExecutionTable.setAutoRepaint(boolean)
)!data
- the data of the cells with the column identifier as the key and the cell's object as the associated valuejava.lang.IllegalArgumentException
- public java.awt.Color getCellBackground(int colIndex)
colIndex
- the column indexpublic void setCellBackground(int colIndex, java.awt.Color color)
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexcolor
- the background colorpublic void setCellBackgroundByID(int colID, java.awt.Color color)
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columncolor
- the background colorpublic java.awt.Color getCellForeground(int colIndex)
colIndex
- the column indexpublic void setCellForeground(int colIndex, java.awt.Color color)
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexcolor
- the foreground colorpublic void setCellForegroundByID(int colID, java.awt.Color color)
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columncolor
- the foreground colorpublic javax.swing.border.Border getCellBorder(int colIndex)
colIndex
- the column indexnull
if the cell does not have a borderpublic void setCellBorder(int colIndex, javax.swing.border.Border border)
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexborder
- the border or null
if the cell should not have a borderpublic void setCellBorder(int colIndex, java.awt.Color color) throws java.lang.IllegalArgumentException
null
.
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexcolor
- the border color or null
if the cell should not have a borderjava.lang.IllegalArgumentException
public void setCellBorder(int colIndex, java.awt.Color color, int width) throws java.lang.IllegalArgumentException
ExecutionTable.setAutoRepaint(boolean)
)!colIndex
- the column indexcolor
- the border color or null
if the cell should not have a borderwidth
- the line width of the borderjava.lang.IllegalArgumentException
- < 1
public void setCellBorderByID(int colID, javax.swing.border.Border border)
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columnborder
- the border or null
if the cell should not have a borderpublic void setCellBorderByID(int colID, java.awt.Color color)
null
.
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columncolor
- the border color or null
if the cell should not have a borderpublic void setCellBorderByID(int colID, java.awt.Color color, int width) throws java.lang.IllegalArgumentException
null
.
ExecutionTable.setAutoRepaint(boolean)
)!colID
- the identifier of the columncolor
- the border color or null
if the cell should not have a borderwidth
- the line width of the borderjava.lang.IllegalArgumentException
- < 1
public ExecutionTableBorder getBorder()
null
if the item has no custom borderpublic void setBorder(ExecutionTableBorder border)
ExecutionTable.setAutoRepaint(boolean)
)!border
- the border or null
if the item should not have a custom border (default)public final int getIndex()
-1
if the item is not even added to the tablepublic boolean isEditable()
true
if the item is editable otherwise false
public void setEditable(boolean editable) throws java.lang.IllegalArgumentException
setDefaultInputParser(InputParser)
) and/or cell input parsers (setCellInputParser(int, InputParser)
)
that the user input can be converted in correct cell objects.
editable
- true
if the item should be editable otherwise false
java.lang.IllegalArgumentException
setDefaultInputParser(InputParser)
,
setCellInputParser(int, InputParser)
public void setDefaultInputParser(ExecutionTableItem.InputParser<?> parser)
ExecutionTableItem.InputParser
is used to convert user input into cell objects. If a cell does not have an ExecutionTableItem.InputParser
the default one is used.
parser
- the input parsersetEditable(boolean)
,
ExecutionTableItem.StringInputParser
,
ExecutionTableItem.NumericInputParser
public void setCellInputParser(int colIndex, ExecutionTableItem.InputParser<?> parser)
ExecutionTableItem.InputParser
is used to convert user input into cell objects. If a cell does not have an ExecutionTableItem.InputParser
the default one is used.
colIndex
- the column indexparser
- the input parsersetEditable(boolean)
,
setDefaultInputParser(InputParser)
,
ExecutionTableItem.StringInputParser
,
ExecutionTableItem.NumericInputParser
public ExecutionTableItem.InputParser<?> getCellInputParser(int colIndex)
ExecutionTableItem.InputParser
is used to convert user input into cell objects. If a cell does not have an ExecutionTableItem.InputParser
the default one is used.
colIndex
- the column indexnull
if the cell does not have an input parserpublic boolean isVisible()
true
if the item is displayed in the table otherwise false
public void setVisible(boolean visible)
visible
- true
if the item should be displayed in the table otherwise false
public java.lang.Object getUserData()
public void setUserData(java.lang.Object data)
data
- the custom data that should be stored at the item