Class PropertyHandleImpl
- java.lang.Object
-
- org.eclipse.birt.report.model.api.ElementDetailHandle
-
- org.eclipse.birt.report.model.api.ValueHandle
-
- org.eclipse.birt.report.model.api.SimpleValueHandle
-
- org.eclipse.birt.report.model.api.PropertyHandleImpl
-
- Direct Known Subclasses:
PropertyHandle
public class PropertyHandleImpl extends SimpleValueHandle
A handle for working with a top-level property of an element.- See Also:
PropertyDefn
,PropertyType
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn
propDefn
Definition of the property.-
Fields inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
elementHandle
-
-
Constructor Summary
Constructors Constructor Description PropertyHandleImpl(DesignElementHandle element, java.lang.String propName)
Constructs the handle for a top-level property with the given element handle and property name.PropertyHandleImpl(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)
Constructs the handle for a top-level property with the given element handle and the definition of the property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DesignElementHandle content)
Adds a report item to the property with the given element handle.void
add(DesignElementHandle content, int newPos)
Adds a report item to this property at the given position.void
addItem(java.lang.Object item)
Adds an item to the end of a list property.boolean
canContain(java.lang.String type)
Determines if the slot can contain an element with the type oftype
.boolean
canContain(DesignElementHandle content)
Determines if the given slot can contain thecontent
.void
drop(int posn)
Drops a content element at the given position from the slot, and unresolve any reference property which refers the element to drop.void
drop(DesignElementHandle content)
Drops a content element from the slot, and unresolve any reference property which refers the element to drop.void
dropAndClear(int posn)
Drops a content element at the given position from the slot, and clear any reference property which refers the element to drop.void
dropAndClear(DesignElementHandle content)
Drops a content element from the slot, and clear any reference property which refers the element to drop.boolean
equals(java.lang.Object propertyHandle)
Returns true if the two property handle has the same element and the same property.DesignElementHandle
getContent(int posn)
Gets the content at the given position.int
getContentCount()
Returns the number of elements in the property.java.util.List
getContents()
Returns the a list with contents.Items are handles to the contents and in order by position.org.eclipse.birt.report.model.core.StructureContext
getContext()
Returns the structure context to the value.IPropertyDefn
getDefn()
Gets the generic property definition.java.util.List
getItems()
Gets the items of the list property.java.util.ArrayList
getListValue()
Gets the value as a list.IElementPropertyDefn
getPropertyDefn()
Gets the property definition.protected java.lang.Object
getRawValue()
Gets the value stored in the memory directly.java.util.List
getReferenceableElementList()
returns the element reference value list if the property is element referenceable type.boolean
isLocal()
Determines whether this property value is set locally for this element.boolean
isReadOnly()
Checks whether a value is read-only in the property sheet.boolean
isSet()
Determines whether this property value is set for this element.boolean
isVisible()
Checks whether a value is visible in the property sheet.void
move(DesignElementHandle content, DesignElementHandle newContainer, java.lang.String propName)
Moves a content element into a slot in another container element.void
move(DesignElementHandle content, DesignElementHandle newContainer, java.lang.String propName, int newPos)
Moves a content element into a slot in another container element at the specified position.java.util.List
paste(IDesignElement content)
Pastes a report item to this property.java.util.List
paste(IDesignElement content, int newPos)
Pastes a report item to the property.java.util.List
paste(DesignElementHandle content)
Pastes a report item to this property.java.util.List
paste(DesignElementHandle content, int newPos)
Pastes a report item to the slot.void
removeItem(int posn)
Removes an item from a list property or member.void
setEncryption(java.lang.String encryptionID)
void
setValue(java.lang.Object value)
Implementation of abstract method defined in base class.void
shift(DesignElementHandle content, int toPosn)
Moves the position of a content element within the slot.-
Methods inherited from class org.eclipse.birt.report.model.api.SimpleValueHandle
addItem, clearValue, get, getAt, getChoices, getDefaultUnit, getDisplayValue, getFloatValue, getIntValue, getNumberValue, getStringValue, getTypeCode, getValue, indexOf, insertItem, isList, iterator, moveItem, removeItem, removeItems, replaceItem, setFloatValue, setIntValue, setNumberValue, setStringValue
-
Methods inherited from class org.eclipse.birt.report.model.api.ValueHandle
getReference
-
Methods inherited from class org.eclipse.birt.report.model.api.ElementDetailHandle
getDesign, getElement, getElementHandle, getModule
-
-
-
-
Constructor Detail
-
PropertyHandleImpl
public PropertyHandleImpl(DesignElementHandle element, java.lang.String propName)
Constructs the handle for a top-level property with the given element handle and property name.- Parameters:
element
- a handle to a report elementpropName
- the name of the property
-
PropertyHandleImpl
public PropertyHandleImpl(DesignElementHandle element, org.eclipse.birt.report.model.metadata.ElementPropertyDefn prop)
Constructs the handle for a top-level property with the given element handle and the definition of the property.- Parameters:
element
- a handle to a report elementprop
- the definition of the property.
-
-
Method Detail
-
getPropertyDefn
public IElementPropertyDefn getPropertyDefn()
Description copied from class:ValueHandle
Gets the property definition. This is the definition of the property that contains the specific value. If the value is a structure or member, then this is the definition of the property that contains the list that contains the structure that contains the member.- Specified by:
getPropertyDefn
in classValueHandle
- Returns:
- the property definition
-
getDefn
public IPropertyDefn getDefn()
Description copied from class:SimpleValueHandle
Gets the generic property definition. Its a property definition for an element or a member definition for a structure.- Specified by:
getDefn
in classSimpleValueHandle
- Returns:
- the value definition.
-
getRawValue
protected java.lang.Object getRawValue()
Description copied from class:SimpleValueHandle
Gets the value stored in the memory directly. The returned value won't be done any conversion.- Specified by:
getRawValue
in classSimpleValueHandle
- Returns:
- the value stored in the memory
-
setValue
public void setValue(java.lang.Object value) throws SemanticException
Implementation of abstract method defined in base class.- Specified by:
setValue
in classSimpleValueHandle
- Parameters:
value
- The new value.- Throws:
SemanticException
- If the value is not valid for the property or member.- See Also:
SimpleValueHandle.setIntValue(int)
,SimpleValueHandle.setStringValue(java.lang.String)
,SimpleValueHandle.setFloatValue(double)
,SimpleValueHandle.setNumberValue(java.math.BigDecimal)
,SimpleValueHandle.clearValue()
-
getContext
public org.eclipse.birt.report.model.core.StructureContext getContext()
Description copied from class:ValueHandle
Returns the structure context to the value. The context is used to identify a list entry or member.- Specified by:
getContext
in classValueHandle
-
isSet
public boolean isSet()
Determines whether this property value is set for this element. It is set if it is defined on this element property or any of its parents, or in the element's private style property. It is considered unset if it is set on a shared style.- Returns:
true
if the value is set,false
if it is not set
-
isLocal
public boolean isLocal()
Determines whether this property value is set locally for this element. It is set if and only if it is defined on this element local property.- Returns:
true
if the local value is set, otherwisefalse
.
-
equals
public boolean equals(java.lang.Object propertyHandle)
Returns true if the two property handle has the same element and the same property.- Overrides:
equals
in classjava.lang.Object
- Parameters:
propertyHandle
- the property handle- Returns:
- true if the two property handles are same.
-
getReferenceableElementList
public java.util.List getReferenceableElementList()
returns the element reference value list if the property is element referenceable type.- Returns:
- list of the reference element value.
-
removeItem
public void removeItem(int posn) throws PropertyValueException
Description copied from class:SimpleValueHandle
Removes an item from a list property or member. The handle must be working on a list property or member.- Specified by:
removeItem
in classSimpleValueHandle
- Parameters:
posn
- The position of the item to remove.- Throws:
PropertyValueException
- If the property is not a list property.
-
addItem
public void addItem(java.lang.Object item) throws SemanticException
Description copied from class:SimpleValueHandle
Adds an item to the end of a list property. The handle must be working on a list property.- Specified by:
addItem
in classSimpleValueHandle
- 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.
-
add
public void add(DesignElementHandle content) throws SemanticException
Adds a report item to the property with the given element handle. The report item must not be newly created and not yet added to the design.- Parameters:
content
- handle to the newly created element- Throws:
SemanticException
- if the element is not allowed to insert
-
add
public void add(DesignElementHandle content, int newPos) throws SemanticException
Adds a report item to this property at the given position. The item must not be newly created and not yet added to the design.- Parameters:
content
- handle to the newly created elementnewPos
- the position index at which the content to be inserted, 0-based integer- Throws:
SemanticException
- if the element is not allowed to insert
-
paste
public java.util.List paste(DesignElementHandle content) throws SemanticException
Pastes a report item to this property. The item must be newly created and not yet added to the design.- Parameters:
content
- the newly created element handle- Returns:
- a list containing all errors for the pasted element
- Throws:
SemanticException
- if the element is not allowed to paste
-
paste
public java.util.List paste(IDesignElement content) throws SemanticException
Pastes a report item to this property. The item must be newly created and not yet added to the design.- Parameters:
content
- the newly created element- Returns:
- a list containing all errors for the pasted element
- Throws:
SemanticException
- if the element is not allowed to paste
-
paste
public java.util.List paste(DesignElementHandle content, int newPos) throws SemanticException
Pastes a report item to the slot. The item must be newly created and not yet added to the design.- Parameters:
content
- the newly created element handlenewPos
- the position index at which the content to be inserted.- Returns:
- a list containing all errors for the pasted element
- Throws:
SemanticException
- if the element is not allowed in the slot
-
paste
public java.util.List paste(IDesignElement content, int newPos) throws SemanticException
Pastes a report item to the property. The item must be newly created and not yet added to the design.- Parameters:
content
- the newly created elementnewPos
- the position index at which the content to be inserted.- Returns:
- a list containing all errors for the pasted element
- Throws:
SemanticException
- if the element is not allowed in the property
-
getListValue
public java.util.ArrayList getListValue()
Description copied from class:SimpleValueHandle
Gets the value as a list.- Overrides:
getListValue
in classSimpleValueHandle
- Returns:
- The value as a list. Returns null if the value cannot be converted to a list.
-
getContents
public java.util.List getContents()
Returns the a list with contents.Items are handles to the contents and in order by position.- Returns:
- a list with property contents, items of the list are handles to the contents.
-
getContentCount
public int getContentCount()
Returns the number of elements in the property.- Returns:
- the count of contents in the property
-
shift
public void shift(DesignElementHandle content, int toPosn) throws ContentException
Moves the position of a content element within the slot.- Parameters:
content
- handle to the content to movetoPosn
- the new position- Throws:
ContentException
- if the content is not in the slot, or if the to position is not valid.
-
move
public void move(DesignElementHandle content, DesignElementHandle newContainer, java.lang.String propName) throws ContentException
Moves a content element into a slot in another container element.- Parameters:
content
- a handle to the element to movenewContainer
- a handle to the new container elementpropName
- the target property name where the element will be moved to.- Throws:
ContentException
- if the content is not in this slot or if the new container is not, in fact, a container, or if the content cannot go into the target slot.
-
move
public void move(DesignElementHandle content, DesignElementHandle newContainer, java.lang.String propName, int newPos) throws ContentException
Moves a content element into a slot in another container element at the specified position.- Parameters:
content
- a handle to the element to movenewContainer
- a handle to the new container elementpropName
- the target property name where the element will be moved to.newPos
- the position to which the content will be moved. If it is greater than the current size of the target slot, the content will be appended at the end of the target slot.- Throws:
ContentException
- if the content is not in this slot or if the new container is not, in fact, a container, or if the content cannot go into the target slot.
-
dropAndClear
public void dropAndClear(DesignElementHandle content) throws SemanticException
Drops a content element from the slot, and clear any reference property which refers the element to drop.- Parameters:
content
- a handle to the content to drop- Throws:
SemanticException
- if the content is not within the slot
-
drop
public void drop(DesignElementHandle content) throws SemanticException
Drops a content element from the slot, and unresolve any reference property which refers the element to drop.- Parameters:
content
- a handle to the content to drop- Throws:
SemanticException
- if the content is not within the slot
-
dropAndClear
public void dropAndClear(int posn) throws SemanticException
Drops a content element at the given position from the slot, and clear any reference property which refers the element to drop.- Parameters:
posn
- the position of the content to drop- Throws:
SemanticException
- if the position is out of range
-
drop
public void drop(int posn) throws SemanticException
Drops a content element at the given position from the slot, and unresolve any reference property which refers the element to drop.- Parameters:
posn
- the position of the content to drop- Throws:
SemanticException
- if the position is out of range
-
canContain
public boolean canContain(java.lang.String type)
Determines if the slot can contain an element with the type oftype
.- Parameters:
type
- the name of the element type, like "Table", "List", etc.- Returns:
true
if the slot can contain the an element withtype
type, otherwisefalse
.
-
canContain
public boolean canContain(DesignElementHandle content)
Determines if the given slot can contain thecontent
.- Parameters:
content
- the design element handle to check- Returns:
true
if the slot with the givenslotId
can contain thecontent
, otherwisefalse
.
-
getContent
public DesignElementHandle getContent(int posn)
Gets the content at the given position.- Parameters:
posn
- the index where the content resides- Returns:
- the corresponding element
-
setEncryption
public void setEncryption(java.lang.String encryptionID) throws SemanticException
- Parameters:
encryptionID
-- Throws:
SemanticException
-
getItems
public java.util.List getItems()
Description copied from class:SimpleValueHandle
Gets the items of the list property. The handle must be working on a list property or member.- Overrides:
getItems
in classSimpleValueHandle
- Returns:
- the list of items, or null if the property is not a list property.
-
isVisible
public boolean isVisible()
Description copied from class:SimpleValueHandle
Checks whether a value is visible in the property sheet.- Specified by:
isVisible
in classSimpleValueHandle
- Returns:
true
if it is visible. Otherwisefalse
.
-
isReadOnly
public boolean isReadOnly()
Description copied from class:SimpleValueHandle
Checks whether a value is read-only in the property sheet.- Specified by:
isReadOnly
in classSimpleValueHandle
- Returns:
true
if it is read-only. Otherwisefalse
.
-
-