public abstract class GralSelectList<UserData> extends GralWidgetBase
actionTable
captures all key and mouse activities on the table-widget.
It is the base class for file selection and command selection.
The base idea is, left and right keys navigates in a tree to outer and deeper nodes. The table
shows only members of the current node. A text line shows the current node path.
It may be possible to switch to a tree presentation (TODO). But this complex widget should occupy
only a simple rectangle of a GUI, not some windows etc. It may be less in spread too if necessary.
GralTable
, because instances of derived classes
should be created as final compositions in the main thread before the table can be presented
in the graphic thread. Therefore the aggregation wdgdTable
cannot be final. It is set
only when #setToPanel(GralMngBuild_ifc, String, int, int[], char)
is called.
GralSelectList
|--wdgdTable
--->GralTable TableLineData
|---idxLine------*>|
|---tableLines---*>|
Hint: The GralSelectList should not be inherited from GralTable though it seems to be possible,
because it is not primary a table. It is more obvious to break the inheritance.GralWidgetBase.GralWidgComposite, GralWidgetBase.TimeOrderCreateImplWidget
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,GralUserAction> |
actions
Not used yet, register actions?
|
private GralUserAction |
actionTable
This is the enhancement to key handling of a common table.
|
protected int |
keyLeft
The keys for left and right navigation.
|
protected int |
keyLeft2
The keys for left and right navigation.
|
protected int |
keyRight
The keys for left and right navigation.
|
protected int |
keyRight2
The keys for left and right navigation.
|
static java.lang.String |
version
Version and history:
2023-02-15 Hartmut new: second key set for entry/exit to left/right
setLeftRightKeys(int, int, int, int)
2022-12-11 Hartmut chg: because new concept of Gral setToPanel is no more called. |
GralTable<UserData> |
wdgdTable
The table which is showing in the widget.
|
_cdata, _wdgPos, bVisibleState, gralMng, name, pixSize, sVersion
Modifier | Constructor and Description |
---|---|
protected |
GralSelectList(GralPos refPos,
java.lang.String posName,
int rows,
int[] columns) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
actionLeft(java.lang.Object userData,
GralTableLine_ifc<UserData> line)
Action if a table line is selected and ctrl-left is pressed or the release button is pressed.
|
protected abstract boolean |
actionOk(java.lang.Object userData,
GralTableLine_ifc<UserData> line)
Action if a table line is selected and entered.
|
protected abstract void |
actionRight(java.lang.Object userData,
GralTableLine_ifc<UserData> line)
Action if a table line is selected and ctrl-right is pressed or the release button is pressed.
|
protected abstract boolean |
actionUserKey(int key,
java.lang.Object userData,
GralTableLine_ifc<UserData> line)
Action if a table line is selected and any other key is pressed or the context menu is invoked.
|
boolean |
createImplWidget_Gthread()
This operation is called to create the implementation widget appearance.
|
GralWidgetBase_ifc |
getFocusedWidget()
Returns the widget which is in focus of a panel or comprehensive widget.
|
boolean |
isInFocus()
Returns true if this widget is the focused one.
|
boolean |
isVisible()
Returns whether the widget is visible or not.
|
boolean |
remove()
Removes all data and all widgets of this class.
|
void |
removeImplWidget_Gthread()
Removes the implementation widget, maybe to re-create with changed properties
or also if the GralWidget itself should be removed.
|
void |
set(java.util.List<java.lang.String[]> listData) |
void |
setFocus()
Sets the focus of the associated table widget.
|
void |
setFocus(int delay,
int latest) |
void |
setFocusedWidget(GralWidgetBase_ifc widg)
If this widget is a comprehensive widget or a panel, it sets one of the content as focused.
|
void |
setLeftRightKeys(int keyLeft,
int keyRight)
The left and right key codes for selection left and right can be changed.
|
void |
setLeftRightKeys(int keyLeft,
int keyRight,
int keyLeft2,
int keyRight2)
The two left and right key codes for selection left and right can be changed.
|
boolean |
setVisible(boolean visible)
Sets this widget visible on graphic or invisible.
|
(package private) void |
stop() |
void |
XXXXsetToPanel(GralMngBuild_ifc gralMng) |
checkImplWidgetCreation, createImplWidget, getImplAccess, getName, gralMng, hasFocus, pos, resizePostPreparation, setFocused, toString, toString
public static final java.lang.String version
setLeftRightKeys(int, int, int, int)
actionTable
now in the ctor which would be also proper in the past but now necessary.
createImplWidget_Gthread()
instead setToPanel(mng)
wdgdTable
. Only this instance is registered on a panel
calling #setToPanel(GralMngBuild_ifc, String, int, int[], char)
.
KeyCode
now,
actionOk(Object, GralTableLine_ifc)
returns boolean now, false if no action is done.
protected int keyLeft
protected int keyLeft2
protected int keyRight
protected int keyRight2
protected java.util.Map<java.lang.String,GralUserAction> actions
private final GralUserAction actionTable
setLeftRightKeys(int, int)
,
calling actionLeft(Object, GralTableLine_ifc)
and actionRight(Object, GralTableLine_ifc)
.
actionOk(Object, GralTableLine_ifc)
All other key codes calls actionUserKey(int, Object, GralTableLine_ifc)
All this operations should be overridden by the implementing class.protected GralSelectList(GralPos refPos, java.lang.String posName, int rows, int[] columns)
public final void setLeftRightKeys(int keyLeft, int keyRight, int keyLeft2, int keyRight2)
KeyCode
.keyLeft
- Key code for outer selectionkeyRight
- KeyCode for deeper selectionkeyLeft2
- second Key code for outer selectionkeyRight2
- second KeyCode for deeper selectionpublic final void setLeftRightKeys(int keyLeft, int keyRight)
KeyCode
.keyLeft
- Key code for outer selectionkeyRight
- KeyCode for deeper selectionpublic void XXXXsetToPanel(GralMngBuild_ifc gralMng)
panel
- identArgJbat
- rows
- columns
- size
- public boolean createImplWidget_Gthread()
GralWidgetBase
GralWidget
by the default behavior.
Or it should be overridden in instances which are not derived from GralWidget itself,
on instances of comprehensive widgets.
This implementation is only called in GralWidget.createImplWidget_Gthread()
for composite widgets.createImplWidget_Gthread
in class GralWidgetBase
public void removeImplWidget_Gthread()
GralMng#runGraphicThread()
and hence package private.removeImplWidget_Gthread
in class GralWidgetBase
public void set(java.util.List<java.lang.String[]> listData)
public boolean setVisible(boolean visible)
GralWidgetBase_ifc
GralWindow
, its the visibility of the whole window.
Note that a window which is invisible is not shown in the task bar of the operation system.
Note that an application can have more as one window.
Note that a dialog window can be set to invisible if it is not need yet instead destroy and build newly.setVisible
in interface GralWidgetBase_ifc
setVisible
in class GralWidgetBase
public boolean isVisible()
GralWidgetBase_ifc
isVisible
in interface GralWidgetBase_ifc
isVisible
in class GralWidgetBase
public boolean isInFocus()
GralWidgetBase_ifc
public void setFocus()
public void setFocus(int delay, int latest)
public void setFocusedWidget(GralWidgetBase_ifc widg)
GralWidgetBase_ifc
widg
- The sub widget which should be focused.
It influences for example the current tab of a tabbed panel,
or influences which widget of a comprehensive widget is first focused.
On a panel it determines which widget should get the focus if the panel gets the focus.public GralWidgetBase_ifc getFocusedWidget()
GralWidgetBase_ifc
public boolean remove()
remove
in class GralWidgetBase
protected abstract boolean actionOk(java.lang.Object userData, GralTableLine_ifc<UserData> line)
userData
- The user data stored in the line of table.protected abstract void actionLeft(java.lang.Object userData, GralTableLine_ifc<UserData> line)
userData
- The user data stored in the line of table.protected abstract void actionRight(java.lang.Object userData, GralTableLine_ifc<UserData> line)
userData
- The user data stored in the line of table.protected abstract boolean actionUserKey(int key, java.lang.Object userData, GralTableLine_ifc<UserData> line)
key
- code or mouse code, one of constans from KeyCode
.userData
- The user data stored in the line of table.line
- The table line.void stop()