public class GralGraphicThread extends java.lang.Object implements java.lang.Runnable
GralGraphicTimeOrder#executeOrder(boolean)
.
wakeup()
is called in the 'addDispatchOrder()'-routine.
#queueGraphicOrders
queue is checked
and all queued method are invoked. That executes the 'widget.setText(text)' or the other routines
from the users programm in the GralGraphicTimeOrder#executeOrder(boolean)
.
#dispatchOsEvents()
is called. In SWT it calls the operation system
dispatching loop. If the underlying graphic system has its own graphic dispatching thread that thread
is woken up only to present the changes in the widgets. If all graphic dispatching is done,
#graphicThreadSleep()
let this thread sleeping, its all done.
GralGraphicTimeOrder
will be remain in the queue. For single activities
it should be queued out by itself calling its own GralGraphicTimeOrder#removeFromList(GralGraphicThread)
method in its GralGraphicTimeOrder#executeOrder(boolean)
-routine.
Another possibility is to have instances of GralGraphicTimeOrder
which are queued
for any time. They are invoked whenever wakeup()
is called.
setInfo(cmd, ...data)
-method
of a GralWidget
:
GralMng#setInfo(org.vishia.gral.base.GralWidget widget, int cmd, int ident, Object toshow, Object data)
GralMng
:
GralMng.WidgetChangeRequExecuter#guiChangeRequests
GralMng.WidgetChangeRequExecuter#executeOrder(boolean)
polls that queue.
GralMng#widgetChangeRequExecuter
: The instance in the GralWidgetManager.
#queueGraphicOrders
queue, it is executed
any time when a wakeup()
will be invoked.
GralMng#setInfoGthread(org.vishia.gral.ifc.GralWidget_ifc, int, int, Object, Object)
GralWidgetGthreadSet_ifc
and
GralWindow_setifc
GralWidget.repaint(int, int)
should be invoked with a suitable
delay. That queues the repaint instance
GralWidget.repaintRequ
(it is private) in the queue
#queueDelayedGraphicOrders
#runTimer
. The starting time
can be shelved if there are queued and re-instruct further time. This is necessary because some
graphic appearance changing requests may be given in any thread one after another, and the graphic thread
should be invoked not for any one request, but only if all requests are given. It saves thread switch activity.
Especially if some data are changed and a GralWidget.repaint()
request only applies the data
to the widgets, that 'repaint()' should be invoked only if all data are given. But any data changing
don't may know whether it is the last one. Therefore GralWidget.repaint(int, int)
can be called
after any data changing with shelving the repaint time. The repaint is executed not till the activity
of data changing is finished.Modifier and Type | Class and Description |
---|---|
static class |
GralGraphicThread.ImplAccess
This class is used only for the implementation level of the graphic.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
bExit
set to true to exit in main
|
protected boolean |
bStarted
True if the startup of the main window is done and the main window is visible.
|
protected MinMaxTime |
checkTimes
Instance to measure execution times.
|
protected long |
graphicThreadId
The thread id of the managing thread for graphic actions.
|
protected boolean |
isWakedUpOnly |
static java.lang.String |
version
Version and history.
|
Constructor and Description |
---|
GralGraphicThread()
Constructs this class as superclass.
|
Modifier and Type | Method and Description |
---|---|
void |
addDispatchOrder(GralGraphicTimeOrder order)
Adds the order to execute in the graphic dispatching thread.
|
void |
addEvent(java.util.EventObject event) |
long |
getThreadIdGui() |
boolean |
isRunning() |
boolean |
isStarted() |
boolean |
isTerminated() |
EventTimerThread |
orderList() |
void |
run()
The run method of the graphic thread.
|
void |
waitForStart() |
void |
wakeup()
This method should wake up the execution of the graphic thread because some actions are registered..
|
protected boolean bExit
protected boolean bStarted
protected MinMaxTime checkTimes
protected long graphicThreadId
protected boolean isWakedUpOnly
public static final java.lang.String version
GralGraphicThread.ImplAccess
.
GralGraphicTimeOrder
throws an exception,
it was started again because it was in the queue yet. The proplem occurs on build graphic. It
was repeated till all graphic handles are consumed. Now the #queueGraphicOrders
entries
are deleted first, then executed. TODO use this class only for SWT, use the adequate given mechanism
for AWT: java.awt.EventQueue.invokeAndWait(Runnable). use Runnable instead GralDispatchCallbackWorker.
public GralGraphicThread()
#threadGuiDispatch
.start() to start the run()
method of this class should be invoked only in the derived constructor
after all parameter are saved to execute the overridden #initGraphic()
method.name
- Name of the thread.public void addDispatchOrder(GralGraphicTimeOrder order)
GralGraphicTimeOrder.activate()
.order
- public void addEvent(java.util.EventObject event)
public long getThreadIdGui()
public boolean isRunning()
public boolean isStarted()
public boolean isTerminated()
public EventTimerThread orderList()
public void run()
#initGraphic()
will be called firstly. It is overridden by the graphic system implementing class
and does some things necessary for the graphic system implementing level.
bExit
is not set to false. bExit may be set to false
in a window close listener of the graphic system level. It means, it is set to false especially
if the windows will be closed from the operation system. If the window is closed because the application
is terminated by any application command the window will be closed, and the close listerer sets bReady
to false then.
#queueGraphicOrders
will be executed.
#dispatchOsEvents()
method.
#graphicThreadSleep()
.
run
in interface java.lang.Runnable
Runnable.run()
public void waitForStart()
public void wakeup()