public class GralWidget extends java.lang.Object implements GralWidget_ifc, GralSetValue_ifc, GetGralWidget_ifc
GralWidget.ImplAccess
which
contains specials of the implementation and refers the widget of the implementation layer graphic,
for example a text field.
GralWidget
.
There are 2 strategies yet to create widgets in respect to the graphical implementation.
Either the Widget is created independent of the graphic implementation first
and then taken as parameter for the graphic widget-creating method. In this case the GralWidget
contains nothing of the graphic implementation but has a reference to it.
The second strategy yet is, the Widget is returned by the graphic-implementation widget-creating method
as a instance which has GralWidget
and its non-graphic specializations as super class
and the graphic depending parts in the created instance.
setToPanel(GralMng)
method
invokes the graphic implementation specific derivation of the GralMng
, which creates
the implementation widgets. Docu_UML_simpleNotation
:
GralHorizontalSelector< UserType > <-----<*>UserCanCreateIt_GraphicIndependently - some special non-graphic data | |<------------------------------------------------------------------data---| | | |&<--------&GraphicImplAccess<|---+ | | | | +--|>GralWidget | | | | | | | |<>--->GralWidgImpl_ifc<|---+--SwtHorizontalSelector | | | | | | | | | |<*>------------------------>swt.Canvas | | | | -paintRoutine <-------paintListener---| -mouseListener<-------mouseListener---| -etc.
GralHorizontalSelector
in any thread maybe as composite,
it is independent of the graphic itself.
Then the user builds its graphic appearance with invocation of setToPanel(GralMngBuild_ifc)
with the derived instance of GralMng
as parameter.
GralWidget
knows the graphic implementation via the GralWidgImpl_ifc
to invoke some methods
for the graphical appearance. The interface is independent
of the implementation itself. The implementor of this interface for this example
is the SwtHorizontalSelector
implements this methods.
Canvas
.
It contains the special paint routines, mouse handling etc.
GralHorizontalSelector
stored as Object-reference. This reference can be used in the paintRoutine, mouseListerner etc. to get
information about the GralWidget.
GralButton <-------UserCanAssociate it but can't create the instance with constructor. | |-------------|>SwtButtonThe instance is Graphic-Implementation-specific and it is created with this interface as factory:
#addButton(String, GralUserAction, String)
.
GralTextField
is the derived class of this to represent a text field
in an implementation independent way.
SwtTextFieldWrapper
is the implementor for the GralTextField
for SWT graphic.
Text
It based on the SWT-specific Widget
.
Widget.setData(Object)
method.
GralPos
at its panel where it is placed. The panel knows all widgets
which are placed there (widgetList).
setBackColor(GralColor, int)
or setValue(int, int, Object)
. This methods can be called in any thread. This concept is described with the
method setText(CharSequence)
, appropriate for all set methods.
variable
and variables
to a management class VariableAccessWithIdx
which knows the user data via a commonly VariableAccess_ifc
. The data can be existing in the
user space with this interface. That part of user software doesn't know the graphical view of the data.
The graphical part of software calls any refresh of showing, it calls the method refreshFromVariable(VariableContainer_ifc)
for all visible widgets. With this the widget gets the data from user with the variable associations
and prepares it for the proper appearance depending on the kind of widget, format String etc.
setDataPath(String)
method. The variable is found with the second interface VariableContainer_ifc
which should be known
by the graphical part of software and which is one parameter of the refreshFromVariable(VariableContainer_ifc)
method.
The conclusion between the String given variable name or path and the data can be supplied in any form
in the users software, which knows the data.
refreshFromVariable(VariableContainer_ifc)
-method
if the data are received yet or in any other proper cycle.
requestNewValueForVariable(long)
can be used to force communication.
GralWidget_ifc
GralMng.GralMngFocusListener
.Modifier and Type | Class and Description |
---|---|
protected static class |
GralWidget.ActionChangeSelect |
static class |
GralWidget.ConfigData
This class holds common configuration data for widgets.
|
static class |
GralWidget.DynamicData
This inner class holds the dynamic data of a widget.
|
static class |
GralWidget.ImplAccess
Methods which should be called back by events of the implementation layer.
|
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
GralWidget.ImplAccess |
_wdgImpl
The implementation specific widget.
|
private GralPos |
_wdgPos
The position of the widget.
|
protected boolean |
bEditable
Set to true on
setEditable(boolean) . |
protected boolean |
bHasFocus
Set on focus gained, false on focus lost.
|
protected boolean |
bShouldInitialize
If this bit is true on an edit field, it should be initialized.
|
protected GralMngBuild_ifc |
buildMng |
protected boolean |
bVisibleState
Set true if its shell, tab card etc is be activated.
|
GralWidget.ConfigData |
cfg
Reference to the common configuration data for widgets.
|
protected GralMenu |
contextMenu
If not null, it is the right-mouse-button menu for this widget.
|
private int |
dataIx
An index associated to the data.
|
protected long |
dateUser |
protected GralWidget.DynamicData |
dyda |
protected java.lang.String |
htmlHelp
The relative path to a html help label (maybe an URL, or file, or file with label).
|
private GralWidgetCfg_ifc |
itsCfgElement
Association to the configuration element from where this widget was built.
|
protected GralMng |
itsMng
The widget manager from where the widget is organized.
|
(package private) long |
lastTimeSetVisible
The time when the bVisible state was changed.
|
java.lang.String |
name
Name of the widget in the panel.
|
private java.lang.Object |
oContentInfo
Any special info, may be set from any user class.
|
protected int |
repaintDelay
Standard delay to repaint if
repaint() is called without arguments. |
protected int |
repaintDelayMax
Standard delay to repaint if
repaint() is called without arguments. |
private GralGraphicTimeOrder |
repaintRequ
This time order calls the
#repaintGthread() in the graphical thread. |
java.lang.String |
sCmd
Any widget can have a command String, which can be quest for example in an action.
|
private java.lang.String |
sDataPath
Textual informations about content.
|
protected java.lang.String |
sFormat
Textual info about representation format.
|
java.lang.String |
sToolTip |
static java.lang.String |
sVersion
Version, history and license.
|
private VariableAccess_ifc |
variable
One variable which is associated with this widget.
|
private java.util.List<VariableAccess_ifc> |
variables
More as one variable which are associated with this widget.
|
char |
whatIs
numeric info what to do (kind of widget).
|
private static GralWidget_ifc.ActionChangeWhen[] |
whenAll |
version
version
Constructor and Description |
---|
GralWidget(java.lang.String sPosName,
char whatIs)
Creates a widget.
|
GralWidget(java.lang.String sName,
char whatIs,
GralMng mng)
Deprecated.
|
GralWidget(java.lang.String pos,
java.lang.String name,
char whatIs)
Deprecated.
since 2016-09: The idea is: Use always one String for "@pos=name".
|
Modifier and Type | Method and Description |
---|---|
void |
chgPos(GralPos newPos) |
void |
clearShowParam()
Clear the parameter if they are over-taken already.
|
void |
createImplWidget_Gthread()
Standard implementation of @see org.vishia.gral.ifc.GralWidget_ifc#setToPanel()
Only large widgets (contains more as one GralWidget) should override this method.
|
GralWidget_ifc.ActionChange |
getActionChange(GralWidget_ifc.ActionChangeWhen when)
Gets the action to execute on changing a widget.
|
GralWidget_ifc.ActionChange |
getActionChangeStrict(GralWidget_ifc.ActionChangeWhen when,
boolean strict)
Gets the action to execute on changing a widget.
|
GralUserAction |
getActionDrag() |
GralUserAction |
getActionDrop() |
GralUserAction |
getActionFocused() |
GralUserAction |
getActionShow()
Gets the action to show the widget.
|
GralColor |
getBackColor(int ix)
Gets the background color for the widget.
|
GralWidgetCfg_ifc |
getCfgElement() |
java.lang.String |
getCmd()
Any widget can have a command String, which can be quest for example in an action.
|
java.lang.String |
getCmd(int option)
Get the command string from the
setCmd(String) with choice of an option. |
long |
getContentIdent()
Gets the content identification of the users data which are set with
GralWidget_ifc.setContentIdent(long) . |
java.lang.Object |
getContentInfo()
Deprecated.
use
getData() |
GralMenu |
getContextMenu()
Gets the context menu to add a menu item.
|
java.lang.Object |
getData()
Gets the application specific info.
|
int |
getDataIx() |
java.lang.String |
getDataPath()
Gets the data path.
|
java.lang.String |
getDataPath(java.lang.String sDataPath)
Changes the data path
|
float |
getFloatValue()
Gets the float attribute value of this widget.
|
java.lang.String |
getFormat() |
GralWidget |
getGralWidget()
Returns this.
|
java.lang.String |
getHtmlHelp() |
GralWidget.ImplAccess |
getImpl()
Returns the instance which extends the
GralWidget.ImplAccess of this widget. |
GralPanelContent |
getItsPanel()
Gets the panel where the widget is member of.
|
float |
getLongValue()
Gets the float attribute value of this widget.
|
java.lang.String |
getName() |
java.lang.String |
getShowMethod() |
java.lang.String[] |
getShowParam()
Returns the parameter of the show method.
|
java.lang.String |
getsToolTip() |
java.lang.String |
getText()
Get the text of this widget.
|
java.lang.String |
getValue()
Gets the current value of the content of the widget in the given context.
|
VariableAccess_ifc |
getVariable(VariableContainer_ifc container) |
VariableAccess_ifc |
getVariableFromContentInfo(VariableContainer_ifc container)
Deprecated.
|
GralMng |
gralMng()
Gets the working interface of the manager.
|
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.
|
GralPos |
pos() |
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 timeLatest,
GralColor colorRefreshed,
GralColor colorOld)
Refreshes the graphical content with the content of the variables.
|
(package private) void |
registerWidget() |
boolean |
remove()
Removes the widget from the lists in its panel and from the graphical representation.
|
void |
repaint()
repaint request.
|
void |
repaint(int delay,
int latest)
The Implementation of repaint calls
#repaintGthread() if it is the graphic thread and the delay is 0. |
void |
requestNewValueForVariable(long timeRequested)
Requests new values for all variables which are associated to this widget.
|
void |
setActionChange(GralUserAction action)
Deprecated.
|
void |
setActionFocused(GralUserAction action) |
void |
setActionMouse(GralMouseWidgetAction_ifc mouseWidgetAction,
int mUser)
Sets the action for mouse operation.
|
void |
setActionShow(GralUserAction action,
java.lang.String[] param)
Sets the action in application context which is invoked for applying user data to show in the widget.
|
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 |
setCfgElement(GralWidgetCfg_ifc cfge) |
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 date)
Sets a identification for the shown data.
|
void |
setContentInfo(java.lang.Object content)
Deprecated.
use
setData(Object) |
void |
setData(java.lang.Object data)
Sets a application specific data.
|
void |
setDataIx(int dataIx) |
void |
setDataPath(java.lang.String sDataPath)
Sets the data path.
|
void |
setDragEnable(GralUserAction action,
int dragType)
Sets the action to receive a drop event and initializes the drop feature of the widget.
|
void |
setDropEnable(GralUserAction action,
int dropType)
Sets the action to receive a drop event and initializes the drop feature of the widget.
|
void |
setEditable(boolean editable)
Sets whether it is able to edit the content of the text field or text box.
|
void |
setFocus()
Standard implementation.
|
void |
setFocus(int delay,
int latest)
Sets the focus to this widget.
|
GralColor |
setForegroundColor(GralColor color) |
void |
setFormat(java.lang.String sFormat) |
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 |
setLongValue(long value)
Sets a value to show.
|
void |
setMinMax(float minValue,
float maxValue)
Sets the border of the value range for showing.
|
void |
setPanelMng(GralMng mng)
Deprecated.
it should be set by the MethodsCalledbackFromImplementation ctor.
|
void |
setPrimaryWidgetOfPanel()
Default implementation:Most of widgets may have only one implementation 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 |
setToolTip(java.lang.String sToolTip) |
void |
setToPanel(GralMngBuild_ifc mngUnused)
Deprecated.
|
void |
setValue(float value)
Sets a value to show.
|
void |
setValue(int cmd,
int ident,
java.lang.Object visibleInfo)
Sets the current value of the content of the widget in the given context.
|
void |
setValue(int cmd,
int ident,
java.lang.Object visibleInfo,
java.lang.Object userData)
Sets the current value of the content of the widget in the given context.
|
void |
setValue(java.lang.Object[] value)
Sets some value to show any content.
|
boolean |
setVisible(boolean visible)
Sets the widget visible or not.
|
void |
setVisibleState(boolean visible) |
void |
setVisibleStateWidget(boolean visible)
Sets the state of the widget whether it seams to be visible.
|
void |
specifyActionChange(java.lang.String sAction,
GralUserAction action,
java.lang.String[] args,
GralWidget_ifc.ActionChangeWhen... when)
Sets the action to invoke after changing or touching the widget.
|
private void |
specifyActionChangeWhen(GralWidget_ifc.ActionChange action,
GralWidget_ifc.ActionChangeWhen when) |
void |
specifyContextMenu(GralMenu menu) |
(package private) void |
stop() |
java.lang.String |
toString()
Especially for test and debug, short info about widget.
|
GralRectangle |
XXXgetPixelPositionSize() |
java.lang.Object |
XXXgetWidgetImplementation() |
void |
XXXremoveWidgetImplementation() |
void |
XXXrepaintGthread() |
boolean |
XXXsetFocusGThread() |
void |
XXXsetVisibleGThread(boolean bVisible)
Sets the implementation widget visible or not.
|
public static final java.lang.String sVersion
setFocus()
has set the default focus of the primaryWindow if the focus of a window was set.
GralWidget.ImplAccess.wdgimpl
: That refers an implementation of a WidgetHelper class of the implementation layer
which knows the widget. Via this aggregation some action with the implementation widget can be do which are defined
in the GralWidgetImpl_ifc
. See SwtWidgetHelper
.
getActionChangeStrict(org.vishia.gral.ifc.GralWidget_ifc.ActionChangeWhen, boolean)
documented,
changed: returns not null if strict and when==null and a common action is given. Earlier: Returns null in that case.
GralWidget(String, String, char)
with a position String is now deprecated.
Instead the GralWidget(String, char)
which was deprecated till now is the favor again, but with a combination
of "@pos=name" as first argument. That can be used for all derived widgets!. Therewith it is more simple to complete the widgets
with the capability of usage of a position String. Without "@...=" it is the old behavior of the constructor.
Note that the position can be given with GralMng.setPosition(GralPos, float, float, float, float, int, char)
etc. too,
with numeric values which may be calculated, instead a constant text.
isGraphicDisposed()
especially used for GralWindow-dispose detection.
GralWidget.ImplAccess
if the position was assigned later in the graphic thread.
createImplWidget_Gthread()
. It is a better name.
createImplWidget_Gthread()
: If the _wdgImpl is initialized already, this method does nothing. Before: Exception
GralWidget_ifc.ActionChange
describes the action class and arguments.
GralWidget.ConfigData.actionChange1
refers the only one change action, or GralWidget.ConfigData.actionChangeSelect
contains more as one change action.
specifyActionChange(String, GralUserAction, String[], org.vishia.gral.ifc.GralWidget_ifc.ActionChangeWhen...)
sets the only one or special actions,
getActionChange(org.vishia.gral.ifc.GralWidget_ifc.ActionChangeWhen)
selects a proper one.
All derived widgets and implementation are adapted to the new system. The user interface is nearly identical.
GralWidgImpl_ifc
any more. It was the old concept: An implementing widgets was derived from the GralWidget.
The new concept is: An implementing widget is derived from its derived class of GralWidget.ImplAccess
. Therefore only that base class implements the GralWidgetImpl_ifc.
setVisible(boolean)
should be invoked on creation.
It is possible that widgets are switched. All widgets of a non-visible tab of a tabbed panel are set to invisible, especially bVisibleState
= false.
The isVisible()
is checked to decide whether a widget should be updated in the inspector. Only visible widgets should be updated.
The GralWidgImpl_ifc.setVisibleGThread(boolean)
is implemented to all known widgets for the implementation layer in the kind of #setFocusGThread()
.
See documentation on the methods.
GralWidget.DynamicData.getChanged()
, now private attribute GralWidget.DynamicData.whatIsChanged
setActionMouse(GralMouseWidgetAction_ifc, int)
was a private thing in SwtGralMouseListener.MouseListenerGralAction
for widget implementation's mouse handling. Now as user define-able property of any widget, especially use-able for text fields.
getData()
, setData(Object)
was existent as setContentInfo(Object)
,
now explicit property of any widget. setContentInfo(Object)
was an older approach, not in interface, now deprecated.
setFocus(int, int)
had hanged because while-loop on same window panel for a parent.
GralWidget.DynamicData.bTouchedField
, ImplAccess##setTouched()
especially for a text field
if any editing key was received. Then the GUI-operator may mark a text or make an input etc. The setting of the text
from a cyclically thread should be prevented then to prevent disturb the GUI-operation. If the focus was lost then this bit
is reseted. It is an important feature for GUI-handling which was missed up to now.
Yet only used for GralTextField.setText(CharSequence, int)
. It may prevent repaint for universally usage for all widgets.
getVariable(VariableContainer_ifc)
instead getVariableFromContentInfo(VariableContainer_ifc)
.
The last one method is used in an application but it does not run well for all requirements. The code of getVariable(VariableContainer_ifc)
is copied from the well tested refreshFromVariable(VariableContainer_ifc)
as own routine and then used in a new application.
getCmd(int)
with options.
isInFocus()
repaint()
invokes redraw immediately if it is in graphic thread.
It invokes repaint(int, int)
with the repaintDelay
if it is not in graphic thread.
It does nothing if the implementation layer widget is not created yet. It means it can invoked
without parameter in any case.
GralWidget.ImplAccess.setDragEnable(int)
and setDropEnable moved from the core class.
It is adapt after change GralTextField
.
setToPanel(GralMngBuild_ifc)
is final now and invokes
GralMngBuild_ifc.createImplWidget_Gthread(GralWidget)
. That method handles all widget types.
refreshFromVariable(VariableContainer_ifc, long, GralColor, GralColor)
which shows old values grayed.
setFocus()
searches the GralTabbedPanel
where the widget is
member of and invokes its GralTabbedPanel.selectTab(String)
. It is not correct that the graphic
implementation layer does that itself.
setToPanel(GralMngBuild_ifc)
as common method.
_wdgImpl
. This instance was present in the past but removed. The concept is re-activated
because a graphic-implementation-independent GralWidget instance can have any generic types
and can be created as composite (with final type name = new Type(...)).
See comments of class GralMngBuild_ifc
.
getContentIdent()
, setContentIdent(long)
bShouldInitialize
getName()
now returns sDataPath
or sCmd
if the other info are null.
refreshFromVariable(VariableContainer_ifc)
for long and double values.
GralWidget.ConfigData
and cfg
, used yet only for GralWidget.ConfigData.showParam
.
GralTextField
. The concept is valid for all widgets
in cohesion with the concept of the whatIsChanged}.
setActionShow(GralUserAction, String[])
now with parameters.
GralWidget.DynamicData
and dyda
for all non-static widget properties, the dynamic data
are that data which are used for all widget types in runtime. TODO: store the configuration data (all other) in an
inner class CfgData or in a common class cfgdata see GralCfgData
.
setBackColor(GralColor, int)
, setLineColor(GralColor, int)
and setTextColor(GralColor)
are declared in the GralWidget_ifc
yet and implemented here using dyda
.
setFocus()
and setFocus(int, int)
can be called in any thread yet.
refreshFromVariable(VariableContainer_ifc)
regards int16, int8
refreshFromVariable(VariableContainer_ifc)
. A GralWidget is binded now
more to a variable via the new VariableAccessWithIdx
and then to any VariableAccess_ifc
.
It is possible to refresh the visible information from the variable.
repaintDelay
, use it.
isVisible()
and GralWidget.ImplAccess.setVisibleState(boolean)
.
renamed: #implMethodWidget_
instead old: 'gralWidgetMethod'.
repaintRequ
firstly remove the request from queue before execution,
a new request after that time will be added newly therefore, then execute it.
#repaintGthread()
and continue the calling level
because elsewhere the repaint order isn't removed from the GralGraphicThread.addDispatchOrder(GralGraphicTimeOrder)
-queue.
GralSetValue_ifc
now.
repaint()
, can be invoked in any thread. With delay possible.
All inherit widgets have to be implement #repaintGthread()
.
setHtmlHelp(String)
. For context sensitive help.
#setFocusGThread()
had called GralMng.setFocus(GralWidget)
and vice versa.
Instead it should be a abstract method here and implemented in all Widgets. See SwtWidgetHelper.setFocusOfTabSwt(org.eclipse.swt.widgets.Control)
.
#setFocusGThread()
. It wrappes the GralMng_ifc.setFocus(GralWidget)
.
sFormat
etc.
itsMng
. The original approach was, that the PanelManager manages only one panel
then one window. Now the GralPanelMng manages all panels of one application. It is instantiated only one time.
Therefore this association isn't the associated panel where the widget is member of.
setLineColor(GralColor, int)
.
Background: Any widget have a background. Most of widgets have lines. The color of them
should be able to animate if user data are changed.
setBackColor(GralColor, int)
.
#widget
is now type of GralWidget_ifc
and not Object.
Generally it is the reference to the implementing code of the widget. The implementing code
may based on a graphic base widget (SWT: Control) and implements the GralWidget_ifc
,
or it references the graphic base widget instance. The class SwtWidgetSimpleWrapper
is able to wrap simple graphical base widget instances.
gralMng()
It is the panel manager!
#actionChanging
and #actionShow
.
The actionChanging was the old action. It was called from the listener of the widgets of the underlying graphic
if any changing is done on the widget (mouse click etc). But the actionShow is necessary too
to prepare values to animate widgets without knowledge of the special kind of widget. The application
should call only the actionShow, all specifics should be done in the action.
itsCfgElement
now if it is present.
It is possible to configurate widgets with the GralDesigner up to now.
protected GralMng itsMng
private GralPos _wdgPos
public GralWidget.ImplAccess _wdgImpl
Control
or Component
.
The user can check and cast this instance if some special operations may be need graphic-implementation-dependent.
It is recommended that implementation specific features should not used if they are not necessary
and the application should be held graphic implementation independent.
protected GralMngBuild_ifc buildMng
private GralWidgetCfg_ifc itsCfgElement
public GralWidget.ConfigData cfg
public java.lang.String name
public final char whatIs
GralCfgData.new_Type()
public java.lang.String sToolTip
private java.lang.String sDataPath
protected GralMenu contextMenu
private int dataIx
protected java.lang.String sFormat
GralTextField
.private VariableAccess_ifc variable
variables
may be set.
See getVariableFromContentInfo(VariableContainer_ifc)
.
See setValue(float)
, #setValue(String)
.
See #indices
to use an array- or bit-variable.private java.util.List<VariableAccess_ifc> variables
variable
may be set.
See getVariableFromContentInfo(VariableContainer_ifc)
.
See setValue(float)
, #setValue(String)
.
See #indices
to use an array- or bit-variable.public java.lang.String sCmd
getCmd()
independent of its name.protected java.lang.String htmlHelp
private java.lang.Object oContentInfo
protected boolean bVisibleState
protected boolean bEditable
setEditable(boolean)
.
With that designation the cyclically refresh of the text field can be prevented.protected boolean bHasFocus
protected boolean bShouldInitialize
protected int repaintDelay
repaint()
is called without arguments.
It delays a few time because an additional process can be occure in a short time, and only one repaint should be invoked.
The repaintDelayMax limits a shifting to the future. See EventTimeout
, that is used.protected int repaintDelayMax
repaint()
is called without arguments.
It delays a few time because an additional process can be occure in a short time, and only one repaint should be invoked.
The repaintDelayMax limits a shifting to the future. See EventTimeout
, that is used.long lastTimeSetVisible
protected long dateUser
protected final GralWidget.DynamicData dyda
private static GralWidget_ifc.ActionChangeWhen[] whenAll
private final GralGraphicTimeOrder repaintRequ
#repaintGthread()
in the graphical thread.
It is used with delay and wind up whenever repaint(int, int)
with an delay is called.
If its executeOrder() runs, it is dequeued from timer queue in the GralGraphicThread
till the next request of repaint(int, int)
or repaint()
.@Deprecated public GralWidget(java.lang.String pos, java.lang.String name, char whatIs)
posString
- If null then the widget is not positioned. !=null then a position string.
The position is taken relative to the GralMng.pos()
, the GralMng.pos()
is changed
see GralPos.setPosition(CharSequence, GralPos)
sName
- If posString is null and sName has the form "@pos = name" then this is a combination from name and pos.
The name should be unified to indent a widget by its name.whatIs
- java.text.ParseException
public GralWidget(java.lang.String sPosName, char whatIs)
sName
- has the form "@pos = name" then this is a combination from position string and name.
The name should be unified to indent a widget by its name.
Syntax of pos: see GralPos.setPosition(CharSequence, GralPos)
. It is the same syntax as in textual config scripts.whatIs
- See whatIs
@Deprecated public GralWidget(java.lang.String sName, char whatIs, GralMng mng)
void registerWidget()
public void createImplWidget_Gthread() throws java.lang.IllegalStateException
createImplWidget_Gthread
in interface GralWidget_ifc
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.@Deprecated public final void setToPanel(GralMngBuild_ifc mngUnused) throws java.lang.IllegalStateException
createImplWidget_Gthread()
GralWidget_ifc
GralWidget_ifc.createImplWidget_Gthread()
.setToPanel
in interface GralWidget_ifc
mngUnused
- not used. It is known as singleton. Use null as argument.java.lang.IllegalStateException
GralWidget_ifc.setToPanel(org.vishia.gral.ifc.GralMngBuild_ifc)
public GralWidget getGralWidget()
getGralWidget
in interface GetGralWidget_ifc
GetGralWidget_ifc.getGralWidget()
public void setPrimaryWidgetOfPanel()
org.vishia.gral.ifc.GralWidget_ifc#getWidgetMultiImplementations()
public java.lang.String getName()
getName
in interface GralWidget_ifc
public void setContentInfo(java.lang.Object content)
setData(Object)
setContentInfo
in interface GralSetValue_ifc
public java.lang.Object getContentInfo()
getData()
setContentInfo(Object)
.getContentInfo
in interface GralSetValue_ifc
getContentInfo
in interface GralWidget_ifc
public void setData(java.lang.Object data)
setData
in interface GralWidget_ifc
public java.lang.Object getData()
setContentInfo(Object)
.getData
in interface GralWidget_ifc
public void setEditable(boolean editable)
GralWidget_ifc
setEditable
in interface GralWidget_ifc
editable
- true then the content is going to be able to change.
False then the edit functionality is disabled.public boolean isEditable()
GralWidget_ifc
isEditable
in interface GralWidget_ifc
public boolean isNotEditableOrShouldInitialize()
GralWidget_ifc
isNotEditableOrShouldInitialize
in interface GralWidget_ifc
public void setDataPath(java.lang.String sDataPath)
setDataPath
in interface GralSetValue_ifc
setDataPath
in interface GralWidget_ifc
sDataPath
- public java.lang.String getDataPath(java.lang.String sDataPath)
sDataPath
- the new onepublic java.lang.String getCmd()
setCmd(String)
.getCmd
in interface GralWidget_ifc
public java.lang.String getCmd(int option)
setCmd(String)
with choice of an option.
The command string should have the form "base[Option1|Option2|Option3]End"
whereby base and end can be empty. if option is <0 an IndexOutOfBoundsException is thrown.
If option is >= the given number of options, the option part is replaced by "??".
That may be more helpfull to detect errors.option
- number >=0public void setCmd(java.lang.String cmd)
getCmd()
independent of its name which can be set on runtime with this method.setCmd
in interface GralWidget_ifc
public java.lang.String getDataPath()
getDataPath
in interface GralSetValue_ifc
getDataPath
in interface GralWidget_ifc
@Deprecated public void setActionChange(GralUserAction action)
GralUserAction.exec(int, GralWidget_ifc, Object...)
will be called with following key codes:
KeyCode.focusGained
, KeyCode.focusLost
on enter and leave a text field.
KeyCode.mouse1Down
etc, any mouse events on any widget.
KeyCode.valueChanged
if the content of a text field is changed.
action
- any instance. Its action method is invoked depending of the type of widget
usual if the user takes an action on screen, press button etc.public void specifyActionChange(java.lang.String sAction, GralUserAction action, java.lang.String[] args, GralWidget_ifc.ActionChangeWhen... when)
sAction
- maybe null, String for visualization, especially menu entry for context menu.action
- The action. null admissible to remove the existing action.args
- possible arguments for the action or nullwhen
- List of type of action, maybe empty, then the given action is set for all conditions.
Especially setActionChange(null, null, null) removes all actions.
private void specifyActionChangeWhen(GralWidget_ifc.ActionChange action, GralWidget_ifc.ActionChangeWhen when)
public void specifyContextMenu(GralMenu menu)
public GralWidget_ifc.ActionChange getActionChange(GralWidget_ifc.ActionChangeWhen when)
setActionChange(String, action, args) without a specified when then this action is returned in any case,
especially if when == null. If specific actions were set, this action is returned, or null.
getActionChange
in interface GralWidget_ifc
when
- type of action, if null then returns the only one given action or null if only specific actions are givenpublic GralWidget_ifc.ActionChange getActionChangeStrict(GralWidget_ifc.ActionChangeWhen when, boolean strict)
setActionChange(String, action, args) without a specified when then this action is returned in any case,
especially if when == null. If specific actions were set, this action is returned, or null.
when
- type of action, if null then returns the only one given action or null if only specific actions are givenstrict
- if true then a common action without when-designation is not returned if when is not null.public void setActionMouse(GralMouseWidgetAction_ifc mouseWidgetAction, int mUser)
setActionChange(GralUserAction)
is used with KeyCode.mouse1Down
etc. key code.
It works with all widgets which uses SwtGralMouseListener.MouseListenerGralAction
respectively the adequate implementation mouse listener.
By contract of Gral, all widgets should add the mouse listener. Therefore no further special action is necessary to activate the requested mouse behavior.
Note: If you set an abbreviate mouse handler for Button etc. where the mouse is an essential functionality
that functionality is disturbed. An extra handler should base on that special mouse handler, for example
GralButton.MouseActionButton
and should invoke that actions calling super.mouse1Down(...) etc.
For that widgets usual the setActionChange(GralUserAction)
is called also, that may be sufficient.mouseWidgetAction
- null possible, elsewhere the mouse operation callback instance.mUser
- One or more of the bits GralMouseWidgetAction_ifc.mUser1down
etc.
If given the setActionChange(GralUserAction)
is invoked with that operation instead the given (or usually not given) mouseWidgetAction.public void setActionShow(GralUserAction action, java.lang.String[] param)
setValue(int, int, Object, Object)
after data preparation to display the value.
Because the GralWidget
is given as parameter, the implementation can use the information
for example sDataPath
or sFormat
. The implementation of the action can be done
in the users context in a specialized form, or some standard actions can be used.
See notes of getActionShow()
.
GralMngBuild_ifc.registerUserAction(String, GralUserAction)
. They are gotten by name
invoking GralMngBuild_ifc.getRegisteredUserAction(String)
in the GralCfgBuilder
.action
- The action instance.param
- maybe param for the show method.public GralUserAction getActionShow()
GralUserAction.userActionGui(String, GralWidget, Object...)
with this WidgetDescriptor and additional user data. The implementation of that method
may be done in the users context but in another module or the implementation may be given in any
library superordinated to this graphic adapter library but subordinated in respect to the explicit application.
The usage of a show method given in the implementation of GralUserAction
helps to separate
the invocation of showing and the decision what and how is to show.public void setActionFocused(GralUserAction action)
public GralUserAction getActionFocused()
public java.lang.String getsToolTip()
public void setToolTip(java.lang.String sToolTip)
public void setDragEnable(GralUserAction action, int dragType)
action
- The drag file get action.dropType
- one of KeyCode.dropFiles
or ..dropTextpublic GralUserAction getActionDrag()
public void setDropEnable(GralUserAction action, int dropType)
action
- The action will be calleddropType
- one of KeyCode.dropFiles
or ..dropTextpublic GralUserAction getActionDrop()
public java.lang.String getShowMethod()
public int getDataIx()
getDataIx
in interface GralSetValue_ifc
public void setDataIx(int dataIx)
setDataIx
in interface GralSetValue_ifc
public java.lang.String[] getShowParam()
setActionShow(GralUserAction, String[])
. They are split in extra Strings,
thispublic void clearShowParam()
public java.lang.String getFormat()
public void setFormat(java.lang.String sFormat)
public GralMenu getContextMenu()
GralMng#addContextMenu(GralWidget)
.
If the widget has a context menu already, it is stored in the reference contextMenu
.public void setHtmlHelp(java.lang.String url)
GralWidget_ifc
setHtmlHelp
in interface GralWidget_ifc
url
- String given url, maybe a local file too with #internalLabel.public java.lang.String getHtmlHelp()
@Deprecated public void setPanelMng(GralMng mng)
@Deprecated public VariableAccess_ifc getVariableFromContentInfo(VariableContainer_ifc container)
VariableContainer_ifc#getVariable(String, int[])
with the stored textual info setDataPath(String)
and setDataIx(int)
.
This operation may need a little bit of calculation time, which were to expensive if a lot of widgets
should be provided with user values. Therefore the returned VariableAccess_ifc
instance is stored
in the oContentInfo
of the widget and returned on the further calls.
VariableAccess_ifc
should be allow the fast access to users values.container
- The container where all VariableAccess_ifc
should be found.public VariableAccess_ifc getVariable(VariableContainer_ifc container)
public void refreshFromVariable(VariableContainer_ifc container)
GralWidget_ifc
refreshFromVariable
in interface GralWidget_ifc
container
- The container is used only if the variable is not known by direct reference
in the private variable
or variables
. If the variable(s) is/are
not known, they are searched by there data path set by GralWidget_ifc.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)
.public void refreshFromVariable(VariableContainer_ifc container, long timeLatest, GralColor colorRefreshed, GralColor colorOld)
setDataPath(String)
. The next times the variable is used independent of
the reference to the container and independent of the data path. If setDataPath(String)
was called again, the variables are searched in the container newly.
refreshFromVariable
in interface GralWidget_ifc
container
- contains variables able to search by string.public void requestNewValueForVariable(long timeRequested)
public java.lang.String getValue()
mng
- The context.public boolean isVisible()
GralWidget_ifc
isVisible
in interface GralWidget_ifc
public boolean isInFocus()
GralWidget_ifc
isInFocus
in interface GralWidget_ifc
public boolean isGraphicDisposed()
GralWidget_ifc
isGraphicDisposed
in interface GralWidget_ifc
public boolean setVisible(boolean visible)
GralWidget.ImplAccess.chgVisible
or GralWidget.ImplAccess.chgInvisible
in GralWidget.DynamicData.setChanged(int)
and invokes repaint()
with the repaintDelay
and repaintDelayMax
setVisible
in interface GralWidget_ifc
visible
- public GralRectangle XXXgetPixelPositionSize()
public boolean isChanged(boolean setUnchanged)
GralWidget_ifc
isChanged
in interface GralWidget_ifc
setUnchanged
- If true then set to unchanged with this call.public void setValue(int cmd, int ident, java.lang.Object visibleInfo)
cmd
- see GralMng_ifc.cmdSet
etc. It is possible to set the color etc.ident
- Any number to specify set, maybe 0value
- The value in the necessary representation.public void setBackColor(GralColor color, int ix)
GralWidget_ifc
setBackColor
in interface GralWidget_ifc
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.public 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.public void setLineColor(GralColor color, int ix)
GralWidget_ifc
setLineColor
in interface GralWidget_ifc
color
- Any colorix
- 0 if only one color is supported, 1, ... if the widget has more as one line.public void setTextColor(GralColor color)
GralWidget_ifc
setTextColor
in interface GralWidget_ifc
color
- Any colorpublic void setValue(int cmd, int ident, java.lang.Object visibleInfo, java.lang.Object userData)
cmd
- see GralMng_ifc.cmdSet
etc. It is possible to set the color etc.ident
- Any number to specify set, maybe 0value
- The value in the necessary representation.public void setValue(float value)
setValue
in interface GralSetValue_ifc
value
- This routine may be overridden by some specialized widgets.public void setLongValue(long value)
setLongValue
in interface GralSetValue_ifc
value
- This routine may be overridden by some specialized widgets.public float getFloatValue()
public float getLongValue()
public void setValue(java.lang.Object[] value)
setValue
in interface GralSetValue_ifc
value
- This routine may be overridden by some specialized widgets.public void setText(java.lang.CharSequence text)
GralWidget_ifc
GralWidget_ifc.setBackColor(GralColor, int)
etc.
GralWidget_ifc.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.setText
in interface GralSetValue_ifc
setText
in interface GralWidget_ifc
public java.lang.String getText()
public void setMinMax(float minValue, float maxValue)
setMinMax
in interface GralSetValue_ifc
minValue
- maxValue
- public long setContentIdent(long date)
GralWidget_ifc
GralWidget_ifc.getContentIdent()
.setContentIdent
in interface GralWidget_ifc
date
- any number which identifies the value of content.public long getContentIdent()
GralWidget_ifc
GralWidget_ifc.setContentIdent(long)
.getContentIdent
in interface GralWidget_ifc
public void setCfgElement(GralWidgetCfg_ifc cfge)
public GralWidgetCfg_ifc getCfgElement()
public void setFocus()
setFocus
in interface GralWidget_ifc
GralWidget_ifc.setFocus()
public void setFocus(int delay, int latest)
setFocus
in interface GralWidget_ifc
delay
- Delay in ms for invoking the focus requestlatest
- public GralMng gralMng()
GralWidget
of specific widgets
to get and set values and properties of this widgets non-symbolic.gralMng
in interface GralWidget_ifc
public GralPanelContent getItsPanel()
public void repaint()
GralWidget_ifc
GralWidget_ifc.repaint(int, int)
repaint
in interface GralWidget_ifc
public void repaint(int delay, int latest)
#repaintGthread()
if it is the graphic thread and the delay is 0.
Elsewhere the repaintRequ
is added as request to the graphic thread.repaint
in interface GralWidget_ifc
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.GralWidget_ifc.repaint(int, int)
public boolean remove()
#removeWidgetImplementation()
which is implemented in the adaption.remove
in interface Removeable
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public GralWidget.ImplAccess getImpl()
GralWidget.ImplAccess
of this widget.public final void setVisibleStateWidget(boolean visible)
visible
- public void setVisibleState(boolean visible)
void stop()
@Deprecated public GralColor setBackgroundColor(GralColor color)
setBackgroundColor
in interface GralWidget_ifc
public void setBoundsPixel(int x, int y, int dx, int dy)
setBoundsPixel
in interface GralWidget_ifc
public GralColor setForegroundColor(GralColor color)
setForegroundColor
in interface GralWidget_ifc
public java.lang.Object XXXgetWidgetImplementation()
public void XXXremoveWidgetImplementation()
public void XXXrepaintGthread()
public boolean XXXsetFocusGThread()
public void XXXsetVisibleGThread(boolean bVisible)