org.foray.fotree.value
Class PropertyCollection

java.lang.Object
  extended by org.foray.fotree.value.PropertyValueStatic
      extended by org.foray.fotree.value.PropertyCollection
All Implemented Interfaces:
PropertyValue

public class PropertyCollection
extends PropertyValueStatic

This class is odd because it is a PropertyValue subclass that encapsulates one or more Property instances. It is useful for properties like "border-style" which can contain 1, 2, 3 or 4 values, and which must be wrapped up and unwrapped in some orderly way.


Constructor Summary
PropertyCollection()
          Constructor.
 
Method Summary
 void addItem(Property property)
          Add an item to the collection.
 boolean canEvalKeyword()
          Indicates whether this property value can evaluate to a keyword.
 PvKeyword evalKeyword()
          Returns the keyword value of this property value.
 Property findProperty(FoProperty propertyType)
          Returns the first occurrence of a Property in the collection that is of the type propertyType.
 int getCount()
          Returns the number of items in this collection.
 Property getItem(int index)
          Returns a specific property from the collection.
 List<Property> getValue()
          Returns the list of properties in this collection.
static byte whichElementForDirectional(org.axsl.common.value.Compass direction, int size)
          Determines which of the elements in this PropertyCollection should be used for the given direction that is supplied.
 
Methods inherited from class org.foray.fotree.value.PropertyValueStatic
canEvalColor, canEvalInteger, canEvalLength, canEvalNumeric, canEvalPercentage, evalColor, evalInteger, evalIntegerException, evalKeywordException, evalLength, evalLengthException, evalNumeric, evalPercentage, evalPercentageException, getUnitPower, lengthRequiresFontSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyCollection

public PropertyCollection()
Constructor.

Method Detail

addItem

public void addItem(Property property)
Add an item to the collection.

Parameters:
property - The property to add to the collection.

getValue

public List<Property> getValue()
Returns the list of properties in this collection.

Returns:
The list of properties in this collection.

getCount

public int getCount()
Returns the number of items in this collection.

Returns:
The number of items in this collection.

getItem

public Property getItem(int index)
Returns a specific property from the collection.

Parameters:
index - The index to the property needed.
Returns:
The property at index.

whichElementForDirectional

public static byte whichElementForDirectional(org.axsl.common.value.Compass direction,
                                              int size)
Determines which of the elements in this PropertyCollection should be used for the given direction that is supplied. From the XSL-FO Standard 1.0, Section 7.29.11:

"If there is only one value, it applies to all sides. If there are two values, the top and bottom borders are set to the first value and the right and left are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left, respectively."

Parameters:
direction - One of the integral direction identifiers (e.g. ABSOLUTE_DIR_LEFT).
size - The number of elements that exist in the collection.
Returns:
The index (starts at 0) to the appropriate element to use for the direction given.

findProperty

public Property findProperty(FoProperty propertyType)
Returns the first occurrence of a Property in the collection that is of the type propertyType.

Parameters:
propertyType - The propertyType which is being sought.
Returns:
The first Property matching propertyType, or null if none is found.

canEvalKeyword

public boolean canEvalKeyword()
Description copied from interface: PropertyValue
Indicates whether this property value can evaluate to a keyword.

Returns:
True iff this property value can evaluate to a keyword.

evalKeyword

public PvKeyword evalKeyword()
Description copied from interface: PropertyValue
Returns the keyword value of this property value. This method should only be executed on instances where PropertyValue.canEvalKeyword() returns true. Doing so on other instances may result in an IllegalStateException.

Returns:
The keyword value of this property value.


Copyright © 2017. All rights reserved.