Package org.eclipse.birt.report.model.api

# Class GroupPropertyHandle

java.lang.Object
org.eclipse.birt.report.model.api.GroupPropertyHandle

public class GroupPropertyHandle extends Object
A handle for working with a top-level property of a collection of elements. Use this handle to set/get values of a property if this property is common across the given collection of elements.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected GroupElementHandle`
`handle`
Handle to a collection of elements.
`protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn`
`propDefn`
Definition of the property.

## Method Summary

Modifier and Type
Method
Description
`void`
`clearValue()`
Clears the value of the property on every element.
`boolean`
`equals(Object target)`
Compares the specified Object with this `GroupPropertyHandle` for equality.
`String`
`getDisplayValue()`
Value will be returned as string only if all values of this property are equal within the collection of elements.
`String`
`getLocalStringValue()`
Value will be returned as string only if all values of this property are equal within the collection of elements and one of them has a local value.
`protected Object`
`getLocalValue()`
Value will be returned only if all values of this property are equal within the collection of elements and one of them has a local value.
`IElementPropertyDefn`
`getPropertyDefn()`
Return the property definition.
`List`
`getReferenceableElementList()`
Returns the element reference value list if the property is element referenceable type.
`String`
`getStringValue()`
Value will be returned as string only if all values of this property are equal within the collection of elements.
`Object`
`getValue()`
Gets the value of the property.
`boolean`
`isReadOnly()`
Checks whether a property is read-only in the property sheet.
`boolean`
`isVisible()`
Checks whether a property is visible in the property sheet.
`void`
`setStringValue(String value)`
Set the string value on a group of elements.
`void`
`setValue(Object value)`
Set the object value on a group of elements.
`final boolean`
`shareSameValue()`
Indicates whether the group of element share the same value for this property.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### propDefn

protected org.eclipse.birt.report.model.metadata.ElementPropertyDefn propDefn
Definition of the property.

### handle

protected GroupElementHandle handle
Handle to a collection of elements.

## Method Details

### shareSameValue

public final boolean shareSameValue()
Indicates whether the group of element share the same value for this property.

If all element has a `null` value for this property, it is considered that they share the same value.

Returns:
  `true` if the group of element share the same value.

### getStringValue

public String getStringValue()
Value will be returned as string only if all values of this property are equal within the collection of elements.

Returns:
  The value as string if all the element values for the property are equal. Return null, if elements have different value for the property.
See Also:
  - `SimpleValueHandle.getStringValue()`

### getLocalStringValue

public String getLocalStringValue()
Value will be returned as string only if all values of this property are equal within the collection of elements and one of them has a local value.

Returns:
  The value as string if all the element values for the property are equal and one of them has a local value. Return null, if elements have different value for the property or none of them has a local value.

### getLocalValue

protected Object getLocalValue()
Value will be returned only if all values of this property are equal within the collection of elements and one of them has a local value.

Returns:
  The value if all the element values for the property are equal and one of them has a local value. Return null, if elements have different value for the property or none of them has a local value.

### getDisplayValue

public String getDisplayValue()
Value will be returned as string only if all values of this property are equal within the collection of elements. The value return are localized.

Returns:
  The localized value as string if all the element values for the property are equal. Return null, if elements have different value for the property.
See Also:
  - `SimpleValueHandle.getDisplayValue()`

### setValue

public void setValue(Object value) throws SemanticException
Set the object value on a group of elements. This operation will be executed within a transaction, it will be rollbacked if any set operation failed.

Parameters:
  `value` - the object value to set
Throws:
  `SemanticException` - if the property is undefined on an element or the value is invalid.
See Also:
  - `PropertyHandleImpl.setValue(Object)`

### setStringValue

public void setStringValue(String value) throws SemanticException
Set the string value on a group of elements. This operation will be executed within a transaction, it will be rollbacked if any set operation failed.

Parameters:
  `value` - the string value to set
Throws:
  `SemanticException` - if the property is undefined on an element or the string value is invalid.
See Also:
  - `SimpleValueHandle.setStringValue(String)`

### getPropertyDefn

public IElementPropertyDefn getPropertyDefn()
Return the property definition.

Returns:
  the property definition.

### clearValue

public void clearValue() throws SemanticException
Clears the value of the property on every element.

Throws:
  `SemanticException` - If the value cannot be cleared.

### getReferenceableElementList

public List getReferenceableElementList()
Returns the element reference value list if the property is element referenceable type. The list of available elements are sorted by their names lexicographically.

Returns:
  list of the reference element value.

### equals

public boolean equals(Object target)
Compares the specified Object with this `GroupPropertyHandle` for equality. Returns `true` in the following cases:

- `target` is a `PropertyHandle`. The element of `target` is in the `GroupElementHandle` and two property definitions are same.
- `target` is a `GroupPropertyHandle`. `GroupElementHandle` and the the property definition are same.

Overrides:
  `equals` in class `Object`
Parameters:
  `target` - the property or group property handle
Returns:
  `true` if the two property handles are considerred as same. Otherwise `false`.

### isVisible

public boolean isVisible()
Checks whether a property is visible in the property sheet. The visible property is visible in all `elements`.

Returns:
  `true` if it is visible. Otherwise `false`.

### isReadOnly

public boolean isReadOnly()
Checks whether a property is read-only in the property sheet. The read-only property is read-only in all `elements`.

Returns:
  `true` if it is read-only. Otherwise `false`.

### getValue

public Object getValue()
Gets the value of the property. Value will be returned as object only if all values of this property are equal within the collection of elements.

Returns:
  The value if all the element values for the property are equal. Return null, if elements have different value for the property.
See Also:
  - `SimpleValueHandle.getValue()`