public class AwtMng extends GralMng.ImplAccess
| Modifier and Type | Class and Description |
|---|---|
protected class |
AwtMng.AwtMngFocusListener
Universal focus listener to register which widgets were in focus in its order,
to set htmlHelp and to invoke the
GralWidget.setActionFocused(GralUserAction). |
| Modifier and Type | Field and Description |
|---|---|
protected AwtMng.AwtMngFocusListener |
focusListener
The package private universal focus listener.
|
private static java.util.HashMap<java.awt.Component,GralWidget> |
gralWidgetFromComponent |
(package private) AwtGralMouseListener.MouseListenerGralAction |
mouseStdAction
The standard listener or action for mouse events, able to assign to all widgets which does not need an extra mouse behaviour.
|
(package private) AwtProperties |
propertiesGuiAwt |
(package private) java.awt.event.KeyListener |
XXXXX_mainKeyListener |
gralMng, sizeCharProperties, threadGuiDispatch| Constructor and Description |
|---|
AwtMng(GralMng gralMng,
char displaySize,
LogMessage log)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(GralTable<?> table) |
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)
Adds a text box for showing or editing a text in multi lines.
|
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) |
GralWidget |
addText(java.lang.String sText,
char size,
int color)
Deprecated.
|
(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 independent of this
GralMng.ImplAccess.pos(). |
(package private) GralRectangle |
calcWidgetPosAndSizeAwt(GralPos pos,
java.awt.Component component,
int widthwidgetNat,
int heigthWidgetNat)
Calculates the bounds of a SWT component with a given position independent of
GralMng.ImplAccess.pos(). |
protected void |
closeImplGraphic() |
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) |
GralWindow |
createWindow(java.lang.String name,
java.lang.String title,
int windPros) |
protected boolean |
dispatchOsEvents()
Calls the dispatch routine of the implementation graphic.
|
void |
finishInit() |
static java.awt.Component |
getAwtImpl(GralWidgetBase_ifc widgg)
Returns the Swt widget which implements the given GralWidget.
|
java.awt.Color |
getColorImpl(GralColor color)
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.
|
java.awt.Container |
getCurrentPanel()
Forbidden.
|
(package private) GralRectangle |
getPixelUseableAreaOfWindow(GralWidget widgg) |
java.lang.String |
getValueFromWidget(GralWidget widgetDescr) |
java.awt.Container |
getWidgetsPanel(GralWidget widg) |
protected void |
graphicThreadSleep()
Forces the graphic thread to sleep and wait for any events.
|
protected void |
initGraphic()
This method should be implemented by the graphical implementation layer.
|
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.
|
GralRectangle |
resizeWidget(GralWidget widgd,
GralRectangle parentPix)
Forces the resizing of the given widged.
|
(package private) void |
setBounds_(GralPos pos,
java.awt.Component component)
Places a current component with knowledge of the current positions and the spreads of the component on graphic.
|
protected void |
setPosAndSize_(GralPos pos,
java.awt.Component component) |
(package private) void |
setPosAndSizeAwt(GralPos posP,
java.awt.Component component,
int widthwidgetNat,
int heigthWidgetNat)
Set bounds of a AWT 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() |
void |
wakeup()
This method should be implemented by the graphical base.
|
protected GralMenu |
XXXaddPopupMenu(java.lang.String sName) |
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, userMainKeyActionfinal AwtProperties propertiesGuiAwt
final AwtGralMouseListener.MouseListenerGralAction mouseStdAction
private static final java.util.HashMap<java.awt.Component,GralWidget> gralWidgetFromComponent
java.awt.event.KeyListener XXXXX_mainKeyListener
protected AwtMng.AwtMngFocusListener focusListener
public AwtMng(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'.public static java.awt.Component getAwtImpl(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 - public java.awt.Container getCurrentPanel()
GralMng.ImplAccessSwtMng.getWidgetsPanel(GralWidget).getCurrentPanel in class GralMng.ImplAccesspublic java.awt.Container getWidgetsPanel(GralWidget widg)
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 GralHtmlBox addHtmlBox(java.lang.String name)
addHtmlBox in class GralMng.ImplAccesssName - 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 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.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 GralTable addTable(java.lang.String sName, int height, int[] columnWidths)
addTable in class GralMng.ImplAccesspublic void add(GralTable<?> table)
@Deprecated public GralWidget addText(java.lang.String sText, char size, int color)
addText 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 GralWindow createWindow(java.lang.String name, java.lang.String title, int windPros)
createWindow in class GralMng.ImplAccesspublic void createSubWindow(GralWindow windowGral)
createSubWindow in class GralMng.ImplAccessGralRectangle 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.GralRectangle getPixelUseableAreaOfWindow(GralWidget widgg)
public boolean remove(GralPanel_ifc compositeBox)
GralMng.ImplAccessremove in class GralMng.ImplAccesspublic java.awt.Color getColorImpl(GralColor color)
GralMng.ImplAccessgetColorImpl in class GralMng.ImplAccesscolor - The Color.public java.lang.String getValueFromWidget(GralWidget widgetDescr)
getValueFromWidget in class GralMng.ImplAccesspublic 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 widgetpublic void setSampleCurveViewY(java.lang.String sName,
float[] values)
GralMng.ImplAccesssetSampleCurveViewY in class GralMng.ImplAccesssName - The registered namevalues - The values.void setBounds_(GralPos pos, java.awt.Component component)
component - The component to place.protected void setPosAndSize_(GralPos pos, java.awt.Component component)
void setPosAndSizeAwt(GralPos posP, java.awt.Component component, int widthwidgetNat, int heigthWidgetNat)
posP - The Position for the component.component - The AWT-widget.widthwidgetNat - The natural size of the component.heigthWidgetNat - The natural size of the component.public GralRectangle calcWidgetPosAndSize(GralPos pos, int widthwidgetNat, int heigthWidgetNat)
GralMng.ImplAccess.pos().
This method is a part of the implementing GralMng because the GralPos is not implemented for
any underlying graphic system and the #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.heigthWidgetNat - The natural size of the component.GralRectangle calcWidgetPosAndSizeAwt(GralPos pos, java.awt.Component component, 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.public boolean showContextMenuGthread(GralWidget widg)
GralMng.ImplAccessshowContextMenuGthread in class GralMng.ImplAccesswidg - The widget.protected void initGraphic()
GralMng.ImplAccessGralMng.runGraphicThread(). See SwtGraphicThread.initGraphic in class GralMng.ImplAccessprotected void closeImplGraphic()
closeImplGraphic in class GralMng.ImplAccessprotected 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.ImplAccesspublic void wakeup()
GralMng.ImplAccesswakeup 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.IOExceptionpublic void finishInit()
finishInit in class GralMng.ImplAccessvoid stop()
public 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.