Interface StateTextDefinition
-
public interface StateTextDefinition
Definition of D2000 state text object. Process of obtaining human readable representation of an object's value with the state text instance follows these rules:-
If object's
UnivalValue.isValid()
is false then visual representation is defined:- text representation by value from
SystemTexts.getStatus()
for keyStatus.Valid
- foreground color by
getForegroundColor()
- background color by
getBackgroundColor()
- text representation by value from
-
Otherwise if
isLimitsDefinition()
is true thenLimitStatus.getStateTextIndex()
of object'sUnivalCommon.getLimitStatus()
is used for indexing intogetStateTextItems()
. -
Otherwise if
getUnivalType()
reffers to enumerable type then object'sUnivalEnum.getOrdinalValue()
is used for indexing intogetStateTextItems()
.Whether
getUnivalType()
reffers to enumerable type is decided by callingUnivalType.getBaseType()
) andClass.isEnum()
. -
Otherwise the following should be used to obtain index into
getStateTextItems()
.int index = Math.floor((object.getValueAsDouble(true) - stateText.getBaseValue()) / stateText.getStepValue()); if (index < 0) index = 0; else if (index >= stateText.getStateTextItems().size() - 2) index = stateText.getStateTextItems().size() - 1; else index += 1;
-
The state text item that is at indexed position defines
- text representation by
StateTextItem.getText()
- foreground color by
StateTextItem.getForegroundColor()
- background color by
StateTextItem.getBackgroundColor()
- text representation by
- If foreground or background color is not defined at state text item level then color from the state text instance level is used. If it is not defined either then default colors of the GUI component is used.
-
If object's
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<sk.ipesoft.d2000.base.UnivalType>
supportedUnivalTypes
Set of unival types that are supported by state texts.static int
undefinedColor
Constant used to indicate that no color has been defined.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Integer
getBackgroundColor()
Get default background color of the state text.double
getBaseValue()
Get base value of the state text definition.java.lang.String
getDescription()
Get human readable description of the state text object.java.lang.Integer
getForegroundColor()
Get default foreground color of the state text.int
getHobj()
Get HOBJ of state text object.java.lang.String
getName()
Get unique name of the state text object.java.util.List<StateTextItem>
getStateTextItems()
Get definitions of individual steps of state text object.double
getStepValue()
Get size of one step between two values distinguished by different text representation.sk.ipesoft.d2000.base.UnivalType
getUnivalType()
Get type of Unival value that is to be translated.boolean
isLimitsDefinition()
Gettrue
if the state text defines value for limits of an object rather than its values.
-
-
-
Field Detail
-
supportedUnivalTypes
static final java.util.Set<sk.ipesoft.d2000.base.UnivalType> supportedUnivalTypes
Set of unival types that are supported by state texts.
-
undefinedColor
static final int undefinedColor
Constant used to indicate that no color has been defined.- See Also:
- Constant Field Values
-
-
Method Detail
-
getBackgroundColor
java.lang.Integer getBackgroundColor()
Get default background color of the state text. Value is composed of read, green and blue in the following order: 0xBBGGRR- Returns:
- default background color as 0xBBGGRR
-
getBaseValue
double getBaseValue()
Get base value of the state text definition.- Returns:
- base value
-
getDescription
java.lang.String getDescription()
Get human readable description of the state text object.- Returns:
- human readable text
-
getForegroundColor
java.lang.Integer getForegroundColor()
Get default foreground color of the state text. Value is composed of read, green and blue in the following order: 0xBBGGRR- Returns:
- default background color as 0xBBGGRR
-
getHobj
int getHobj()
Get HOBJ of state text object.- Returns:
- HOBJ
-
getName
java.lang.String getName()
Get unique name of the state text object.- Returns:
- name of the object
-
getStateTextItems
java.util.List<StateTextItem> getStateTextItems()
Get definitions of individual steps of state text object.- Returns:
- definitions of individual steps
-
getStepValue
double getStepValue()
Get size of one step between two values distinguished by different text representation.- Returns:
- size of one step
-
getUnivalType
sk.ipesoft.d2000.base.UnivalType getUnivalType()
Get type of Unival value that is to be translated. This value is not considered whenisLimitsDefinition()
istrue
. Otherwise it is important only to decide whether the values are of enum type or not.- Returns:
- type of unival value that is to be translated
-
isLimitsDefinition
boolean isLimitsDefinition()
Gettrue
if the state text defines value for limits of an object rather than its values.- Returns:
true
if the state text defines value for limits of an object
-
-