public class SwtMng extends GralMng.ImplAccess
org.vishia.mainGuiSwt.SampleGuiSwtButtonInput
GralCfgBuilder,
but it is able to simplify the access to data and actions elsewhere too.
| Modifier and Type | Class and Description |
|---|---|
class |
SwtMng.NotExistException
The GUI may be determined by a external user file.
|
(package private) static class |
SwtMng.SelectionListenerForSlider |
protected class |
SwtMng.SwtMngFocusListener
Universal focus listener to register which widgets were in focus in its order,
to set htmlHelp and to invoke the
GralWidget.setActionFocused(GralUserAction). |
protected class |
SwtMng.SwtMngMouseMenuListener
Universal context menu listener
|
private static class |
SwtMng.TestHelp
This class is only used to store values to inspect.
|
class |
SwtMng.WindowsCloseListener
The windows-closing event handler.
|
protected class |
SwtMng.XXXButtonUserAction
Action for user commands of buttons.
|
protected static interface |
SwtMng.XXXUserAction
It is a marker interface.
|
| Modifier and Type | Field and Description |
|---|---|
protected Display |
displaySwt |
protected SwtMng.SwtMngFocusListener |
focusListener
The package private universal focus listener.
|
(package private) KeyListener |
keyListener |
(package private) ShellListener |
mainComponentListerner |
(package private) MouseListener |
mouseClickForInfo
Deprecated.
use
SwtGralMouseListener.mouseActionStd, it is the same, but better structured. |
(package private) SwtMng.SwtMngMouseMenuListener |
mouseMenuListener
The package private universal focus listener.
|
(package private) static java.lang.String |
nl |
protected SwtProperties |
propertiesGuiSwt
Properties of this Dialog Window.
|
(package private) static SwtTraverseListener |
swtTraverseListener
The instance for all traverse listener applicable to all widgets.
|
(package private) SwtMng.TestHelp |
testHelp |
(package private) Listener |
traverseKeyFilter
This interface routine is invoked on any key which is used as 'traverse' key to switch
between widgets, panels etc.
|
static java.lang.String |
version
Version, history and license.
|
private SwtMng.WindowsCloseListener |
windowsCloseListener
Instance of windowsCloseHandler.
|
(package private) TraverseListener |
XXXkeyTraverse
Disables the ctrl-pgUp and ctrl-Pgdn as traversal key listener.
|
(package private) Listener |
XXXX_mainKeyListener
This routine is invoked on any key event.
|
protected Rectangle |
XXXXXcurrPanelPos
The graphical frame.
|
gralMng, sizeCharProperties, threadGuiDispatch| Modifier | Constructor and Description |
|---|---|
protected |
SwtMng(GralMng gralMng,
char displaySize,
LogMessage log)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
GralCurveView |
addCurveViewY(java.lang.String sName,
int nrofXvalues,
GralCurveView.CommonCurve common) |
void |
addFocusAction(GralWidget widgetInfo,
GralUserAction action,
java.lang.String sCmdEnter,
java.lang.String sCmdRelease) |
GralWidget |
addFocusAction(java.lang.String sName,
GralUserAction action,
java.lang.String sCmdEnter,
java.lang.String sCmdRelease) |
GralHtmlBox |
addHtmlBox(java.lang.String name) |
java.lang.Object |
addImage(java.lang.String sName,
java.io.InputStream imageStream,
int height,
int width,
java.lang.String sCmd) |
GralWidget |
addSlider(java.lang.String sName,
GralUserAction action,
java.lang.String sShowMethod,
java.lang.String sDataPath) |
GralTable |
addTable(java.lang.String sName,
int height,
int[] columnWidths)
Deprecated.
|
GralWidget |
addText(java.lang.String sText,
char size,
int color)
Deprecated.
|
protected void |
addToGraphicImplThread(java.lang.Runnable exec)
Yet Experience: SWT knows the
Display#asyncExec(Runnable). |
(package private) GralRectangle |
calcPositionOfWindow(GralPos posWindow)
Calculates the position as absolute value on screen from a given position inside a panel.
|
GralRectangle |
calcWidgetPosAndSize(GralPos pos,
int widthwidgetNat,
int heigthWidgetNat)
Calculates the bounds of a widget with a given pos inside the implementation panel following
GralPos.parent. |
(package private) GralRectangle |
calcWidgetPosAndSizeSwt(GralPos pos,
Control parentComp,
int widthwidgetNat,
int heigthWidgetNat)
Calculates the bounds of a SWT component with a given position independent of
GralMng.ImplAccess.pos(). |
protected void |
closeImplGraphic()
Called as last operation in the Graphic thread see
GralMng.runGraphicThread() |
protected GralMenu |
createContextMenu(GralWidget widg)
Creates the context menu for the given widget for right-mouse pressing.
|
GralFileDialog_ifc |
createFileDialog() |
void |
createImplWidget_Gthread(GralWidget widgg)
This is the core operation to create all implementation widgets from given
GralWidget. |
protected GralMenu |
createMenuBar(GralWindow windg)
Creates the menu bar for the given window.
|
void |
createSubWindow(GralWindow windowGral)
Deprecated.
|
GralWindow |
createWindow(java.lang.String name,
java.lang.String title,
int windProps)
Deprecated.
|
protected boolean |
dispatchOsEvents()
Calls the dispatch routine of the implementation graphic.
|
void |
finishInit() |
Color |
getColorImpl(GralColor colorGral)
Gets the color of the graphic implementation (swt.Color, swing.TODO)
Either the implementation color instance is stored already in the GralColor,
or it will be created, stored in GralColor and returned here.
|
Composite |
getCurrentPanel()
The composite of the panel in SWT.
|
private Composite |
getCurrentPanel(GralWidget widgg) |
(package private) Rectangle |
getPixelPos(GralPos src)
Converts a GralPos to pixel.
|
(package private) Rectangle |
getPixelPosInner(GralPos src)
Gets a rectangle as 'inner' coordinates for filling a drawn rectangle
|
(package private) GralRectangle |
getPixelUseableAreaOfWindow(GralWidget widgg) |
static Control |
getSwtImpl(GralWidgetBase_ifc widgg)
Returns the Swt widget which implements the given GralWidget.
|
static Composite |
getSwtParent(GralPos pos)
Deprecated.
|
private java.lang.String |
getValueFromTable(Table table) |
java.lang.String |
getValueFromWidget(GralWidget widgd)
Deprecated.
|
static Composite |
getWidgetsPanel(GralWidget widg) |
protected void |
graphicThreadSleep()
Forces the graphic thread to sleep and wait for any events.
|
protected void |
initGraphic()
Called as first operation in the Graphic thread see
GralMng.runGraphicThread() |
(package private) static void |
logBounds(java.lang.StringBuilder sLog,
Control wdg) |
void |
redrawWidget(java.lang.String sName)
Forces the redrawing for all set samples.
|
boolean |
remove(GralPanel_ifc compositeBox)
Creates an independent grid panel which is managed by this.
|
void |
reportContent(java.lang.Appendable out)
Reports all existing Widgets on implementation level.
|
(package private) void |
reportContent(java.lang.Appendable out,
Control parent,
java.lang.String mark,
int recursion) |
GralRectangle |
resizeWidget(GralWidget widgd,
GralRectangle parentPix)
Forces the resizing of the given widged.
|
(package private) GralRectangle |
setBounds_(GralPos pos,
Control component)
Places a current component with knowledge of the current positions and the spreads of the component on graphic.
|
(package private) GralRectangle |
setPosAndSize_(GralPos pos,
Control component) |
(package private) GralRectangle |
setPosAndSizeSwt(GralPos posP,
Control component,
int widthwidgetNat,
int heigthWidgetNat)
Set bounds of a SWT component with a given position.
|
void |
setSampleCurveViewY(java.lang.String sName,
float[] values)
Adds a sampling value set.
|
boolean |
showContextMenuGthread(GralWidget widg)
Shows the context menu of any widget independent of the internal right-mouse invocation.
|
(package private) void |
stop() |
(package private) static void |
storeGralPixBounds(GralWidget.ImplAccess widgg,
Control widg)
Stores the Control#getBounds() in the
GralWidget.ImplAccess#pixBounds. |
(package private) static SwtMng |
swtMng(GralWidget.ImplAccess widgi)
Gets the SwtMng instance for the given implementation Widget from the
GralWidgetBase.gralMng. |
void |
wakeup()
This method should be implemented by the graphical base.
|
protected void |
windowClosing()
This method can be override by the user to force some actions if the dialog window is closed.
|
protected GralMenu |
XXXaddPopupMenu(java.lang.String sName) |
GralWidget |
XXXaddTextField(GralWidget widgetInfo,
boolean editable,
java.lang.String prompt,
char promptStylePosition)
Adds a text field for showing or editing a text value.
|
GralWidget |
XXXaddTextField(java.lang.String name,
boolean editable,
java.lang.String prompt,
char promptStylePosition)
Adds a text field for showing or editing a text value.
|
(package private) void |
XXXsetPosAndSizeSwt(Control component,
int widthwidgetNat,
int heigthWidgetNat)
Set bounds of a SWT component with this
GralMng.pos() from the GralWidgetMng. |
boolean |
XXXsetWindowsVisible(GralWindow_ifc window,
GralPos atPos)
Sets a given and registered window visible at the given position and size or set it invisible.
|
getPanel, idxWindows, indexNameWidgets, listVisiblePanels_add, pos, sCurrPanel, startThread, userMainKeyActionpublic static final java.lang.String version
getPixelPos(GralPos) and getPixelPosInner(GralPos).
swtMng(org.vishia.gral.base.GralWidget.ImplAccess)
storeGralPixBounds(org.vishia.gral.base.GralWidget.ImplAccess, Control) general usable.
createImplWidget_Gthread(GralWidget) enhanced.
GralPanelContent#GralPanelContent(String, String, char) and GralTabbedPanel#GralTabbedPanel(String, String, GralPanelActivated_ifc, int)
was invoked with "@" for the posString without any more posString information. That is false. The idea was: Set the current panel. But that does not run.
See changes on GralMng on 2016-09-02.
createImplWidget_Gthread(GralWidget) instanciates all widget types.
#resizeWidget(GralWidget, int, int) can work with more as one widget implementation.
But it isn't test and used yet. Size of any implementation widget?
#setPosAndSizeSwt(Control, int, int) etc.
#setInfoGthread(GralWidget, int, int, Object, Object) routine
uses the SwtSetValue_ifc capability to associate cmd to types of widgets. Yet used only for SwtSubWindow.
#setInfoGthread(GralWidget, int, int, Object, Object) catches
any exception, before: An exception causes aborting the graphic thread.
#addLed(String, String, String) now uses GralLed.
#swtKeyListener as base for all fields.
calcPositionOfWindow(GralPos) improved
GralMng_ifc#cmdClear used to clear a whole swt.Table, commonly using: clear a content of widget.
protected Rectangle XXXXXcurrPanelPos
protected SwtProperties propertiesGuiSwt
GralMng contains an aggregation
to the same instance, but with type GralGridProperties. Internally there are some more
Swt-capabilities in the derived type.protected Display displaySwt
@Deprecated MouseListener mouseClickForInfo
SwtGralMouseListener.mouseActionStd, it is the same, but better structured.GralWidget in its data.
The infos of the last clicked widget can be got with it.static SwtTraverseListener swtTraverseListener
SwtMng.TestHelp testHelp
private final SwtMng.WindowsCloseListener windowsCloseListener
KeyListener keyListener
TraverseListener XXXkeyTraverse
Listener traverseKeyFilter
ShellListener mainComponentListerner
static final java.lang.String nl
Listener XXXX_mainKeyListener
protected SwtMng.SwtMngFocusListener focusListener
SwtMng.SwtMngMouseMenuListener mouseMenuListener
protected SwtMng(GralMng gralMng, char displaySize, LogMessage log)
guiContainer - The container where the elements are stored in.width - in display-units for the window's width, the number of pixel depends from param displaySize.height - in display-units for the window's height, the number of pixel depends from param displaySize.displaySize - character 'A' to 'E' to determine the size of the content
(font size, pixel per cell). 'A' is the smallest, 'E' the largest size. Default: use 'C'.static SwtMng swtMng(GralWidget.ImplAccess widgi)
GralWidgetBase.gralMng.
Note: It is a quest of effort, simplicity or universality where to use only one instance for the GralMng and SwtMng
(Singleton) or reference it. The reference is a small effort in data.
The access via reference or from singleton is approximately the same (run time effort).
But using a singleton prohibits a system with different graphic appearances in one running JRE environment.
This should be also possible in future. Consider that many applications can run in one JRE environment.
It is really a restriction using a singleton.
GralWidgetBase.gralMng
So the singleton usage can be refactored.widgi - The implementation access, anytime accessible from the SWT implementation level.ImplAccess#gralMng(),
then the GralMng._mngImpl is anytime the SwtMng if the graphic is running.
It is unconditionally downcasted here from the universal GralMng.ImplAccess to the SwtMng.public static Control getSwtImpl(GralWidgetBase_ifc widgg)
GralWidget_ifc.getImplWidget() and then checks,
whether the Swt impl Widget is immediately an Control,
or it istype of SwtWidgetHelper.
In the last case SwtWidgetHelper.widgetSwt is returned.
GralWidget.ImplAccess#wdgimpl should be used
to store the aggregation to the implementation widget, so simple as possible.widgg - @Deprecated public static Composite getSwtParent(GralPos pos)
getWidgetsPanel(GralWidget)pos - Rectangle getPixelPos(GralPos src)
calcWidgetPosAndSize(GralPos, int, int).
Note: The size of the panel is gotten from the current size.src - Rectangle getPixelPosInner(GralPos src)
src - public Composite getCurrentPanel()
getCurrentPanel in class GralMng.ImplAccessGralMng.ImplAccess.getCurrentPanel()public static Composite getWidgetsPanel(GralWidget widg)
private Composite getCurrentPanel(GralWidget widgg)
public void createImplWidget_Gthread(GralWidget widgg)
GralWidget.
It knows all types of widgets, selects it and calls the proper swt counterpart.
See definition on GralMng.createImplWidget_Gthread(GralWidget)createImplWidget_Gthread in class GralMng.ImplAccesswidgg - the existing GralWidget derived typepublic boolean remove(GralPanel_ifc compositeBox)
GralMng.ImplAccessremove in class GralMng.ImplAccess@Deprecated public GralWindow createWindow(java.lang.String name, java.lang.String title, int windProps)
createWindow in class GralMng.ImplAccess@Deprecated public void createSubWindow(GralWindow windowGral) throws java.io.IOException
createSubWindow in class GralMng.ImplAccessjava.io.IOExceptionpublic boolean XXXsetWindowsVisible(GralWindow_ifc window, GralPos atPos)
GralMng.ImplAccessorg.vishia.gral.ifc.GralMngBuild_ifc#createWindow(String, boolean)
in the build phase of the gui. It can be hidden because it is not necessary to show and operate with them.
In a adequate phase of operate it can be shown and focused.
GralPos#panel. To get a position instance,
you can set a position invoking
GralMngBuild_ifc.selectPanel(String)
org.vishia.gral.ifc.GralMngBuild_ifc#setPosition(float, float, float, float, int, char)
GralMngBuild_ifc.getPositionInPanel().
GralPos.x etc.
It is possible too to change the Panel which relates to the position. Then the grid managing instance
have to be known via the GralMngBuild_ifc to select a panel.
The panels may be moved or resized. With the knowledge of the relative position of the window in respect to a panel
of the parent window, the window can be placed onto a proper position of the whole display.XXXsetWindowsVisible in class GralMng.ImplAccesswindow - the instance of the window wrapper.atPos - If null then hide the window. If not null then show the window.
The position and size of the window is given related to any panel of any other window.GralRectangle calcPositionOfWindow(GralPos posWindow)
posWindow - contains any GralPos#panel. Its absolute position will be determined.
from that position and size the absolute postion will be calculate, with this given grid positions
inside the panel.static void storeGralPixBounds(GralWidget.ImplAccess widgg, Control widg)
GralWidget.ImplAccess#pixBounds.
This operation is called onwidgg - The appropriate GralWidgetwidg - The SWT widget which is presented with this Gral Widget.
On comprehensive GralWidgets this routine is especially implemented.static void logBounds(java.lang.StringBuilder sLog,
Control wdg)
GralRectangle getPixelUseableAreaOfWindow(GralWidget widgg)
protected void windowClosing()
GralRectangle setBounds_(GralPos pos, Control component)
component - The component to place.GralRectangle setPosAndSize_(GralPos pos, Control component)
void XXXsetPosAndSizeSwt(Control component,
int widthwidgetNat,
int heigthWidgetNat)
GralMng.pos() from the GralWidgetMng.
The GralMng.setNextPosition() is called to process a used this.pos to its next.
This method is package-private for SWT-implementation. It calls
GralMng.setNextPosition() and setPosAndSizeSwt(GralPos, Control, int, int)
withcomponent - The SWT-widget.widthwidgetNat - The natural size of the component.heigthWidgetNat - The natural size of the component.
NOTE: 2015-07-13: This method is set to unused because it uses the mng-position additional to the constructor of GralWidget.
This is the old concept which is in conflict with the usuage there.GralRectangle setPosAndSizeSwt(GralPos posP, Control component, int widthwidgetNat, int heigthWidgetNat)
posP - The Position for the component.component - The SWT-widget.widthwidgetNat - The natural size of the component.heigthWidgetNat - The natural size of the component.public GralRectangle calcWidgetPosAndSize(GralPos pos, int widthwidgetNat, int heigthWidgetNat)
GralPos.parent.
Note: The size of the panel is gotten from the current one (maybe resize has had occured).
It means coordinates from right and bottom should be correct.
propertiesGuiSwt are used.
It is possible to tune the bounds after calculation, for example to enhance the width if a text
is larger then the intended position.calcWidgetPosAndSize in class GralMng.ImplAccesspos - The position.widthwidgetNat - The natural size of the component given if necessary.heigthWidgetNat - The natural size of the component given if necessary.GralRectangle calcWidgetPosAndSizeSwt(GralPos pos, Control parentComp, int widthwidgetNat, int heigthWidgetNat)
GralMng.ImplAccess.pos().
This method is package-private for SWT-implementation.
It is possible to tune the bounds after calculation, for example to enhance the width if a text
is larger then the intended position.pos - The position.component - The SWT-widget.widthwidgetNat - The natural size of the component.heigthWidgetNat - The natural size of the component.@Deprecated public GralWidget addText(java.lang.String sText, char size, int color)
addText in class GralMng.ImplAccessorg.vishia.gral.base.GralMng.ImplAccess#addTabbedPanel(java.lang.String, org.vishia.gral.base.GralPanelActivated_ifc, int)public GralWidget XXXaddTextField(java.lang.String name, boolean editable, java.lang.String prompt, char promptStylePosition)
sName - The registering namewidth - Number of grid units for lengtheditable - true than edit-able, false to show contentprompt - If not null, than a description label is shownpromptStylePosition - Position and size of description label:
upper case letter: normal font, lower case letter: small font
'l' left, 't' top (above field)public GralWidget XXXaddTextField(GralWidget widgetInfo, boolean editable, java.lang.String prompt, char promptStylePosition)
sName - The registering namewidth - Number of grid units for lengtheditable - true than edit-able, false to show contentprompt - If not null, than a description label is shownpromptStylePosition - Position and size of description label:
upper case letter: normal font, lower case letter: small font
'l' left, 't' top (above field)public GralHtmlBox addHtmlBox(java.lang.String name)
addHtmlBox in class GralMng.ImplAccesspublic java.lang.Object addImage(java.lang.String sName,
java.io.InputStream imageStream,
int height,
int width,
java.lang.String sCmd)
addImage in class GralMng.ImplAccesspublic GralWidget addSlider(java.lang.String sName, GralUserAction action, java.lang.String sShowMethod, java.lang.String sDataPath)
addSlider in class GralMng.ImplAccesspublic GralCurveView addCurveViewY(java.lang.String sName, int nrofXvalues, GralCurveView.CommonCurve common)
addCurveViewY in class GralMng.ImplAccesspublic GralWidget addFocusAction(java.lang.String sName, GralUserAction action, java.lang.String sCmdEnter, java.lang.String sCmdRelease)
addFocusAction in class GralMng.ImplAccesspublic void addFocusAction(GralWidget widgetInfo, GralUserAction action, java.lang.String sCmdEnter, java.lang.String sCmdRelease)
addFocusAction in class GralMng.ImplAccess@Deprecated public GralTable addTable(java.lang.String sName, int height, int[] columnWidths)
addTable in class GralMng.ImplAccessprotected GralMenu XXXaddPopupMenu(java.lang.String sName)
XXXaddPopupMenu in class GralMng.ImplAccessprotected GralMenu createContextMenu(GralWidget widg)
GralMng.ImplAccessGralWidget.getContextMenu() whereby an existing
context menu is stored in the GralWidget.contextMenu association.
The widget have to be set to panel already, an implementation widget have to be existing.
It means GralWidget#getWidgetImplementation() should be return that instance
where the menu is to be added.
This method is package protected because it should only be called internally.createContextMenu in class GralMng.ImplAccessprotected GralMenu createMenuBar(GralWindow windg)
GralMng.ImplAccessGralWindow.getMenuBar() whereby an existing
menu bar is stored in the GralWindow.menuBarGral association.createMenuBar in class GralMng.ImplAccesswindg - The windowpublic GralFileDialog_ifc createFileDialog()
createFileDialog in class GralMng.ImplAccesspublic void setSampleCurveViewY(java.lang.String sName,
float[] values)
GralMng.ImplAccesssetSampleCurveViewY in class GralMng.ImplAccesssName - The registered namevalues - The values.public void redrawWidget(java.lang.String sName)
GralMng.ImplAccessredrawWidget in class GralMng.ImplAccesssName - The name of the widget.public GralRectangle resizeWidget(GralWidget widgd, GralRectangle parentPix)
GralMng.ImplAccessresizeWidget in class GralMng.ImplAccesswidgd - the widget@Deprecated public java.lang.String getValueFromWidget(GralWidget widgd)
getValueFromWidget in class GralMng.ImplAccessprivate java.lang.String getValueFromTable(Table table)
public Color getColorImpl(GralColor colorGral)
GralMng.ImplAccessgetColorImpl in class GralMng.ImplAccesscolorGral - The Color.public boolean showContextMenuGthread(GralWidget widg)
GralMng.ImplAccessshowContextMenuGthread in class GralMng.ImplAccesswidg - The widget.protected void initGraphic()
GralMng.runGraphicThread()initGraphic in class GralMng.ImplAccessprotected void closeImplGraphic()
GralMng.runGraphicThread()closeImplGraphic in class GralMng.ImplAccesspublic void finishInit()
finishInit in class GralMng.ImplAccesspublic void reportContent(java.lang.Appendable out)
throws java.io.IOException
GralMng.ImplAccessGralMng.reportGralContent(Appendable) for the Gral level.reportContent in class GralMng.ImplAccessout - any output, maybe especially System.out or LogMessagejava.io.IOExceptionvoid reportContent(java.lang.Appendable out,
Control parent,
java.lang.String mark,
int recursion)
throws java.io.IOException
java.io.IOExceptionprotected boolean dispatchOsEvents()
GralMng.ImplAccessdispatchOsEvents in class GralMng.ImplAccessprotected void graphicThreadSleep()
GralMng.ImplAccessGralMng.ImplAccess.wakeup() is called or this routine returns if the operation system wakes up the graphic thread.graphicThreadSleep in class GralMng.ImplAccessprotected void addToGraphicImplThread(java.lang.Runnable exec)
Display#asyncExec(Runnable).exec - public void wakeup()
GralMng.ImplAccesswakeup in class GralMng.ImplAccessvoid stop()