public abstract class ParameterBase<T,P extends ParameterBase<T,P>> extends ParameterWrapper<T,P>
By using a generic self-reference all methods in this class return an instance of the respective subclass to better support the fluent concatenation of method calls. Different subclasses may add additional methods for their specific datatype.
Constructor and Description |
---|
ParameterBase(InteractionFragment rFragment,
org.obrel.core.RelationType<T> rParamType)
Creates a new instance for a certain fragment and parameter relation
type.
|
Modifier and Type | Method and Description |
---|---|
P |
actionEvents()
Enables action events without setting an event handler.
|
P |
alignHorizontal(de.esoco.lib.property.Alignment eAlignment)
Sets the property
LayoutProperties.HORIZONTAL_ALIGN . |
P |
alignIcon(de.esoco.lib.property.Alignment eAlignment)
Sets the property
LayoutProperties.ICON_ALIGN . |
P |
alignText(de.esoco.lib.property.Alignment eAlignment)
Sets the property
LayoutProperties.TEXT_ALIGN . |
P |
alignVertical(de.esoco.lib.property.Alignment eAlignment)
Sets the property
LayoutProperties.VERTICAL_ALIGN . |
P |
allEvents()
Enables all events without setting an event handler.
|
P |
allow(java.util.Collection<T> rValues)
Sets the allowed values for the parameter.
|
P |
allow(T... rValues)
Sets the allowed values for the parameter.
|
java.util.Collection<T> |
allowedValues()
Returns the values that this parameter is allowed to contain.
|
P |
allowNull(java.lang.String sNullValueItem)
Allows the value NULL for a parameter that has constrained values as set
with
allow(Collection) . |
<A> P |
annotate(org.obrel.core.RelationType<A> rAnnotationType,
A rValue)
Sets an annotation on the relation of this parameter.
|
P |
buttons(T... rAllowedValues)
Marks this parameter to be displayed as interactive buttons.
|
P |
buttonStyle(de.esoco.lib.property.ButtonStyle eButtonStyle)
Mark this parameter to be displayed with a certain button style.
|
boolean |
check(de.esoco.lib.expression.Predicate<? super T> pValueCondition)
Checks whether the value of this parameter fulfills a certain condition.
|
P |
colSpan(int nColumns)
Sets the UI property
LayoutProperties.COLUMN_SPAN . |
P |
columns(int nColumns)
Sets the UI property
LayoutProperties.COLUMNS . |
P |
content(de.esoco.lib.property.ContentType eContentType)
Sets the content type of this parameter.
|
P |
continueOnInteraction(boolean bContinue)
Sets whether the process should continue on an interaction with this
parameter or not.
|
P |
continuousEvents()
Enables continuous events without setting an event handler.
|
P |
couple(java.util.function.Consumer<T> fUpdateTarget,
java.util.function.Supplier<T> fQuerySource)
Couples the relation of this parameter with a certain target and/or
source.
|
P |
couple(org.obrel.core.Relatable rCoupledRelatable,
org.obrel.core.RelationType<T> rCoupledType)
Couples the relation of this parameter with another relation in a
relatable object.
|
P |
css(java.lang.String sCssProperty,
java.lang.String sValue)
Sets a CSS style property for the parameter.
|
P |
display()
Marks the wrapped relation type to be displayed as readonly in the
fragment this parameter belongs to.
|
P |
ensure(de.esoco.lib.expression.Predicate<? super T> pValueConstraint,
java.lang.String sErrorMessage)
Sets a general validation for this parameter.
|
P |
ensureNotEmpty()
Sets a not empty validation for this parameter.
|
P |
height(int nHeight)
Sets the pixel width of an element in the UI property
LayoutProperties.WIDTH . |
P |
height(de.esoco.lib.property.RelativeSize eHeight)
Sets the UI property
LayoutProperties.RELATIVE_WIDTH . |
P |
height(java.lang.String sHeight)
Sets the UI property
LayoutProperties.HTML_HEIGHT . |
P |
hideLabel()
Hides the label of this parameter.
|
P |
icon(java.lang.Object rIconIdentifier)
Sets the UI property
ContentProperties.ICON . |
P |
icon(java.lang.Object rIconIdentifier,
de.esoco.lib.property.Alignment eAlignment)
Sets both UI properties
ContentProperties.ICON and LayoutProperties.ICON_ALIGN . |
P |
icon(java.lang.Object rIconIdentifier,
de.esoco.lib.property.RelativeScale eSize)
Sets both UI properties
ContentProperties.ICON and LayoutProperties.ICON_SIZE . |
P |
iconSize(de.esoco.lib.property.RelativeScale eSize)
Sets the property
LayoutProperties.ICON_SIZE . |
P |
images()
Sets the flag property
StyleProperties.HAS_IMAGES . |
P |
inherit(de.esoco.lib.property.PropertyName<?>... rProperties)
Transfers certain properties from the parent fragment to this parameter.
|
P |
input()
Overridden to be public.
|
P |
interactive(de.esoco.lib.property.InteractiveInputMode eInputMode)
Sets the interactive input mode for this parameter.
|
P |
interactive(de.esoco.lib.property.ListStyle eListStyle)
Sets a parameter with a list of allowed values to be displayed in a
certain interactive list style.
|
boolean |
is(de.esoco.lib.property.PropertyName<java.lang.Boolean> rFlagProperty)
Checks the value of a boolean property.
|
P |
label(java.lang.String sLabel)
Sets the UI property
ContentProperties.LABEL . |
P |
layout(de.esoco.lib.property.LayoutType eLayout)
Sets the layout for the panel of a parameter.
|
P |
modified()
Marks this parameter as modified.
|
P |
notifyChangeListeners()
Notifies all listeners that have been registered to listen for parameter
updates with
onChange(EventHandler) . |
P |
onAction(ValueEventHandler<T> rEventHandler)
Sets a simple event handler for action events of this parameter.
|
P |
onChange(de.esoco.lib.event.EventHandler<org.obrel.core.RelationEvent<T>> rEventHandler)
Registers an event handler that will be notified of changes of this
parameter's relation.
|
P |
onEvent(Interaction.InteractionHandler rEventHandler)
Sets the event handler for this parameter.
|
P |
onFocusLost(ValueEventHandler<T> rEventHandler)
Sets a simple event handler for action events of this parameter.
|
P |
onUpdate(ValueEventHandler<T> rEventHandler)
Sets an event handler for update events of this parameter.
|
void |
prepareDownload(java.lang.String sFileName,
FileType eFileType,
de.esoco.lib.expression.Function<FileType,?> fDownloadGenerator)
Prepares a download that is associated with an event on this parameter.
|
P |
responsiveColSpans(int nSmall,
int nMedium)
Sets the UI properties
LayoutProperties.SMALL_COLUMN_SPAN and
LayoutProperties.MEDIUM_COLUMN_SPAN . |
P |
rows(int nRows)
Sets the UI property
LayoutProperties.ROWS . |
P |
rowSpan(int nRows)
Sets the UI property
LayoutProperties.ROW_SPAN . |
P |
sameRow()
Marks this parameter to be displayed in the same row as the previous
parameter (in grid and table layouts).
|
P |
sameRow(int nColumnSpan)
Marks this parameter to be displayed in the same row as the previous
parameter with a certain column span in a grid or table layout.
|
P |
sameRow(de.esoco.lib.property.RelativeSize eColumnWidth)
Marks this parameter to be displayed in the same row as the previous
parameter with a certain width in a grid layout.
|
P |
size(java.lang.String sWidth,
java.lang.String sHeight)
Invokes
width(String) and height(String) . |
java.lang.String |
style()
Queries the UI property
StyleProperties.STYLE . |
P |
style(java.lang.String sStyle)
Sets the UI property
StyleProperties.STYLE . |
P |
then(ParameterBase<?,?> rParameter)
Appends a parameter to the row of this one.
|
P |
tooltip(java.lang.String sTooltip)
Sets the UI property
ContentProperties.TOOLTIP . |
java.lang.String |
toString() |
P |
validate(de.esoco.lib.expression.Predicate<? super T> pValueConstraint,
java.lang.String sErrorMessage)
Validates that the value of this parameter fulfills a certain constraint.
|
P |
validate(de.esoco.lib.expression.Predicate<? super T> pValueConstraint,
java.lang.String sErrorMessage,
java.lang.Runnable rRunOnViolation)
Validates that the value of this parameter fulfills a certain constraint.
|
T |
value()
Returns the value of the wrapped parameter.
|
P |
value(T rValue)
Sets the parameter value.
|
P |
width(int nWidth)
Sets the pixel width of an element in the UI property
LayoutProperties.WIDTH . |
P |
width(de.esoco.lib.property.RelativeSize eWidth)
Sets the UI property
LayoutProperties.RELATIVE_WIDTH . |
P |
width(java.lang.String sWidth)
Sets the UI property
LayoutProperties.HTML_WIDTH . |
clear, disable, enable, fragment, get, getParam, has, hide, id, initiateDownload, isEnabled, isVisible, remove, resid, set, set, set, setEnabled, setFragment, setParam, setParameterEventHandler, setParameterType, setVisible, show, type
deleteRelation, get, getRelation, getRelations, notifyRelationListeners, readRelations, relationsEqual, relationsHashCode, relationsString, set, set, transform, writeRelations
public ParameterBase(InteractionFragment rFragment, org.obrel.core.RelationType<T> rParamType)
If a subclass cannot provide the fragment or the relation type at
creation time it may use NULL when invoking the super constructor. These
values must then be set as soon as possible by invoking the respective
setter method(s) (see ParameterWrapper.setFragment(InteractionFragment)
and
ParameterWrapper.setParameterType(RelationType)
). This must happen before any
other method on this instance is called or else a null pointer exception
will occur. Typically this should only be used in the constructor of a
subclass, e.g. to include some kind of self-reference (which is not
possible while invoking the super constructor).
rFragment
- The fragment to handle the parameter forrParamType
- The parameter relation type to handlepublic final P actionEvents()
InteractionFragment.handleInteraction(RelationType)
.public final P alignHorizontal(de.esoco.lib.property.Alignment eAlignment)
LayoutProperties.HORIZONTAL_ALIGN
.eAlignment
- The alignmentpublic final P alignIcon(de.esoco.lib.property.Alignment eAlignment)
LayoutProperties.ICON_ALIGN
.eAlignment
- The alignment of the iconpublic final P alignText(de.esoco.lib.property.Alignment eAlignment)
LayoutProperties.TEXT_ALIGN
.eAlignment
- The alignmentpublic final P alignVertical(de.esoco.lib.property.Alignment eAlignment)
LayoutProperties.VERTICAL_ALIGN
.eAlignment
- The alignmentpublic final P allEvents()
InteractionFragment.handleInteraction(RelationType)
.public final P allow(java.util.Collection<T> rValues)
public java.util.Collection<T> allowedValues()
public final P allowNull(java.lang.String sNullValueItem)
allow(Collection)
. If a NULL value item string is set it
will be displayed as an additional selectable value along with the
allowed values. This sets the ContentProperties.NULL_VALUE
.sNullValueItem
- The descriptive string for the NULL value itempublic final <A> P annotate(org.obrel.core.RelationType<A> rAnnotationType, A rValue)
NullPointerException
will occur.rAnnotationType
- The relation type of the annotationrValue
- The annotation value@SafeVarargs public final P buttons(T... rAllowedValues)
ListStyle.IMMEDIATE
, it will have the flag
StyleProperties.HIDE_LABEL
set, and the property LayoutProperties.COLUMNS
will be set to the number of allowed
values. This will also add this parameter as an input parameter to the
fragment.rAllowedValues
- Optionally the allowed values for this parameter
(NULL or empty for the default)public final P buttonStyle(de.esoco.lib.property.ButtonStyle eButtonStyle)
eButtonStyle
- The button stylebuttons(Object...)
public boolean check(de.esoco.lib.expression.Predicate<? super T> pValueCondition)
pValueCondition
- The predicate that checks the conditionpublic final P colSpan(int nColumns)
LayoutProperties.COLUMN_SPAN
.nColumns
- the number of columns to span.public final P columns(int nColumns)
LayoutProperties.COLUMNS
.nColumns
- the number of columns.public final P content(de.esoco.lib.property.ContentType eContentType)
eContentType
- The content typepublic final P continueOnInteraction(boolean bContinue)
bContinue
- TRUE to continue process execution, FALSE to stay in
the current step and wait for further interactionspublic final P continuousEvents()
InteractionFragment.handleInteraction(RelationType)
.public P couple(java.util.function.Consumer<T> fUpdateTarget, java.util.function.Supplier<T> fQuerySource)
RelationCoupling.couple(org.obrel.core.Relatable, RelationType,
Consumer, Supplier)
public P couple(org.obrel.core.Relatable rCoupledRelatable, org.obrel.core.RelationType<T> rCoupledType)
rCoupledRelatable
- The coupled relatablerCoupledType
- The relation type to couple this parameter withpublic final P css(java.lang.String sCssProperty, java.lang.String sValue)
sCssProperty
- The name of the CSS propertysValue
- The value of the CSS property or NULL to clearpublic P display()
public P ensure(de.esoco.lib.expression.Predicate<? super T> pValueConstraint, java.lang.String sErrorMessage)
pValueConstraint
- The constraint that must be validsErrorMessage
- The error message to be displayed for the
parameter in the case of a constraint violationpublic P ensureNotEmpty()
public final P height(int nHeight)
LayoutProperties.WIDTH
.nHeight
- nWidth The widthpublic final P height(de.esoco.lib.property.RelativeSize eHeight)
LayoutProperties.RELATIVE_WIDTH
.eHeight
- sWidth The relative width constantpublic final P height(java.lang.String sHeight)
LayoutProperties.HTML_HEIGHT
.sHeight
- The HTML height stringpublic final P hideLabel()
public final P icon(java.lang.Object rIconIdentifier)
ContentProperties.ICON
.rIconIdentifier
- An identifier that describes the icon to display;
will be converted to a string and should
typically either be a string of an enum constantpublic final P icon(java.lang.Object rIconIdentifier, de.esoco.lib.property.RelativeScale eSize)
ContentProperties.ICON
and LayoutProperties.ICON_SIZE
.rIconIdentifier
- The icon identifier (icon(Object)
)eSize
- The relative size of the iconpublic final P icon(java.lang.Object rIconIdentifier, de.esoco.lib.property.Alignment eAlignment)
ContentProperties.ICON
and LayoutProperties.ICON_ALIGN
. Not all types of Alignment
may be
supported in an UI implementation.rIconIdentifier
- The icon identifier (icon(Object)
)eAlignment
- The position alignment of the iconpublic final P iconSize(de.esoco.lib.property.RelativeScale eSize)
LayoutProperties.ICON_SIZE
.eSize
- The relative size of the iconpublic final P images()
StyleProperties.HAS_IMAGES
.public final P inherit(de.esoco.lib.property.PropertyName<?>... rProperties)
rProperties
- The properties to transferpublic P input()
ParameterWrapper.input()
public final P interactive(de.esoco.lib.property.InteractiveInputMode eInputMode)
eInputMode
- The interactive input modepublic final P interactive(de.esoco.lib.property.ListStyle eListStyle)
eListStyle
- The style in which to display the allowed valuespublic final boolean is(de.esoco.lib.property.PropertyName<java.lang.Boolean> rFlagProperty)
ParameterWrapper.get(PropertyName)
public final P label(java.lang.String sLabel)
ContentProperties.LABEL
.sLabel
- sWidth The label stringpublic P layout(de.esoco.lib.property.LayoutType eLayout)
DataElementList
or buttons).eLayout
- The panel layoutpublic final P modified()
public final P notifyChangeListeners()
onChange(EventHandler)
.public final P onAction(ValueEventHandler<T> rEventHandler)
rEventHandler
- The event handler to be invoked on an eventpublic final P onChange(de.esoco.lib.event.EventHandler<org.obrel.core.RelationEvent<T>> rEventHandler)
rEventHandler
- The event handler to registerRelation.addUpdateListener(EventHandler)
public final P onEvent(Interaction.InteractionHandler rEventHandler)
rEventHandler
- The event handler to registerinteractive(InteractiveInputMode)
,
interactive(ListStyle)
,
continuousEvents()
,
actionEvents()
,
allEvents()
public final P onFocusLost(ValueEventHandler<T> rEventHandler)
rEventHandler
- The event handler to be invoked on an eventpublic final P onUpdate(ValueEventHandler<T> rEventHandler)
rEventHandler
- The event handler to be invoked on an eventpublic void prepareDownload(java.lang.String sFileName, FileType eFileType, de.esoco.lib.expression.Function<FileType,?> fDownloadGenerator)
sFileName
- The file name of the downloadeFileType
- The file type of the downloadfDownloadGenerator
- The function that generates the download datajava.lang.Exception
- If the download preparation failspublic final P responsiveColSpans(int nSmall, int nMedium)
LayoutProperties.SMALL_COLUMN_SPAN
and
LayoutProperties.MEDIUM_COLUMN_SPAN
.nSmall
- the number of columns to span in small-size layoutsnMedium
- the number of columns to span in medium-size layoutspublic final P rows(int nRows)
LayoutProperties.ROWS
.nRows
- the number of rows.public final P rowSpan(int nRows)
LayoutProperties.ROW_SPAN
.nRows
- the number of rows to span.public final P sameRow()
public final P sameRow(int nColumnSpan)
nColumnSpan
- The number of columns that the parameter UI should
spanpublic final P sameRow(de.esoco.lib.property.RelativeSize eColumnWidth)
eColumnWidth
- The relative width of the parameter UI in a grid
layoutpublic final P size(java.lang.String sWidth, java.lang.String sHeight)
width(String)
and height(String)
.sWidth
- The HTML width stringsHeight
- The HTML height stringpublic final java.lang.String style()
StyleProperties.STYLE
.public final P style(java.lang.String sStyle)
StyleProperties.STYLE
.sStyle
- The style name(s)public P then(ParameterBase<?,?> rParameter)
sameRow()
on the argument parameter.rParameter
- The parameter to add to the current rowpublic final P tooltip(java.lang.String sTooltip)
ContentProperties.TOOLTIP
.sTooltip
- sWidth The tooltip stringpublic java.lang.String toString()
toString
in class org.obrel.core.RelatedObject
public P validate(de.esoco.lib.expression.Predicate<? super T> pValueConstraint, java.lang.String sErrorMessage) throws InvalidParametersException
pValueConstraint
- The constraint to be validatedsErrorMessage
- The error message to be displayed for the
parameter in the case of a constraint violationInvalidParametersException
- If the constraint is violatedpublic P validate(de.esoco.lib.expression.Predicate<? super T> pValueConstraint, java.lang.String sErrorMessage, java.lang.Runnable rRunOnViolation) throws InvalidParametersException
pValueConstraint
- The constraint to be validatedsErrorMessage
- The error message to be displayed for the
parameter in the case of a constraint violationrRunOnViolation
- A runnable to be executed if the constraint is
violatedInvalidParametersException
- If the constraint is violatedpublic final T value()
public final P width(java.lang.String sWidth)
LayoutProperties.HTML_WIDTH
.sWidth
- The HTML width stringpublic final P width(de.esoco.lib.property.RelativeSize eWidth)
LayoutProperties.RELATIVE_WIDTH
.eWidth
- The relative width constantpublic final P width(int nWidth)
LayoutProperties.WIDTH
.nWidth
- The width