Class TLcyDataPropertyValueCustomizerPanelFactories
java.lang.Object
com.luciad.lucy.gui.customizer.dataproperty.TLcyDataPropertyValueCustomizerPanelFactories
Utility class to create instances of
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 certainTLcdDataProperty
. -
createCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty, com.luciad.util.ILcdFilter<com.luciad.view.TLcdDataPropertyValueContext>)
: ifcanCreateCustomizerPanelFactory
returns true, calling this method with the sameTLcdDataProperty
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 ofTLcdDataPropertyValueContext
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 aFormat
that can format it and parse it from aString
. 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 anenumeration
. -
createCheckBoxCustomizerPanelFactory(com.luciad.util.ILcdFilter)
: a factory returned by this method can create customizers that use a check box to edit boolean values.
- Since:
- 2013.0
-
Constructor Summary
ConstructorDescriptionCreates a new instance ofTLcyDataPropertyValueCustomizerPanelFactories
for the specified Lucy environment. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canCreateCustomizerPanelFactory
(TLcdDataProperty aDataProperty) Returns true if you can create a customizer factory for the passed data property usingcreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty, com.luciad.util.ILcdFilter<com.luciad.view.TLcdDataPropertyValueContext>)
.createCheckBoxCustomizerPanelFactory
(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter) Creates aILcyCustomizerPanelFactory
that creates a check box customizer for instances ofTLcdDataPropertyValueContext
that contain boolean values.createComboBoxCustomizerPanelFactory
(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Set<?> aPossibleValues) Creates aILcyCustomizerPanelFactory
that creates a combobox customizer using the passed set of values.createCustomizerPanelFactory
(TLcdDataProperty aDataProperty, ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter) This method creates a customizer factory implementation for the passedTLcdDataProperty
.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 ofTLcdDataPropertyValueContext
.createTextFieldCustomizerPanelFactory
(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, int aMinNbOfChars, int aMaxNbOfChars, boolean aEmptyStringForNull) Creates aILcyCustomizerPanelFactory
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.createTextFieldCustomizerPanelFactory
(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Format aFormat) Creates aILcyCustomizerPanelFactory
that creates a text field customizer that can edit instances ofTLcdDataPropertyValueContext
if the passed format can convert strings to values and vice versa.
-
Constructor Details
-
TLcyDataPropertyValueCustomizerPanelFactories
Creates a new instance ofTLcyDataPropertyValueCustomizerPanelFactories
for the specified Lucy environment.- Parameters:
aLucyEnv
- the lucy env.
-
-
Method Details
-
canCreateCustomizerPanelFactory
Returns true if you can create a customizer factory for the passed data property usingcreateCustomizerPanelFactory(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 isTLcdCoreDataTypes.STRING_TYPE
.TLcdCoreDataTypes.DOUBLE_TYPE
.TLcdCoreDataTypes.FLOAT_TYPE
.TLcdCoreDataTypes.INTEGER_TYPE
.TLcdCoreDataTypes.LONG_TYPE
.TLcdCoreDataTypes.SHORT_TYPE
.TLcdCoreDataTypes.BOOLEAN_TYPE
.- an
Enumeration
- Parameters:
aDataProperty
- the data property to check.- Returns:
- true for the cases above, false otherwise.
-
createCustomizerPanelFactory
public ILcyCustomizerPanelFactory createCustomizerPanelFactory(TLcdDataProperty aDataProperty, ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter) This method creates a customizer factory implementation for the passed
TLcdDataProperty
. Will only succeed ifcanCreateCustomizerPanelFactory(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.
- Parameters:
aDataProperty
- the data property whose values will be edited. This controls the specific type of customizer.aPropertyValueFilter
- the filter that determines for which instances ofTLcdDataPropertyValueContext
the returned customizer panel factory applies.- Returns:
- a customizer panel factory to edit values of the specified data property.
- Throws:
IllegalArgumentException
- ifcanCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
evaluates to false for the passed property.
-
createGeneralCustomizerPanelFactory
public 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
. -
The expression language used by the
TLcdDataPropertyValueContext
is an instance ofTLcdDataObjectExpressionLanguage
. -
The expression in the
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, seeTLcdDataObjectExpressionLanguage.update(java.lang.String, com.luciad.datamodel.ILcdDataObject, java.lang.Object)
. -
The method
canCreateCustomizerPanelFactory(com.luciad.datamodel.TLcdDataProperty)
returns true for the leaf property of the expression (the one with name NestedPropertyName in the previous example). -
The value in the
TLcdDataPropertyValueContext
is valid (for instance, noString
value for aBoolean
property). -
The
TLcdDataPropertyValueContext
is accepted by the passed filter.
- Parameters:
aPropertyValueFilter
- a filter to control for which instances a customizer panel can be created.- Returns:
- a customizer panel factory than can create data property value customizers under certain conditions.
-
The object to create a customizer for is an instance of
-
createTextFieldCustomizerPanelFactory
public ILcyCustomizerPanelFactory createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, int aMinNbOfChars, int aMaxNbOfChars, boolean aEmptyStringForNull) Creates aILcyCustomizerPanelFactory
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.- Parameters:
aPropertyValueFilter
- the filter that determines for which instances ofTLcdDataPropertyValueContext
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.- Returns:
- a
ILcyCustomizerPanelFactory
that can create customizer panels that can edit instances ofTLcdDataPropertyValueContext
containing string values, and enforce conditions on the string length.
-
createTextFieldCustomizerPanelFactory
public ILcyCustomizerPanelFactory createTextFieldCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Format aFormat) Creates aILcyCustomizerPanelFactory
that creates a text field customizer that can edit instances ofTLcdDataPropertyValueContext
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.- Parameters:
aPropertyValueFilter
- the filter that determines for which instances ofTLcdDataPropertyValueContext
the returned customizer panel factory applies.aFormat
- the format used to format and parse the values.- Returns:
- a
ILcyCustomizerPanelFactory
that can create customizer panels that use a text field with the passed format to edit instances ofTLcdDataPropertyValueContext
.
-
createCheckBoxCustomizerPanelFactory
public ILcyCustomizerPanelFactory createCheckBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter) Creates aILcyCustomizerPanelFactory
that creates a check box customizer for instances ofTLcdDataPropertyValueContext
that contain boolean values.- Parameters:
aPropertyValueFilter
- the filter that determines for which instances ofTLcdDataPropertyValueContext
the returned customizer panel factory applies.- Returns:
- a
ILcyCustomizerPanelFactory
that can create customizer panels that use a check box to edit edit instances ofTLcdDataPropertyValueContext
containing boolean values.
-
createComboBoxCustomizerPanelFactory
public ILcyCustomizerPanelFactory createComboBoxCustomizerPanelFactory(ILcdFilter<TLcdDataPropertyValueContext> aPropertyValueFilter, Set<?> aPossibleValues) Creates aILcyCustomizerPanelFactory
that creates a combobox customizer using the passed set of values. This is especially useful to edit values corresponding toenumeration
data types.- Parameters:
aPropertyValueFilter
- the filter that determines for which instances ofTLcdDataPropertyValueContext
the returned customizer panel factory applies.aPossibleValues
- a set of possible values.- Returns:
- a
ILcyCustomizerPanelFactory
that can create customizer panels that use a combo box to edit instances ofTLcdDataPropertyValueContext
.
-