public class CompoundProperty extends AbstractProperty<List<AbstractProperty<?>>> 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<AbstractProperty<?>> initialValue,
boolean readOnly,
int displayPriority)
Construct a CompoundProperty.
|
Modifier and Type | Method and Description |
---|---|
void |
add(AbstractProperty<?> ap)
Add an AbstractProperty at the end of the list.
|
void |
add(int index,
AbstractProperty<?> ap)
Add an AbstractProperty at a specified position.
|
AbstractProperty<List<AbstractProperty<?>>> |
deepCopy()
Construct a deep copy of this property (duplicates everything except immutable fields).
|
List<AbstractProperty<?>> |
displayOrderedValue()
Return the sub-items in display order.
|
AbstractProperty<?> |
findSubPropertyByKey(String key)
Find an embedded AbstractProperty that has a specified shortName.
|
AbstractProperty<?> |
get(int index)
Return the sub property at a specified index.
|
protected Map<String,AbstractProperty<?>> |
getPropertyGroup()
Retrieve the property group.
|
List<AbstractProperty<?>> |
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(AbstractProperty<?> removeMe)
Remove a property from this CompoundProperty.
|
void |
remove(int index)
Remove a sub property from this CompoundProperty.
|
protected void |
setPropertyGroup(Map<String,AbstractProperty<?>> newPropertyGroup)
Update the property group when this CompoundProperty is added or removed from another CompoundProperty.
|
void |
setValue(List<AbstractProperty<?>> 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<AbstractProperty<?>> 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 List<AbstractProperty<?>> getValue()
getValue
in interface Property<List<AbstractProperty<?>>>
public final void setValue(List<AbstractProperty<?>> newValue) throws PropertyException
setValue
in interface Property<List<AbstractProperty<?>>>
newValue
- T; the new value for the propertyPropertyException
- when this Property is read-only, or newValue is not validpublic final AbstractProperty<?> findSubPropertyByKey(String key)
key
- String; the key of the sought embedded AbstractPropertypublic final void add(int index, AbstractProperty<?> ap) throws PropertyException
index
- int; the position where the AbstractProperty must be addedap
- AbstractProperty; the property to addPropertyException
- when this CompoundProperty is read-only, or index is out of rangepublic final void add(AbstractProperty<?> ap) throws PropertyException
ap
- AbstractProperty; 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(AbstractProperty<?> 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,AbstractProperty<?>> 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 AbstractProperty<?> get(int index) throws PropertyException
index
- int; the index of the property to retrievePropertyException
- when index is out of rangepublic final List<AbstractProperty<?>> displayOrderedValue()
public final String htmlStateDescription()
htmlStateDescription
in interface Property<List<AbstractProperty<?>>>
htmlStateDescription
in class AbstractProperty<List<AbstractProperty<?>>>
public final AbstractProperty<List<AbstractProperty<?>>> deepCopy()
deepCopy
in interface Property<List<AbstractProperty<?>>>
protected final Map<String,AbstractProperty<?>> getPropertyGroup()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.