|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.vishia.mainGuiSwt.GuiPanelMng
public class GuiPanelMng
This class manages the building of a Dialog Box (Window) using a Java-AWT-container
and Swing elements. The container can be visiblized as a part of another container of any window.
An example is given in org.vishia.mainGui.SampleGui
The positions on the display does not based on pixel units. Instead, a grid is used.
The grid-size (number of x- and y-pixel per grid unit) is able to set, so a more large
or a more small representation of the graphic is shown, depending on the display point size,
the distance to view or personal defaults.
A layout manager is not used. The user sets fix positions in the grid units.
A grid unit is a half-small-line in the vertical direction and about a small character width
in the x-direction. So a closed-to-user-thinking position is able to set for any component.
It is like rows or lines and columns.
An automatically layout managing using self-deciding positioning of any components is not done.
But a next added component may be positioned right from the previous or below the previous
without manually calculation and setting of the position. It simplifies.
This class supports setting of values of shown components with symbolic access (String-name)
in runtime
and selecting of button-actions and data-container while creating with symbolic access
to the action-instance or the data-container. This property is used especially
by the text-script-controlled built of a dialog widget using the GuiDialogZbnfControlled,
but it is able to simplify the access to data and actions elsewhere too.
| Nested Class Summary | |
|---|---|
protected class |
GuiPanelMng.ButtonUserAction
Action for user commands of buttons. |
static class |
GuiPanelMng.GuiChangeReq
|
protected class |
GuiPanelMng.MouseClickAction
This action class supports the call of a user method while mouse-button. |
class |
GuiPanelMng.NotExistException
The GUI may be determined by a external user file. |
protected static interface |
GuiPanelMng.UserAction
It is a marker interface. |
| Nested classes/interfaces inherited from interface org.vishia.mainGui.GuiPanelMngBuildIfc |
|---|
GuiPanelMngBuildIfc.WidgetDescriptor<WidgetTYPE> |
| Field Summary | |
|---|---|
(package private) boolean |
bBelow
True if the next element should be placed below the last. |
(package private) boolean |
bRigth
True if the next element should be placed below the last. |
private Composite |
currPanel
|
private GuiDispatchCallbackWorker |
dispatchListener
The dispatch listener should be included in the dispatch loop in the SWT-Thread. |
(package private) java.util.concurrent.ConcurrentLinkedQueue<GuiPanelMng.GuiChangeReq> |
guiChangeRequests
Index of all Tables, which are representable. |
private java.util.Map<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>> |
indexNameWidgets
Index of all input fields to access symbolic. |
private LogMessage |
log
|
private java.util.Map<java.lang.String,Composite> |
panels
The container of the whole dialog window. |
PropertiesGuiSwt |
propertiesGui
Properties of this Dialog Window. |
private static long |
serialVersionUID
|
private java.util.Map<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>> |
showFields
Index of all input fields to access symbolic. |
(package private) Table |
testTable
|
private java.util.Map<java.lang.String,UserActionGui> |
userActions
Index of all user actions, which are able to use in Button etc. |
(package private) int |
xPos
Position of the next widget to add. |
(package private) int |
xPosPrev
Position of the next widget to add. |
(package private) int |
yPos
Position of the next widget to add. |
(package private) int |
yPosPrev
Position of the next widget to add. |
| Constructor Summary | |
|---|---|
GuiPanelMng(Device device,
int width,
int height,
char displaySize,
LogMessage log)
Creates an instance. |
|
GuiPanelMng(int width,
int height,
PropertiesGuiSwt propertiesGui,
LogMessage log)
Creates an instance. |
|
| Method Summary | |
|---|---|
Button |
addButton(java.lang.String sButtonText,
int height,
int width,
java.lang.String sCmd,
java.lang.String sUserAction,
java.lang.String sName)
Adss a button |
Canvas |
addCurveViewY(java.lang.String sName,
int dyGrid,
int dxGrid,
int nrofXvalues,
int nrofTracks)
Adds a curve view for displaying values with ordinary x-coordinate. |
void |
addLine(int colorValue,
float xa,
float ya,
float xe,
float ye)
Adds a line. |
java.lang.Object |
addMouseButtonAction(java.lang.String sName,
java.lang.String sRegisteredUserAction,
java.lang.String sCmdPress,
java.lang.String sCmdRelease,
java.lang.String sCmdDoubleClick)
Adds a mouse click action (left button) to any widget. |
Table |
addTable(java.lang.String sName,
int height,
int[] columnWidths)
Adds a table, which is able to scroll. |
Label |
addText(java.lang.String sText,
char size,
int color)
Adds a simple text at the current position. |
Text |
addTextField(java.lang.String sName,
int width,
boolean editable,
java.lang.String prompt,
char promptStylePosition)
Adds a edit field for editing a number value. |
private void |
furtherSetPosition(int dx,
int dy)
Sets the position for further add.. calls. |
java.lang.String |
getFieldContent(java.lang.String name)
Gets the content of any field during operation. |
java.util.Set<java.util.Map.Entry<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>>> |
getShowFields()
Returns a Set of all fields, which are created to show. |
GuiDispatchCallbackWorker |
getTheGuiChangeWorker()
The GUI-change-listener should be called in the dispatch-loop of the GUI-(SWT)-Thread. |
java.lang.String |
insertInfo(java.lang.String name,
int ident,
java.lang.String content)
Inserts a textual information at any widget. |
void |
registerPanel(java.lang.String name,
java.lang.Object panelP)
Registers a panel to place the widgets. |
void |
registerUserAction(java.lang.String name,
UserActionGui action)
Registers all user actions, which are able to use in Button etc. |
void |
repaint()
|
void |
selectPanel(java.lang.String sName)
selects a registered panel for the next add-operations. |
private void |
setBounds_(Control component)
Places a current component with knowledge of the current positions and the spreads of the component on graphic. |
private void |
setBounds_(Control component,
int yGridSize,
int xGridSize)
Places a current component with knowledge of the current positions and the spreads of the component on graphic. |
private void |
setBounds_(Control component,
int pyGrid,
int pxGrid,
int dyGrid,
int dxGrid)
Places a current component with knowledge of the current positions and the spreads of the component on graphic. |
private void |
setBounds_(Control component,
Point size)
Places a current component with knowledge of the current positions and the spreads of the component on graphic. |
void |
setColorGridCurveViewY(java.lang.String sName,
int backgroundColor,
int[] colorLines,
char grid)
Sets the appearance of the graphic respectively color and grid. |
java.lang.String |
setFieldContent(java.lang.String name,
java.lang.String content)
Sets the content of any field during operation. |
void |
setLineCurveView(java.lang.String sNameView,
int trackNr,
java.lang.String sNameLine,
java.lang.String sVariable,
int colorValue,
int style,
int nullLine,
float yScale,
float yOffset)
Sets the values for a line |
void |
setNextPositionX()
Positions the next widget below to the previous one. |
void |
setNextPositionY()
Positions the next widget on the right next to the previous one. |
void |
setPosition(int ypos,
int xpos)
Sets the position for the next widget to add in the container. |
void |
setSampleCurveViewY(java.lang.String sName,
float[] values)
Adds a sampling value set. |
protected void |
windowClosing()
This method can be override by the user to force some actions if the dialog window is closed. |
int |
xxxgetWidthLast()
Returns the width (number of grid step horizontal) of the last element. |
void |
xxxregisterTableAccess(java.lang.String name,
Table table)
Registers all Tables, which are representable. |
void |
xxxsetWindowVisible()
This method is able to call by the user anywhere to set a dialog window visible. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private final LogMessage log
private final java.util.Map<java.lang.String,Composite> panels
private Composite currPanel
public final PropertiesGuiSwt propertiesGui
int xPos
int yPos
int xPosPrev
int yPosPrev
boolean bBelow
boolean bRigth
private final java.util.Map<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>> indexNameWidgets
private final java.util.Map<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>> showFields
private final java.util.Map<java.lang.String,UserActionGui> userActions
java.util.concurrent.ConcurrentLinkedQueue<GuiPanelMng.GuiChangeReq> guiChangeRequests
Table testTable
private final GuiDispatchCallbackWorker dispatchListener
guiChangeRequests-Queue, see
| Constructor Detail |
|---|
public GuiPanelMng(Device device,
int width,
int height,
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 GuiPanelMng(int width,
int height,
PropertiesGuiSwt propertiesGui,
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'.| Method Detail |
|---|
public void registerPanel(java.lang.String name,
java.lang.Object panelP)
selectPanel(String) -Routine
registerPanel in interface GuiPanelMngBuildIfcname - Name of the panel.panel - The panel.public void xxxsetWindowVisible()
protected void windowClosing()
public void registerUserAction(java.lang.String name,
UserActionGui action)
userAction= designation in the configuration String.
registerUserAction in interface GuiPanelMngBuildIfcname - action -
public void xxxregisterTableAccess(java.lang.String name,
Table table)
public void selectPanel(java.lang.String sName)
selectPanel in interface GuiPanelMngBuildIfc
public void setPosition(int ypos,
int xpos)
setPosition in interface GuiPanelMngBuildIfcxpos - x-Position in x-Units, count from left of the box.ypos - y-Position in y-Units, count from top of the box. It is the bottom line of the widget.
It means ypos = 0 is not a proper value. To show a text in the first line, use y=2.public void setNextPositionX()
setNextPositionX in interface GuiPanelMngBuildIfcpublic void setNextPositionY()
public int xxxgetWidthLast()
private void setBounds_(Control component)
component - The component to place.
private void setBounds_(Control component,
Point size)
component - The component to place.
private void setBounds_(Control component,
int yGridSize,
int xGridSize)
component - The component to place.
private void setBounds_(Control component,
int pyGrid,
int pxGrid,
int dyGrid,
int dxGrid)
component - The component to place.diff - movement of the placement in dedicated pixel units, usefull for example to place a table head and body.
It may be null.
private void furtherSetPosition(int dx,
int dy)
dx - dy -
public Label addText(java.lang.String sText,
char size,
int color)
GuiPanelMngBuildIfc
addText in interface GuiPanelMngBuildIfcsText - The textsize - size, 'A' is small ...'E' is large.color - The color as RGB-value in 3 Byte. 0xffffff is white, 0xff0000 is red.
public Text addTextField(java.lang.String sName,
int width,
boolean editable,
java.lang.String prompt,
char promptStylePosition)
addTextField in interface GuiPanelMngBuildIfcsName - The register 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 void addLine(int colorValue,
float xa,
float ya,
float xe,
float ye)
CanvasStorePanel. This class stores the line coordinates and conditions
and draws it as background if drawing is invoked.
addLine in interface GuiPanelMngBuildIfccolorValue - The value for color, 0xffffff is white, 0xff0000 is red.xa - start of line relative to current position in grid units.
The start is relative to the given position! Not absolute in window!ya - start of line relative to current position in grid units.xe - end of line relative to current position in grid units.ye - end of line relative to current position in grid units.
public Button addButton(java.lang.String sButtonText,
int height,
int width,
java.lang.String sCmd,
java.lang.String sUserAction,
java.lang.String sName)
GuiPanelMngBuildIfc
addButton in interface GuiPanelMngBuildIfcsButtonText - text in the buttonheight - in grid-unitswidth - in grid-unigssCmd - The command string will be transfered to the action-methodsUserAction - The user action shoult be registered before
calling GuiPanelMngBuildIfc.registerUserAction(String, UserActionGui)
public Canvas addCurveViewY(java.lang.String sName,
int dyGrid,
int dxGrid,
int nrofXvalues,
int nrofTracks)
GuiPanelMngBuildIfc
addCurveViewY in interface GuiPanelMngBuildIfcsName - Its registered namedyGrid - height in grid-unitsdxGrid - width in grid-unitsnrofXvalues - depth of the buffer for x-values. It should be 6..20 times of dx.nrofTracks - number of curves (tracks).
public java.lang.Object addMouseButtonAction(java.lang.String sName,
java.lang.String sRegisteredUserAction,
java.lang.String sCmdPress,
java.lang.String sCmdRelease,
java.lang.String sCmdDoubleClick)
sName - registered name of the widget.sRegisteredUserAction - The registered user action.
public Table addTable(java.lang.String sName,
int height,
int[] columnWidths)
GuiPanelMngBuildIfc
addTable in interface GuiPanelMngBuildIfcsName - register name, used for GuiPanelMngWorkingIfc.insertInfo(String, int, String).height - The height in grid units for the appearancecolumnWidths - Array with width of the columns.
Each column has a fix default width per construction.
It may or may not a fix widht, it may able to change by mouse actions,
adequate to the possibilities of the used graphic base system.
public void repaint()
repaint in interface GuiPanelMngBuildIfc
public java.lang.String setFieldContent(java.lang.String name,
java.lang.String content)
throws GuiPanelMng.NotExistException
name - Name of the field, corresponding with the name-designation of the field
in the configuration.content - The new content.
GuiPanelMng.NotExistException
public java.lang.String insertInfo(java.lang.String name,
int ident,
java.lang.String content)
'\t'.
The line number is identified by the ident.
insertInfo in interface GuiPanelMngWorkingIfcname - The name of the widget, which was given by the add...()-Operationident - A identifying number. It meaning depends on the kind of widget.
0 means, insert on top. Integer.MAXVALUE means, insert after the last element (append).content - The content to insert.
public java.lang.String getFieldContent(java.lang.String name)
throws GuiPanelMng.NotExistException
name - Name of the field, corresponding with the name-designation of the field
in the configuration.
GuiPanelMng.NotExistExceptionpublic java.util.Set<java.util.Map.Entry<java.lang.String,GuiPanelMngBuildIfc.WidgetDescriptor<Control>>> getShowFields()
getShowFields in interface GuiPanelMngBuildIfcpublic GuiDispatchCallbackWorker getTheGuiChangeWorker()
getTheGuiChangeWorker in interface GuiPanelMngBuildIfc
public void setSampleCurveViewY(java.lang.String sName,
float[] values)
GuiPanelMngWorkingIfc
setSampleCurveViewY in interface GuiPanelMngWorkingIfcsName - The registered namevalues - The values.
public void setColorGridCurveViewY(java.lang.String sName,
int backgroundColor,
int[] colorLines,
char grid)
GuiPanelMngBuildIfc
setColorGridCurveViewY in interface GuiPanelMngBuildIfcsName - The registered namebackgroundColor - The color of the backgroundcolorLines - Array of color values for the lines. Any value should be given
as red-green-blue value in 24 bit. Additionally
grid - character to determine how the grid is shown. '0' no grid, 'a'..'f' weak to strong.
public void setLineCurveView(java.lang.String sNameView,
int trackNr,
java.lang.String sNameLine,
java.lang.String sVariable,
int colorValue,
int style,
int nullLine,
float yScale,
float yOffset)
GuiPanelMngBuildIfc
setLineCurveView in interface GuiPanelMngBuildIfcyScale - This value is that value, which is shown in a 10%-difference in the output window.yOffset - This value will be subtract from the input values before scale.
It is the 0-line-reference of the input values.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||