org.eclipse.birt.report.model.api
Class ContentElementHandle

java.lang.Object
  extended by org.eclipse.birt.report.model.api.DesignElementHandle
      extended by org.eclipse.birt.report.model.api.ContentElementHandle
All Implemented Interfaces:
org.eclipse.birt.report.model.elements.interfaces.IDesignElementModel
Direct Known Subclasses:
AccessControlHandle, DataGroupHandle, FilterConditionElementHandle, MemberValueHandle, SortElementHandle, VariableElementHandle

public abstract class ContentElementHandle
extends DesignElementHandle


Field Summary
protected  org.eclipse.birt.report.model.core.DesignElement element
          The target report element.
 
Fields inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
module
 
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, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROP
 
Constructor Summary
ContentElementHandle(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element)
          Constructs the handle for a report element with the given design and element.
 
Method Summary
 void addListener(Listener obj)
          Registers a change event listener.
 void addUserPropertyDefn(UserPropertyDefn prop)
          Adds a user-defined property definition.
 boolean canTransformToTemplate()
          Determines if the current element can be transformed to a template element.
 java.util.Iterator clientsIterator()
          Returns an iterator over the clients of this element.
 TemplateElementHandle createTemplateElement(java.lang.String name)
          Creates a template element handle and transforms the current element handle to the created template element.
 java.util.Iterator derivedIterator()
          Returns an iterator over the elements that derive from this one.
 org.eclipse.birt.report.model.core.DesignElement getElement()
          Returns the element to which this handle is attached.
 java.lang.String getEventHandlerClass()
          Gets a string that defines the event handle class.
 DesignElementHandle getExtends()
          Returns a handle to the element that this element extends.
 java.lang.String getName()
          Returns the name of this element.
 StyleHandle getPrivateStyle()
          Returns a handle to work with the style properties of this element.
 java.lang.String getQualifiedName()
          Gets the name of this element.
 java.util.List getUserProperties()
          Returns a list of user properties defined in this element and somewhere up the inheritance chain.
 UserPropertyDefnHandle getUserPropertyDefnHandle(java.lang.String propName)
          Returns a user-defined property handle for a top-level property.
 boolean isTemplateParameterValue()
          Checks whether this element is based on a template parameter definition or not.
 void localize()
          Localize the element, break the parent/child relationship and set all the extended properties locally.
 void removeListener(Listener obj)
          Removes a given listener.
 void revertToReportItem()
          if this design element is based on a template definition DesignElementHandle.isTemplateParameterValue(),get rid of the template definition )
 TemplateElementHandle revertToTemplate(java.lang.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.
 void setEventHandlerClass(java.lang.String expr)
          Sets the group expression.
 void setExtends(DesignElementHandle parent)
          Sets this element to extend the given element.
 void setExtendsName(java.lang.String name)
          Sets the name of the element that this element extends.
 void setName(java.lang.String name)
          Sets the name of this element.
 void setStyle(SharedStyleHandle style)
          Sets the shared style element for this element.
 void setStyleName(java.lang.String name)
          Sets the name of the shared style for this element.
 
Methods inherited from class org.eclipse.birt.report.model.api.DesignElementHandle
add, add, addElement, addElement, cachePropertyHandles, canContain, canContain, canContain, canContain, canDrop, canEdit, clearAllProperties, clearContents, clearProperty, copy, copyPropertyTo, doSort, drop, drop, drop, dropAndClear, dropAndClear, dropAndClear, dropUserPropertyDefn, findContentSlot, getBooleanProperty, getChoices, getColorProperty, getContainer, getContainerPropertyHandle, getContainerSlotHandle, getContent, getContentCount, getContents, getDefn, getDesign, getDesignHandle, getDimensionProperty, getDisplayLabel, getDisplayLabel, getDisplayProperty, getEffectiveModule, getElementFactory, getElementProperty, getExternalizedValue, getExternalizedValue, getExternalizedValue, getFactoryPropertyHandle, getFloatProperty, getFontProperty, getFullName, getHostViewHandle, getID, getIndex, getIntProperty, getListProperty, getListProperty, getMethods, getModule, getModuleHandle, getNumberProperty, getProperty, getPropertyBinding, getPropertyBindings, getPropertyDefn, getPropertyHandle, getPropertyIterator, getRoot, getSemanticErrors, getSlot, getStringProperty, getStyle, getXPath, hasLocalProperties, hasSemanticError, initializeSlotHandles, isDirectionRTL, isInTemplateParameter, isValid, move, move, moveTo, moveTo, moveTo, moveTo, paste, paste, paste, paste, semanticCheck, setEncryption, setExtendsElement, setFloatProperty, setIntProperty, setNumberProperty, setProperties, setProperty, setPropertyBinding, setStringProperty, setStyleElement, setValid, shift, showError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected org.eclipse.birt.report.model.core.DesignElement element
The target report element.

Constructor Detail

ContentElementHandle

public ContentElementHandle(org.eclipse.birt.report.model.core.Module module,
                            org.eclipse.birt.report.model.core.DesignElement element)
Constructs the handle for a report element with the given design and element. The application generally does not create handles directly. Instead, it uses one of the navigation methods available on other element handles.

Parameters:
module - the module
element - the model representation of the element
Method Detail

getElement

public final org.eclipse.birt.report.model.core.DesignElement getElement()
Description copied from class: DesignElementHandle
Returns the element to which this handle is attached.

Specified by:
getElement in class DesignElementHandle
Returns:
The attached element. Will be null if the handle is not attached.

addListener

public final void addListener(Listener obj)
Description copied from class: DesignElementHandle
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.

Overrides:
addListener in class DesignElementHandle
Parameters:
obj - the listener to register

addUserPropertyDefn

public final void addUserPropertyDefn(UserPropertyDefn prop)
                               throws UserPropertyException
Description copied from class: DesignElementHandle
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.

Overrides:
addUserPropertyDefn in class DesignElementHandle
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.

isTemplateParameterValue

public final boolean isTemplateParameterValue()
Description copied from class: DesignElementHandle
Checks whether this element is based on a template parameter definition or not. Call this method before calling method DesignElementHandle.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.

Overrides:
isTemplateParameterValue in class DesignElementHandle
Returns:
true if this element is based on a template parameter definition, otherwise false

localize

public final void localize()
                    throws SemanticException
Description copied from class: DesignElementHandle
Localize the element, break the parent/child relationship and set all the extended properties locally.

Overrides:
localize in class DesignElementHandle
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.

removeListener

public final void removeListener(Listener obj)
Description copied from class: DesignElementHandle
Removes a given listener. If the listener registered, then the request is silently ignored.

Overrides:
removeListener in class DesignElementHandle
Parameters:
obj - the listener to de-register

revertToReportItem

public final void revertToReportItem()
                              throws SemanticException
Description copied from class: DesignElementHandle
if this design element is based on a template definition DesignElementHandle.isTemplateParameterValue(),get rid of the template definition )

Overrides:
revertToReportItem in class DesignElementHandle
Throws:
SemanticException

revertToTemplate

public final TemplateElementHandle revertToTemplate(java.lang.String name)
                                             throws SemanticException
Description copied from class: DesignElementHandle
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.

Overrides:
revertToTemplate in class DesignElementHandle
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

canTransformToTemplate

public final boolean canTransformToTemplate()
Description copied from class: DesignElementHandle
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.

Overrides:
canTransformToTemplate in class DesignElementHandle
Returns:
true if it can be transformed, otherwise false.

clientsIterator

public final java.util.Iterator clientsIterator()
Description copied from class: DesignElementHandle
Returns an iterator over the clients of this element. Useful only for styles. Returns a list of all the elements that use this style.

Overrides:
clientsIterator in class DesignElementHandle
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.

createTemplateElement

public final TemplateElementHandle createTemplateElement(java.lang.String name)
                                                  throws SemanticException
Description copied from class: DesignElementHandle
Creates a template element handle and transforms the current element handle to the created template element.

Overrides:
createTemplateElement in class DesignElementHandle
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

derivedIterator

public final java.util.Iterator derivedIterator()
Description copied from class: DesignElementHandle
Returns an iterator over the elements that derive from this one.

Overrides:
derivedIterator in class DesignElementHandle
Returns:
an iterator over the elements that derive from this one. Each item returned by the iterator's getNext( ) method is of type DesignElementHandle.

getName

public final java.lang.String getName()
Description copied from class: DesignElementHandle
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.

Overrides:
getName in class DesignElementHandle
Returns:
the element name, or null if the name is not set

getPrivateStyle

public final StyleHandle getPrivateStyle()
Description copied from class: DesignElementHandle
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.

Overrides:
getPrivateStyle in class DesignElementHandle
Returns:
a style handle to work with the style properties of this element. Returns null if this element does not have style properties.

getQualifiedName

public final java.lang.String getQualifiedName()
Description copied from class: DesignElementHandle
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.

Overrides:
getQualifiedName in class DesignElementHandle
Returns:
the qualified name of the element.

getUserProperties

public final java.util.List getUserProperties()
Description copied from class: DesignElementHandle
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.

Overrides:
getUserProperties in class DesignElementHandle
Returns:
The list of user property definitions

getUserPropertyDefnHandle

public final UserPropertyDefnHandle getUserPropertyDefnHandle(java.lang.String propName)
Description copied from class: DesignElementHandle
Returns a user-defined property handle for a top-level property. A top-level property is a property that defines on an element.

Overrides:
getUserPropertyDefnHandle in class DesignElementHandle
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.

setEventHandlerClass

public final void setEventHandlerClass(java.lang.String expr)
                                throws SemanticException
Description copied from class: DesignElementHandle
Sets the group expression.

Overrides:
setEventHandlerClass in class DesignElementHandle
Parameters:
expr - the expression to set
Throws:
SemanticException - If the expression is invalid.
See Also:
DesignElementHandle.getEventHandlerClass()

setExtends

public final void setExtends(DesignElementHandle parent)
                      throws ExtendsException
Description copied from class: DesignElementHandle
Sets this element to extend the given element.

Overrides:
setExtends in class DesignElementHandle
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 final void setExtendsName(java.lang.String name)
                          throws ExtendsException
Description copied from class: DesignElementHandle
Sets the name of the element that this element extends. The name must resolve to an element of the same type as this element.

Overrides:
setExtendsName in class DesignElementHandle
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.

setName

public final void setName(java.lang.String name)
                   throws NameException
Description copied from class: DesignElementHandle
Sets the name of this element. If the name is null, then the name is cleared if this element does not require a name.

Overrides:
setName in class DesignElementHandle
Parameters:
name - the new name
Throws:
NameException - if the name is duplicate, or if the name is null and this element requires a name.

getEventHandlerClass

public java.lang.String getEventHandlerClass()
Description copied from class: DesignElementHandle
Gets a string that defines the event handle class.

Overrides:
getEventHandlerClass in class DesignElementHandle
Returns:
the expression as a string
See Also:
DesignElementHandle.setEventHandlerClass(String)

getExtends

public DesignElementHandle getExtends()
Description copied from class: DesignElementHandle
Returns a handle to the element that this element extends.

Overrides:
getExtends in class DesignElementHandle
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.

setStyle

public void setStyle(SharedStyleHandle style)
              throws StyleException
Description copied from class: DesignElementHandle
Sets the shared style element for this element.

Overrides:
setStyle in class DesignElementHandle
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:
DesignElementHandle.getStyle()

setStyleName

public void setStyleName(java.lang.String name)
                  throws StyleException
Description copied from class: DesignElementHandle
Sets the name of the shared style for this element.

Overrides:
setStyleName in class DesignElementHandle
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:
DesignElementHandle.getStyle()


Copyright © 2008 Actuate Corp. All rights reserved.