|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.birt.report.model.api.DesignElementHandle
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.
SlotHandle,
DesignElement| Field Summary | |
protected org.eclipse.birt.report.model.core.Module |
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, NO_SLOT, PROPERTY_MASKS_PROP, REF_TEMPLATE_PARAMETER_PROP, SHORT_LABEL, USER_LABEL, USER_PROPERTIES_PROP, VIEW_ACTION_PROP |
| Constructor Summary | |
DesignElementHandle(org.eclipse.birt.report.model.core.Module module)
Constructs a handle with the given module. |
|
| Method Summary | |
void |
add(java.lang.String propName,
DesignElementHandle content)
Adds a report item to the property with the given element handle. |
void |
add(java.lang.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 |
addUserPropertyDefn(UserPropertyDefn prop)
Adds a user-defined property definition. |
boolean |
canContain(int slotId,
DesignElementHandle content)
Determines if the given slot can contain the content. |
boolean |
canContain(int slotId,
java.lang.String type)
Determines if the slot can contain an element with the type of type. |
boolean |
canContain(java.lang.String propName,
DesignElementHandle content)
Determines if the given slot can contain the content. |
boolean |
canContain(java.lang.String propName,
java.lang.String type)
Determines if the slot can contain an element with the type of type. |
boolean |
canDrop()
Determines if this element can be dropped from its container. |
boolean |
canEdit()
Determines if this element is editable or not. |
boolean |
canTransformToTemplate()
Determines if the current element can be transformed to a template element. |
void |
clearAllProperties()
Clears values of all properties. |
void |
clearContents(int slotId)
Clears all the content within the given slot. |
void |
clearProperty(java.lang.String propName)
Clears the value of a property. |
java.util.Iterator |
clientsIterator()
Returns an iterator over the clients of this element. |
IDesignElement |
copy()
Deeply clones the current design element which is wrapped by the handle. |
void |
copyPropertyTo(java.lang.String propName,
DesignElementHandle targetHandle)
Copies all properties to the target 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. |
static void |
doSort(java.util.List list)
Sorts a list of elements by localized display name. |
void |
drop()
Drops this element from the design. |
void |
drop(java.lang.String propName,
DesignElementHandle content)
Drops a content element from the container, and unresolve any reference property which refers the element to drop. |
void |
drop(java.lang.String propName,
int posn)
Drops a content element at the given position from the container, and unresolve any reference property which refers the element to drop. |
void |
dropAndClear()
Drops this element from the design. |
void |
dropAndClear(java.lang.String propName,
DesignElementHandle content)
Drops a content element from the container, and clear any reference property which refers the element to drop. |
void |
dropAndClear(java.lang.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 |
dropUserPropertyDefn(java.lang.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(java.lang.String propName)
Returns the value of a property as a Boolean. |
IChoice[] |
getChoices(java.lang.String propName)
Returns a array of valid choices for a property. |
ColorHandle |
getColorProperty(java.lang.String propName)
Returns a handle to work with a color property. |
DesignElementHandle |
getContainer()
Returns a handle to the element that contains this element. |
PropertyHandle |
getContainerPropertyHandle()
Gets a handle for the container's property what holds this element. |
SlotHandle |
getContainerSlotHandle()
Returns the a handle the the container's slot that holds this element. |
DesignElementHandle |
getContent(java.lang.String propName,
int index)
Gets a handle to the content element at the given position. |
int |
getContentCount(java.lang.String propName)
Returns the number of elements in the property. |
java.util.List |
getContents(java.lang.String propName)
Returns the a list with contents.Items are handles to the contents and in order by position. |
IElementDefn |
getDefn()
Gets the definition of the element. |
org.eclipse.birt.report.model.elements.ReportDesign |
getDesign()
Deprecated. replaced by getModule() |
ReportDesignHandle |
getDesignHandle()
Deprecated. replaced by getModuleHandle() |
DimensionHandle |
getDimensionProperty(java.lang.String propName)
Returns a handle to work with a Dimension property. |
java.lang.String |
getDisplayLabel()
Returns the short display label for this element. |
java.lang.String |
getDisplayLabel(int level)
Returns the display label for this element. |
java.lang.String |
getDisplayProperty(java.lang.String propName)
Return a localized string version of the property. |
protected org.eclipse.birt.report.model.core.Module |
getEffectiveModule()
Returns the effective module of the element. |
abstract org.eclipse.birt.report.model.core.DesignElement |
getElement()
Returns the element to which this handle is attached. |
ElementFactory |
getElementFactory()
Returns the element factory for creating new report elements. |
DesignElementHandle |
getElementProperty(java.lang.String propName)
Returns the value of an element reference property. |
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 |
getExternalizedValue(java.lang.String textIDProp,
java.lang.String textProp)
Returns externalized message. |
java.lang.String |
getExternalizedValue(java.lang.String textIDProp,
java.lang.String textProp,
java.util.Locale locale)
Returns externalized message. |
java.lang.String |
getExternalizedValue(java.lang.String textIDProp,
java.lang.String textProp,
com.ibm.icu.util.ULocale locale)
Returns externalized message. |
FactoryPropertyHandle |
getFactoryPropertyHandle(java.lang.String propName)
Returns a handle for a top-level property for use in preparing the Factory data structures. |
double |
getFloatProperty(java.lang.String propName)
Returns the value of a property as a double. |
protected FontHandle |
getFontProperty()
Gets the font handle for the element. |
java.lang.String |
getFullName()
Returns the full name of this element. |
long |
getID()
Returns the unique ID for this object. |
int |
getIndex()
Gets the position where this element resides in its container. |
int |
getIntProperty(java.lang.String propName)
Returns the value of a property as an integer. |
java.util.List |
getListProperty(org.eclipse.birt.report.model.core.Module module,
java.lang.String propName)
Deprecated. |
java.util.List |
getListProperty(java.lang.String propName)
Gets the value of a property as a list. |
java.util.List |
getMethods()
Returns the methods defined on the element definition. |
org.eclipse.birt.report.model.core.Module |
getModule()
Returns the module on which this handle is attached. |
ModuleHandle |
getModuleHandle()
Returns the handle of module. |
java.lang.String |
getName()
Returns the name of this element. |
java.math.BigDecimal |
getNumberProperty(java.lang.String propName)
Returns the value of a property as a number (BigDecimal). |
StyleHandle |
getPrivateStyle()
Returns a handle to work with the style properties of this element. |
java.lang.Object |
getProperty(java.lang.String propName)
Returns the value of a property as a generic object. |
java.lang.String |
getPropertyBinding(java.lang.String propName)
Returns the overridden value of the specified property given its internal name. |
java.util.List |
getPropertyBindings()
Gets all the defined property bindings for the given element. |
IElementPropertyDefn |
getPropertyDefn(java.lang.String propName)
Gets the property data for either a system-defined or user-defined property. |
PropertyHandle |
getPropertyHandle(java.lang.String propName)
Returns a property handle for a top-level property. |
java.util.Iterator |
getPropertyIterator()
Returns an iterator over the properties of this element. |
java.lang.String |
getQualifiedName()
Gets the name of this element. |
ModuleHandle |
getRoot()
Returns the root container of this element. |
java.util.List |
getSemanticErrors()
Returns the semantic error list, each of which is the instance of ErrorDetail. |
SlotHandle |
getSlot(int slotID)
Returns a handle to the given slot. |
java.lang.String |
getStringProperty(java.lang.String propName)
Returns the value of a property as a string which is locale independent. |
SharedStyleHandle |
getStyle()
Returns the shared style, if any, as a style handle. |
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. |
java.lang.String |
getXPath()
Returns return the path corresponding to the current position of the element in the tree. |
boolean |
hasLocalProperties()
Returns true if this element has any locally-defined
property values. |
boolean |
hasSemanticError()
Justifies whether this element has any semantic error or not. |
boolean |
isTemplateParameterValue()
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(java.lang.String fromPropName,
DesignElementHandle content,
DesignElementHandle newContainer,
java.lang.String toPropName)
Moves a content element from this element into a property in another container element. |
void |
move(java.lang.String fromPropName,
DesignElementHandle content,
DesignElementHandle newContainer,
java.lang.String toPropName,
int newPos)
Moves a content element into a property in another container element at the specified position. |
void |
moveTo(DesignElementHandle newContainer,
int toSlot)
Moves this element to a new location within the design. |
void |
moveTo(DesignElementHandle newContainer,
java.lang.String toPropName)
Moves this element to a property in another container element. |
void |
moveTo(DesignElementHandle newContainer,
java.lang.String toPropName,
int newPos)
Moves this element to 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. |
java.util.List |
paste(java.lang.String propName,
DesignElementHandle content)
Pastes a report item to this property. |
java.util.List |
paste(java.lang.String propName,
DesignElementHandle content,
int newPos)
Pastes a report item to the slot. |
java.util.List |
paste(java.lang.String propName,
IDesignElement content)
Pastes a report item to this property. |
java.util.List |
paste(java.lang.String propName,
IDesignElement content,
int newPos)
Pastes a report item to the property. |
void |
removeListener(Listener obj)
Removes a given listener. |
void |
revertToReportItem()
if this design element is based on a template definition 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. |
java.util.List |
semanticCheck()
Checks this element with semantic rules. |
void |
setEventHandlerClass(java.lang.String expr)
Sets the group expression. |
void |
setExtends(DesignElementHandle parent)
Sets this element to extend the given element. |
void |
setExtendsElement(org.eclipse.birt.report.model.core.DesignElement parent)
Deprecated. by setExtends(DesignElementHandle) |
void |
setExtendsName(java.lang.String name)
Sets the name of the element that this element extends. |
void |
setFloatProperty(java.lang.String propName,
double value)
Sets the value of a property to a double. |
void |
setIntProperty(java.lang.String propName,
int value)
Sets the value of a property to an integer. |
void |
setName(java.lang.String name)
Sets the name of this element. |
void |
setNumberProperty(java.lang.String propName,
java.math.BigDecimal value)
Sets the value of a property to a number (BigDecimal). |
void |
setProperties(java.util.Map properties)
Sets a bunch of property values on the element. |
void |
setProperty(java.lang.String propName,
java.lang.Object value)
Sets the value of a property from a generic object. |
void |
setPropertyBinding(java.lang.String propName,
java.lang.String value)
Sets the mask of the specified property. |
void |
setStringProperty(java.lang.String propName,
java.lang.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. by setStyle(SharedStyleHandle) |
void |
setStyleName(java.lang.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(java.lang.String propName,
DesignElementHandle content,
int toPosn)
Moves the position of a content element within this container. |
boolean |
showError()
Determines whether to show an error item on the element or not. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final org.eclipse.birt.report.model.core.Module module
DesignElementHandle.
| Constructor Detail |
public DesignElementHandle(org.eclipse.birt.report.model.core.Module module)
module - the module| Method Detail |
public org.eclipse.birt.report.model.elements.ReportDesign getDesign()
public org.eclipse.birt.report.model.core.Module getModule()
ReportDesign or Library.
public ReportDesignHandle getDesignHandle()
public ModuleHandle getModuleHandle()
ReportDesignHandle or LibraryHandle.
public abstract org.eclipse.birt.report.model.core.DesignElement getElement()
public IElementDefn getDefn()
public java.lang.Object getProperty(java.lang.String propName)
propName - the name of the property of interest
getIntProperty(java.lang.String),
getStringProperty(java.lang.String),
getFloatProperty(java.lang.String),
getNumberProperty(java.lang.String)public java.lang.String getStringProperty(java.lang.String propName)
propName - the name of the property
public java.lang.String getDisplayProperty(java.lang.String propName)
propName - the name of the property
public boolean getBooleanProperty(java.lang.String propName)
propName - the name of the property
public int getIntProperty(java.lang.String propName)
propName - the name of the property.
public double getFloatProperty(java.lang.String propName)
propName - the name of the property.
null if the value
cannot be converted to a double.public java.math.BigDecimal getNumberProperty(java.lang.String propName)
propName - the name of the property.
null if the value
cannot be converted to a number.public DimensionHandle getDimensionProperty(java.lang.String propName)
propName - name of the property.
null if the property is defined
or not dimension property.DimensionHandlepublic ColorHandle getColorProperty(java.lang.String propName)
propName - name of the property.
null if the given property is not defined
or not color property.ColorHandleprotected FontHandle getFontProperty()
FontHandle. Otherwise, return
null.
null.FontHandlepublic DesignElementHandle getElementProperty(java.lang.String propName)
null if the reference is
unresolved or unset.
propName - the name of the property.
public java.util.List getListProperty(org.eclipse.birt.report.model.core.Module module,
java.lang.String propName)
module - the modulepropName - the name of the property to get
ArrayList, or null if the
property is not set or the value is not a listpublic java.util.List getListProperty(java.lang.String propName)
propName - the name of the property to get
ArrayList, or null if the
property is not set or the value is not a list
public void setProperty(java.lang.String propName,
java.lang.Object value)
throws SemanticException
propName - the property namevalue - the value to set
SemanticException - if the property is undefined on the element or the value is
invalid.
public void setIntProperty(java.lang.String propName,
int value)
throws SemanticException
propName - the property namevalue - the value to set
SemanticException - If the property value cannot be converted from an integer, or
if the value of a choice is incorrect.
public void setStringProperty(java.lang.String propName,
java.lang.String value)
throws SemanticException
propName - the property namevalue - the value to set
SemanticException - if the value of a choice or other property is incorrect.
public void setFloatProperty(java.lang.String propName,
double value)
throws SemanticException
propName - the property namevalue - the value to set
SemanticException - If the property value cannot be converted from a double.
public void setNumberProperty(java.lang.String propName,
java.math.BigDecimal value)
throws SemanticException
propName - the property namevalue - the value to set
SemanticException - if the property value cannot be converted from a number.
public void clearProperty(java.lang.String propName)
throws SemanticException
propName - the name of the property to clear.
SemanticException - if the property is not defined on this element
public void clearAllProperties()
throws SemanticException
SemanticException - if the property is not defined on this elementpublic boolean hasLocalProperties()
true if this element has any locally-defined
property values. Returns false otherwise.
public void addUserPropertyDefn(UserPropertyDefn prop)
throws UserPropertyException
prop - the user property definition to add. The name and property
type must be valid.
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.
public void addElement(DesignElementHandle child,
int slotId,
int pos)
throws ContentException,
NameException
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.
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal name
public void addElement(DesignElementHandle child,
int slotId)
throws ContentException,
NameException
child - handle to the newly created elementslotId - slot id in which the child item will be added.
ContentException - if the element is not allowed in the slot
NameException - if the element has a duplicate or illegal namepublic java.util.List getMethods()
public void setProperties(java.util.Map properties)
throws SemanticException
properties - a Map store the property values keyed by the property name.
SemanticException - if the property is undefined on the element or the value is
invalid.setProperty(String, Object)
public void clearContents(int slotId)
throws SemanticException
slotId - id of the slot to be cleared.
SemanticException
public void dropUserPropertyDefn(java.lang.String propName)
throws UserPropertyException
propName - the name of the user property to remove
UserPropertyException - If the property is not found.public DesignElementHandle getExtends()
null if this element
does not have a parent, or if the extends name does not resolve
to a valid element.
public void setExtends(DesignElementHandle parent)
throws ExtendsException
parent - handle to the element that this element is to extend. If
null, then this element will no longer extend
another element.
ExtendsException - if the parent element is of the wrong type as this element.
public void setExtendsName(java.lang.String name)
throws ExtendsException
name - the name of the element that this one is to extend
ExtendsException - if no element exists with the given name, or if the element
is of the wrong type.
public void localize()
throws SemanticException
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.
public void setExtendsElement(org.eclipse.birt.report.model.core.DesignElement parent)
throws ExtendsException
setExtends(DesignElementHandle)
parent - the element that this element is to extend
ExtendsException - If the parent element is of the wrong type as this element.public SharedStyleHandle getStyle()
setStyle(SharedStyleHandle),
setStyleElement(StyleElement),
setStyleName(String)
public void setStyleName(java.lang.String name)
throws StyleException
name - the name of the shared style. If null, then
the shared style name is cleared.
StyleException - If the name is not valid, or if this element does not support
a style.getStyle()
public void setStyleElement(org.eclipse.birt.report.model.core.StyleElement obj)
throws StyleException
setStyle(SharedStyleHandle)
obj - the shared style. If null, then the shared
style is cleared.
StyleException - If this element does not support a style.getStyle()
public void setStyle(SharedStyleHandle style)
throws StyleException
style - the handle to the shared style. If null, then the shared style
is cleared.
StyleException - if this element does not support a style.getStyle()public StyleHandle getPrivateStyle()
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.
null if this element does not have style
properties.public java.lang.String getName()
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.
public java.lang.String getFullName()
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.
public java.lang.String getQualifiedName()
getName(), plus the namespace of the module that the
elment 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.
public void setName(java.lang.String name)
throws NameException
null, then
the name is cleared if this element does not require a name.
name - the new name
NameException - if the name is duplicate, or if the name is null
and this element requires a name.public long getID()
ModuleHandle.getElementByID(long),
MetaDataDictionary.enableElementID()public ElementFactory getElementFactory()
add method
of the slot handle that represents the point in the design where the new
element should appear.
SlotHandlepublic PropertyHandle getPropertyHandle(java.lang.String propName)
propName - the name of the property to get
null if the no property
exists with the given name.PropertyHandlepublic UserPropertyDefnHandle getUserPropertyDefnHandle(java.lang.String propName)
propName - the name of the property to get
null if
the no property exists with the given name or it is not a
user-defined property.public java.util.List getUserProperties()
UserPropertyDefn.
public FactoryPropertyHandle getFactoryPropertyHandle(java.lang.String propName)
propName - the name of the property to get
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.public DesignElementHandle getContainer()
public void moveTo(DesignElementHandle newContainer,
int toSlot)
throws ContentException
newContainer - the new container elementtoSlot - the target slot within the new container
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.SlotHandle
public void dropAndClear()
throws SemanticException
Note: If this element is referenceable, the property referring it will be set null.
SemanticException - if this element has no container or the element cannot be
dropped.SlotHandle,
drop()
public void drop()
throws SemanticException
Note: If this element is referenceable, the property referring it will be unresolved.
SemanticException - if this element has no container or the element cannot be
dropped.SlotHandle,
dropAndClear()public int findContentSlot(DesignElementHandle content)
content - handle to the content element to find
IDesignElementModel.NO_SLOTif the element is not contained in
this element.public SlotHandle getContainerSlotHandle()
null
if this element has no container.public PropertyHandle getContainerPropertyHandle()
null if this element has no containerpublic SlotHandle getSlot(int slotID)
null will be returned.
slotID - the identifier of the slot for which to obtain a handle
public java.util.Iterator getPropertyIterator()
getNext( ) returns an object of type
PropertyHandle.P