net.sf.jasperreports.engine

## Interface JRCommonElement

- All Superinterfaces:
    JRStyleContainer
  All Known Subinterfaces:
    JRBreak, JRChart, JRCommonGraphicElement, JRCommonImage, JRCommonText, JRComponentElement, JRCrosstab, JRElement, JREllipse, JRFrame, JRGenericElement, JRGenericPrintElement, JRGraphicElement, JRImage, JRLine, JRPrintElement, JRPrintEllipse, JRPrintFrame, JRPrintGraphicElement, JRPrintImage, JRPrintLine, JRPrintRectangle, JRPrintText, JRRecordedValuesPrintElement, JRRectangle, JRStaticText, JRSubreport, JRTextElement, JRTextField
  All Known Implementing Classes:
    ElementDecorator, FillTableSubreport, JRBaseBreak, JRBaseChart, JRBaseComponentElement, JRBaseCrosstab, JRBaseElement, JRBaseEllipse, JRBaseFrame, JRBaseGenericElement, JRBaseGenericPrintElement, JRBaseGraphicElement, JRBaseImage, JRBaseLine, JRBasePrintElement, JRBasePrintEllipse, JRBasePrintFrame, JRBasePrintGraphicElement, JRBasePrintImage, JRBasePrintLine, JRBasePrintRectangle, JRBasePrintText, JRBaseRectangle, JRBaseStaticText, JRBaseSubreport, JRBaseTextElement, JRBaseTextField, JRDesignBreak, JRDesignChart, JRDesignComponentElement, JRDesignCrosstab, JRDesignElement, JRDesignEllipse, JRDesignFrame, JRDesignGenericElement, JRDesignGraphicElement, JRDesignImage, JRDesignLine, JRDesignRectangle, JRDesignStaticText, JRDesignSubreport, JRDesignTextElement, JRDesignTextField, JRFillBreak, JRFillChart, JRFillComponentElement, JRFillCrosstab, JRFillElement, JRFillEllipse, JRFillFrame, JRFillGenericElement, JRFillGraphicElement, JRFillImage, JRFillLine, JRFillRectangle, JRFillStaticText, JRFillSubreport, JRFillTextElement, JRFillTextField, JRRecordedValuesGenericPrintElement, JRRecordedValuesPrintImage, JRRecordedValuesPrintText, JRTemplateElement, JRTemplateEllipse, JRTemplateFrame, JRTemplateGenericElement, JRTemplateGenericPrintElement, JRTemplateGraphicElement, JRTemplateImage, JRTemplateLine, JRTemplatePrintElement, JRTemplatePrintEllipse, JRTemplatePrintFrame, JRTemplatePrintGraphicElement, JRTemplatePrintImage, JRTemplatePrintLine, JRTemplatePrintRectangle, JRTemplatePrintText, JRTemplateRectangle, JRTemplateText, JRVirtualPrintPage.JRIdHolderTemplateElement, TableSubreport

      public interface JRCommonElement
      extends JRStyleContainer

  An abstract representation of a report element. All report elements implement this interface. The interface contains constants and methods that apply to all report elements.

  The properties that are common to all types of report elements are grouped in the `<reportElement>` tag, which appears in the declaration of all report elements.

  ### Element Key

  Unlike variables and parameters, report elements are not required to have a name, because normally you do not need to obtain any individual element inside a report template. However, in some cases it is useful to be able to locate an element to alter one of its properties before using the report template.

  This could be the case in an application for which the color of some elements in the report template needs to change based on user input. To locate the report elements that need to have their colors altered, the caller program could use the `getElementByKey(String)` method available at band level. A key value must be associated with the report element and it must be unique within the overall band for the lookup to work.

  ### Element Size

  The `width` and `height` attributes are mandatory and represent the size of the report element measured in pixels. Other element stretching settings may instruct the reporting engine to ignore the specified element height. Even in this case, the attributes remain mandatory since even when the height is calculated dynamically, the element will not be smaller than the originally specified height.

  ### Element Transparency

  Report elements can either be transparent or opaque, depending on the value specified for the `mode` attribute. The default value for this attribute depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, while images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.

  ### Element Color

  Two attributes represent colors: `forecolor` and `backcolor`. The fore color is for the text of the text elements and the border of the graphic elements. The background color fills the background of the specified report element, if it is not transparent.

  One can also use the decimal or hexadecimal representation for the desired color. The preferred way to specify colors in JRXML is using the hexadecimal representation, because it lets people control the level for each base color of the RGB system. For example, one can display a text field in red by setting its `forecolor` attribute as follows:

  `forecolor="#FF0000"`

  The equivalent using the decimal representation would be the following:

  `forecolor="16711680"`

  The default fore color is `black` and the default background color is `white`.
  Version:
    $Id: JRCommonElement.java 7045 2014-04-24 14:20:46Z shertage $
  Author:
    Teodor Danciu (teodord@users.sourceforge.net)

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.awt.Color` | `getBackcolor()`
    `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()`
    `int` | `getWidth()`
    `void` | `setBackcolor(java.awt.Color backcolor)`
    `void` | `setForecolor(java.awt.Color forecolor)`
    `void` | `setMode(ModeEnum mode)` Sets the element transparency mode.

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

      `getDefaultStyleProvider, getStyle, getStyleNameReference`

- - ### Method Detail

    - #### getWidth

          int getWidth()

    - #### getHeight

          int getHeight()

    - #### getKey

          java.lang.String getKey()

      Returns the string value that uniquely identifies the element.

    - #### getModeValue

          ModeEnum getModeValue()

      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.

    - #### getOwnModeValue

          ModeEnum getOwnModeValue()

    - #### setMode

          void setMode(ModeEnum mode)

      Sets the element transparency mode.

    - #### getForecolor

          java.awt.Color getForecolor()

    - #### getOwnForecolor

          java.awt.Color getOwnForecolor()

    - #### setForecolor

          void setForecolor(java.awt.Color forecolor)

    - #### getBackcolor

          java.awt.Color getBackcolor()

    - #### getOwnBackcolor

          java.awt.Color getOwnBackcolor()

    - #### setBackcolor

          void setBackcolor(java.awt.Color backcolor)

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com