public class TLcyDataPropertyValueCustomizerPanelFactories extends Object
ILcyCustomizerPanelFactory
that can be used to
create customizer panels for instances of TLcdDataPropertyValueContext
.
These customizer panels are used for instance, to edit the values of data properties in a Table view.
There are some generally applicable methods that can handle a wide variety of common cases:
canCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
: this method can be used to check if a default
customizer panel factory can be created for a certain TLcdDataProperty
.
createCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty, com.luciad.util.ILcdFilter<com.luciad.view.TLcdDataPropertyValueContext>)
: if canCreateCustomizerPanelFactory
returns
true, calling this method with the same TLcdDataProperty
creates a customizer panel
factory that will be able to create customizer panels for the value of that property. The filter
you pass will control which instances of TLcdDataPropertyValueContext
are supported.
TLcyDataPropertyValueCustomizerPanelFactories factories = new TLcyDataPropertyValueCustomizerPanelFactories( aLucyEnv );
if ( factories.canCreateCustomizerPanelFactory( STRING_PROPERTY ) ) {
ILcdFilter<TLcdDataPropertyValueContext> filter =
TLcyDataPropertyValueFilters.createFilter( DATA_TYPE, STRING_PROPERTY);
ILcyCustomizerPanelFactory customizerPanelFactory =
factories.createCustomizerPanelFactory(filter, STRING_PROPERTY);
//do something with the factory, for instance:
aLucyEnv.addService( customizerPanelFactory ):
}
For more specific behaviour, some other methods are available:
createTextFieldCustomizerPanelFactory(com.luciad.util.ILcdFilter, java.text.Format)
:
with customizers created using a factory returned by this method, you can edit any object
using a text field, as long as you can provide a Format
that can format it and
parse it from a String
. Using a format is also a great way to do input validation.
If the format is not able to parse an input string, the text field will turn red indicating
that the input string is invalid, and making sure it can't be applied.
createTextFieldCustomizerPanelFactory(com.luciad.util.ILcdFilter, int, int, boolean)
:
customizers created using a factory returned by this method have some build in input
validation. Only strings that have a length within a specific range are accepted as valid values.
createComboBoxCustomizerPanelFactory(com.luciad.util.ILcdFilter, java.util.Set)
: with
customizers created using a factory returned by this method you can choose values for a
property from a limited set of possibilities. Note that the type of the property does not have
to be an enumeration
.
createCheckBoxCustomizerPanelFactory(com.luciad.util.ILcdFilter)
: a factory
returned by this method can create customizers that use a check box to edit boolean values.
Constructor and Description |
---|
TLcyDataPropertyValueCustomizerPanelFactories(ILcyLucyEnv aLucyEnv)
Creates a new instance of
TLcyDataPropertyValueCustomizerPanelFactories for the specified
Lucy environment. |
Modifier and Type | Method and Description |
---|---|
boolean |
canCreateCustomizerPanelFactory(TLcdDataProperty aDataProperty)
Returns true if you can create a customizer factory for the passed data property using
createCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty, com.luciad.util.ILcdFilter<com.luciad.view.TLcdDataPropertyValueContext>) . |
ILcyCustomizerPanelFactory |
createCheckBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
Creates a
ILcyCustomizerPanelFactory that creates a check box customizer for
instances of TLcdDataPropertyValueContext that contain boolean values. |
ILcyCustomizerPanelFactory |
createComboBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter,
Set<?> aPossibleValues)
Creates a
ILcyCustomizerPanelFactory that creates a combobox
customizer using the passed set of values. |
ILcyCustomizerPanelFactory |
createCustomizerPanelFactory(TLcdDataProperty aDataProperty,
ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
This method creates a customizer factory implementation for the passed
TLcdDataProperty . |
ILcyCustomizerPanelFactory |
createGeneralCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
Returns a factory that can create data property value customizers if the following conditions apply:
The object to create a customizer for is an instance of
TLcdDataPropertyValueContext . |
ILcyCustomizerPanelFactory |
createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter,
Format aFormat)
Creates a
ILcyCustomizerPanelFactory that creates a text field customizer that can
edit instances of TLcdDataPropertyValueContext if the passed format can convert
strings to values and vice versa. |
ILcyCustomizerPanelFactory |
createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter,
int aMinNbOfChars,
int aMaxNbOfChars,
boolean aEmptyStringForNull)
Creates a
ILcyCustomizerPanelFactory that creates a text field customizer with
input validation for string values of the specified data property, making sure the length of the
string is within the bounds. |
public TLcyDataPropertyValueCustomizerPanelFactories(ILcyLucyEnv aLucyEnv)
TLcyDataPropertyValueCustomizerPanelFactories
for the specified
Lucy environment.aLucyEnv
- the lucy env.public boolean canCreateCustomizerPanelFactory(TLcdDataProperty aDataProperty)
createCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty, com.luciad.util.ILcdFilter<com.luciad.view.TLcdDataPropertyValueContext>)
.
Currently the following cases are supported:
The data property does not represent a collection
and the type of the data property is
TLcdCoreDataTypes.STRING_TYPE
.TLcdCoreDataTypes.DOUBLE_TYPE
.TLcdCoreDataTypes.FLOAT_TYPE
.TLcdCoreDataTypes.INTEGER_TYPE
.TLcdCoreDataTypes.LONG_TYPE
.TLcdCoreDataTypes.SHORT_TYPE
.TLcdCoreDataTypes.BOOLEAN_TYPE
.Enumeration
aDataProperty
- the data property to check.public ILcyCustomizerPanelFactory createCustomizerPanelFactory(TLcdDataProperty aDataProperty, ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
This method creates a customizer factory implementation for the passed
TLcdDataProperty
. Will only succeed if canCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
evaluates to true for the passed data property.
Note: if this method does not offer a customizer factory for a specific data property, you can probably create one using the other methods in this class.
aDataProperty
- the data property whose values will be edited. This controls the specific
type of customizer.aPropertyValueFilter
- the filter that determines for which instances of
TLcdDataPropertyValueContext
the returned customizer
panel factory applies.IllegalArgumentException
- if canCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
evaluates to false for the passed property.public ILcyCustomizerPanelFactory createGeneralCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
TLcdDataPropertyValueContext
.
TLcdDataPropertyValueContext
is an instance
of TLcdDataObjectExpressionLanguage
.
TLcdDataPropertyValueContext
is simple path to a (nested)
property, for instance 'PropertyName.NestedPropertyName', where NestedPropertyName is a property
of the data type associated with the value of PropertyName in the data object. For more information
about which expressions are supported, see TLcdDataObjectExpressionLanguage.update(java.lang.String, com.luciad.datamodel.ILcdDataObject, java.lang.Object)
.
canCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
returns true for the leaf property of the expression
(the one with name NestedPropertyName in the previous example).
TLcdDataPropertyValueContext
is valid (for instance, no
String
value for a Boolean
property).
TLcdDataPropertyValueContext
is accepted by the passed filter.
aPropertyValueFilter
- a filter to control for which instances a customizer panel can be
created.public ILcyCustomizerPanelFactory createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, int aMinNbOfChars, int aMaxNbOfChars, boolean aEmptyStringForNull)
ILcyCustomizerPanelFactory
that creates a text field customizer with
input validation for string values of the specified data property, making sure the length of the
string is within the bounds.aPropertyValueFilter
- the filter that determines for which instances of
TLcdDataPropertyValueContext
the returned customizer
panel factory applies.aMinNbOfChars
- the minimum number of chars that should be in a valid string.aMaxNbOfChars
- the maximum number of characters that are allowed in a valid string.ILcyCustomizerPanelFactory
that can create customizer panels that
can edit instances of TLcdDataPropertyValueContext
containing string values,
and enforce conditions on the string length.public ILcyCustomizerPanelFactory createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Format aFormat)
ILcyCustomizerPanelFactory
that creates a text field customizer that can
edit instances of TLcdDataPropertyValueContext
if the passed format can convert
strings to values and vice versa. The format can also provide input validation. If the format
can't parse a input string the customizer panel will turn red and won't apply changes.aPropertyValueFilter
- the filter that determines for which instances of
TLcdDataPropertyValueContext
the returned customizer
panel factory applies.aFormat
- the format used to format and parse the values.ILcyCustomizerPanelFactory
that can create customizer panels that
use a text field with the passed format to edit instances of TLcdDataPropertyValueContext
.public ILcyCustomizerPanelFactory createCheckBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter)
ILcyCustomizerPanelFactory
that creates a check box customizer for
instances of TLcdDataPropertyValueContext
that contain boolean values.aPropertyValueFilter
- the filter that determines for which instances of
TLcdDataPropertyValueContext
the returned customizer
panel factory applies.ILcyCustomizerPanelFactory
that can create customizer panels that
use a check box to edit edit instances of TLcdDataPropertyValueContext
containing boolean values.public ILcyCustomizerPanelFactory createComboBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Set<?> aPossibleValues)
ILcyCustomizerPanelFactory
that creates a combobox
customizer using the passed set of values. This is especially useful to edit values
corresponding to enumeration
data types.aPropertyValueFilter
- the filter that determines for which instances of
TLcdDataPropertyValueContext
the returned customizer
panel factory applies.aPossibleValues
- a set of possible values.ILcyCustomizerPanelFactory
that can create customizer panels that
use a combo box to edit instances of TLcdDataPropertyValueContext
.