Class GroupElementHandle
- Direct Known Subclasses:
EmptyGroupElementHandle
,SimpleGroupElementHandle
For our ease-of-use purpose, we support multiple selections across type. Given a collection of elements, user can ask for their common properties(including user property definitions). Also, return a list of values that are identical for all items. Finally, return an indication of whether all elements are of the same type.
This class also supports a collection of elements contains some objects that
are not a DesignElementHandle
or its subclass. For this case,
getCommonProperties
always returns an empty list.
For BIRT UI usage, the attributes view will go blank if the providing elements are not of the same type, the property sheet will show the common properties(including user property definitions).
This handle is mutable, it can be kept. The query results changed as the given elements themselves changed.
Note that the Model special handling of the case where all elements are the same type: in this case, by definition, all BIRT-defined properties are the same. (User-defined properties may differ.)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Checks if all elements have extends parents or virtual parents.abstract void
Clears values of all common properties(except the extends property) for the given collection of elements.abstract void
Clears values of all common properties(except the extends property) for the given collection of elements.final void
clearProperty
(String propName) Clears the value of a property on the given collection of elements if the property is a common property shared by each element.abstract List
Returns the common properties shared by the given group of elements(including user properties).final String
getDisplayProperty
(String propName) If the given property is a common property, value will be returned as a display value if all values within the group of elements are equal.abstract List
Returns the list that contains the group of design elements.final String
getLocalStringProperty
(String propName) If the given property is a common property, value will be returned as a string if all values within the group of elements are equal and one of them has a local value.abstract org.eclipse.birt.report.model.core.Module
Returns the module.abstract ModuleHandle
Returns the handle of module.abstract GroupPropertyHandle
getPropertyHandle
(String propName) If property is shared by the group of elements, return the correspondingGroupPropertyHandle
, otherwise, returnnull
.final String
getStringProperty
(String propName) If the given property is a common property, value will be returned as a string if all values within the group of elements are equal.final boolean
This method returnttrue
in following condition:final boolean
This method returnttrue
in following condition:protected boolean
hasLocalPropertiesIncludeSubElement
(DesignElementHandle elementHandle) return true if the Element or subElement has local propertiesabstract boolean
Returnstrue
if each of the given collection of element extends has a parent.protected abstract boolean
isInGroup
(DesignElementHandle element) Checks whether theelement
is a member ofGroupElementHandle
.protected abstract boolean
isPropertyReadOnly
(String propName) Checks whether a property is read-only in the property sheet.protected abstract boolean
isPropertyVisible
(String propName) Checks whether a property is visible in the property sheet.abstract boolean
Indicates that if the given elements are of the same definition.final Iterator
Returns an iterator over the common properties.final void
setProperty
(String propName, Object value) Set the value of a property on the given collection of elements.final void
setStringProperty
(String propName, String value) Set the value of a property to a string .final boolean
shareSameValue
(String propName) Indicates whether the group of element share the same value for this property.abstract Iterator
Returns an iterator over the common properties that are visible.
-
Constructor Details
-
GroupElementHandle
public GroupElementHandle()Default constructor.
-
-
Method Details
-
getElements
Returns the list that contains the group of design elements. Contents of it isDesignElementHandle
- Returns:
- the list that contains the group of design elements.
-
getModule
public abstract org.eclipse.birt.report.model.core.Module getModule()Returns the module.- Returns:
- the module
-
getModuleHandle
Returns the handle of module.- Returns:
- the handle of module
-
isSameType
public abstract boolean isSameType()Indicates that if the given elements are of the same definition. Elements are considered of same type if their element definitions are identical.If elements have different definitions. Even the same element type, the return value is
false
. For example, if the list contains anOdaDataSource
and aOdaDataSource
, this method returnsfalse
.- Returns:
true
if the given elements are of the same type; returnfalse
if elements are of different element types, or the given list is empty, or the list contains any object that is not an instance ofDesignElementHandle
.
-
getCommonProperties
Returns the common properties shared by the given group of elements(including user properties). Contents of the list is element property definitions. If elements do not share any common property, return an empty list.- Returns:
- the common properties shared by the given group of elements. If
elements do not share any common property, or the given list is
empty, or the list contains any item that is not an instance of
DesignElementHandle
, return an empty list.
-
propertyIterator
Returns an iterator over the common properties. Contents of the iterator are handles to the common properties, type of them isGroupPropertyHandle
. Note: remove is not support for the iterator.- Returns:
- an iterator over the common properties. Contents of the iterator are
handles to the common properties, type of them is
GroupPropertyHandle
-
visiblePropertyIterator
Returns an iterator over the common properties that are visible. Contents of the iterator are handles to the common properties, type of them isGroupPropertyHandle
. Note: remove is not support for the iterator.- Returns:
- an iterator over the common properties. Contents of the iterator are
handles to the common properties, type of them is
GroupPropertyHandle
-
isPropertyVisible
Checks whether a property is visible in the property sheet. The visible property is visible in allelements
.- Parameters:
propName
- the property name- Returns:
true
if it is visible. Otherwisefalse
.
-
clearLocalProperties
Clears values of all common properties(except the extends property) for the given collection of elements. 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. Note: this method clear the values of local properties ( not include sub element)- Throws:
SemanticException
- if the property is not defined on this element
-
clearLocalPropertiesIncludeSubElement
Clears values of all common properties(except the extends property) for the given collection of elements. 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. Note: this method clear all the values of local properties (include sub element)- Throws:
SemanticException
- if the property is not defined on this element
-
isExtendedElements
public abstract boolean isExtendedElements()Returnstrue
if each of the given collection of element extends has a parent. Returnsfalse
otherwise. If the collection has no elements, also returnfalse
- Returns:
true
if each of the given collection of element extends has a parent. Returnsfalse
otherwise. If the collection has no elements, also returnfalse
-
hasLocalPropertiesForExtendedElements
public final boolean hasLocalPropertiesForExtendedElements()This method returnttrue
in following condition:1. The multi selected elements are same type.
2. And the multi selected elements have extends.
3. If any of the given elements has local properties.
- Returns:
true
if the conditions is met.
-
hasLocalPropertiesIncludeSubElement
public final boolean hasLocalPropertiesIncludeSubElement()This method returnttrue
in following condition:1. The multi selected elements are same type.
2. And the multi selected elements have extends.
3. If any of the given elements or their subElement has local properties.
- Returns:
true
if the conditions is met.
-
hasLocalPropertiesIncludeSubElement
return true if the Element or subElement has local properties- Parameters:
elementHandle
-- Returns:
- true if the Element or his subElement has local properties
-
allExtendedElements
protected abstract boolean allExtendedElements()Checks if all elements have extends parents or virtual parents.- Returns:
true
If all elements have extend parents or virtual parents. Otherwisefalse
;
-
isPropertyReadOnly
Checks whether a property is read-only in the property sheet. The visible property is read-only in allelements
.- Parameters:
propName
- the property name- Returns:
true
if it is read-only. Otherwisefalse
.
-
getPropertyHandle
If property is shared by the group of elements, return the correspondingGroupPropertyHandle
, otherwise, returnnull
.- Parameters:
propName
- name of the property needs to be handled.- Returns:
- If the property is a common property among the elements, return the
corresponding
GroupPropertyHandle
; Otherwise returnnull
.
-
getStringProperty
If the given property is a common property, value will be returned as a string if all values within the group of elements are equal. If the property is not a common property, returnnull
.- Parameters:
propName
- name of the property.- Returns:
- the value as a string if the property is a common property and all the elements have the same value. Return null if the property is not a common property or elements have different values for this property.
- See Also:
-
getDisplayProperty
If the given property is a common property, value will be returned as a display value if all values within the group of elements are equal. If the property is not a common property, returnnull
.- Parameters:
propName
- name of the property.- Returns:
- the value as a display value if the property is a common property and all the elements have the same value. Return null if the property is not a common property or elements have different values for this property.
- See Also:
-
GroupPropertyHandle#getDisplayProperty()
-
getLocalStringProperty
If the given property is a common property, value will be returned as a string if all values within the group of elements are equal and one of them has a local value. If the property is not a common property or none of them has a local value, returnnull
.- Parameters:
propName
- name of the property.- Returns:
- the value as a string if the property is a common property, all the elements have the same value and one of them has a local value. Return null if the property is not a common property or elements have different values for this property or none of them has a local value.
- See Also:
-
setProperty
Set the value of a property on the given collection of elements. If the property provided is not a common property then this method simply return; Otherwise, the value will be set on the group of elements.- Parameters:
propName
- name of the property.value
- value needs to set.- Throws:
SemanticException
- if the value is invalid for the property, or the property is undefined on the elements.- See Also:
-
clearProperty
Clears the value of a property on the given collection of elements if the property is a common property shared by each element. 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.If the property provided is not a common property then this method simply return, else, the value will be cleared on the group of elements.
- Parameters:
propName
- the name of the property to clear.- Throws:
SemanticException
- if the property is not defined on this element
-
setStringProperty
Set the value of a property to a string . If the property provided is not a common property then this method simply return; Else, the string value will be set on the group of element.- Parameters:
propName
- name of the property.value
- value needs to set.- Throws:
SemanticException
- if the value is invalid for the property, or the property is undefined on the elements.
-
isInGroup
Checks whether theelement
is a member ofGroupElementHandle
.- Parameters:
element
- the element to check- Returns:
true
if the element is in the list, otherwisefalse
.
-