All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jasperreports.engine.JRCommonElement Maven / Gradle / Ivy

There is a newer version: 6.21.3
Show newest version
/*
 * JasperReports - Free Java Reporting Library.
 * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
 * http://www.jaspersoft.com
 *
 * Unless you have purchased a commercial license agreement from Jaspersoft,
 * the following license terms apply:
 *
 * This program is part of JasperReports.
 *
 * JasperReports is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JasperReports is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with JasperReports. If not, see .
 */
package net.sf.jasperreports.engine;

import java.awt.Color;

import net.sf.jasperreports.engine.type.ModeEnum;


/**
 * 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 * {@link JRBand#getElementByKey(String) 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. * * * * * * * * @author Teodor Danciu ([email protected]) */ public interface JRCommonElement extends JRStyleContainer { public int getWidth(); public int getHeight(); /** * Returns the string value that uniquely identifies the element. */ public String getKey(); /** * 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. */ public ModeEnum getModeValue(); public ModeEnum getOwnModeValue(); /** * Sets the element transparency mode. */ public void setMode(ModeEnum mode); /** * */ public Color getForecolor(); /** * */ public Color getOwnForecolor(); /** * */ public void setForecolor(Color forecolor); /** * */ public Color getBackcolor(); /** * */ public Color getOwnBackcolor(); /** * */ public void setBackcolor(Color backcolor); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy