Class DesignElementHandle
- All Implemented Interfaces:
org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
- Direct Known Subclasses:
ContentElementHandle
,ModuleHandleImpl
,MultiViewsHandle
,ReportElementHandle
Element handles are immutable. Once created, they always point to the same element. Handles also cannot point to a null element. An assertion will be raised if the derived classes are created with a null element.
For a complete description of the services available for any design element,
see the class description for the
DesignElement
class.
- See Also:
-
SlotHandle
DesignElement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.eclipse.birt.report.model.core.Module
Provides overall information about the root element.Fields inherited from interface org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
COMMENTS_PROP, CUSTOM_XML_PROP, DISPLAY_NAME_ID_PROP, DISPLAY_NAME_PROP, EVENT_HANDLER_CLASS_PROP, EXTENDS_PROP, FULL_LABEL, ID_SUFFIX, NAME_PROP, NEW_HANDLER_ON_EACH_EVENT_PROP, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROP
-
Constructor Summary
ConstructorsConstructorDescriptionDesignElementHandle
(org.eclipse.birt.report.model.core.Module module) Constructs a handle with the given module. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String propName, DesignElementHandle content) Adds a report item to the property with the given element handle.void
add
(String propName, DesignElementHandle content, int newPos) Adds a report item to this property at the given position.void
addElement
(DesignElementHandle child, int slotId) Adds a report item to the end of the given slot.void
addElement
(DesignElementHandle child, int slotId, int pos) Adds a report item to the given slot at the given position.void
addListener
(Listener obj) Registers a change event listener.void
Adds a user-defined property definition.protected void
Constructs slot handles in the constructor to make sure that getMumble() methods won't construct any new instance.boolean
canContain
(int slotId, String type) Determines if the slot can contain an element with the type oftype
.boolean
canContain
(int slotId, DesignElementHandle content) Determines if the given slot can contain thecontent
.boolean
canContain
(String propName, String type) Determines if the slot can contain an element with the type oftype
.boolean
canContain
(String propName, DesignElementHandle content) Determines if the given slot can contain thecontent
.boolean
canDrop()
Determines if this element can be dropped from its container.boolean
canEdit()
Determines if this element is editable or not.boolean
Determines if the current element can be transformed to a template element.void
Clears values of all properties.void
clearContents
(int slotId) Clears all the content within the given slot.void
clearProperty
(String propName) Clears the value of a property.Returns an iterator over the clients of this element.copy()
Deeply clones the current design element which is wrapped by the handle.void
copyPropertyTo
(String propName, DesignElementHandle targetHandle) Copies all properties to the target element.createTemplateElement
(String name) Creates a template element handle and transforms the current element handle to the created template element.Returns an iterator over the elements that derive from this one.static void
Sorts a list of elements by localized display name.void
drop()
Drops this element from the design.void
Drops a content element at the given position from the container, and unresolve any reference property which refers the element to drop.void
drop
(String propName, DesignElementHandle content) Drops a content element from the container, and unresolve any reference property which refers the element to drop.void
Drops this element from the design.void
dropAndClear
(String propName, int posn) Drops a content element at the given position from the container, and clear any reference property which refers the element to drop.void
dropAndClear
(String propName, DesignElementHandle content) Drops a content element from the container, and clear any reference property which refers the element to drop.void
dropUserPropertyDefn
(String propName) Removes an existing user property definition from the element.int
findContentSlot
(DesignElementHandle content) Finds the slot within this element that contains the given element.boolean
getBooleanProperty
(String propName) Returns the value of a property as a Boolean.IChoice[]
getChoices
(String propName) Returns a array of valid choices for a property.getColorProperty
(String propName) Returns a handle to work with a color property.Returns a handle to the element that contains this element.Gets a handle for the container's property what holds this element.Returns the a handle the the container's slot that holds this element.getContent
(String propName, int index) Gets a handle to the content element at the given position.int
getContentCount
(String propName) Returns the number of elements in the property.getContents
(String propName) Returns the a list with contents.Items are handles to the contents and in order by position.getDefn()
Gets the definition of the element.org.eclipse.birt.report.model.elements.ReportDesign
Deprecated.replaced by getModule()Deprecated.replaced by getModuleHandle()getDimensionProperty
(String propName) Returns a handle to work with a Dimension property.Returns the short display label for this element.getDisplayLabel
(int level) Returns the display label for this element.getDisplayProperty
(String propName) Return a localized string version of the property.protected org.eclipse.birt.report.model.core.Module
Returns the effective module of the element.abstract org.eclipse.birt.report.model.core.DesignElement
Returns the element to which this handle is attached.Returns the element factory for creating new report elements.getElementProperty
(String propName) Returns the value of an element reference property.Gets a string that defines the event handle class.getExpressionProperty
(String propName) Returns a handle to work with an expression property.Returns a handle to the element that this element extends.getExternalizedValue
(String textIDProp, String textProp) Returns externalized message.getExternalizedValue
(String textIDProp, String textProp, com.ibm.icu.util.ULocale locale) Returns externalized message.getExternalizedValue
(String textIDProp, String textProp, Locale locale) Returns externalized message.Gets the factory element handle for this element.getFactoryPropertyHandle
(String propName) Returns a handle for a top-level property for use in preparing the Factory data structures.double
getFloatProperty
(String propName) Returns the value of a property as a double.protected FontHandle
Gets the font handle for the element.Returns the full name of this element.Return the direct host element handle for this view element.long
getID()
Returns the unique ID for this object.int
getIndex()
Gets the position where this element resides in its container.int
getIntProperty
(String propName) Returns the value of a property as an integer.getListProperty
(String propName) Gets the value of a property as a list.getListProperty
(org.eclipse.birt.report.model.core.Module module, String propName) Deprecated.replaced bygetListProperty(String)
Returns the methods defined on the element definition.org.eclipse.birt.report.model.core.Module
Returns the module on which this handle is attached.Returns the handle of module.getName()
Returns the name of this element.getNumberProperty
(String propName) Returns the value of a property as a number (BigDecimal).Returns a handle to work with the style properties of this element.getProperty
(String propName) Returns the value of a property as a generic object.getPropertyBinding
(String propName) Deprecated.instead use getPropertyBindingExpression( String propName )getPropertyBindingExpression
(String propName) Returns the overridden value of the specified property given its internal name.Gets all the defined property bindings for the given element.getPropertyDefn
(String propName) Gets the property data for either a system-defined or user-defined property.getPropertyHandle
(String propName) Returns a property handle for a top-level property.Returns an iterator over the properties of this element.Gets the name of this element.getRoot()
Returns the root container of this element.Returns the semantic error list, each of which is the instance ofErrorDetail
.getSlot
(int slotID) Returns a handle to the given slot.getStringProperty
(String propName) Returns the value of a property as a string which is locale independent.getStyle()
Returns the shared style, if any, as a style handle.Returns a list of user properties defined in this element and somewhere up the inheritance chain.getUserPropertyDefnHandle
(String propName) Returns a user-defined property handle for a top-level property.getXPath()
Returns return the path corresponding to the current position of the element in the tree.boolean
Returnstrue
if this element has any locally-defined property values.boolean
Justifies whether this element has any semantic error or not.protected final void
Constructs slot handles in the constructor to make sure that getMumble() methods won't construct any new instance.boolean
Examines whether the resolved direction of this design element is Right to Left or not.boolean
Checks whether the given element is contained by one of template parameter definition.boolean
Checks whether this element is based on a template parameter definition or not.boolean
isValid()
Returns whether the element is valid or not.void
localize()
Localize the element, break the parent/child relationship and set all the extended properties locally.void
move
(String fromPropName, DesignElementHandle content, DesignElementHandle newContainer, String toPropName) Moves a content element from this element into a property in another container element.void
move
(String fromPropName, DesignElementHandle content, DesignElementHandle newContainer, String toPropName, int newPos) Moves a content element into a property in another container element at the specified position.void
moveTo
(int posn) Moves this element handle to the given position within its container.void
moveTo
(DesignElementHandle newContainer, int toSlot) Moves this element to a new location within the design.void
moveTo
(DesignElementHandle newContainer, String toPropName) Moves this element to a property in another container element.void
moveTo
(DesignElementHandle newContainer, String toPropName, int newPos) Moves this element to a property in another container element at the specified position.boolean
Gets the newHandlerOnEachEvent property value.paste
(String propName, IDesignElement content) Pastes a report item to this property.paste
(String propName, IDesignElement content, int newPos) Pastes a report item to the property.paste
(String propName, DesignElementHandle content) Pastes a report item to this property.paste
(String propName, DesignElementHandle content, int newPos) Pastes a report item to the slot.void
removeListener
(Listener obj) Removes a given listener.void
if this design element is based on a template definitionisTemplateParameterValue()
,get rid of the template definition )revertToTemplate
(String name) Creates a template element handle and transforms the current element handle to the created template element if the current element is based on a template parameter definition.Checks this element with semantic rules.void
setBooleanProperty
(String propName, boolean value) Sets the boolean value to the property.void
setEncryption
(String propName, String encryptionID) Sets the encryption for an encryptable property.void
setEventHandlerClass
(String expr) Sets the group expression.void
setExpressionProperty
(String propName, Expression expression) Sets the value of a property to an expression.void
setExtends
(DesignElementHandle parent) Sets this element to extend the given element.void
setExtendsElement
(org.eclipse.birt.report.model.core.DesignElement parent) Deprecated.void
setExtendsName
(String name) Sets the name of the element that this element extends.void
setFloatProperty
(String propName, double value) Sets the value of a property to a double.void
setIntProperty
(String propName, int value) Sets the value of a property to an integer.void
Sets the name of this element.void
setNewHandlerOnEachEvent
(boolean newHandler) Sets the newHandlerOnEachEvent property value.void
setNumberProperty
(String propName, BigDecimal value) Sets the value of a property to a number (BigDecimal).void
setProperties
(Map properties) Sets a bunch of property values on the element.void
setProperty
(String propName, Object value) Sets the value of a property from a generic object.void
setPropertyBinding
(String propName, String value) Deprecated.instead use setPropertyBinding( String propName, Expression value )void
setPropertyBinding
(String propName, Expression value) Sets the mask of the specified property.void
setStringProperty
(String propName, String value) Sets the value of a property to a string.void
setStyle
(SharedStyleHandle style) Sets the shared style element for this element.void
setStyleElement
(org.eclipse.birt.report.model.core.StyleElement obj) Deprecated.void
setStyleName
(String name) Sets the name of the shared style for this element.void
setValid
(boolean isValid) Sets the status that identifies whether the element is valid or not.void
shift
(String propName, DesignElementHandle content, int toPosn) Moves the position of a content element within this container.boolean
Determines whether to show an error item on the element or not.Returns the iterator for slot defined on the element.
-
Field Details
-
module
protected final org.eclipse.birt.report.model.core.Module moduleProvides overall information about the root element. If the element is on the design tree, the root is corresponding library/design. If the element is not on the tree, the root is the module of ElementFactory that creates thisDesignElementHandle
.
-
-
Constructor Details
-
DesignElementHandle
public DesignElementHandle(org.eclipse.birt.report.model.core.Module module) Constructs a handle with the given module.- Parameters:
module
- the module
-
-
Method Details
-
initializeSlotHandles
protected final void initializeSlotHandles()Constructs slot handles in the constructor to make sure that getMumble() methods won't construct any new instance. -
cachePropertyHandles
protected void cachePropertyHandles()Constructs slot handles in the constructor to make sure that getMumble() methods won't construct any new instance. -
getDesign
Deprecated.replaced by getModule()Returns the report design only when the module is report design. Otherwise, null is returned. So this method can also be used to check whether this element is in report design or library.- Returns:
- the report design, or null if the module is not report design.
-
getModule
public org.eclipse.birt.report.model.core.Module getModule()Returns the module on which this handle is attached. The returned module must beReportDesign
orLibrary
.- Returns:
- the module on which this handle is attached.
-
getDesignHandle
Deprecated.replaced by getModuleHandle()Returns the handle of report design only when the module is report design. Otherwise, null is returned.- Returns:
- the handle of report design, or null if the module is not report design.
-
getModuleHandle
Returns the handle of module. The returned module must beReportDesignHandle
orLibraryHandle
.- Returns:
- the handle of module
-
getElement
public abstract org.eclipse.birt.report.model.core.DesignElement getElement()Returns the element to which this handle is attached.- Returns:
- The attached element. Will be null if the handle is not attached.
-
getDefn
Gets the definition of the element. The definition provides meta-data about the element, such as its type name, list of defined properties, list of slots and so on.- Returns:
- the meta-data definition of the element
-
getProperty
Returns the value of a property as a generic object. The value is the internal property value, it is not localized. For a property with the element reference type, the reference element name is returned.- Parameters:
propName
- the name of the property of interest- Returns:
- the value of the property. The type of the returned object depends on the property type.
- See Also:
-
getStringProperty
Returns the value of a property as a string which is locale independent.- Parameters:
propName
- the name of the property- Returns:
- the internal string property value of the property.
-
getDisplayProperty
Return a localized string version of the property. This method will works for all property types except a list. Dates and numbers will be converted using the current locale. Display name will be returned for a choice or a color property.- Parameters:
propName
- the name of the property- Returns:
- a localized string version of the property.
-
getBooleanProperty
Returns the value of a property as a Boolean.- Parameters:
propName
- the name of the property- Returns:
- the value as a boolean
-
getIntProperty
Returns the value of a property as an integer.- Parameters:
propName
- the name of the property.- Returns:
- the value as an integer. Return 0 if the value cannot be converted to an integer.
-
getFloatProperty
Returns the value of a property as a double.- Parameters:
propName
- the name of the property.- Returns:
- the value as a double. Returns
null
if the value cannot be converted to a double.
-
getNumberProperty
Returns the value of a property as a number (BigDecimal).- Parameters:
propName
- the name of the property.- Returns:
- the value as a number. Returns
null
if the value cannot be converted to a number.
-
getDimensionProperty
Returns a handle to work with a Dimension property. Returns null if the given property is not defined or not dimension property.- Parameters:
propName
- name of the property.- Returns:
- a corresponding DimensionHandle to deal with the dimension property.
Return
null
if the property is defined or not dimension property. - See Also:
-
getColorProperty
Returns a handle to work with a color property. Returns null if the given property is not defined or not color property.- Parameters:
propName
- name of the property.- Returns:
- a corresponding ColorHandle to with with the color property. Return
null
if the given property is not defined or not color property. - See Also:
-
getFontProperty
Gets the font handle for the element. If this element defines a font family property, return aFontHandle
. Otherwise, returnnull
.- Returns:
- a corresponding FontHandle or
null
. - See Also:
-
getElementProperty
Returns the value of an element reference property. Returns a handle to the referenced element, ornull
if the reference is unresolved or unset.- Parameters:
propName
- the name of the property.- Returns:
- a corresponding DesignElement handle to the referenced element
-
getListProperty
@Deprecated public List getListProperty(org.eclipse.birt.report.model.core.Module module, String propName) Deprecated.replaced bygetListProperty(String)
Gets the value of a property as a list.- Parameters:
module
- the modulepropName
- the name of the property to get- Returns:
- the value as an
ArrayList
, or null if the property is not set or the value is not a list
-
getListProperty
Gets the value of a property as a list.- Parameters:
module
- the modulepropName
- the name of the property to get- Returns:
- the value as an
ArrayList
, or null if the property is not set or the value is not a list
-
setProperty
Sets the value of a property from a generic object. The value can be any of the supported types: String, Double, Integer, BigDecimal or one of the specialized property types. The type of object allowed depends on the type of the property.- Parameters:
propName
- the property namevalue
- the value to set- Throws:
SemanticException
- if the property is undefined on the element or the value is invalid.
-
setIntProperty
Sets the value of a property to an integer.- Parameters:
propName
- the property namevalue
- 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.
-
setStringProperty
Sets the value of a property to a string. 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".WARNING: Numbers are parsed according to the number format of the currently active locale.
- Parameters:
propName
- the property namevalue
- the value to set- Throws:
SemanticException
- if the value of a choice or other property is incorrect.
-
setFloatProperty
Sets the value of a property to a double. When used for dimension properties, the units of the dimension are assumed to be in application units.- Parameters:
propName
- the property namevalue
- the value to set- Throws:
SemanticException
- If the property value cannot be converted from a double.
-
setNumberProperty
Sets the value of a property to a number (BigDecimal).- Parameters:
propName
- the property namevalue
- the value to set- Throws:
SemanticException
- if the property value cannot be converted from a number.
-
setBooleanProperty
Sets the boolean value to the property.- Parameters:
propName
- the name of the property to setvalue
- the boolean value to set- Throws:
SemanticException
- if the property is not defined or value is invalid
-
clearProperty
Clears the value of a property. Clearing a property removes any value set for the property on this element. After this, the element will now inherit the property from its parent element, style, or from the default value for the property.- Parameters:
propName
- the name of the property to clear.- Throws:
SemanticException
- if the property is not defined on this element
-
clearAllProperties
Clears values of all properties. Clearing a property removes any value set for the property on this element. After this, the element will now inherit the property from its parent element, style, or from the default value for the property.- Throws:
SemanticException
- if the property is not defined on this element
-
hasLocalProperties
public boolean hasLocalProperties()Returnstrue
if this element has any locally-defined property values. Returnsfalse
otherwise.- Returns:
- True if the element has property values, false if not.
-
addUserPropertyDefn
Adds a user-defined property definition. The property definition must have a valid name and property type. The other attributes can be set either before or after adding the property to the element. The application can modify the property definition directly before adding the property to an element. However, the application must use a structure handle to modify the definition after it has been added to an element.- Parameters:
prop
- the user property definition to add. The name and property type must be valid.- Throws:
UserPropertyException
- if the element is not allowed to have user property or the user property definition is invalid, or if the value of the user-defined choice is invalid for the type of user property definition, the property type is incorrect.
-
addElement
public void addElement(DesignElementHandle child, int slotId, int pos) throws ContentException, NameException Adds a report item to the given slot at the given position. The item must be newly created and not yet added to the design.- Parameters:
child
- handle to the newly created elementslotId
- slot id in which the child item will be added.pos
- position in the slot that the child item will be added.- Throws:
ContentException
- if the element is not allowed in the slotNameException
- if the element has a duplicate or illegal name
-
addElement
public void addElement(DesignElementHandle child, int slotId) throws ContentException, NameException Adds a report item to the end of the given slot. The item must be newly created and not yet added to the design.- Parameters:
child
- handle to the newly created elementslotId
- slot id in which the child item will be added.- Throws:
ContentException
- if the element is not allowed in the slotNameException
- if the element has a duplicate or illegal name
-
getMethods
Returns the methods defined on the element definition.- Returns:
- List contains the methods.
-
setProperties
Sets a bunch of property values on the element. If this operation should be treated as a whole, execution should be in a transaction.- Parameters:
properties
- a Map store the property values keyed by the property name.- Throws:
SemanticException
- if the property is undefined on the element or the value is invalid.- See Also:
-
clearContents
Clears all the content within the given slot. If this operation should be treated as a whole, execution should be in a transaction.- Parameters:
slotId
- id of the slot to be cleared.- Throws:
SemanticException
-
dropUserPropertyDefn
Removes an existing user property definition from the element. This method will remove all existing values for the property, in both this element and all its derived elements.- Parameters:
propName
- the name of the user property to remove- Throws:
UserPropertyException
- If the property is not found.
-
getExtends
Returns a handle to the element that this element extends.- Returns:
- the parent element. Returns
null
if this element does not have a parent, or if the extends name does not resolve to a valid element.
-
setExtends
Sets this element to extend the given element.- Parameters:
parent
- handle to the element that this element is to extend. Ifnull
, then this element will no longer extend another element.- Throws:
ExtendsException
- if the parent element is of the wrong type as this element.
-
setExtendsName
Sets the name of the element that this element extends. The name must resolve to an element of the same type as this element.- Parameters:
name
- the name of the element that this one is to extend- Throws:
ExtendsException
- if no element exists with the given name, or if the element is of the wrong type.
-
localize
Localize the element, break the parent/child relationship and set all the extended properties locally.- Throws:
SemanticException
- the element can not be localized properly. It may be because that the element is not extended from a parent, or that same properties can not be localized on the element or the content elements inside it.
-
setExtendsElement
@Deprecated public void setExtendsElement(org.eclipse.birt.report.model.core.DesignElement parent) throws ExtendsException Deprecated.Sets this element to extend the given element.- Parameters:
parent
- the element that this element is to extend- Throws:
ExtendsException
- If the parent element is of the wrong type as this element.
-
getStyle
Returns the shared style, if any, as a style handle. A shared style is a style that defines in the "styles" slot of the report design.- Returns:
- a handle to the shared style used by this element. Returns null if the style is not set, or if the element does not support a style.
- See Also:
-
setStyleName
Sets the name of the shared style for this element.- Parameters:
name
- the name of the shared style. Ifnull
, then the shared style name is cleared.- Throws:
StyleException
- If the name is not valid, or if this element does not support a style.- See Also:
-
setStyleElement
@Deprecated public void setStyleElement(org.eclipse.birt.report.model.core.StyleElement obj) throws StyleException Deprecated.Sets the shared style element for this element.- Parameters:
obj
- the shared style. Ifnull
, then the shared style is cleared.- Throws:
StyleException
- If this element does not support a style.- See Also:
-
getPrivateStyle
Returns a handle to work with the style properties of this element. Use a style handle to work with the specific getter/setter methods for each style property. The style handle is not necessary to work with style properties generically.Note a key difference between this method and the
getStyle( )
method. This method returns a handle to the this element. ThegetStyle( )
method returns a handle to the shared style, if any, that this element references.- Returns:
- a style handle to work with the style properties of this element.
Returns
null
if this element does not have style properties.
-
getName
Returns the name of this element. Returnsnull
if the element does not have a name. Many elements do not require a name. The name does not inherit. If this element does not have a name, it will not inherit the name of its parent element.- Returns:
- the element name, or null if the name is not set
-
getFullName
Returns the full name of this element. Generally, the full name is identical with the name of the element. That is the returned value is just what returned bygetName()
.However, some elements have a local name scope and its full name is not the name of the element itself. For example, the name of the level is managed by its contaienr dimension element. Therefore its full name is that name of the container dimension appends character '/' and appends the name of the level itself, like dimensionName/levelName. If the level has no container dimension, then its full name is the same as the name.- Returns:
- the full name of the element
-
getQualifiedName
Gets the name of this element. The returned element name will be the same asgetName()
, plus the namespace of the module that the element is contained, if the element name resides in the whole design tree scope; otherwise we will append the name of the holder where the element name resides. If the element is existed in the current module,this method andgetName()
will return identical results.- Returns:
- the qualified name of the element.
-
setName
Sets the name of this element. If the name isnull
, then the name is cleared if this element does not require a name.- Parameters:
name
- the new name- Throws:
NameException
- if the name is duplicate, or if the name isnull
and this element requires a name.
-
getID
public long getID()Returns the unique ID for this object. The ID is valid only within this one design session. IDs are available only if the application is configured to use IDs. In general, the web client requires IDs, but the Eclipse client does not.- Returns:
- the element ID
- See Also:
-
ModuleHandleImpl.getElementByID(long)
MetaDataDictionary.enableElementID()
-
getElementFactory
Returns the element factory for creating new report elements. After creating the element, add it to the design by calling the theadd
- Returns:
- a handle to the new element.
- See Also:
-
getPropertyHandle
Returns a property handle for a top-level property. A top-level property is a property that defines on an element.- Parameters:
propName
- the name of the property to get- Returns:
- The property handle, or
null
if the no property exists with the given name. - See Also:
-
getUserPropertyDefnHandle
Returns a user-defined property handle for a top-level property. A top-level property is a property that defines on an element.- Parameters:
propName
- the name of the property to get- Returns:
- the user property definition handle, or
null
if the no property exists with the given name or it is not a user-defined property.
-
getUserProperties
Returns a list of user properties defined in this element and somewhere up the inheritance chain. Each object in the list is instance ofUserPropertyDefn
.- Returns:
- The list of user property definitions
-
getFactoryPropertyHandle
Returns a handle for a top-level property for use in preparing the Factory data structures. This handle follows specialized rules:- Optimized to get each property value only once.
- Indicates if the value is a style property.
- Indicates if a style property is set on the element's private style or a shared style.
- Performs property conversions as needed for the Factory context.
- Parameters:
propName
- the name of the property to get- Returns:
- the factory property handle, or
null
if either 1) no property exists with the given name or 2) the property is a style property and is not set in a private style.
-
getContainer
Returns a handle to the element that contains this element. Every element except the report design has a container. The container of a parameter, shared style, data source or data set is the report design itself. The container of a report item is the section or other report item in which it appears.- Returns:
- a handle to the container element.
-
moveTo
Moves this element to a new location within the design.- Parameters:
newContainer
- the new container elementtoSlot
- the target slot within the new container- Throws:
ContentException
- If the element cannot be placed into the target element or slot, perhaps because the element is of the wrong type, the slot is full, or other error.- See Also:
-
dropAndClear
Drops this element from the design. Removes the element from its container and name space, if any.Note: If this element is referencable, the property referring it will be set null.
- Throws:
SemanticException
- if this element has no container or the element cannot be dropped.- See Also:
-
drop
Drops this element from the design. Removes the element from its container and name space, if any.Note: If this element is referencable, the property referring it will be unresolved.
- Throws:
SemanticException
- if this element has no container or the element cannot be dropped.- See Also:
-
findContentSlot
Finds the slot within this element that contains the given element.- Parameters:
content
- handle to the content element to find- Returns:
- The ID of the slot that contains the element, or
IDesignElementModel.NO_SLOT
if the element is not contained in this element.
-
getContainerSlotHandle
Returns the a handle the the container's slot that holds this element.- Returns:
- the slot handle in which this element resides,
null
if this element has no container.
-
getContainerPropertyHandle
Gets a handle for the container's property what holds this element.- Returns:
- the property handle in which this element resides,
null
if this element has no container
-
getSlot
Returns a handle to the given slot. If this element has no such slot,null
will be returned.- Parameters:
slotID
- the identifier of the slot for which to obtain a handle- Returns:
- the handle for the requested slot
-
slotsIterator
Returns the iterator for slot defined on the element.- Returns:
- the iterator for
SlotHandle
-
getPropertyIterator
Returns an iterator over the properties of this element. This handle returns all properties defined on this element, whether or not they are actually set on this element.- Returns:
- an iterator over the properties. Each call to
getNext( )
returns an object of typePropertyHandle
. - See Also:
-
PropertyIterator
PropertyHandle
UserPropertyDefnHandle
-
addListener
Registers a change event listener. A listener receives notifications each time an element changes. A listener can be registered any number of times, but will receive each event only once.- Parameters:
obj
- the listener to register
-
removeListener
Removes a given listener. If the listener registered, then the request is silently ignored.- Parameters:
obj
- the listener to de-register
-
derivedIterator
Returns an iterator over the elements that derive from this one.- Returns:
- an iterator over the elements that derive from this one. Each item
returned by the iterator's
getNext( )
method is of typeDesignElementHandle
.
-
clientsIterator
Returns an iterator over the clients of this element. Useful only for styles. Returns a list of all the elements that use this style.- Returns:
- an iterator over the clients of this element. Each item returned by
the iterator's
getNext( )
method is of typeDesignElementHandle
. Nothing will be iterated over an element that is notReferenceableElement
.
-
getChoices
Returns a array of valid choices for a property.- Parameters:
propName
- the property name- Returns:
- a array containing choices for the given property. Return
null
, if this property has no choice.
-
getDisplayLabel
Returns the short display label for this element.- Returns:
- the display label of this element in SHORT_LABEL level.
- See Also:
-
getDisplayLabel
Returns the display label for this element. The display label is the localized display name to be shown in the UI. The display label is one of the following:- The localized display name of this element, if the display name resource key is set and the localized string is available
- The static display name property text of this element, if set
- The name of element, if set
- The localized display name of this kind of element, which is defined in metadata, if set
- The name of this kind of element, which is also defined in metadata
The user can also decide at which detail level the display label should be returned. The level can be one of the following options:
- USER_LABEL: Only the first 3 steps are used, if not found, return null
- SHORT_LABEL: All the above steps are used. This will ensure there will be a return value
- FULL_LABEL: Besides the return value of SHORT_LABEL, this option says we need to return additional information. This information is specific to each kind of element and my include row and column position, x and y position and so on. To get this, every child element needs to overwrite this method
- Parameters:
level
- the display label detail level- Returns:
- the display label of this element in a given level
-
doSort
Sorts a list of elements by localized display name.- Parameters:
list
- the list to sort
-
isValid
public boolean isValid()Returns whether the element is valid or not. An element may be valid even though it has some semantic errors.- Returns:
true
if this element is valid, otherwisefalse
.
-
showError
public boolean showError()Determines whether to show an error item on the element or not. Show an error item if the element is invalid or has semantic errors, otherwise not.- Returns:
- true if the element has semantic error or the element is invalid
-
setValid
public void setValid(boolean isValid) Sets the status that identifies whether the element is valid or not.- Parameters:
isValid
- the status to set
-
hasSemanticError
public boolean hasSemanticError()Justifies whether this element has any semantic error or not.- Returns:
- true if the element has any semantic error, otherwise false
-
copy
Deeply clones the current design element which is wrapped by the handle.- Returns:
- the copy of the design element
-
copyPropertyTo
public void copyPropertyTo(String propName, DesignElementHandle targetHandle) throws SemanticException Copies all properties to the target element. The following properties will not be copied.DesignElement.NAME_PROP
DesignElement.EXTENDS_PROP
targetHandle
should be in the same report as this element. And this method should be called in one transaction.- Parameters:
propName
- name of the property to copytargetHandle
- the target element handle- Throws:
SemanticException
- if the target element type is not as same as this element type, or property is not defined .IllegalArgumentException
- if the target element is not in the same report as this element.
-
semanticCheck
Checks this element with semantic rules.- Returns:
- the list of errors, each of which is the
ErrorDetail
object. - See Also:
-
canDrop
public boolean canDrop()Determines if this element can be dropped from its container.- Returns:
true
if it can be dropped. Returnsfalse
otherwise.
-
canEdit
public boolean canEdit()Determines if this element is editable or not. If the element comes from a library, it can not be edited in the report design.- Returns:
- true if it can be edited. false if it can't.
-
canTransformToTemplate
public boolean canTransformToTemplate()Determines if the current element can be transformed to a template element. False will be returned if the element can not be dropped or the container of the current element can not contain the template element.- Returns:
- true if it can be transformed, otherwise false.
-
canContain
Determines if the slot can contain an element with the type oftype
. Even return value istrue
, doesn't mean the element can be added/moved without exceptions.- Parameters:
slotId
- the slot idtype
- the name of the element type, like "Table", "List", etc.- Returns:
true
if the slot can contain the an element withtype
type, otherwisefalse
.- See Also:
-
canContain
Determines if the given slot can contain thecontent
. Even return value istrue
, doesn't mean the element can be added/moved without exceptions.- Parameters:
slotId
- the slot idcontent
- the design element handle to check- Returns:
true
if the slot with the givenslotId
can contain thecontent
, otherwisefalse
.- See Also:
-
canContain
Determines if the slot can contain an element with the type oftype
. Even return value istrue
, doesn't mean the element can be added/moved without exceptions.- Parameters:
propName
- name of the property where the type to inserttype
- the name of the element type, like "Table", "List", etc.- Returns:
true
if the slot can contain the an element withtype
type, otherwisefalse
.- See Also:
-
canContain
Determines if the given slot can contain thecontent
. Even return value istrue
, doesn't mean the element can be added/moved without exceptions.- Parameters:
propName
- the name of the property where the content to insertcontent
- the design element handle to check- Returns:
true
if the slot with the givenslotId
can contain thecontent
, otherwisefalse
.- See Also:
-
getSemanticErrors
Returns the semantic error list, each of which is the instance ofErrorDetail
.- Returns:
- the semantic error list.
-
getRoot
Returns the root container of this element. It must be Library or Report Design.- Returns:
- the handle of the root container.
-
getXPath
Returns return the path corresponding to the current position of the element in the tree. This path string helps user locate this element in user interface. It follows XPath syntax. Each node name indicates the name of the element definition and the 1-based element position in the slot. The position information is only available when the element is in the multicardinality slot.For example,
- /report/Body[1]/Label[3] - The third label element in body slot
- /report/Styles[1]/Style[1] - The first style in the styles slot
- /report/page-setup[1]/Graphic Master Page - The master page in the page setup slot.
Note: the localized name is used for element type and slot name.
- Returns:
- the path of this element
-
getEventHandlerClass
Gets a string that defines the event handle class.- Returns:
- the expression as a string
- See Also:
-
setEventHandlerClass
Sets the group expression.- Parameters:
expr
- the expression to set- Throws:
SemanticException
- If the expression is invalid.- See Also:
-
newHandlerOnEachEvent
public boolean newHandlerOnEachEvent()Gets the newHandlerOnEachEvent property value. This property controls if the event handler should be created.- Returns:
- the newHandlerOnEachEvent property value.
-
setNewHandlerOnEachEvent
Sets the newHandlerOnEachEvent property value. This property controls if the event handler should be created.- Parameters:
newHandler
- controls if the event handler should be reloaded.- Throws:
SemanticException
-
createTemplateElement
Creates a template element handle and transforms the current element handle to the created template element.- Parameters:
name
- the name of created template element handle- Returns:
- the template element handle
- Throws:
SemanticException
- if the current element can not be transformed to a template element, current module is not a report design or some containing contexts don't match
-
revertToTemplate
Creates a template element handle and transforms the current element handle to the created template element if the current element is based on a template parameter definition.- Parameters:
name
- the name of created template element handle- Returns:
- the template element handle
- Throws:
SemanticException
- if the current element can not be transformed to a template element, current element has no template parameter definition, current module is not a report design or some containing contexts don't match
-
revertToReportItem
if this design element is based on a template definitionisTemplateParameterValue()
,get rid of the template definition )- Throws:
SemanticException
-
isTemplateParameterValue
public boolean isTemplateParameterValue()Checks whether this element is based on a template parameter definition or not. Call this method before calling methodrevertToTemplate(String)
to assure that this element can be reverted to a template element. If this method returns false, methodrevertToTemplate(String)
must fail too.- Returns:
- true if this element is based on a template parameter definition, otherwise false
-
getPropertyDefn
Gets the property data for either a system-defined or user-defined property.- Parameters:
propName
- The name of the property to lookup.- Returns:
- The property definition, or null, if the property is undefined.
-
getEffectiveModule
protected org.eclipse.birt.report.model.core.Module getEffectiveModule()Returns the effective module of the element. If the element is attached to the design/library, the design/library is returned. Otherwise, the module cached in theDesignElementHandle
is returned.- Returns:
- the effective module of the element. Can be null.
-
getPropertyBinding
Deprecated.instead use getPropertyBindingExpression( String propName )Returns the overridden value of the specified property given its internal name.- Parameters:
propName
- the name of the property to get. Can be a system-defined or user-defined property name.- Returns:
- the property binding, or null if the overridden value is not set
-
getPropertyBindings
Gets all the defined property bindings for the given element. Each one in the list is instance ofPropertyBinding
.- Returns:
- the property binding list defined for the element
-
setPropertyBinding
Deprecated.instead use setPropertyBinding( String propName, Expression value )Sets the mask of the specified property.- Parameters:
propName
- the property name to get. Can be a system-defined or user-defined property name.value
- the overridden value- Throws:
SemanticException
- if the maskValue is not one of the above.
-
getExternalizedValue
Returns externalized message.- Parameters:
textIDProp
- the display key property nametextProp
- the property name- Returns:
- externalized message.
-
getExternalizedValue
public String getExternalizedValue(String textIDProp, String textProp, com.ibm.icu.util.ULocale locale) Returns externalized message.- Parameters:
textIDProp
- the display key property nametextProp
- the property namelocale
- the locale to externalize the message- Returns:
- externalized message.
-
getExternalizedValue
Returns externalized message.- Parameters:
textIDProp
- the display key property nametextProp
- the property namelocale
- the locale to externalize the message- Returns:
- externalized message.
-
getIndex
public int getIndex()Gets the position where this element resides in its container.- Returns:
- the index where this element resides in its container, otherwise -1 if this element has no container
-
add
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:
propName
- name of the property where the content to insertcontent
- handle to the newly created element- Throws:
SemanticException
- if the element is not allowed to insert
-
add
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:
propName
- name of the property where the content to insertcontent
- 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
Pastes a report item to this property. The item must be newly created and not yet added to the design.- Parameters:
propName
- name of the property where the content to insertcontent
- 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
Pastes a report item to this property. The item must be newly created and not yet added to the design.- Parameters:
propName
- name of the property where the content to insertcontent
- 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 List paste(String propName, 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:
propName
- name of the property where the content to insertcontent
- 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
Pastes a report item to the property. The item must be newly created and not yet added to the design.- Parameters:
propName
- name of the property where the content to insertcontent
- 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
-
getContents
Returns the a list with contents.Items are handles to the contents and in order by position.- Parameters:
propName
- name of the property where the contents reside- Returns:
- a list with property contents, items of the list are handles to the contents.
-
getContentCount
Returns the number of elements in the property.- Parameters:
propName
- name of the property where the contents reside- Returns:
- the count of contents in the property
-
getContent
Gets a handle to the content element at the given position.- Parameters:
propName
- name of the property where the content residesindex
- the specified position to find- Returns:
- the content handle if found, otherwise null
-
shift
public void shift(String propName, DesignElementHandle content, int toPosn) throws SemanticException Moves the position of a content element within this container.- Parameters:
propName
- name of the property where the content residescontent
- handle to the content to movetoPosn
- the new position- Throws:
SemanticException
- if the content is not in the property, or if the to position is not valid.
-
moveTo
Moves this element handle to the given position within its container.- Parameters:
posn
- the new position to move- Throws:
SemanticException
-
move
public void move(String fromPropName, DesignElementHandle content, DesignElementHandle newContainer, String toPropName) throws SemanticException Moves a content element from this element into a property in another container element.- Parameters:
fromPropName
- name of the property where the content originally residescontent
- a handle to the element to movenewContainer
- a handle to the new container elementtoPropName
- the target property name where the element will be moved to.- Throws:
SemanticException
- 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.
-
moveTo
Moves this element to a property in another container element.- Parameters:
newContainer
- a handle to the new container elementtoPropName
- the target property name where this element will be moved to- Throws:
SemanticException
-
move
public void move(String fromPropName, DesignElementHandle content, DesignElementHandle newContainer, String toPropName, int newPos) throws SemanticException Moves a content element into a property in another container element at the specified position.- Parameters:
fromPropName
- name of the property where the content originally residescontent
- a handle to the element to movenewContainer
- a handle to the new container elementtoPropName
- 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 content size of the target property, the content will be appended at the end of the target property.- Throws:
SemanticException
- if the content is not in this property or if the new container is not, in fact, a container, or if the content cannot go into the target property.
-
moveTo
public void moveTo(DesignElementHandle newContainer, String toPropName, int newPos) throws SemanticException Moves this element to a property in another container element at the specified position.- Parameters:
newContainer
- a handle to the new container elementtoPropName
- the target property name where this element will be moved tonewPos
- the position to which this element will be moved. It is a 0-based integer. If it is greater than the current content size of the target property, this element will be appended at the tail- Throws:
SemanticException
-
dropAndClear
Drops a content element from the container, and clear any reference property which refers the element to drop.- Parameters:
propName
- name of the property where the content residescontent
- a handle to the content to drop- Throws:
SemanticException
- if the content is not within the container
-
drop
Drops a content element from the container, and unresolve any reference property which refers the element to drop.- Parameters:
propName
- name of the property where the content residescontent
- a handle to the content to drop- Throws:
SemanticException
- if the content is not within the container
-
dropAndClear
Drops a content element at the given position from the container, and clear any reference property which refers the element to drop.- Parameters:
propName
- name of the property where the content residesposn
- the position of the content to drop- Throws:
SemanticException
- if the position is out of range
-
drop
Drops a content element at the given position from the container, and unresolve any reference property which refers the element to drop.- Parameters:
propName
- name of the property where the content residesposn
- the position of the content to drop- Throws:
SemanticException
- if the position is out of range
-
setEncryption
Sets the encryption for an encryptable property. Not only this method can change the encryption ID for a property, but also callsetProperty(String, Object)
to change the value of the encryptable property.- Parameters:
propName
-encryptionID
-- Throws:
SemanticException
-
isDirectionRTL
public boolean isDirectionRTL()Examines whether the resolved direction of this design element is Right to Left or not.- Returns:
- true if the direction is RTL, false otherwise
-
getHostViewHandle
Return the direct host element handle for this view element.- Returns:
- null, if the current element is not a sub view. else return DesignElementHandle which is the direct host element of the current element view.
-
isInTemplateParameter
public boolean isInTemplateParameter()Checks whether the given element is contained by one of template parameter definition.- Returns:
true
if the element is in the template parameter definition. Otherwise,false
.
-
getFactoryElementHandle
Gets the factory element handle for this element. The factory element handle is to retrieve some factory property value and factory styles.- Returns:
- the factory element handle.
-
getExpressionProperty
Returns a handle to work with an expression property. Returns null if the given property is not defined or cannot be set with expression value.- Parameters:
propName
- name of the property.- Returns:
- a corresponding ExpressionHandle to with with the expression property.
- See Also:
-
setExpressionProperty
Sets the value of a property to an expression.- Parameters:
propName
- the property nameexpression
- the value to set- Throws:
SemanticException
-
setPropertyBinding
Sets the mask of the specified property.- Parameters:
propName
- the property name to get. Can be a system-defined or user-defined property name.value
- the overridden value- Throws:
SemanticException
- if the maskValue is not one of the above.
-
getPropertyBindingExpression
Returns the overridden value of the specified property given its internal name.- Parameters:
propName
- the name of the property to get. Can be a system-defined or user-defined property name.- Returns:
- the property binding, or null if the overridden value is not set
-