public class JavaBean extends AbstractFontElement implements HyperlinkProperties, BorderProperties
Element
that represents a Java Bean
which can be rendered to a report. The Java bean must be a lightweight bean extending
java.awt.Component
.Section.addJavaBean
to create a JavaBean
element.setBeanProperty
methods to set a bean property to a Java Object
or an i-net Clear Reports ForumulaField
.paintToImage
paints the view of the Java bean into a background image then draws the image to the report.
If paintToImage
is set to false, this class will attempt to render directly to
the report (which may provide better quality, e.g when using fonts). Please note that the second
method does not support components that use a Java Graphics2D
object to paint
themselves and currently does not support clipping.paint
method returns. If the bean accesses its Graphics
in threads or after the paint method
the resulting view will be incorrect.
The following example code creates a PDF report containing a javax.swing.JSlider
component showing 75% of 100%:
Engine engine = RDC.createEmptyEngine();
Section section = (Section) engine.getSections().get(0);
JavaBean javaBean = section.addJavaBean("javax.swing.JSlider", 1, 100, 3000, 315);
javaBean.setBeanProperty("minimum", new Integer(0));
javaBean.setBeanProperty("maximum", new Integer(100));
javaBean.setBeanProperty("value", new Integer(75));
engine.execute();
FileOutputStream fos = new FileOutputStream("D:/exports/slider_bean.pdf");
for( int i=1;i<=engine.getPageCount();i++ ) {
fos.write(engine.getPageData(i));
}
fos.close();
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLY_PROPERTIES
The Constant used for notify Customizer component
|
BOX, CHART, CROSSTAB, CROSSTABSECTION, DATABASE_PICTURE, FIELD, FIELDPART, FORMFIELD, INTERACTIVE_SORTING, JAVABEAN, LINE, PARAGRAPH, PICTURE, SIGNATURE, SUBREPORT, TEXT, TEXTPART
LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_DOUBLE, LINE_STYLE_SINGLE, NO_LINE
FONT_DIALOG, FONT_MONOSPACED, FONT_SANS_SERIF, FONT_SERIF, FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_STRIKETHROUGH, FONT_STYLE_UNDERLINE
ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_DEFAULT, ALIGN_HORIZONTAL_JUSTIFIED, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT
Modifier and Type | Method and Description |
---|---|
static void |
checkBean(java.lang.String className)
Checks if the class named
className is a valid lightweight java bean
extending java.awt.Component . |
java.lang.String |
getBeanClassName()
Returns the name of the beans's class
|
java.awt.Component |
getBeanComponent()
Return a instance of bean Component.
|
java.beans.PropertyDescriptor[] |
getBeanPropertyDescriptorsForGUI()
Returns those bean property descriptors that are suitable for setting via the i-net Desginer GUI.
|
FormulaField |
getBeanPropertyFormula(java.lang.String name)
Returns the current property FormulaField of the beans' property named
name . |
java.lang.Object |
getBeanPropertyValue(java.lang.String name)
Returns the current property value of the beans' property named
name . |
java.beans.Customizer |
getCustomizer()
Returns the customizer component if it is supported for this bean.
|
java.util.List<FormulaField> |
getPropertyFormulas()
Returns a list with all property formulas that are set for this report element.
|
double |
getScale()
Returns the scaling factor used for this JavaBean.
|
FormulaField |
getScaleFormula()
Returns the formula used to determine the scaling factor of this JavaBean.
|
java.util.List<? extends ReportComponent> |
getSubComponents()
Returns all
ReportComponent s that are descendants of this one. |
boolean |
isPaintToImage()
Returns whether the bean is set to "paint to an image", which makes sure
that all Graphics2D methods are supported, however it also causes less graphical
quality on higher zoom levels.
|
void |
setBeanClassName(java.lang.String name)
Sets the name of the beans' class
|
void |
setBeanProperty(java.lang.String name,
FormulaField field)
Sets the beans property named
name to be the value of the passed
FormulaField . |
void |
setBeanProperty(java.lang.String name,
java.lang.Object value)
Sets the beans property named
name to the passed value (while
trying to convert to the properties' type). |
void |
setPaintToImage(boolean paintToImage)
If the bean is paint to a image then all API methods of
Graphics2D for paint() of the current JDK are supported.
|
void |
setScale(double scale)
Sets the scaling factor for this JavaBean element.
|
void |
setScaleFormula(FormulaField scaleFormula)
Sets a formula for the scaling factor of this JavaBean.
|
getFontColor, getFontColorFormula, getFontName, getFontNameFormula, getFontSize, getFontSizeFormula, getFontSizeTwips, getFontStyle, getFontStyleFormula, getStrikeoutFormula, getUnderlineFormula, isBold, isItalic, isStrikeout, isUnderline, setBold, setFontColor, setFontColorFormula, setFontName, setFontNameFormula, setFontSize, setFontSizeFormula, setFontSizeTwips, setFontStyle, setFontStyleFormula, setItalic, setStrikeout, setStrikeoutFormula, setUnderline, setUnderlineFormula
addListener, copy, getBottomLineStyle, getBottomLineStyleFormula, getCanGrowCount, getCanGrowFormula, getCloseBorderOnPageBreakFormula, getDropShadowFormula, getEngine, getField, getForeColor, getForeColorFormula, getHorAlign, getHorAlignFormula, getHyperlinkUrl, getHyperlinkUrlFormula, getLeftLineStyle, getLeftLineStyleFormula, getParent, getRightLineStyle, getRightLineStyleFormula, getSuppressIfDuplicatedFormula, getTightHorizontalFormula, getToolTipsText, getToolTipsTextFormula, getTopLineStyle, getTopLineStyleFormula, indexOf, isCanGrow, isCloseBorderOnPageBreak, isDropShadow, isSuppressIfDuplicated, isTightHorizontal, paramString, removeListener, setBottomLineStyle, setBottomLineStyleFormula, setCanGrow, setCanGrowCount, setCanGrowFormula, setCloseBorderOnPageBreak, setCloseBorderOnPageBreakFormula, setDropShadow, setDropShadowFormula, setField, setForeColor, setForeColorFormula, setHorAlign, setHorAlignFormula, setHyperlinkUrl, setHyperlinkUrlFormula, setIndex, setLeftLineStyle, setLeftLineStyleFormula, setRightLineStyle, setRightLineStyleFormula, setSuppressIfDuplicated, setSuppressIfDuplicatedFormula, setTightHorizontal, setTightHorizontalFormula, setToolTipsText, setToolTipsTextFormula, setTopLineStyle, setTopLineStyleFormula
getBackColor, getBackColorFormula, getHeight, getKeepTogetherFormula, getSuppressFormula, getType, getWidth, getX, getY, isKeepTogether, isSuppress, setBackColor, setBackColorFormula, setHeight, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula, setWidth, setX, setY
getHyperlinkUrl, getHyperlinkUrlFormula, setHyperlinkUrl, setHyperlinkUrlFormula
getBackColor, getBackColorFormula, getBottomLineStyle, getBottomLineStyleFormula, getCloseBorderOnPageBreakFormula, getDropShadowFormula, getForeColor, getForeColorFormula, getLeftLineStyle, getLeftLineStyleFormula, getRightLineStyle, getRightLineStyleFormula, getTightHorizontalFormula, getTopLineStyle, getTopLineStyleFormula, isCloseBorderOnPageBreak, isDropShadow, isTightHorizontal, setBackColor, setBackColorFormula, setBottomLineStyle, setBottomLineStyleFormula, setCloseBorderOnPageBreak, setCloseBorderOnPageBreakFormula, setDropShadow, setDropShadowFormula, setForeColor, setForeColorFormula, setLeftLineStyle, setLeftLineStyleFormula, setRightLineStyle, setRightLineStyleFormula, setTightHorizontal, setTightHorizontalFormula, setTopLineStyle, setTopLineStyleFormula
getKeepTogetherFormula, getSuppressFormula, isKeepTogether, isSuppress, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula
isDOMParser, parseDOM, parseElement, parseEndElement, parseText
public static final java.lang.String APPLY_PROPERTIES
public void setBeanClassName(java.lang.String name) throws ReportException
name
- The name of the beans' classReportException
- If there are problems finding or initializing the bean by the name given.public java.lang.String getBeanClassName()
public java.beans.Customizer getCustomizer()
public java.beans.PropertyDescriptor[] getBeanPropertyDescriptorsForGUI() throws ReportException
ReportException
- If an exception occurs during Introspection. IntrospectionException
public void setBeanProperty(java.lang.String name, FormulaField field) throws ReportException
name
to be the value of the passed
FormulaField
. The value is computed at report time.name
- The name of the beans' propertyfield
- The formula that produces the beans properties' valueReportException
- If a get or set method is missing for the property trying to be set.public void setBeanProperty(java.lang.String name, java.lang.Object value) throws ReportException
name
to the passed value (while
trying to convert to the properties' type). Please note: name
is
the name of the property as defined in the JavaBeans API Specification (1.01),
chapter 8.8 "Capitalization of inferred names".name
- Name of the beans property to setvalue
- Value of the property, should be != null and convertible to the properties' typeReportException
- If a set or get method is missing for the property trying to be set.public FormulaField getBeanPropertyFormula(java.lang.String name) throws ReportException
name
.name
- The name of the beans propertyname
.ReportException
- If problems occur while trying to access the formula,
should never occurpublic java.lang.Object getBeanPropertyValue(java.lang.String name) throws ReportException
name
.
If this property is an i-net Clear Reports formula, the return value has type FormulaField
.name
- The name of the beans propertyname
.ReportException
- If the property specified by the given name could not be foundpublic static void checkBean(java.lang.String className) throws ReportException
className
is a valid lightweight java bean
extending java.awt.Component
.className
- Name to check whether it exists as a java bean.ReportException
- If the bean could not be found, or is not valid
(e.g. it is not public or not a component, etc.)public boolean isPaintToImage()
setPaintToImage(boolean)
public void setPaintToImage(boolean paintToImage)
paintToImage
- The paintToImage to set.isPaintToImage()
public java.awt.Component getBeanComponent()
public java.util.List<FormulaField> getPropertyFormulas()
ReportComponent
of this one. To get the property formulas for descendant ReportComponent
use ReportComponent.getSubComponents()
getPropertyFormulas
in class AbstractFontElement
public void setScale(double scale) throws java.lang.IllegalArgumentException
scale
- The scaling factor to be used for this JavaBean.java.lang.IllegalArgumentException
- If the supplied scale factor is less or
equal to zero.getScale()
,
setScaleFormula(FormulaField)
,
getScaleFormula()
public double getScale()
setScale(double)
,
setScaleFormula(FormulaField)
,
getScaleFormula()
public void setScaleFormula(FormulaField scaleFormula)
setScale(double)
. The formula
should return a number value greater than zero.scaleFormula
- The formula which should be used to determine the
scale factor for this JavaBean.getScaleFormula()
,
setScale(double)
,
getScale()
public FormulaField getScaleFormula()
null
if no formula has been set.setScaleFormula(FormulaField)
,
setScale(double)
,
getScale()
public java.util.List<? extends ReportComponent> getSubComponents()
ReportComponent
s that are descendants of this one. E.G. this will return all Element
of a Section
. But it's as well useful for CrossTab
s or Text
elements which have
additional elements.getSubComponents
in class ReportComponent
null
if the component has no descendantsCopyright © 1999-2020 by i-net software GmbH