public class CompoundProperty extends AbstractProperty<List<Property<?>>> implements Serializable
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2016-05-28 11:33:31 +0200 (Sat, 28 May 2016) $, @version $Revision: 2051 $, by $Author: averbraeck $,
initial version 30 dec. 2014
AbstractProperty.PropertyIterator
Constructor and Description |
---|
CompoundProperty(String key,
String shortName,
String description,
List<Property<?>> initialValue,
boolean readOnly,
int displayPriority)
Construct a CompoundProperty.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Property<?> ap)
Add a Property at a specified position.
|
void |
add(Property<?> ap)
Add a Property at the end of the list.
|
CompoundProperty |
deepCopy()
Construct a deep copy of this property (duplicates everything except immutable fields).
|
List<Property<?>> |
displayOrderedValue()
Return the sub-items in display order.
|
Property<?> |
findSubPropertyByKey(String key)
Find an embedded Property that has a specified shortName.
|
Property<?> |
get(int index)
Return the sub property at a specified index.
|
protected Map<String,Property<?>> |
getPropertyGroup()
Retrieve the property group.
|
List<Property<?>> |
getValue()
Retrieve the current value of the property.
|
String |
htmlStateDescription()
Generate a description of the state of this property in HTML (excluding the <html> at the start and the
</html> at the end.
|
void |
remove(int index)
Remove a sub property from this CompoundProperty.
|
void |
remove(Property<?> removeMe)
Remove a property from this CompoundProperty.
|
protected void |
setPropertyGroup(Map<String,Property<?>> newPropertyGroup)
Update the property group when this CompoundProperty is added or removed from another CompoundProperty.
|
void |
setValue(List<Property<?>> newValue)
Change the value of the property.
|
int |
size()
Return the number of sub properties of this CompoundProperty.
|
findByKey, getDescription, getDisplayPriority, getKey, getParent, getShortName, isReadOnly, iterator, setParent, setReadOnly, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public CompoundProperty(String key, String shortName, String description, List<Property<?>> initialValue, boolean readOnly, int displayPriority) throws PropertyException
key
- String; the unique key of the new propertyshortName
- String; the short name of the new CompoundPropertydescription
- String; description of the new CompoundProperty (may use HTML mark up)initialValue
- Integer; the initial value of the new CompoundPropertyreadOnly
- boolean; if true this CompoundProperty can not be altereddisplayPriority
- int; the display priority of the new CompoundPropertyPropertyException
- if key is already in usepublic final void setValue(List<Property<?>> newValue) throws PropertyException
setValue
in interface Property<List<Property<?>>>
newValue
- T; the new value for the propertyPropertyException
- when this Property is read-only, or newValue is not validpublic final Property<?> findSubPropertyByKey(String key)
key
- String; the key of the sought embedded Propertypublic final void add(int index, Property<?> ap) throws PropertyException
index
- int; the position where the Property must be addedap
- Property; the property to addPropertyException
- when this CompoundProperty is read-only, or index is out of rangepublic final void add(Property<?> ap) throws PropertyException
ap
- Property; the property to addPropertyException
- when this CompoundProperty is read-onlypublic final void remove(int index) throws PropertyException
index
- int; the position of the sub property to removePropertyException
- when this CompoundProperty is read-only, or index is out of rangepublic final void remove(Property<?> removeMe) throws PropertyException
removeMe
- AbstractProperty the property that must be removedPropertyException
- when the supplied property cannot be removed (probably because it is not part of this
CompoundProperty)public final int size()
protected final void setPropertyGroup(Map<String,Property<?>> newPropertyGroup)
newPropertyGroup
- Map<String, AbstractProperty<?>>; if non-null; this is the property group of the new
parent which we are now part of and we must use that in lieu of our own; if null; we are being removed from
our parent and we must rebuild our own property grouppublic final Property<?> get(int index) throws PropertyException
index
- int; the index of the property to retrievePropertyException
- when index is out of rangepublic final List<Property<?>> displayOrderedValue()
public final String htmlStateDescription()
htmlStateDescription
in interface Property<List<Property<?>>>
htmlStateDescription
in class AbstractProperty<List<Property<?>>>
public final CompoundProperty deepCopy()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.