public class GralTextField extends GralWidget implements GralTextField_ifc
Modifier and Type | Class and Description |
---|---|
class |
GralTextField.GraphicImplAccess |
static class |
GralTextField.Type |
GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData, GralWidget.ImplAccess
GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen
Modifier and Type | Field and Description |
---|---|
protected int |
borderwidth
The width of an extra border arround the text field to mark it.
0: initially, no border.
|
protected int |
caretPos |
protected GralKeyListener |
gralKeyListener |
protected java.lang.String |
sPrompt
The prompt to the text field.
|
protected java.lang.String |
sPromptStylePosition
The prompt to the text field.
|
protected GralTextFieldUser_ifc |
user |
static java.lang.String |
version
Version, history and license .
|
protected GralGraphicThread |
windowMng
It is used for some operations.
|
_wdgImpl, bEditable, bHasFocus, bShouldInitialize, buildMng, bVisibleState, cfg, contextMenu, dateUser, dyda, htmlHelp, itsMng, name, repaintDelay, repaintDelayMax, sCmd, sFormat, sToolTip, sVersion, whatIs
sVersion
Constructor and Description |
---|
GralTextField(java.lang.String name,
char whatis,
GralMng mng)
Deprecated.
|
GralTextField(java.lang.String posName,
GralTextField.Type... property)
Constructs a text field with given properties
|
Modifier and Type | Method and Description |
---|---|
int |
getCursorPos() |
java.lang.String |
getPromptLabelImpl()
Returns the Label for a prompt or null if there isn't used a prompt
|
java.lang.String |
getValue()
Gets the current value of the text field thread-independent.
|
int |
setBorderWidth(int width)
Sets a new border width and returns the old one.
|
int |
setCursorPos(int pos) |
void |
setFormat(java.lang.String sFormat) |
void |
setLongValue(long valueP)
Sets a long value into a text field.
|
void |
setPrompt(java.lang.String sPrompt) |
void |
setPrompt(java.lang.String sPrompt,
java.lang.String sPromptPos) |
void |
setText(java.lang.CharSequence arg)
Set the text of the widget.
|
void |
setText(java.lang.CharSequence arg,
int caretPos)
Sets the textual content.
|
void |
setTextStyle(GralColor color,
GralFont font)
Sets the style of all new set and added texts.
|
void |
setUser(GralTextFieldUser_ifc user) |
void |
setValue(double valueP)
Sets a float value into a text field.
|
void |
setValue(float valueP)
Sets a float value into a text field.
|
void |
setValue(java.lang.Object[] value)
Sets some value to show any content.
|
chgPos, clearShowParam, createImplWidget_Gthread, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFormat, getGralWidget, getHtmlHelp, getImpl, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getVariable, getVariableFromContentInfo, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, pos, refreshFromVariable, refreshFromVariable, remove, repaint, repaint, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setFocus, setForegroundColor, setHtmlHelp, setLineColor, setMinMax, setPrimaryWidgetOfPanel, setTextColor, setToolTip, setValue, setValue, setVisible, setVisibleState, setVisibleStateWidget, specifyActionChange, specifyContextMenu, toString, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread, XXXsetVisibleGThread
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getText
createImplWidget_Gthread, getActionChange, getBackColor, getCmd, getContentIdent, getContentInfo, getData, getDataPath, getName, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, refreshFromVariable, refreshFromVariable, repaint, repaint, setBackColor, setBoundsPixel, setCmd, setContentIdent, setData, setDataPath, setEditable, setFocus, setFocus, setHtmlHelp, setLineColor, setTextColor, setToPanel, setVisible
remove
getContentInfo, setContentInfo
protected int borderwidth
GralWidget.DynamicData.lineColor
protected int caretPos
protected GralKeyListener gralKeyListener
protected java.lang.String sPrompt
protected java.lang.String sPromptStylePosition
protected GralTextFieldUser_ifc user
public static final java.lang.String version
setBorderWidth(int)
to show the text field with a border.
setLongValue(long)
is more complexly, a calculation can result in a float value. Fixed.
GralTextField.GraphicImplAccess.posPrompt
and ...posField is processed
in this class commonly for SWT and AWT implementation.
GralTextField.Type
, supports password field.
GralTextField
uses the new concept of instantiation: It is not
the super class of the implementation class. But it provides GralTextField.GraphicImplAccess
as the super class.
setText(CharSequence, int)
: supports GralWidget_ifc.isNotEditableOrShouldInitialize()
to support
edit field handling.
setText(CharSequence, int)
overwriting concept is faulty.
Because an accidentally change of text prevents setting the correct text. Check of #bTextChg
removed. The preventing of overwriting an edit field should be prevented outside as condition of
call of setText(CharSequence)
.
#bTextChg
detects whether any input is taken. GralWidget.isChanged(boolean)
returns this information
and resets #bTextChg
. setText(CharSequence, int)
only sets if the text is unchanged.
Therefore a changed text won't be over-written by an setText().
setValue(double)
and setValue(Object[])
for double values.
sFormat2
etc: Now format "int16AngleDegree" etc. are recognized
as special format. Improved calling calculator
in setValue(float)
.
#isChanged()
, setUser(GralTextFieldUser_ifc)
setValue(float)
now supports formatting view.
This algorithm was used for the InspcGui
before.
#setMouseAction(GralUserAction)
. This method should be
an abstract method of all GralWidget
but it is used yet only here.
protected final GralGraphicThread windowMng
@Deprecated public GralTextField(java.lang.String name, char whatis, GralMng mng)
public GralTextField(java.lang.String posName, GralTextField.Type... property)
posName
- Position and Name of the field. Maybe null if it is not need in management by name
See GralWidget.GralWidget(String, char)
.property
- password, editable, maybe left empty.public int getCursorPos()
getCursorPos
in interface GralTextField_ifc
public final java.lang.String getPromptLabelImpl()
public java.lang.String getValue()
GralWidget.DynamicData.displayedText
which is updated while typing the text
or if the focus is changed (depending on implementation).getValue
in class GralWidget
public int setBorderWidth(int width)
width
- 0: No border, 1... number of pixel for border.public int setCursorPos(int pos)
setCursorPos
in interface GralTextField_ifc
public void setFormat(java.lang.String sFormat)
setFormat
in class GralWidget
public void setLongValue(long valueP)
setFormat(String)
of this widget starts with '!' and contains a second '!',
the String between that is used as expression to calculate the long value
using CalculatorExpr
. Therewith any calculation can be done. The result may be a float or double.
int32AngleDegree
and int16AngleDegree
is supported, if that text is contained in the format string. The value should come from an integer,
which contains an angle value with wrap-around-presentation: 0x7fffffff (32 bit) or 0x7fff (16 bit) and
0x80000000 which is exactly 180 degree. This format helps to calculate with angle values in range
of -180...+179.99999 degree. The presentation in the text field is shown as degree angle value.
setLongValue
in interface GralSetValue_ifc
setLongValue
in class GralWidget
valueP
- This routine may be overridden by some specialized widgets.GralWidget.setValue(float)
public void setPrompt(java.lang.String sPrompt)
public void setPrompt(java.lang.String sPrompt, java.lang.String sPromptPos)
public void setText(java.lang.CharSequence arg)
GralWidget_ifc
GralWidget_ifc.setBackColor(GralColor, int)
etc.
GralWidget_ifc.repaint(int, int)
is invoked with the standard delay of #repaintDelay
and #repaintDelayMax
.
With that the widget-specific private instance of #repaintRequ
is added to the queue of requests
in the GralGraphicThread#addTimeOrder(GralGraphicTimeOrder)
. In the requested time that
dispatch order is executed in the graphic thread. It calls GralWidgImpl_ifc.repaintGthread()
.
That method is implemented in the graphic implementation layer of the widget. It sets the appropriate values
from the independent Gral attributes to the implementation specifics and invoke a redraw of the graphic layer.
GralGraphicTimeOrder
is queued. All changed attributes are stored in DynamicData#whatIsChanged
and the
GralWidgImpl_ifc.repaintGthread()
quests all changes one after another.
It means that a thread switch is invoked only one time per widget for more as one change.
DynamicData
. That composite part of a widget stores all standard dynamic data of a widget.setText
in interface GralSetValue_ifc
setText
in interface GralTextField_ifc
setText
in interface GralWidget_ifc
setText
in class GralWidget
arg
- The contentpublic void setText(java.lang.CharSequence arg, int caretPos)
GralWidget.repaint(int, int)
in 100 ms
if the content is changed in another thread than the graphical thread. It invokes a #repaintGthread()
if the content was changed in the graphical thread.
Note: If the current content is equals with the new one, a repaint request is not forced.
Therewith the cursor can be positioned inside. But if the content is changed, it is set with this given one.setText
in interface GralTextField_ifc
arg
- 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.GralTextField_ifc.setText(java.lang.CharSequence, int)
public void setTextStyle(GralColor color, GralFont font)
GralTextField_ifc
setTextStyle
in interface GralTextField_ifc
public void setUser(GralTextFieldUser_ifc user)
public void setValue(double valueP)
setFormat(String)
of this widget starts with '!' and contains a second '!',
the String between that is used as expression to calculate the float value
using CalculatorExpr
. Therewith any calculation can be done.
GralWidget.setValue(float)
public void setValue(float valueP)
setFormat(String)
of this widget starts with '!' and contains a second '!',
the String between that is used as expression to calculate the float value
using CalculatorExpr
. Therewith any calculation can be done.
setValue
in interface GralSetValue_ifc
setValue
in class GralWidget
valueP
- This routine may be overridden by some specialized widgets.GralWidget.setValue(float)
public void setValue(java.lang.Object[] value)
GralWidget
setValue
in interface GralSetValue_ifc
setValue
in class GralWidget
value
- This routine may be overridden by some specialized widgets.