public interface GralWidget_ifc extends Removeable
GralGraphicThread
.
GralWidget_ifc
or methods of an derived GralWidget
such as GralTable
, for example setText(CharSequence)
, setTextColor(GralColor)
or org.vishia.gral.base.GralTable#setColorCurrLine(GralColor)
.
GralWidget.DynamicData
GralWidget.dyda
of the widget
or in specific data of a GralWidget implementation.
repaint(int, int)
with a proper millisecond delay (usual 100).
The graphic implementation widget is not touched in this time. Usual it is not necessary to show information
in a faster time than 100 ms if it is not a high speed animated graphic. The delayed repaint request
saves calculation time if more as one property is changed on the same widget.
GralWidget.repaintRequ
(only private visible)
of GralGraphicTimeOrder
in the central queue of requests using
GralGraphicThread.addDispatchOrder(org.vishia.gral.base.GralGraphicTimeOrder)
.
The GralGraphicThread
is known by GralWidget.itsMng
.
GralGraphicTimeOrder
. Any of them may have a specific delay.
The graphic thread organizes it in a proper kind of time.
GralGraphicTimeOrder
is dequeued in the graphic thread,
its method org.vishia.gral.base.GralGraphicTimeOrder#executeOrder(boolean)
is invoked.
This method calls GralWidgImpl_ifc.repaintGthread()
via the association GralWidget._wdgImpl
.
rerepaintGthread()
method is overridden in the implementation layer
with the necessary statements to transfer the non-graphic data of this GralWidget
especially
stored in GralWidget.dyda
to the special implementation widget method invocations
such as Text.setText(String)
which touches the graphic widget.
Then a Control.update()
and Control.redraw()
is invoked to show the content.
GralMngBuild_ifc
.Modifier and Type | Interface and Description |
---|---|
static class |
GralWidget_ifc.ActionChange |
static class |
GralWidget_ifc.ActionChangeWhen |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
sVersion
Version, history and license.
|
Modifier and Type | Method and Description |
---|---|
void |
createImplWidget_Gthread()
Sets this widget to the current panel at the current given position.
|
GralWidget_ifc.ActionChange |
getActionChange(GralWidget_ifc.ActionChangeWhen when) |
GralColor |
getBackColor(int ix)
Gets the background color for the widget.
|
java.lang.String |
getCmd()
Any widget can have a command String, which can be quest for example in an action.
|
long |
getContentIdent()
Gets the content identification of the users data which are set with
setContentIdent(long) . |
java.lang.Object |
getContentInfo() |
java.lang.Object |
getData()
Gets the application specific info.
|
java.lang.String |
getDataPath() |
java.lang.String |
getName() |
GralMng |
gralMng()
Returns the associated singleton GralMng.
|
boolean |
isChanged(boolean setUnchanged)
Returns true if the content is changed from a user action on GUI.
|
boolean |
isEditable()
Query whether this widget is able to change from user handling.
|
boolean |
isGraphicDisposed()
Returns true if the graphic implementatin widget was initialized, and then it was disposed.
|
boolean |
isInFocus()
Returns true if this widget is the focused one.
|
boolean |
isNotEditableOrShouldInitialize()
Query whether this field should be written from any initial or actual data.
|
boolean |
isVisible()
Returns whether the widget is visible or not.
|
void |
refreshFromVariable(VariableContainer_ifc container)
Capability for any widget to update its content from its associated variables described in its sDataPath.
|
void |
refreshFromVariable(VariableContainer_ifc container,
long timeAtleast,
GralColor colorRefreshed,
GralColor colorOld) |
void |
repaint()
repaint request.
|
void |
repaint(int delay,
int latest)
Possible delayed repaint, can be called in any thread.
|
void |
setBackColor(GralColor color,
int ix)
Sets the background color for the widget.
|
GralColor |
setBackgroundColor(GralColor color)
Deprecated.
|
void |
setBoundsPixel(int x,
int y,
int dx,
int dy) |
void |
setCmd(java.lang.String cmd)
Any widget can have a command String, which can be quest for example in an action.
|
long |
setContentIdent(long ident)
Sets a identification for the shown data.
|
void |
setData(java.lang.Object data)
Sets a application specific data.
|
void |
setDataPath(java.lang.String sDataPath)
Sets the data path.
|
void |
setEditable(boolean editable)
Sets whether it is able to edit the content of the text field or text box.
|
void |
setFocus()
Sets the focus to the widget. .
|
void |
setFocus(int delay,
int latest)
Sets the focus to the widget. .
|
GralColor |
setForegroundColor(GralColor color)
Deprecated.
|
void |
setHtmlHelp(java.lang.String url)
Sets the html help url for this widget.
|
void |
setLineColor(GralColor color,
int ix)
Sets the line color for the widget.
|
void |
setText(java.lang.CharSequence text)
Set the text of the widget.
|
void |
setTextColor(GralColor color)
Sets the text color for the widget.
|
void |
setToPanel(GralMngBuild_ifc mng)
Deprecated.
|
boolean |
setVisible(boolean visible)
Sets this widget visible on graphic or invisible.
|
remove
static final java.lang.String sVersion
isGraphicDisposed()
especially used for GralWindow-dispose detection.
createImplWidget_Gthread()
. It is a better name.
createImplWidget_Gthread()
without mng as parameter.
getData()
, setData(Object)
was existent as GralWidget.setContentInfo(Object)
,
now explicit property of any widget.
setCmd(String)
and getCmd()
is present in GralWidget
since 2010 but it was not accepted as core property. But it is a core property.
getContentIdent()
, setContentIdent(long)
isNotEditableOrShouldInitialize()
to support edit fields.
setBackColor(GralColor, int)
, setLineColor(GralColor, int)
and setTextColor(GralColor)
are declared here. What methods are deprecated? I thing setBackgroundColor(GralColor)
.
setFocus()
and setFocus(int, int)
can be called in any thread yet.
#getWidgetMultiImplementations()
. This method is not used in any widget yet,
but it may be necessary for complex widgets.
refreshFromVariable(VariableContainer_ifc)
: Capability for any widget
to update its content from its associated variables described in its sDataPath.
isVisible()
repaint()
, can be invoked in any thread. With delay possible.
java.lang.String getName()
java.lang.String getDataPath()
void setCmd(java.lang.String cmd)
getCmd()
independent of its name which can be set on runtime with this method.java.lang.String getCmd()
setCmd(String)
.void setData(java.lang.Object data)
java.lang.Object getData()
#setContentInfo(Object)
.GralWidget_ifc.ActionChange getActionChange(GralWidget_ifc.ActionChangeWhen when)
void createImplWidget_Gthread()
GralMng.createImplWidget_Gthread(GralWidget)
which tests the type of the derived GralWidget
to create the correct graphical widget. That method calls the implementing specific GralMng.ImplAccess#createImplWidget_Gthread(GralWidget)
which knows the implementation graphic.
ImplAccess
. With them the GralWidget
is references because it is the environment class. The core graphical widget is an aggregation in this instance. It is possible
that more as one implementation widget is used for a Gral Widget implementation. For example a text field with a prompt
consists of two implementation widgets, the text field and a label for the prompt.
GralWidget#initPosAndRegisterWidget(GralPos)
which is called either
on construction of a widget with a String-given position, before it appears on graphic, or on construction of the
graphic widget. It calls the package private GralWidget#initPosAndRegisterWidget(GralPos)
, which takes the
given position, stores it in the GralWidget.pos()
and adds the widget both to its panel which is given
with the pos and registers the widget in the GralMng for simple global access.
If the name of the widget starts with "@" its name in the panel is the part after "@" whereby the global name
is the "panelname.widgetname". If a widget's position is given from left and from right or with percent, it is resized
on resizing the window and the panel.
java.lang.IllegalStateException
- This routine can be called only if the graphic implementation widget is not
existing. It is one time after startup or more as one time if #removeWidgetImplementation()
was called.void setToPanel(GralMngBuild_ifc mng)
createImplWidget_Gthread()
.mng
- not used. It is known as singleton. Use null as argument.GralMng gralMng()
setToPanel(GralMngBuild_ifc)
.void setFocus()
void setFocus(int delay, int latest)
delay
- latest
- boolean isInFocus()
boolean isGraphicDisposed()
boolean setVisible(boolean visible)
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.visible
- boolean isVisible()
void setEditable(boolean editable)
editable
- true then the content is going to be able to change.
False then the edit functionality is disabled.boolean isEditable()
boolean isNotEditableOrShouldInitialize()
@Deprecated GralColor setBackgroundColor(GralColor color)
setBackColor(GralColor, int)
@Deprecated GralColor setForegroundColor(GralColor color)
setLineColor(GralColor, int)
void setBackColor(GralColor color, int ix)
color
- Any colorix
- -1 for non-specific, 0 for the first color or if only one color is supported, 1, ... if the widget has more as one background.GralColor getBackColor(int ix)
ix
- 0 if only one color is supported, 1, ... if the widget has more as one background.void setLineColor(GralColor color, int ix)
color
- Any colorix
- 0 if only one color is supported, 1, ... if the widget has more as one line.void setTextColor(GralColor color)
color
- Any colorvoid setText(java.lang.CharSequence text)
setBackColor(GralColor, int)
etc.
repaint(int, int)
is invoked with the standard delay of #repaintDelay
and #repaintDelayMax
.
With that the widget-specific private instance of #repaintRequ
is added to the queue of requests
in the GralGraphicThread#addTimeOrder(GralGraphicTimeOrder)
. In the requested time that
dispatch order is executed in the graphic thread. It calls GralWidgImpl_ifc.repaintGthread()
.
That method is implemented in the graphic implementation layer of the widget. It sets the appropriate values
from the independent Gral attributes to the implementation specifics and invoke a redraw of the graphic layer.
GralGraphicTimeOrder
is queued. All changed attributes are stored in DynamicData#whatIsChanged
and the
GralWidgImpl_ifc.repaintGthread()
quests all changes one after another.
It means that a thread switch is invoked only one time per widget for more as one change.
DynamicData
. That composite part of a widget stores all standard dynamic data of a widget.void setHtmlHelp(java.lang.String url)
url
- String given url, maybe a local file too with #internalLabel.void repaint()
repaint(int, int)
void repaint(int delay, int latest)
delay
- in milliseconds. If 0 or less 0, then it is executed immediately if the calling
thread is the graphic thread.latest
- The latest draw time in milliseconds. If it is less 0, then it is unused.
If it is 0 or less delay if a delay is given, then the delay isn't wound up on re-call.void setBoundsPixel(int x, int y, int dx, int dy)
void setDataPath(java.lang.String sDataPath)
refreshFromVariable(VariableContainer_ifc)
.sDataPath
- boolean isChanged(boolean setUnchanged)
setUnchanged
- If true then set to unchanged with this call.long setContentIdent(long ident)
getContentIdent()
.ident
- any number which identifies the value of content.long getContentIdent()
setContentIdent(long)
.java.lang.Object getContentInfo()
void refreshFromVariable(VariableContainer_ifc container)
container
- The container is used only if the variable is not known by direct reference
in the private GralWidget.variable
or GralWidget.variables
. If the variable(s) is/are
not known, they are searched by there data path set by setDataPath(String)
. More as one
variables are possible separated by "," in the setDataPath("variable1, variable2").
The variables are searched in the container calling VariableContainer_ifc.getVariable(String)
.void refreshFromVariable(VariableContainer_ifc container, long timeAtleast, GralColor colorRefreshed, GralColor colorOld)