UserData
- Type of the data which is associated with a table line.public interface GralTable_ifc<UserData> extends GralWidget_ifc
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
static int |
kAllLines
Identify number for some methods which have a line number parameter.
|
static int |
kEmptyArea
Identify number for some methods which have a line number parameter.
|
static int |
version
Version, history and license.
|
sVersion
Modifier and Type | Method and Description |
---|---|
GralTableLine_ifc<UserData> |
addLine(java.lang.String key,
java.lang.String[] cellTexts,
UserData userData)
Inserts a line in the table with given content.
|
void |
clearTable() |
void |
deleteLine(GralTableLine_ifc<UserData> line)
Deletes a line in the table.
|
TreeNode_ifc<?,UserData> |
getAllLines()
Returns all lines.
|
GralColor |
getBackColor(int ix)
Gets the background color for the widget.
|
GralTableLine_ifc<UserData> |
getCurrentLine()
Returns the currently selected line or null if nothing is selected.
|
GralTableLine_ifc<UserData> |
getFirstMarkedLine(int mask)
Returns the first line from top of the table which is marked or null if no line is marked.
|
GralTableLine_ifc<UserData> |
getLine(java.lang.String key)
Get the line which is designated with the requested key.
|
java.util.List<UserData> |
getListContent()
Returns all content of lines.
|
java.util.List<GralTableLine_ifc<UserData>> |
getMarkedLines(int mask)
Returns all marked lines.
|
GralTableLine_ifc<UserData> |
insertLine(java.lang.String key,
int row,
java.lang.String[] cellTexts,
UserData userData)
Inserts a line in the table with given content.
|
void |
setBackColor(GralColor color,
int ix)
Sets the background color of the table or one line.
|
void |
setCurrentLine(GralTableLine_ifc<UserData> line,
int ixline,
int ixcolumn)
Sets the cell which is the current one in the given line.
|
boolean |
setCurrentLine(java.lang.String key)
Sets the line which is the current one.
|
int |
size()
Returns the number of active lines of the table.
|
createImplWidget_Gthread, getActionChange, getCmd, getContentIdent, getContentInfo, getData, getDataPath, getName, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, refreshFromVariable, refreshFromVariable, repaint, repaint, setBoundsPixel, setCmd, setContentIdent, setData, setDataPath, setEditable, setFocus, setFocus, setHtmlHelp, setLineColor, setText, setTextColor, setToPanel, setVisible
remove
static final int kAllLines
static final int kEmptyArea
static final int version
setBackColor(GralColor, int)
parallel to the
GralWidget_ifc.getBackColor(int)
with special comments for usage of the int parameter.
See kAllLines
, kEmptyArea
. Adequate getBackColor(int)
.
getMarkedLines(int)
now has that 1 argument for mark mask.
GralTable
, the GralTable.TableLineData
and this
interface are marked with the generic type UserData.
#setCurrentLine(int)
with int, it isn't new because it was able to set with
#setCurrentCell(int, int)
with -1 as second parameter.
#getMarkedLines()
clearTable()
#insertLine(String, int)
returns now the instance of GralTableLine_ifc
The user doesn't create a line instance, an extra factory isn't necessary. The implementing instance
can be determined by the implementer of this interface.
GralTableLine_ifc<UserData> addLine(java.lang.String key, java.lang.String[] cellTexts, UserData userData)
key
- The key to get it.cellTexts
- texts of the cells. May be null.userData
- data assigned to the line, maybe null, able to get with GralTableLine_ifc.getUserData()
.GralTableLine_ifc} to add content.
void clearTable()
void deleteLine(GralTableLine_ifc<UserData> line)
TreeNode_ifc<?,UserData> getAllLines()
insertLine(String, int, String[], Object)
or deleteLine(GralTableLine_ifc)
will be called. Do not call any modification of this list
for example List.add(Object)
or List.remove(int)
, use the methods
of this interface to change the content of the table. Elsewhere the graphical presentation of the data
may be corrupted.
See getListContent()
.GralColor getBackColor(int ix)
GralWidget_ifc
getBackColor
in interface GralWidget_ifc
ix
- 0 if only one color is supported, 1, ... if the widget has more as one background.GralTableLine_ifc<UserData> getCurrentLine()
GralTableLine_ifc<UserData> getFirstMarkedLine(int mask)
GralTableLine_ifc<UserData> getLine(java.lang.String key)
key
- The key to find out the row.java.util.List<UserData> getListContent()
ConcurrentModificationException
will be thrown. But after them the list is able to use independently.java.util.List<GralTableLine_ifc<UserData>> getMarkedLines(int mask)
GralTableLine_ifc<UserData> insertLine(java.lang.String key, int row, java.lang.String[] cellTexts, UserData userData)
key
- The key to get it.row
- The row where the line should be inserted before. 0 - insert on top.
negative or Integer.MAXINT or number greater as number of rows: append on end.cellTexts
- texts of the cells. May be null.userData
- data assigned to the line, able to get with GralTableLine_ifc.getUserData()
.GralTableLine_ifc} to add content.
void setBackColor(GralColor color, int ix)
setBackColor
in interface GralWidget_ifc
ix
- >=0 sets for one line only,
kAllLines
: Sets for all lines and the table background,
kEmptyArea
: Only for table background.color
- Any colorGralWidget_ifc.setBackColor(org.vishia.gral.ifc.GralColor, int)
void setCurrentLine(GralTableLine_ifc<UserData> line, int ixline, int ixcolumn)
line
- The line which should be selected.ixline
- the index in the visible are of table where the line should be present.
If the index is negative, it is the index from end of visible area. -1 means the last line.
if the index is outside of the area, it will be set inside.ixcolumn
- from 0 for the left column, if -1 then let the current row of table unchanged.boolean setCurrentLine(java.lang.String key)
key
- The key of the line, given by insertLine(String, int, String[], Object)
.int size()