Class DesignElementHandle

java.lang.Object
org.eclipse.birt.report.model.api.DesignElementHandle
All Implemented Interfaces:
org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
Direct Known Subclasses:
ContentElementHandle, ModuleHandleImpl, MultiViewsHandle, ReportElementHandle

public abstract class DesignElementHandle extends Object implements org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
Base class for all report elements. Provides a high-level interface to the BIRT report model. This class provides generic services for all elements. Derived classes provide specialized methods for each element type.

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 DesignElementclass.

See Also:
  • Field Details

    • module

      protected final org.eclipse.birt.report.model.core.Module module
      Provides 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 this DesignElementHandle.
  • 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 public org.eclipse.birt.report.model.elements.ReportDesign 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 be ReportDesign or Library.
      Returns:
      the module on which this handle is attached.
    • getDesignHandle

      @Deprecated public ReportDesignHandle 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

      public ModuleHandle getModuleHandle()
      Returns the handle of module. The returned module must be ReportDesignHandle or LibraryHandle.
      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

      public IElementDefn 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

      public Object getProperty(String propName)
      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

      public String getStringProperty(String propName)
      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

      public String getDisplayProperty(String propName)
      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

      public boolean getBooleanProperty(String propName)
      Returns the value of a property as a Boolean.
      Parameters:
      propName - the name of the property
      Returns:
      the value as a boolean
    • getIntProperty

      public int getIntProperty(String propName)
      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

      public double getFloatProperty(String propName)
      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

      public BigDecimal getNumberProperty(String propName)
      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

      public DimensionHandle getDimensionProperty(String propName)
      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

      public ColorHandle getColorProperty(String propName)
      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

      protected FontHandle getFontProperty()
      Gets the font handle for the element. If this element defines a font family property, return a FontHandle. Otherwise, return null.
      Returns:
      a corresponding FontHandle or null.
      See Also:
    • getElementProperty

      public DesignElementHandle getElementProperty(String propName)
      Returns the value of an element reference property. Returns a handle to the referenced element, or null 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.
      Gets the value of a property as a list.
      Parameters:
      module - the module
      propName - 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

      public List getListProperty(String propName)
      Gets the value of a property as a list.
      Parameters:
      module - the module
      propName - 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

      public void setProperty(String propName, Object value) throws SemanticException
      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 name
      value - the value to set
      Throws:
      SemanticException - if the property is undefined on the element or the value is invalid.
    • setIntProperty

      public void setIntProperty(String propName, int value) throws SemanticException
      Sets the value of a property to an integer.
      Parameters:
      propName - the property name
      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.
    • setStringProperty

      public void setStringProperty(String propName, String value) throws SemanticException
      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 name
      value - the value to set
      Throws:
      SemanticException - if the value of a choice or other property is incorrect.
    • setFloatProperty

      public void setFloatProperty(String propName, double value) throws SemanticException
      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 name
      value - the value to set
      Throws:
      SemanticException - If the property value cannot be converted from a double.
    • setNumberProperty

      public void setNumberProperty(String propName, BigDecimal value) throws SemanticException
      Sets the value of a property to a number (BigDecimal).
      Parameters:
      propName - the property name
      value - the value to set
      Throws:
      SemanticException - if the property value cannot be converted from a number.
    • setBooleanProperty

      public void setBooleanProperty(String propName, boolean value) throws SemanticException
      Sets the boolean value to the property.
      Parameters:
      propName - the name of the property to set
      value - the boolean value to set
      Throws:
      SemanticException - if the property is not defined or value is invalid
    • clearProperty

      public void clearProperty(String propName) throws SemanticException
      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

      public void clearAllProperties() throws SemanticException
      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()
      Returns true if this element has any locally-defined property values. Returns false otherwise.
      Returns:
      True if the element has property values, false if not.
    • addUserPropertyDefn

      public void addUserPropertyDefn(UserPropertyDefn prop) throws UserPropertyException
      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 element
      slotId - 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 slot
      NameException - 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 element
      slotId - slot id in which the child item will be added.
      Throws:
      ContentException - if the element is not allowed in the slot
      NameException - if the element has a duplicate or illegal name
    • getMethods

      public List getMethods()
      Returns the methods defined on the element definition.
      Returns:
      List contains the methods.
    • setProperties

      public void setProperties(Map properties) throws SemanticException
      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

      public void clearContents(int slotId) throws SemanticException
      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

      public void dropUserPropertyDefn(String propName) throws UserPropertyException
      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

      public DesignElementHandle 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

      public void setExtends(DesignElementHandle parent) throws ExtendsException
      Sets this element to extend the given element.
      Parameters:
      parent - handle to the element that this element is to extend. If null, then this element will no longer extend another element.
      Throws:
      ExtendsException - if the parent element is of the wrong type as this element.
    • setExtendsName

      public void setExtendsName(String name) throws ExtendsException
      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

      public void localize() throws SemanticException
      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
      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

      public SharedStyleHandle 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

      public void setStyleName(String name) throws StyleException
      Sets the name of the shared style for this element.
      Parameters:
      name - the name of the shared style. If null, 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
      Sets the shared style element for this element.
      Parameters:
      obj - the shared style. If null, then the shared style is cleared.
      Throws:
      StyleException - If this element does not support a style.
      See Also:
    • setStyle

      public void setStyle(SharedStyleHandle style) throws StyleException
      Sets the shared style element for this element.
      Parameters:
      style - the handle to the shared style. If null, then the shared style is cleared.
      Throws:
      StyleException - if this element does not support a style.
      See Also:
    • getPrivateStyle

      public StyleHandle 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. The getStyle( ) 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

      public String getName()
      Returns the name of this element. Returns null 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

      public String 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 by getName().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

      public String getQualifiedName()
      Gets the name of this element. The returned element name will be the same as getName(), 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 and getName() will return identical results.
      Returns:
      the qualified name of the element.
    • setName

      public void setName(String name) throws NameException
      Sets the name of this element. If the name is null, 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 is null 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:
    • getElementFactory

      public ElementFactory getElementFactory()
      Returns the element factory for creating new report elements. After creating the element, add it to the design by calling the the add method of the slot handle that represents the point in the design where the new element should appear.
      Returns:
      a handle to the new element.
      See Also:
    • getPropertyHandle

      public PropertyHandle getPropertyHandle(String propName)
      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

      public UserPropertyDefnHandle getUserPropertyDefnHandle(String propName)
      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

      public List getUserProperties()
      Returns a list of user properties defined in this element and somewhere up the inheritance chain. Each object in the list is instance of UserPropertyDefn.
      Returns:
      The list of user property definitions
    • getFactoryPropertyHandle

      public FactoryPropertyHandle getFactoryPropertyHandle(String propName)
      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

      public DesignElementHandle 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

      public void moveTo(DesignElementHandle newContainer, int toSlot) throws ContentException
      Moves this element to a new location within the design.
      Parameters:
      newContainer - the new container element
      toSlot - 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

      public void dropAndClear() throws SemanticException
      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

      public void drop() throws SemanticException
      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

      public int findContentSlot(DesignElementHandle content)
      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_SLOTif the element is not contained in this element.
    • getContainerSlotHandle

      public SlotHandle 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

      public PropertyHandle 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

      public SlotHandle getSlot(int slotID)
      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

      public Iterator<SlotHandle> slotsIterator()
      Returns the iterator for slot defined on the element.
      Returns:
      the iterator for SlotHandle
    • getPropertyIterator

      public Iterator 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 type PropertyHandle.
      See Also:
    • addListener

      public void addListener(Listener obj)
      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

      public void removeListener(Listener obj)
      Removes a given listener. If the listener registered, then the request is silently ignored.
      Parameters:
      obj - the listener to de-register
    • derivedIterator

      public Iterator 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 type DesignElementHandle.
    • clientsIterator

      public Iterator 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 type DesignElementHandle. Nothing will be iterated over an element that is not ReferenceableElement.
    • getChoices

      public IChoice[] getChoices(String propName)
      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

      public String getDisplayLabel()
      Returns the short display label for this element.
      Returns:
      the display label of this element in SHORT_LABEL level.
      See Also:
    • getDisplayLabel

      public String getDisplayLabel(int level)
      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

      public static void doSort(List list)
      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, otherwise false.
    • 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

      public IDesignElement 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
      The 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 copy
      targetHandle - 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

      public List 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. Returns false 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

      public boolean canContain(int slotId, String type)
      Determines if the slot can contain an element with the type of type. Even return value is true, doesn't mean the element can be added/moved without exceptions.
      Parameters:
      slotId - the slot id
      type - the name of the element type, like "Table", "List", etc.
      Returns:
      true if the slot can contain the an element with type type, otherwise false.
      See Also:
    • canContain

      public boolean canContain(int slotId, DesignElementHandle content)
      Determines if the given slot can contain the content. Even return value is true, doesn't mean the element can be added/moved without exceptions.
      Parameters:
      slotId - the slot id
      content - the design element handle to check
      Returns:
      true if the slot with the given slotId can contain the content, otherwise false.
      See Also:
    • canContain

      public boolean canContain(String propName, String type)
      Determines if the slot can contain an element with the type of type. Even return value is true, doesn't mean the element can be added/moved without exceptions.
      Parameters:
      propName - name of the property where the type to insert
      type - the name of the element type, like "Table", "List", etc.
      Returns:
      true if the slot can contain the an element with type type, otherwise false.
      See Also:
    • canContain

      public boolean canContain(String propName, DesignElementHandle content)
      Determines if the given slot can contain the content. Even return value is true, doesn't mean the element can be added/moved without exceptions.
      Parameters:
      propName - the name of the property where the content to insert
      content - the design element handle to check
      Returns:
      true if the slot with the given slotId can contain the content, otherwise false.
      See Also:
    • getSemanticErrors

      public List getSemanticErrors()
      Returns the semantic error list, each of which is the instance of ErrorDetail.
      Returns:
      the semantic error list.
    • getRoot

      public ModuleHandle getRoot()
      Returns the root container of this element. It must be Library or Report Design.
      Returns:
      the handle of the root container.
    • getXPath

      public String 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

      public String getEventHandlerClass()
      Gets a string that defines the event handle class.
      Returns:
      the expression as a string
      See Also:
    • setEventHandlerClass

      public void setEventHandlerClass(String expr) throws SemanticException
      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

      public void setNewHandlerOnEachEvent(boolean newHandler) throws SemanticException
      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

      public TemplateElementHandle createTemplateElement(String name) throws SemanticException
      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

      public TemplateElementHandle revertToTemplate(String name) throws SemanticException
      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

      public void revertToReportItem() throws SemanticException
      if this design element is based on a template definition isTemplateParameterValue(),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 method revertToTemplate(String)to assure that this element can be reverted to a template element. If this method returns false, method revertToTemplate(String) must fail too.
      Returns:
      true if this element is based on a template parameter definition, otherwise false
    • getPropertyDefn

      public IElementPropertyDefn getPropertyDefn(String propName)
      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 the DesignElementHandle is returned.
      Returns:
      the effective module of the element. Can be null.
    • getPropertyBinding

      @Deprecated public String getPropertyBinding(String propName)
      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

      public List getPropertyBindings()
      Gets all the defined property bindings for the given element. Each one in the list is instance of PropertyBinding.
      Returns:
      the property binding list defined for the element
    • setPropertyBinding

      @Deprecated public void setPropertyBinding(String propName, String value) throws SemanticException
      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

      public String getExternalizedValue(String textIDProp, String textProp)
      Returns externalized message.
      Parameters:
      textIDProp - the display key property name
      textProp - 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 name
      textProp - the property name
      locale - the locale to externalize the message
      Returns:
      externalized message.
    • getExternalizedValue

      public String getExternalizedValue(String textIDProp, String textProp, Locale locale)
      Returns externalized message.
      Parameters:
      textIDProp - the display key property name
      textProp - the property name
      locale - 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

      public void add(String propName, 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:
      propName - name of the property where the content to insert
      content - handle to the newly created element
      Throws:
      SemanticException - if the element is not allowed to insert
    • add

      public void add(String propName, 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:
      propName - name of the property where the content to insert
      content - handle to the newly created element
      newPos - 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 List paste(String propName, 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:
      propName - name of the property where the content to insert
      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 List paste(String propName, 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:
      propName - name of the property where the content to insert
      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 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 insert
      content - the newly created element handle
      newPos - 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 List paste(String propName, 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:
      propName - name of the property where the content to insert
      content - the newly created element
      newPos - 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

      public List getContents(String propName)
      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

      public int getContentCount(String propName)
      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

      public DesignElementHandle getContent(String propName, int index)
      Gets a handle to the content element at the given position.
      Parameters:
      propName - name of the property where the content resides
      index - 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 resides
      content - handle to the content to move
      toPosn - the new position
      Throws:
      SemanticException - if the content is not in the property, or if the to position is not valid.
    • moveTo

      public void moveTo(int posn) throws SemanticException
      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 resides
      content - a handle to the element to move
      newContainer - a handle to the new container element
      toPropName - 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

      public void moveTo(DesignElementHandle newContainer, String toPropName) throws SemanticException
      Moves this element to a property in another container element.
      Parameters:
      newContainer - a handle to the new container element
      toPropName - 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 resides
      content - a handle to the element to move
      newContainer - a handle to the new container element
      toPropName - 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 element
      toPropName - the target property name where this element will be moved to
      newPos - 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

      public void dropAndClear(String propName, DesignElementHandle content) throws SemanticException
      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 resides
      content - a handle to the content to drop
      Throws:
      SemanticException - if the content is not within the container
    • drop

      public void drop(String propName, DesignElementHandle content) throws SemanticException
      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 resides
      content - a handle to the content to drop
      Throws:
      SemanticException - if the content is not within the container
    • dropAndClear

      public void dropAndClear(String propName, int posn) throws SemanticException
      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 resides
      posn - the position of the content to drop
      Throws:
      SemanticException - if the position is out of range
    • drop

      public void drop(String propName, int posn) throws SemanticException
      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 resides
      posn - the position of the content to drop
      Throws:
      SemanticException - if the position is out of range
    • setEncryption

      public void setEncryption(String propName, String encryptionID) throws SemanticException
      Sets the encryption for an encryptable property. Not only this method can change the encryption ID for a property, but also call setProperty(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

      public DesignElementHandle 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

      public FactoryElementHandle 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

      public ExpressionHandle getExpressionProperty(String propName)
      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

      public void setExpressionProperty(String propName, Expression expression) throws SemanticException
      Sets the value of a property to an expression.
      Parameters:
      propName - the property name
      expression - the value to set
      Throws:
      SemanticException
    • setPropertyBinding

      public void setPropertyBinding(String propName, Expression value) throws SemanticException
      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

      public Expression 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