public final class GralInfoBox extends java.lang.Object implements GralTextBox_ifc, GralWindow_setifc, GralWindow_getifc
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
(package private) GralUserAction |
actionClear |
private GralUserAction |
actionOk |
(package private) GralUserAction |
actionOkButton |
private GralButton |
buttonLock |
private GralWidget |
buttonOk |
private GralHtmlBox |
htmlBox |
protected GralTextField |
infoLine |
private GralTextBox |
textBox
The widget which holds the text in the
window . |
static int |
version
Version, history and license.
|
private GralWindow |
window
The window is created invoking the
GralMngBuild_ifc#createWindow(String, boolean) . |
sVersion
Constructor and Description |
---|
GralInfoBox(GralWindow window,
GralHtmlBox htmlBox,
GralTextField infoLine,
GralWidget buttonOk) |
GralInfoBox(GralWindow window,
GralTextBox textBox,
GralTextField infoLine,
GralWidget buttonOk) |
Modifier and Type | Method and Description |
---|---|
void |
activate() |
java.lang.Appendable |
append(char arg0) |
java.lang.Appendable |
append(java.lang.CharSequence text) |
java.lang.Appendable |
append(java.lang.CharSequence arg0,
int arg1,
int arg2) |
void |
closeWindow() |
static GralInfoBox |
createHtmlInfoBox(java.lang.String posString,
java.lang.String name,
java.lang.String title,
boolean onTop)
Creates a sub window for showing html content.
|
void |
createImplWidget_Gthread()
Sets this widget to the current panel at the current given position.
|
static GralInfoBox |
createTextInfoBox(GralMngBuild_ifc mng,
java.lang.String name,
java.lang.String title) |
GralWidget_ifc.ActionChange |
getActionChange(GralWidget_ifc.ActionChangeWhen when) |
GralColor |
getBackColor(int ix)
Gets the background color for the widget.
|
java.lang.String |
getCmd()
Any widget can have a command String, which can be quest for example in an action.
|
long |
getContentIdent()
Gets the content identification of the users data which are set with
GralWidget_ifc.setContentIdent(long) . |
java.lang.Object |
getContentInfo() |
int |
getCursorPos() |
java.lang.Object |
getData()
Gets the application specific info.
|
java.lang.String |
getDataPath() |
java.lang.String |
getName() |
int |
getNrofLines() |
GralRectangle |
getPixelPositionSize() |
java.lang.String |
getText()
Returns the text of this field.
|
GralMng |
gralMng()
Returns the associated singleton GralMng.
|
boolean |
isChanged(boolean setUnchanged)
Returns true if the content is changed from a user action on GUI.
|
boolean |
isEditable()
Query whether the table line is able to edit: Return from the whole table.
|
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.
|
boolean |
isWindowsVisible() |
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 timeAtleast,
GralColor colorRefreshed,
GralColor colorOld) |
boolean |
remove()
Removes all referenced data, close all opened resources, removes all graphical widgets etc.
|
void |
repaint()
repaint request.
|
void |
repaint(int delay,
int latest)
Possible delayed repaint, can be called in any thread.
|
void |
setActionOk(GralUserAction action) |
void |
setBackColor(GralColor color,
int ix)
Sets the background color for the widget.
|
GralColor |
setBackgroundColor(GralColor color) |
void |
setBoundsPixel(int x,
int y,
int dx,
int dy) |
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.
|
int |
setCursorPos(int pos) |
void |
setData(java.lang.Object data)
Sets a application specific data.
|
void |
setDataPath(java.lang.String sDataPath)
Sets the data path.
|
void |
setEditable(boolean editable)
Sets whether it is able to edit the content of the text field or text box.
|
void |
setFocus()
Sets the focus to the widget. .
|
void |
setFocus(int delay,
int latest)
Sets the focus to the widget. .
|
GralColor |
setForegroundColor(GralColor color) |
void |
setFullScreen(boolean full) |
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 |
setText(java.lang.CharSequence text)
Set the textual content of the widget.
|
void |
setText(java.lang.CharSequence text,
int caretPos)
Sets the textual content and show it with the given caret position.
|
void |
setTextColor(GralColor color)
Sets the text color for the widget.
|
void |
setTextStyle(GralColor color,
GralFont font)
Sets the style of all new set and added texts.
|
void |
setToPanel(GralMngBuild_ifc mng)
Deprecated.
|
void |
setUrl(java.lang.String url) |
boolean |
setVisible(boolean visible)
Sets this widget visible on graphic or invisible.
|
void |
setWindowVisible(boolean visible)
Controls whether the whole window, which contains this panel, should be visible or not.
|
void |
viewTrail()
Sets the view to the trail of the text.
|
public static final int version
#createHtmlInfoBox(GralMngBuild_ifc, String, String, boolean)
with Parameter onTop: Especially a help window should able to stay on top.
private final GralWindow window
GralMngBuild_ifc#createWindow(String, boolean)
.
It has its implementation in the underlying graphic system.private final GralTextBox textBox
window
.private final GralHtmlBox htmlBox
private final GralWidget buttonOk
private GralButton buttonLock
protected final GralTextField infoLine
private GralUserAction actionOk
GralUserAction actionOkButton
GralUserAction actionClear
public GralInfoBox(GralWindow window, GralTextBox textBox, GralTextField infoLine, GralWidget buttonOk)
public GralInfoBox(GralWindow window, GralHtmlBox htmlBox, GralTextField infoLine, GralWidget buttonOk)
public static GralInfoBox createTextInfoBox(GralMngBuild_ifc mng, java.lang.String name, java.lang.String title)
public void setToPanel(GralMngBuild_ifc mng)
GralWidget_ifc
GralWidget_ifc.createImplWidget_Gthread()
.setToPanel
in interface GralWidget_ifc
mng
- not used. It is known as singleton. Use null as argument.public void createImplWidget_Gthread()
GralWidget_ifc
GralMng.createImplWidget_Gthread(GralWidget)
which tests the type of the derived GralWidget
to create the correct graphical widget. That method calls the implementing specific GralMng.ImplAccess#createImplWidget_Gthread(GralWidget)
which knows the implementation graphic.
ImplAccess
. With them the GralWidget
is references because it is the environment class. The core graphical widget is an aggregation in this instance. It is possible
that more as one implementation widget is used for a Gral Widget implementation. For example a text field with a prompt
consists of two implementation widgets, the text field and a label for the prompt.
GralWidget#initPosAndRegisterWidget(GralPos)
which is called either
on construction of a widget with a String-given position, before it appears on graphic, or on construction of the
graphic widget. It calls the package private GralWidget#initPosAndRegisterWidget(GralPos)
, which takes the
given position, stores it in the GralWidget.pos()
and adds the widget both to its panel which is given
with the pos and registers the widget in the GralMng for simple global access.
If the name of the widget starts with "@" its name in the panel is the part after "@" whereby the global name
is the "panelname.widgetname". If a widget's position is given from left and from right or with percent, it is resized
on resizing the window and the panel.
createImplWidget_Gthread
in interface GralWidget_ifc
public static GralInfoBox createHtmlInfoBox(java.lang.String posString, java.lang.String name, java.lang.String title, boolean onTop)
posString
- name
- title
- onTop
- public void setActionOk(GralUserAction action)
public void activate()
public java.lang.String getName()
getName
in interface GralWidget_ifc
public void setCmd(java.lang.String cmd)
GralWidget_ifc
GralWidget_ifc.getCmd()
independent of its name which can be set on runtime with this method.setCmd
in interface GralWidget_ifc
public java.lang.String getCmd()
GralWidget_ifc
GralWidget_ifc.setCmd(String)
.getCmd
in interface GralWidget_ifc
public java.lang.String getDataPath()
getDataPath
in interface GralWidget_ifc
public GralWidget_ifc.ActionChange getActionChange(GralWidget_ifc.ActionChangeWhen when)
getActionChange
in interface GralWidget_ifc
public void setTextStyle(GralColor color, GralFont font)
GralTextField_ifc
setTextStyle
in interface GralTextField_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 java.lang.Appendable append(java.lang.CharSequence text) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public int getNrofLines()
getNrofLines
in interface GralTextBox_ifc
public void setText(java.lang.CharSequence text)
GralTextField_ifc
setText
in interface GralTextField_ifc
setText
in interface GralWidget_ifc
text
- The contentpublic void setText(java.lang.CharSequence text, int caretPos)
GralTextField_ifc
GralTextField_ifc.setText(CharSequence)
if caretPos = 0.setText
in interface GralTextField_ifc
text
- The text to show in the widget.caretPos
- 0 for left, -1 for right, 0 to Integer.MAXINT for a given position.
If the caret position is greater then the number of chars, it is set right.
That character which is left from the caret position is shown guaranteed in the text field.
Especially -1 can be given to show the text right-aligned.public int setCursorPos(int pos)
setCursorPos
in interface GralTextField_ifc
public void setUrl(java.lang.String url)
public boolean isEditable()
isEditable
in interface GralWidget_ifc
GralWidget_ifc.isEditable()
public boolean isNotEditableOrShouldInitialize()
GralWidget_ifc
isNotEditableOrShouldInitialize
in interface GralWidget_ifc
public boolean isGraphicDisposed()
GralWidget_ifc
isGraphicDisposed
in interface GralWidget_ifc
public boolean isChanged(boolean setUnchanged)
GralWidget_ifc
isChanged
in interface GralWidget_ifc
setUnchanged
- If true then set to unchanged with this call.public java.lang.String getText()
GralTextField_ifc
getText
in interface GralTextField_ifc
public boolean isVisible()
GralWidget_ifc
isVisible
in interface GralWidget_ifc
public int getCursorPos()
getCursorPos
in interface GralTextField_ifc
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 repaint()
GralWidget_ifc
GralWidget_ifc.repaint(int, int)
repaint
in interface GralWidget_ifc
public void repaint(int delay, int latest)
GralWidget_ifc
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.public void viewTrail()
GralTextBox_ifc
viewTrail
in interface GralTextBox_ifc
public GralColor setBackgroundColor(GralColor color)
setBackgroundColor
in interface GralWidget_ifc
public void setFocus()
GralWidget_ifc
setFocus
in interface GralWidget_ifc
public void setFocus(int delay, int latest)
GralWidget_ifc
setFocus
in interface GralWidget_ifc
public boolean isInFocus()
GralWidget_ifc
isInFocus
in interface GralWidget_ifc
public void setFullScreen(boolean full)
setFullScreen
in interface GralWindow_setifc
public GralColor setForegroundColor(GralColor color)
setForegroundColor
in interface GralWidget_ifc
public boolean isWindowsVisible()
isWindowsVisible
in interface GralWindow_getifc
public void setWindowVisible(boolean visible)
GralWindow_setifc
setWindowVisible
in interface GralWindow_setifc
public java.lang.Appendable append(char arg0) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public java.lang.Appendable append(java.lang.CharSequence arg0, int arg1, int arg2) throws java.io.IOException
append
in interface java.lang.Appendable
java.io.IOException
public void setBoundsPixel(int x, int y, int dx, int dy)
setBoundsPixel
in interface GralWidget_ifc
public GralRectangle getPixelPositionSize()
getPixelPositionSize
in interface GralWindow_getifc
public void closeWindow()
closeWindow
in interface GralWindow_setifc
public boolean remove()
org.vishia.util.Removeable
remove
in interface Removeable
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 boolean setVisible(boolean visible)
GralWidget_ifc
GralWindow
, its the visibility of the whole window.
Note that a window which is invisible is not shown in the task bar of the operation system.
Note that an application can have more as one window.
Note that a dialog window can be set to invisible if it is not need yet instead destroy and build newly.setVisible
in interface GralWidget_ifc
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 GralWidget.variable
or GralWidget.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 timeAtleast, GralColor colorRefreshed, GralColor colorOld)
refreshFromVariable
in interface GralWidget_ifc
public void setDataPath(java.lang.String sDataPath)
GralWidget_ifc
GralWidget_ifc.refreshFromVariable(VariableContainer_ifc)
.setDataPath
in interface GralWidget_ifc
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 java.lang.Object getContentInfo()
getContentInfo
in interface GralWidget_ifc
public GralMng gralMng()
GralWidget_ifc
GralWidget_ifc.setToPanel(GralMngBuild_ifc)
.gralMng
in interface GralWidget_ifc
public void setData(java.lang.Object data)
GralWidget_ifc
setData
in interface GralWidget_ifc
public java.lang.Object getData()
GralWidget_ifc
#setContentInfo(Object)
.getData
in interface GralWidget_ifc