Class SimpleValueHandle
java.lang.Object
org.eclipse.birt.report.model.api.ElementDetailHandle
org.eclipse.birt.report.model.api.ValueHandle
org.eclipse.birt.report.model.api.SimpleValueHandle
- Direct Known Subclasses:
MemberHandle
,PropertyHandleImpl
Abstract base class that represents a handle for the value to either a
property or a structure member.
-
Field Summary
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleValueHandle
(DesignElementHandle element) Constructs a handle with the given handle to an design element. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Adds an item to the end of a list property.addItem
(IStructure item) Adds an item to the end of a list property or member.void
Clears the value of the property or member.get
(int n) Returns the the nth entry in a list property or member.getAt
(int n) Returns the the nth entry in a list property or member.IChoice[]
Returns the array of choices that are defined for this property or member.Gets the default unit of the property.abstract IPropertyDefn
getDefn()
Gets the generic property definition.gets the localized value of the property.double
Gets the value as a double.int
Gets the value as an integer.getItems()
Gets the items of the list property.Gets the value as a list.Gets the value as a number (BigDecimal).protected abstract Object
Gets the value stored in the memory directly.Gets the value as a string.int
Returns the numeric code for the type of this property or member.final Object
getValue()
Gets the value of the property as a generic object.int
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.insertItem
(IStructure item, int posn) Inserts a new item into a list property or member at the given position.protected boolean
isList()
Indicate if this handle is working on a list property.abstract boolean
Checks whether a value is read-only in the property sheet.abstract boolean
Checks whether a value is visible in the property sheet.iterator()
Returns an iterator over the values in a list property, ornull
if the property is not a list property.void
moveItem
(int from, int to) Moves an item within a list property or member.abstract void
removeItem
(int posn) Removes an item from a list property or member.final void
removeItem
(Object item) Removes an item from a list property or member.void
removeItems
(List items) Removes all the items in the list from a list property or member.void
replaceItem
(IStructure oldItem, IStructure newItem) Replaces an old structure with a new one for the this property or member.void
setFloatValue
(double value) Sets the value of the property or member to the given double.void
setIntValue
(int value) Sets the value of the property or member to the given integer.void
setNumberValue
(BigDecimal value) Sets the value of the property or member to the given number.void
setStringValue
(String value) Sets the value of the property or member to the given integer.abstract void
Sets the value of a property or member to the object given.Methods inherited from class org.eclipse.birt.report.model.api.ValueHandle
getContext, getPropertyDefn, getReference
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
-
Constructor Details
-
SimpleValueHandle
Constructs a handle with the given handle to an design element.- Parameters:
element
- a handle to a report element
-
-
Method Details
-
getDefn
Gets the generic property definition. Its a property definition for an element or a member definition for a structure.- Returns:
- the value definition.
-
getRawValue
Gets the value stored in the memory directly. The returned value won't be done any conversion.- Returns:
- the value stored in the memory
-
getValue
Gets the value of the property as a generic object. Use the specialized methods to get the value as a particular type.- Returns:
- The value of the property as a generic object.
- See Also:
-
getIntValue
public int getIntValue()Gets the value as an integer.- Returns:
- The value as an integer. Returns 0 if the value cannot be converted to an integer.
-
getStringValue
Gets the value as a string.- Returns:
- The value as a string.
-
getFloatValue
public double getFloatValue()Gets the value as a double.- Returns:
- The value as a double. Returns 0 if the value cannot be converted to a double.
-
getNumberValue
Gets the value as a number (BigDecimal).- Returns:
- The value as a number. Returns null if the value cannot be converted to a number.
-
getListValue
Gets the value as a list.- Returns:
- The value as a list. Returns null if the value cannot be converted to a list.
-
getDisplayValue
gets the localized value of the property.- Returns:
- the localized value
-
getAt
Returns the the nth entry in a list property or member. Use this method for properties that contain a list of structures. The index must be valid for the list.- Parameters:
n
- The list index.- Returns:
- A handle to the structure at the given index.
-
get
Returns the the nth entry in a list property or member. Use this method for properties that contain a list of items. The index must be valid for the list. In the following cases, this method will return a meaningful value:- If this property or member is a structure list type, then return
StructureHandle
.- If this property or member is a list of element reference, return
DesignElementHandle
if resolved, otherwise return the qualified name of the referred element.- If this property or member is a list of simeple value(int, float, decimal, date-time, string), then return the atomice Java Object(Integer, Float, Double, BigDecimal, Date, String).
- If this property or member is not a list value or the index is out of range, then return
null
.- Parameters:
n
- The list index.- Returns:
- A handle to the structure, a handle to the referred element, or some simple value(int, float, decimal, data-time, string) at the given index.
- If this property or member is a structure list type, then return
-
indexOf
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Parameters:
o
- element to search for.- Returns:
- the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
-
getTypeCode
public int getTypeCode()Returns the numeric code for the type of this property or member. The types are defined in thePropertyType
class.- Returns:
- The property type code.
- See Also:
-
PropertyType
-
iterator
Returns an iterator over the values in a list property, ornull
if the property is not a list property. The iterator returns aStructureHandle
for each entry in the list. For highlight rules, the iterator returns a list ofHighlightRuleHandle
s.- Returns:
- An iterator over the values in a list property.
- See Also:
-
StructureHandle
StructureIterator
-
setIntValue
Sets the value of the property or member to the given integer. It can also be used to set dimensions but dimensions are better set using a double.- Parameters:
value
- The value to set.- Throws:
SemanticException
- If the property value cannot be converted from an integer, or if the value of a choice is incorrect.
-
setStringValue
Sets the value of the property or member to the given integer. Use this for properties such as expressions, labels, HTML, or XML. Also use it to set the value of a choice using the internal string name of the choice. Use it to set the value of a dimension when using specified units, such as "10pt".- Parameters:
value
- The value to set.- Throws:
SemanticException
- If the value of a choice or other property is incorrect.
-
setFloatValue
Sets the value of the property or member to the given double. Used primarily for dimension properties. The units of the dimension are assumed to be application units.- Parameters:
value
- The value to set.- Throws:
SemanticException
- If the property value cannot be converted from a double.
-
setNumberValue
Sets the value of the property or member to the given number.- Parameters:
value
- The value to set.- Throws:
SemanticException
- If the property value cannot be converted from a number.
-
clearValue
Clears the value of the property or member.- Throws:
SemanticException
- If the value cannot be cleared.
-
setValue
Sets the value of a property or member to the object given. If the object isnull
, then the value is cleared.- Parameters:
value
- The new value.- Throws:
SemanticException
- If the value is not valid for the property or member.- See Also:
-
removeItem
Removes an item from a list property or member. The handle must be working on a list property or member.- Parameters:
posn
- The position of the item to remove.- Throws:
PropertyValueException
- If the property is not a list property.IndexOutOfBoundsException
- if the givenposn
is out of range(index < 0 || index >= list.size())
.
-
removeItem
Removes an item from a list property or member. The handle must be working on a list property or member.The item should be a meaningfule value in the following cases:- If this property or member is a structure list type, the item should be a
StructureHandle
orStructure
.- If this property or member is a list of element reference, the item should be
DesignElementHandle
orIDesignElement
.- If this property or member is a list of simeple value(int, float, decimal, date-time, string), then return the atomice Java Object(Integer, Float, Double, BigDecimal, Date, String).
- Parameters:
item
- the item to remove- Throws:
PropertyValueException
- If the property is not a list property, or if the given item is not contained in the list.
- If this property or member is a structure list type, the item should be a
-
removeItems
Removes all the items in the list from a list property or member. The handle must be working on a list property or member. Each one in the list is instance ofStructureHandle
- Parameters:
items
- the item list to remove- Throws:
PropertyValueException
- If the property or the member is not a list type, or if any item in the list is not found
-
replaceItem
Replaces an old structure with a new one for the this property or member. The handle must be working on a list property or member.- Parameters:
oldItem
- the old item to be replaced.newItem
- the new item.- Throws:
SemanticException
- if the property/member does not contain the list value or the new structure is invalid or the old structure is not contained in the list.
-
addItem
Adds an item to the end of a list property or member. The handle must be working on a list property or member.- Parameters:
item
- The new item to add.- Returns:
- a handle to the newly added structure; return null if the item is null.
- Throws:
SemanticException
- If the property is not a list property, or if the the value of the item is incorrect.
-
addItem
Adds an item to the end of a list property. The handle must be working on a list property.- Parameters:
item
- The new item to add.- Throws:
SemanticException
- If the property is not a list property, or if the the value of the item is incorrect.
-
insertItem
Inserts a new item into a list property or member at the given position. The handle must be working on a list property or member.- Parameters:
item
- The new item to insert.posn
- The insert position.- Returns:
- a handle to the newly inserted structure, return null if the item is null.
- Throws:
SemanticException
- If the property is not a list property, or if the the value of the item is incorrect.IndexOutOfBoundsException
- if the givenposn
is out of range(index < 0 || index > list.size())
.
-
moveItem
Moves an item within a list property or member. The handle must be working on a list property or member.- Parameters:
from
- The current position of the item to moveto
- The new position of the item to move.- Throws:
PropertyValueException
- If the property is not a list property.IndexOutOfBoundsException
- if the given from or to index is out of range(index < 0 || index >= list.size())
.
-
getChoices
Returns the array of choices that are defined for this property or member.- Returns:
- an array containing choices of this property. Return
null
, if this property has no choice. - See Also:
-
Choice
-
isList
protected boolean isList()Indicate if this handle is working on a list property.- Returns:
true
if the handle is working on a list property, otherwise returnfalse
-
getDefaultUnit
Gets the default unit of the property.- Returns:
- the default unit if the property is dimension type, otherwise empty string
-
isVisible
public abstract boolean isVisible()Checks whether a value is visible in the property sheet.- Returns:
true
if it is visible. Otherwisefalse
.
-
isReadOnly
public abstract boolean isReadOnly()Checks whether a value is read-only in the property sheet.- Returns:
true
if it is read-only. Otherwisefalse
.
-
getItems
Gets the items of the list property. The handle must be working on a list property or member.- Returns:
- the list of items, or null if the property is not a list property.
-