net.sf.jasperreports.engine.base

## Class JRBaseElement

- java.lang.Object
- - net.sf.jasperreports.engine.base.JRBaseElement

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, JRChangeEventsSupport, JRChild, JRCloneable, JRCommonElement, JRElement, JRIdentifiable, JRPropertiesHolder, JRStyleContainer, JRVisitable
  Direct Known Subclasses:
    JRBaseBreak, JRBaseChart, JRBaseComponentElement, JRBaseCrosstab, JRBaseFrame, JRBaseGenericElement, JRBaseGraphicElement, JRBaseSubreport, JRBaseTextElement, JRDesignElement

      public abstract class JRBaseElement
      extends java.lang.Object
      implements JRElement, java.io.Serializable, JRChangeEventsSupport

  This class provides a skeleton implementation for a report element. It mostly provides internal variables, representing the most common element properties, and their getter/setter methods. It also has a constructor for initializing these properties.
  Version:
    $Id: JRBaseElement.java 6260 2013-06-12 14:59:35Z lucianc $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.awt.Color` | `backcolor`
    `protected JRDefaultStyleProvider` | `defaultStyleProvider`
    `protected JRElementGroup` | `elementGroup`
    `protected java.awt.Color` | `forecolor`
    `protected int` | `height`
    `protected boolean` | `isPrintInFirstWholeBand`
    `protected boolean` | `isPrintRepeatedValues`
    `protected boolean` | `isPrintWhenDetailOverflows`
    `protected boolean` | `isRemoveLineWhenBlank`
    `protected java.lang.String` | `key`
    `protected ModeEnum` | `modeValue`
    `protected JRStyle` | `parentStyle`
    `protected java.lang.String` | `parentStyleNameReference`
    `protected PositionTypeEnum` | `positionTypeValue`
    `protected JRExpression` | `printWhenExpression`
    `protected JRGroup` | `printWhenGroupChanges`
    `static java.lang.String` | `PROPERTY_POSITION_TYPE`
    `static java.lang.String` | `PROPERTY_PRINT_IN_FIRST_WHOLE_BAND`
    `static java.lang.String` | `PROPERTY_PRINT_REPEATED_VALUES`
    `static java.lang.String` | `PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS`
    `static java.lang.String` | `PROPERTY_REMOVE_LINE_WHEN_BLANK`
    `static java.lang.String` | `PROPERTY_STRETCH_TYPE`
    `static java.lang.String` | `PROPERTY_WIDTH`
    `static java.lang.String` | `PROPERTY_X`
    `protected StretchTypeEnum` | `stretchTypeValue`
    `protected java.util.UUID` | `uuid`
    `protected int` | `width`
    `protected int` | `x`
    `protected int` | `y`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `JRBaseElement(JRDefaultStyleProvider defaultStyleProvider)`
    `protected` | `JRBaseElement(JRElement element, JRBaseObjectFactory factory)` Initializes basic properties of the element.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()`
    `java.lang.Object` | `clone(JRElementGroup parentGroup)`
    `JRElement` | `clone(JRElementGroup parentGroup, int y)`
    `java.awt.Color` | `getBackcolor()`
    `protected JRStyle` | `getBaseStyle()`
    `JRDefaultStyleProvider` | `getDefaultStyleProvider()`
    `JRElementGroup` | `getElementGroup()` Indicates the logical group that the element belongs to.
    `JRPropertyChangeSupport` | `getEventSupport()` Returns the property change support object for this instance.
    `java.awt.Color` | `getForecolor()`
    `int` | `getHeight()`
    `java.lang.String` | `getKey()` Returns the string value that uniquely identifies the element.
    `ModeEnum` | `getModeValue()` Returns the element transparency mode.
    `java.awt.Color` | `getOwnBackcolor()`
    `java.awt.Color` | `getOwnForecolor()`
    `ModeEnum` | `getOwnModeValue()`
    `JRPropertiesHolder` | `getParentProperties()` Returns the parent properties holder, whose properties are used as defaults for this object.
    `PositionTypeEnum` | `getPositionTypeValue()` Returns the position type for the element
    `JRExpression` | `getPrintWhenExpression()` Gets the expression that is evaluated in order to decide if the element should be displayed.
    `JRGroup` | `getPrintWhenGroupChanges()` Returns the group for which an element with a printRepeatedValues attribute set to true will be redisplayed even if the value has not changed.
    `JRPropertiesMap` | `getPropertiesMap()` Returns this object's properties map.
    `JRPropertyExpression[]` | `getPropertyExpressions()` Returns the list of dynamic/expression-based properties for this report element.
    `StretchTypeEnum` | `getStretchTypeValue()` Indicates the stretch type for the element
    `JRStyle` | `getStyle()` Returns this object's style.
    `java.lang.String` | `getStyleNameReference()` Returns the name of an external style which is to be used by this object.
    `java.util.UUID` | `getUUID()`
    `int` | `getWidth()`
    `int` | `getX()` Gets the the section relative horizontal offset of the element top left corner.
    `int` | `getY()` Gets the the section relative vertical offset of the element top left corner.
    `boolean` | `hasProperties()` Checks whether the object has any properties.
    `boolean` | `isPrintInFirstWholeBand()` Returns true if an element with a printRepeatedValues attribute set to true will be redisplayed for every new page or column that is not an overflow from a previous page or column.
    `boolean` | `isPrintRepeatedValues()` Specifies if the element value will be printed for every iteration, even if its value has not changed.
    `boolean` | `isPrintWhenDetailOverflows()` If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
    `boolean` | `isRemoveLineWhenBlank()` Returns true if the remaining blank space appearing when the value is not printed will be removed.
    `void` | `setBackcolor(java.awt.Color backcolor)`
    `void` | `setForecolor(java.awt.Color forecolor)`
    `void` | `setMode(ModeEnum modeValue)` Sets the element transparency mode.
    `void` | `setPositionType(PositionTypeEnum positionTypeValue)` Sets the position type for the element.
    `void` | `setPrintInFirstWholeBand(boolean isPrint)` Specifies whether an element with a printRepeatedValues attribute set to true should be redisplayed for every new page or column that is not an overflow from a previous page or column.
    `void` | `setPrintRepeatedValues(boolean isPrintRepeatedValues)`
    `void` | `setPrintWhenDetailOverflows(boolean isPrint)` If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
    `void` | `setRemoveLineWhenBlank(boolean isRemoveLine)` Specifies whether the remaining blank space appearing when the value is not printed will be removed.
    `void` | `setStretchType(StretchTypeEnum stretchTypeValue)` Specifies how the engine should treat a missing image.
    `void` | `setWidth(int width)`
    `void` | `setX(int x)` Sets the the section relative horizontal offset of the element top left corner.

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

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

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRElement

      `collectExpressions`

    - ### Methods inherited from interface net.sf.jasperreports.engine.JRVisitable

      `visit`

- - ### Field Detail

    - #### PROPERTY_POSITION_TYPE

          public static final java.lang.String PROPERTY_POSITION_TYPE

      See Also:
        Constant Field Values

    - #### PROPERTY_PRINT_IN_FIRST_WHOLE_BAND

          public static final java.lang.String PROPERTY_PRINT_IN_FIRST_WHOLE_BAND

      See Also:
        Constant Field Values

    - #### PROPERTY_PRINT_REPEATED_VALUES

          public static final java.lang.String PROPERTY_PRINT_REPEATED_VALUES

      See Also:
        Constant Field Values

    - #### PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS

          public static final java.lang.String PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS

      See Also:
        Constant Field Values

    - #### PROPERTY_REMOVE_LINE_WHEN_BLANK

          public static final java.lang.String PROPERTY_REMOVE_LINE_WHEN_BLANK

      See Also:
        Constant Field Values

    - #### PROPERTY_STRETCH_TYPE

          public static final java.lang.String PROPERTY_STRETCH_TYPE

      See Also:
        Constant Field Values

    - #### PROPERTY_WIDTH

          public static final java.lang.String PROPERTY_WIDTH

      See Also:
        Constant Field Values

    - #### PROPERTY_X

          public static final java.lang.String PROPERTY_X

      See Also:
        Constant Field Values

    - #### uuid

          protected java.util.UUID uuid

    - #### key

          protected java.lang.String key

    - #### positionTypeValue

          protected PositionTypeEnum positionTypeValue

    - #### stretchTypeValue

          protected StretchTypeEnum stretchTypeValue

    - #### isPrintRepeatedValues

          protected boolean isPrintRepeatedValues

    - #### modeValue

          protected ModeEnum modeValue

    - #### x

          protected int x

    - #### y

          protected int y

    - #### width

          protected int width

    - #### height

          protected int height

    - #### isRemoveLineWhenBlank

          protected boolean isRemoveLineWhenBlank

    - #### isPrintInFirstWholeBand

          protected boolean isPrintInFirstWholeBand

    - #### isPrintWhenDetailOverflows

          protected boolean isPrintWhenDetailOverflows

    - #### forecolor

          protected java.awt.Color forecolor

    - #### backcolor

          protected java.awt.Color backcolor

    - #### printWhenExpression

          protected JRExpression printWhenExpression

    - #### printWhenGroupChanges

          protected JRGroup printWhenGroupChanges

    - #### elementGroup

          protected JRElementGroup elementGroup

    - #### defaultStyleProvider

          protected JRDefaultStyleProvider defaultStyleProvider

    - #### parentStyle

          protected JRStyle parentStyle

    - #### parentStyleNameReference

          protected java.lang.String parentStyleNameReference

  - ### Constructor Detail

    - #### JRBaseElement

          protected JRBaseElement(JRDefaultStyleProvider defaultStyleProvider)

    - #### JRBaseElement

          protected JRBaseElement(JRElement element,
                       JRBaseObjectFactory factory)

      Initializes basic properties of the element.
      Parameters:
        `element` - an element whose properties are copied to this element. Usually it is a `JRDesignElement` that must be transformed into an `JRBaseElement` at compile time.
        `factory` - a factory used in the compile process

  - ### Method Detail

    - #### getDefaultStyleProvider

          public JRDefaultStyleProvider getDefaultStyleProvider()

      Specified by:
        `getDefaultStyleProvider` in interface `JRStyleContainer`

    - #### getBaseStyle

          protected JRStyle getBaseStyle()

    - #### getUUID

          public java.util.UUID getUUID()

      Specified by:
        `getUUID` in interface `JRIdentifiable`

    - #### getKey

          public java.lang.String getKey()

      Description copied from interface: `JRElement`
      Returns the string value that uniquely identifies the element.
      Specified by:
        `getKey` in interface `JRCommonElement`
      Specified by:
        `getKey` in interface `JRElement`

    - #### getPositionTypeValue

          public PositionTypeEnum getPositionTypeValue()

      Description copied from interface: `JRElement`
      Returns the position type for the element
      Specified by:
        `getPositionTypeValue` in interface `JRElement`
      Returns:
        the position type

    - #### setPositionType

          public void setPositionType(PositionTypeEnum positionTypeValue)

      Description copied from interface: `JRElement`
      Sets the position type for the element.
      Specified by:
        `setPositionType` in interface `JRElement`
      Parameters:
        `positionTypeValue` - the position type

    - #### getStretchTypeValue

          public StretchTypeEnum getStretchTypeValue()

      Description copied from interface: `JRElement`
      Indicates the stretch type for the element
      Specified by:
        `getStretchTypeValue` in interface `JRElement`
      Returns:
        a value representing one of the stretch type constants in `StretchTypeEnum`

    - #### setStretchType

          public void setStretchType(StretchTypeEnum stretchTypeValue)

      Description copied from interface: `JRElement`
      Specifies how the engine should treat a missing image.
      Specified by:
        `setStretchType` in interface `JRElement`
      Parameters:
        `stretchTypeValue` - a value representing one of the stretch type constants in `StretchTypeEnum`

    - #### isPrintRepeatedValues

          public boolean isPrintRepeatedValues()

      Description copied from interface: `JRElement`
      Specifies if the element value will be printed for every iteration, even if its value has not changed.
      Specified by:
        `isPrintRepeatedValues` in interface `JRElement`
      See Also:
        `JRElement.isRemoveLineWhenBlank()`, `JRElement.isPrintInFirstWholeBand()`

    - #### setPrintRepeatedValues

          public void setPrintRepeatedValues(boolean isPrintRepeatedValues)

      Specified by:
        `setPrintRepeatedValues` in interface `JRElement`

    - #### getModeValue

          public ModeEnum getModeValue()

      Description copied from interface: `JRCommonElement`
      Returns the element transparency mode. The default value depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, but the images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.
      Specified by:
        `getModeValue` in interface `JRCommonElement`

    - #### getOwnModeValue

          public ModeEnum getOwnModeValue()

      Specified by:
        `getOwnModeValue` in interface `JRCommonElement`

    - #### setMode

          public void setMode(ModeEnum modeValue)

      Description copied from interface: `JRCommonElement`
      Sets the element transparency mode.
      Specified by:
        `setMode` in interface `JRCommonElement`

    - #### getX

          public int getX()

      Description copied from interface: `JRElement`
      Gets the the section relative horizontal offset of the element top left corner.
      Specified by:
        `getX` in interface `JRElement`

    - #### setX

          public void setX(int x)

      Description copied from interface: `JRElement`
      Sets the the section relative horizontal offset of the element top left corner.
      Specified by:
        `setX` in interface `JRElement`

    - #### getY

          public int getY()

      Description copied from interface: `JRElement`
      Gets the the section relative vertical offset of the element top left corner.
      Specified by:
        `getY` in interface `JRElement`

    - #### getWidth

          public int getWidth()

      Specified by:
        `getWidth` in interface `JRCommonElement`

    - #### setWidth

          public void setWidth(int width)

      Specified by:
        `setWidth` in interface `JRElement`

    - #### getHeight

          public int getHeight()

      Specified by:
        `getHeight` in interface `JRCommonElement`

    - #### isRemoveLineWhenBlank

          public boolean isRemoveLineWhenBlank()

      Description copied from interface: `JRElement`
      Returns true if the remaining blank space appearing when the value is not printed will be removed. Under certain circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the space reserved for the current element remains empty. If this method returns true, it means the engine will try to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.
      Specified by:
        `isRemoveLineWhenBlank` in interface `JRElement`

    - #### setRemoveLineWhenBlank

          public void setRemoveLineWhenBlank(boolean isRemoveLine)

      Description copied from interface: `JRElement`
      Specifies whether the remaining blank space appearing when the value is not printed will be removed. Under certain circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the space reserved for the current element remains empty. If the parameter is set to true, it means the engine will try to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.
      Specified by:
        `setRemoveLineWhenBlank` in interface `JRElement`

    - #### isPrintInFirstWholeBand

          public boolean isPrintInFirstWholeBand()

      Description copied from interface: `JRElement`
      Returns true if an element with a printRepeatedValues attribute set to true will be redisplayed for every new page or column that is not an overflow from a previous page or column.
      Specified by:
        `isPrintInFirstWholeBand` in interface `JRElement`
      See Also:
        `JRElement.isPrintRepeatedValues()`

    - #### setPrintInFirstWholeBand

          public void setPrintInFirstWholeBand(boolean isPrint)

      Description copied from interface: `JRElement`
      Specifies whether an element with a printRepeatedValues attribute set to true should be redisplayed for every new page or column that is not an overflow from a previous page or column.
      Specified by:
        `setPrintInFirstWholeBand` in interface `JRElement`
      See Also:
        `JRElement.isPrintRepeatedValues()`

    - #### isPrintWhenDetailOverflows

          public boolean isPrintWhenDetailOverflows()

      Description copied from interface: `JRElement`
      If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page. Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except those elements that fitted in the current page and have isPrintWhenDetailOverflow set to false.
      Specified by:
        `isPrintWhenDetailOverflows` in interface `JRElement`

    - #### setPrintWhenDetailOverflows

          public void setPrintWhenDetailOverflows(boolean isPrint)

      Description copied from interface: `JRElement`
      If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page. Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except those elements that fitted in the current page and have isPrintWhenDetailOverflow set to false.
      Specified by:
        `setPrintWhenDetailOverflows` in interface `JRElement`

    - #### getForecolor

          public java.awt.Color getForecolor()

      Specified by:
        `getForecolor` in interface `JRCommonElement`

    - #### getOwnForecolor

          public java.awt.Color getOwnForecolor()

      Specified by:
        `getOwnForecolor` in interface `JRCommonElement`

    - #### setForecolor

          public void setForecolor(java.awt.Color forecolor)

      Specified by:
        `setForecolor` in interface `JRCommonElement`

    - #### getBackcolor

          public java.awt.Color getBackcolor()

      Specified by:
        `getBackcolor` in interface `JRCommonElement`

    - #### getOwnBackcolor

          public java.awt.Color getOwnBackcolor()

      Specified by:
        `getOwnBackcolor` in interface `JRCommonElement`

    - #### setBackcolor

          public void setBackcolor(java.awt.Color backcolor)

      Specified by:
        `setBackcolor` in interface `JRCommonElement`

    - #### getPrintWhenExpression

          public JRExpression getPrintWhenExpression()

      Description copied from interface: `JRElement`
      Gets the expression that is evaluated in order to decide if the element should be displayed. This expression always returns a boolean value.
      Specified by:
        `getPrintWhenExpression` in interface `JRElement`

    - #### getPrintWhenGroupChanges

          public JRGroup getPrintWhenGroupChanges()

      Description copied from interface: `JRElement`
      Returns the group for which an element with a printRepeatedValues attribute set to true will be redisplayed even if the value has not changed.
      Specified by:
        `getPrintWhenGroupChanges` in interface `JRElement`
      See Also:
        `JRElement.isPrintRepeatedValues()`

    - #### getElementGroup

          public JRElementGroup getElementGroup()

      Description copied from interface: `JRElement`
      Indicates the logical group that the element belongs to. More elements can be grouped in order to get the height of the tallest one.
      Specified by:
        `getElementGroup` in interface `JRElement`
      See Also:
        `StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT`

    - #### getStyle

          public JRStyle getStyle()

      Description copied from interface: `JRStyleContainer`
      Returns this object's style.
      Specified by:
        `getStyle` in interface `JRStyleContainer`
      Returns:
        this object's style

    - #### getStyleNameReference

          public java.lang.String getStyleNameReference()

      Description copied from interface: `JRStyleContainer`
      Returns the name of an external style which is to be used by this object.

      External styles are defined in `templates` and are resolved at fill time. This attribute is only effective if no direct style (as returned by `getStyle()` is specified for this object.
      Specified by:
        `getStyleNameReference` in interface `JRStyleContainer`
      Returns:
        the name of an external style

    - #### getEventSupport

          public JRPropertyChangeSupport getEventSupport()

      Description copied from interface: `JRChangeEventsSupport`
      Returns the property change support object for this instance.
      Specified by:
        `getEventSupport` in interface `JRChangeEventsSupport`
      Returns:
        the property change support object for this instance

    - #### clone

          public java.lang.Object clone()

      Specified by:
        `clone` in interface `JRCloneable`
      Overrides:
        `clone` in class `java.lang.Object`

    - #### clone

          public java.lang.Object clone(JRElementGroup parentGroup)

      Specified by:
        `clone` in interface `JRChild`

    - #### clone

          public JRElement clone(JRElementGroup parentGroup,
                        int y)

      Specified by:
        `clone` in interface `JRElement`

    - #### hasProperties

          public boolean hasProperties()

      Description copied from interface: `JRPropertiesHolder`
      Checks whether the object has any properties.
      Specified by:
        `hasProperties` in interface `JRPropertiesHolder`
      Returns:
        whether the object has any properties

    - #### getPropertiesMap

          public JRPropertiesMap getPropertiesMap()

      Description copied from interface: `JRPropertiesHolder`
      Returns this object's properties map.
      Specified by:
        `getPropertiesMap` in interface `JRPropertiesHolder`
      Returns:
        this object's properties map

    - #### getParentProperties

          public JRPropertiesHolder getParentProperties()

      Description copied from interface: `JRPropertiesHolder`
      Returns the parent properties holder, whose properties are used as defaults for this object.
      Specified by:
        `getParentProperties` in interface `JRPropertiesHolder`
      Returns:
        the parent properties holder, or `null` if no parent

    - #### getPropertyExpressions

          public JRPropertyExpression[] getPropertyExpressions()

      Description copied from interface: `JRElement`
      Returns the list of dynamic/expression-based properties for this report element.
      Specified by:
        `getPropertyExpressions` in interface `JRElement`
      Returns:
        an array containing the expression-based properties of this report element

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com