Class BasicConfigurationPropertyModel
- java.lang.Object
-
- com.inductiveautomation.ignition.common.config.BasicConfigurationPropertyModel
-
- All Implemented Interfaces:
ConfigurationPropertyModel
,PropertyResolver
,java.io.Serializable
- Direct Known Subclasses:
BasicMutableConfigurationPropertyModel
public class BasicConfigurationPropertyModel extends java.lang.Object implements ConfigurationPropertyModel
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
BasicConfigurationPropertyModel.DefaultRankedProperty
protected class
BasicConfigurationPropertyModel.InternalProperty<T>
protected static interface
BasicConfigurationPropertyModel.RankedProperty
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.util.Set>
resources
-
Fields inherited from interface com.inductiveautomation.ignition.common.config.ConfigurationPropertyModel
EMPTY_MODEL
-
-
Constructor Summary
Constructors Modifier Constructor Description BasicConfigurationPropertyModel(long version)
protected
BasicConfigurationPropertyModel(long version, java.util.Map<Property<?>,BasicConfigurationPropertyModel.InternalProperty> properties)
Used for cloningBasicConfigurationPropertyModel(PropertySet propertySet)
Creates a simple model off of the properties contained in the propertyset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
compareRankedProperties(BasicConfigurationPropertyModel.RankedProperty a, BasicConfigurationPropertyModel.RankedProperty b)
protected <T> void
connectDependency(BasicConfigurationPropertyModel.InternalProperty<T> owner, T value, BasicConfigurationPropertyModel.InternalProperty<?> child)
boolean
contains(Property<?> property)
Returns whether this property is contained in the model at all.java.util.Set<Property<?>>
getAffectedProperties(Property<?> p)
Called after editing the given property, this returns the props whose isRelevant/isEditable should be called.<T> java.util.Optional<java.util.Collection<T>>
getAllowedValues(Property<T> p)
If the range of allowed properties is restricted, this will return the valid values.java.util.List<Property<?>>
getApplicableProperties(PropertySet config)
Given the current config, returns the properties that should be displayed.long
getCurrentModelVersion()
Returns the current model version, incremented when the model is changed.java.util.Set<Property<?>>
getModelProperties()
Returns properties that are in some way registered with the model.protected java.util.Set
getResourceValues(java.lang.String id)
boolean
isApplicable(PropertySet config, Property<?> property)
Returns whether a property is relevant given the current configuration.boolean
isCustomizable(Property<?> property)
Returns whether a property that has allowed values defined also allows custom values.boolean
isModelProperty(Property<?> property)
Returns true if this is a property that is contained in the Model Properties.void
mergeTo(MutableConfigurationPropertyModel target)
Takes the traits of this configuration prop model and puts them in the target model.protected <T> BasicConfigurationPropertyModel.InternalProperty<T>
p(Property<T> prop)
Property<?>
resolve(java.lang.String id)
Returns the property represented by the id, or null if the property cannot be found.
-
-
-
Constructor Detail
-
BasicConfigurationPropertyModel
public BasicConfigurationPropertyModel(long version)
-
BasicConfigurationPropertyModel
public BasicConfigurationPropertyModel(PropertySet propertySet)
Creates a simple model off of the properties contained in the propertyset.- Parameters:
propertySet
- the collection of properties to register.
-
BasicConfigurationPropertyModel
protected BasicConfigurationPropertyModel(long version, java.util.Map<Property<?>,BasicConfigurationPropertyModel.InternalProperty> properties)
Used for cloning
-
-
Method Detail
-
getCurrentModelVersion
public long getCurrentModelVersion()
Description copied from interface:ConfigurationPropertyModel
Returns the current model version, incremented when the model is changed.- Specified by:
getCurrentModelVersion
in interfaceConfigurationPropertyModel
-
p
protected <T> BasicConfigurationPropertyModel.InternalProperty<T> p(Property<T> prop)
-
getApplicableProperties
public java.util.List<Property<?>> getApplicableProperties(PropertySet config)
Description copied from interface:ConfigurationPropertyModel
Given the current config, returns the properties that should be displayed. There is no need to call isApplicable for each, as that would be true. The properties are returned in desired display order.- Specified by:
getApplicableProperties
in interfaceConfigurationPropertyModel
-
isApplicable
public boolean isApplicable(PropertySet config, Property<?> property)
Description copied from interface:ConfigurationPropertyModel
Returns whether a property is relevant given the current configuration.- Specified by:
isApplicable
in interfaceConfigurationPropertyModel
-
getAffectedProperties
public java.util.Set<Property<?>> getAffectedProperties(Property<?> p)
Description copied from interface:ConfigurationPropertyModel
Called after editing the given property, this returns the props whose isRelevant/isEditable should be called. The result of those calls means that properties might be added or removed to the editable property list.- Specified by:
getAffectedProperties
in interfaceConfigurationPropertyModel
-
getAllowedValues
public <T> java.util.Optional<java.util.Collection<T>> getAllowedValues(Property<T> p)
Description copied from interface:ConfigurationPropertyModel
If the range of allowed properties is restricted, this will return the valid values. Otherwise it will return Optional.empty, in which case the editor should be built based on the property type.- Specified by:
getAllowedValues
in interfaceConfigurationPropertyModel
-
resolve
public Property<?> resolve(java.lang.String id)
Description copied from interface:PropertyResolver
Returns the property represented by the id, or null if the property cannot be found.- Specified by:
resolve
in interfacePropertyResolver
-
contains
public boolean contains(Property<?> property)
Description copied from interface:ConfigurationPropertyModel
Returns whether this property is contained in the model at all. Does not indicate whether it would be applicable to the current config or not.- Specified by:
contains
in interfaceConfigurationPropertyModel
-
getModelProperties
public java.util.Set<Property<?>> getModelProperties()
Description copied from interface:ConfigurationPropertyModel
Returns properties that are in some way registered with the model. Any property in a PropertySet that is not in this Set is a custom property.- Specified by:
getModelProperties
in interfaceConfigurationPropertyModel
-
isModelProperty
public boolean isModelProperty(Property<?> property)
Description copied from interface:ConfigurationPropertyModel
Returns true if this is a property that is contained in the Model Properties.- Specified by:
isModelProperty
in interfaceConfigurationPropertyModel
-
isCustomizable
public boolean isCustomizable(Property<?> property)
Description copied from interface:ConfigurationPropertyModel
Returns whether a property that has allowed values defined also allows custom values.- Specified by:
isCustomizable
in interfaceConfigurationPropertyModel
-
mergeTo
public void mergeTo(MutableConfigurationPropertyModel target)
Description copied from interface:ConfigurationPropertyModel
Takes the traits of this configuration prop model and puts them in the target model.- Specified by:
mergeTo
in interfaceConfigurationPropertyModel
-
connectDependency
protected <T> void connectDependency(BasicConfigurationPropertyModel.InternalProperty<T> owner, T value, BasicConfigurationPropertyModel.InternalProperty<?> child)
-
getResourceValues
protected java.util.Set getResourceValues(java.lang.String id)
-
compareRankedProperties
protected int compareRankedProperties(BasicConfigurationPropertyModel.RankedProperty a, BasicConfigurationPropertyModel.RankedProperty b)
-
-