public class HeaderElement extends FrameElement
Typically, this element is part of a larger array of other instance of this same class. The
expression is only used for in the get()
and the set(com.goldencode.p2j.util.BaseDataType)
is unsupported since
this is a one-way transfer to the client.
Modifier and Type | Field and Description |
---|---|
private java.lang.Object[] |
args
Arguments to be passed to the non-capturing lambda form.
|
private BaseDataType |
cached
For literals and simple variables, we can avoid inner classes and lambdas.
|
private java.lang.String |
fmt
The value's associated format string or
null . |
private java.util.function.Function<java.lang.Object[],BaseDataType> |
func
Non-capturing form of complex expression.
|
private Resolvable |
resolver
For resolvables, we don't use a lambda but cache the instance and access it directly.
|
private java.util.function.Supplier<BaseDataType> |
source
The (possibly capturing) expression to be executed at
get() time. |
private GenericWidget |
widget
The widget associated with this element.
|
Constructor and Description |
---|
HeaderElement(BaseDataType val,
GenericWidget widget)
Create an instance.
|
HeaderElement(BaseDataType val,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(boolean source,
GenericWidget widget)
Create an instance.
|
HeaderElement(boolean source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(double source,
GenericWidget widget)
Create an instance.
|
HeaderElement(double source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(java.util.function.Function<java.lang.Object[],BaseDataType> func,
GenericWidget widget,
java.lang.Object... args)
Create an instance.
|
HeaderElement(java.util.function.Function<java.lang.Object[],BaseDataType> func,
java.lang.String fmt,
GenericWidget widget,
java.lang.Object... args)
Create an instance.
|
HeaderElement(int source,
GenericWidget widget)
Create an instance.
|
HeaderElement(int source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(Resolvable source,
GenericWidget widget)
Create an instance.
|
HeaderElement(Resolvable source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(java.lang.String source,
GenericWidget widget)
Create an instance.
|
HeaderElement(java.lang.String source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
HeaderElement(java.util.function.Supplier<BaseDataType> source,
GenericWidget widget)
Create an instance.
|
HeaderElement(java.util.function.Supplier<BaseDataType> source,
java.lang.String fmt,
GenericWidget widget)
Create an instance.
|
Modifier and Type | Method and Description |
---|---|
BaseDataType |
get()
Get a copy of the referenced object's current runtime value.
|
java.lang.String |
getFormat()
Accesses the format string associated with this frame element.
|
FormattedValue |
getFormattedValue()
Accesses the formatted value associated with this frame element.
|
GenericWidget |
getWidget()
Accesses the widget associated with this frame element.
|
boolean |
hasFormat()
Determines if the element stores a format string in addition to a data
value.
|
void |
set(BaseDataType val)
Set the referenced object's current runtime value to the given value.
|
assignOnly, bypass, getAccumulator, statsColumn, widgetOnly, wordWrap
private BaseDataType cached
private Resolvable resolver
private java.util.function.Supplier<BaseDataType> source
get()
time.private java.util.function.Function<java.lang.Object[],BaseDataType> func
private java.lang.Object[] args
private GenericWidget widget
private java.lang.String fmt
null
.public HeaderElement(int source, java.lang.String fmt, GenericWidget widget)
source
- The data used for the header.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(int source, GenericWidget widget)
source
- The data used for the header.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(double source, java.lang.String fmt, GenericWidget widget)
source
- The data used for the header.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(double source, GenericWidget widget)
source
- The data used for the header.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(boolean source, java.lang.String fmt, GenericWidget widget)
source
- The data used for the header.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(boolean source, GenericWidget widget)
source
- The data used for the header.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(java.lang.String source, java.lang.String fmt, GenericWidget widget)
source
- The data used for the header.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(java.lang.String source, GenericWidget widget)
source
- The data used for the header.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(BaseDataType val, java.lang.String fmt, GenericWidget widget)
val
- The variable to be de-referenced for its value as header data.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(BaseDataType val, GenericWidget widget)
val
- The variable to be de-referenced for its value as header data.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(Resolvable source, java.lang.String fmt, GenericWidget widget)
source
- The expression to be evaluated for its value as header data.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(Resolvable source, GenericWidget widget)
source
- The expression to be evaluated for its value as header data.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(java.util.function.Supplier<BaseDataType> source, java.lang.String fmt, GenericWidget widget)
source
- The expression to be evaluated for its value as header data.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(java.util.function.Supplier<BaseDataType> source, GenericWidget widget)
source
- The expression to be evaluated for its value as header data.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.public HeaderElement(java.util.function.Function<java.lang.Object[],BaseDataType> func, java.lang.String fmt, GenericWidget widget, java.lang.Object... args)
func
- The expression to be evaluated for its value as header data.fmt
- The format string to associate with the data value. May be
null
.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.args
- The arguments to be passed to the function when it is executed.public HeaderElement(java.util.function.Function<java.lang.Object[],BaseDataType> func, GenericWidget widget, java.lang.Object... args)
func
- The expression to be evaluated for its value as header data.widget
- The widget instance representing the exact frame field and state of that field.
Must NOT be null
.args
- The arguments to be passed to the function when it is executed.public boolean hasFormat()
hasFormat
in class FrameElement
true
if there is a format string encoded in this
instance, false
if the format string is
null
.public FormattedValue getFormattedValue()
getFormattedValue
in class FrameElement
public java.lang.String getFormat()
getFormat
in class FrameElement
public GenericWidget getWidget()
getWidget
in class FrameElement
public BaseDataType get()
public void set(BaseDataType val)
val
- The current value to be assigned into the referenced object.
This value will be ignored for embedded assignments and can
be passed as null
.