Package com.inet.report
Class JavaBean
java.lang.Object
com.inet.report.ReportComponent
com.inet.report.Element
com.inet.report.AbstractFontElement
com.inet.report.JavaBean
- All Implemented Interfaces:
BorderProperties
,FontProperties
,GeneralProperties
,HyperlinkProperties
,NodeParser
,com.inet.report.ReferenceHolder
,Serializable
,Cloneable
An instance of this class is an i-net Clear Reports
Use
Use the
There are two methods for rendering a report. The default method
Please note that the view (image) of the bean is taken directly after the beans'
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
.Use
Section.addJavaBean
to create a JavaBean
element.Use the
setBeanProperty
methods to set a bean property to a Java Object
or an i-net Clear Reports ForumulaField
.There are two methods for rendering a report. The default method
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.Please note that the view (image) of the bean is taken directly after the beans'
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();
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inet.report.AbstractFontElement
AbstractFontElement.FontProps
Nested classes/interfaces inherited from class com.inet.report.Element
Element.BorderProps, Element.CommonProperties, Element.ElementTypes, Element.HyperlinkProps, Element.StringProps
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The Constant used for notify Customizer componentFields inherited from class com.inet.report.Element
BOX, CHART, CROSSTAB, CROSSTABSECTION, DATABASE_PICTURE, FIELD, FIELDPART, FORMFIELD, INTERACTIVE_SORTING, JAVABEAN, LINE, PARAGRAPH, PICTURE, SIGNATURE, SUBREPORT, TEXT, TEXTPART
Fields inherited from interface com.inet.report.BorderProperties
LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_DOUBLE, LINE_STYLE_SINGLE, NO_LINE
Fields inherited from interface com.inet.report.FontProperties
FONT_DIALOG, FONT_MONOSPACED, FONT_SANS_SERIF, FONT_SERIF, FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_STRIKETHROUGH, FONT_STYLE_UNDERLINE
Fields inherited from interface com.inet.report.GeneralProperties
ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_DEFAULT, ALIGN_HORIZONTAL_JUSTIFIED, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_RIGHT
-
Method Summary
Modifier and TypeMethodDescriptionvoid
FOR INTERNAL USE ONLY Bei 'OK' werden properties vom original bean eingelesen undPropertyValue
Einträge erstellt.static void
Checks if the class namedclassName
is a valid lightweight java bean extendingjava.awt.Component
.Returns the name of the beans's classReturn a instance of bean Component.Returns those bean property descriptors that are suitable for setting via the i-net Desginer GUI.getBeanPropertyFormula
(String name) Returns the current property FormulaField of the beans' property namedname
.getBeanPropertyValue
(String name) Returns the current property value of the beans' property namedname
.Returns the customizer component if it is supported for this bean.Returns a list with all property formulas that are set for this report element.double
getScale()
Returns the scaling factor used for this JavaBean.Returns the formula used to determine the scaling factor of this JavaBean.List<? extends ReportComponent>
Returns allReportComponent
s that are descendants of this one.boolean
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.parseElement
(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String, Object> parserMap) FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
setBeanClassName
(String name) Sets the name of the beans' classvoid
setBeanProperty
(String name, FormulaField field) Sets the beans property namedname
to be the value of the passedFormulaField
.void
setBeanProperty
(String name, Object value) Sets the beans property namedname
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.Methods inherited from class com.inet.report.AbstractFontElement
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
Methods inherited from class com.inet.report.Element
addListener, copy, getBottomLineStyle, getBottomLineStyleFormula, getBulletValueStack, getCanGrowCount, getCanGrowFormula, getCloseBorderOnPageBreakFormula, getDropShadowFormula, getEngine, getField, getForeColor, getForeColorFormula, getHorAlign, getHorAlignFormula, getHyperlinkUrl, getHyperlinkUrlFormula, getLeftLineStyle, getLeftLineStyleFormula, getListStack, getParent, getRightLineStyle, getRightLineStyleFormula, getSuppressIfDuplicatedFormula, getTightHorizontalFormula, getToolTipsText, getToolTipsTextFormula, getTopLineStyle, getTopLineStyleFormula, getTypeAsString, indexOf, isCanGrow, isCloseBorderOnPageBreak, isCloseBorderOnPageBreakInternal, isDropShadow, isInCrossTab, isSuppressIfDuplicated, isTightHorizontal, paramString, parseText, removeListener, setBottomLineStyle, setBottomLineStyleFormula, setBulletValueStack, setCanGrow, setCanGrowCount, setCanGrowFormula, setCloseBorderOnPageBreak, setCloseBorderOnPageBreakFormula, setDropShadow, setDropShadowFormula, setField, setForeColor, setForeColorFormula, setHorAlign, setHorAlignFormula, setHyperlinkUrl, setHyperlinkUrlFormula, setIndex, setLeftLineStyle, setLeftLineStyleFormula, setListStack, setReferences, setRightLineStyle, setRightLineStyleFormula, setSuppressIfDuplicated, setSuppressIfDuplicatedFormula, setTightHorizontal, setTightHorizontalFormula, setToolTipsText, setToolTipsTextFormula, setTopLineStyle, setTopLineStyleFormula
Methods inherited from class com.inet.report.ReportComponent
addPropertyChangeListener, addPropertyChangeListener, addReferencedObject, addVetoableChangeListener, addVetoableChangeListener, getBackColor, getBackColorFormula, getCustomData, getHeight, getKeepTogetherFormula, getRealReferencedObjectCount, getReferencedObjectCount, getReferencedObjects, getSuppressFormula, getType, getWidth, getX, getY, isDOMParser, isKeepTogether, isSuppress, parseDOM, parseEndElement, removePropertyChangeListener, removePropertyChangeListener, removeReferencedObject, removeVetoableChangeListener, removeVetoableChangeListener, resetReferences, setBackColor, setBackColorFormula, setCustomData, setHeight, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula, setWidth, setX, setY
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inet.report.BorderProperties
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
Methods inherited from interface com.inet.report.GeneralProperties
getKeepTogetherFormula, getSuppressFormula, isKeepTogether, isSuppress, setKeepTogether, setKeepTogetherFormula, setSuppress, setSuppressFormula
Methods inherited from interface com.inet.report.HyperlinkProperties
getHyperlinkUrl, getHyperlinkUrlFormula, setHyperlinkUrl, setHyperlinkUrlFormula
-
Field Details
-
APPLY_PROPERTIES
The Constant used for notify Customizer component- See Also:
-
-
Method Details
-
setBeanClassName
Sets the name of the beans' class- Parameters:
name
- The name of the beans' class- Throws:
ReportException
- If there are problems finding or initializing the bean by the name given.- Since:
- 6.0
-
getBeanClassName
Returns the name of the beans's class- Returns:
- The name of the beans' class
- Since:
- 6.0
-
getCustomizer
Returns the customizer component if it is supported for this bean.- Returns:
- the customizer component (null possible)
- Since:
- 10.1
-
getBeanPropertyDescriptorsForGUI
Returns those bean property descriptors that are suitable for setting via the i-net Desginer GUI.- Returns:
- Those bean property descriptors that are suitable for setting via the i-net Desginer GUI.
- Throws:
ReportException
- If an exception occurs during Introspection.IntrospectionException
- Since:
- 6.0
-
setBeanProperty
Sets the beans property namedname
to be the value of the passedFormulaField
. The value is computed at report time.- Parameters:
name
- The name of the beans' propertyfield
- The formula that produces the beans properties' value- Throws:
ReportException
- If a get or set method is missing for the property trying to be set.- Since:
- 6.0
-
setBeanProperty
Sets the beans property namedname
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".- Parameters:
name
- Name of the beans property to setvalue
- Value of the property, should be != null and convertible to the properties' type- Throws:
ReportException
- If a set or get method is missing for the property trying to be set.- Since:
- 6.0
-
getBeanPropertyFormula
Returns the current property FormulaField of the beans' property namedname
.- Parameters:
name
- The name of the beans property- Returns:
- The current property FormulaField of the beans' property named
name
. - Throws:
ReportException
- If problems occur while trying to access the formula, should never occur- Since:
- 6.5
-
getBeanPropertyValue
Returns the current property value of the beans' property namedname
. If this property is an i-net Clear Reports formula, the return value has typeFormulaField
.- Parameters:
name
- The name of the beans property- Returns:
- The current property value of the beans' property named
name
. - Throws:
ReportException
- If the property specified by the given name could not be found- Since:
- 6.5
-
checkBean
Checks if the class namedclassName
is a valid lightweight java bean extendingjava.awt.Component
.- Parameters:
className
- Name to check whether it exists as a java bean.- Throws:
ReportException
- If the bean could not be found, or is not valid (e.g. it is not public or not a component, etc.)- Since:
- 10.0
-
applyProperties
FOR INTERNAL USE ONLY Bei 'OK' werden properties vom original bean eingelesen undPropertyValue
Einträge erstellt.- Throws:
ReportException
-
isPaintToImage
public 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.- Returns:
- Returns whether the bean is set to "paint to an image"
- Since:
- 6.0
- See Also:
-
setPaintToImage
public 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. On printing the result can be screened. It can be look like printed with a dot matrix printer.- Parameters:
paintToImage
- The paintToImage to set.- Since:
- 6.0
- See Also:
-
getBeanComponent
Return a instance of bean Component. This method is used for example by i-net Designer to create a preview of the component in the design view.- Returns:
- Instance of the bean as a Component.
- Since:
- 6.0
-
getPropertyFormulas
Returns a list with all property formulas that are set for this report element. This includes property formulas for any type of sub-component but excludes formulas for any descendantReportComponent
of this one. To get the property formulas for descendantReportComponent
useReportComponent.getSubComponents()
- Overrides:
getPropertyFormulas
in classAbstractFontElement
- Returns:
- List of property formulas
-
setScale
Sets the scaling factor for this JavaBean element. The scaling factory is used for both the width and the height of this JavaBean. At runtime a uniform scaling of this JavaBean will be done.- Parameters:
scale
- The scaling factor to be used for this JavaBean.- Throws:
IllegalArgumentException
- If the supplied scale factor is less or equal to zero.- Since:
- 7.4
- See Also:
-
getScale
public double getScale()Returns the scaling factor used for this JavaBean.- Returns:
- The current scaling factor of this JavaBean.
- Since:
- 7.4
- See Also:
-
setScaleFormula
Sets a formula for the scaling factor of this JavaBean. The set formula will override the value set bysetScale(double)
. The formula should return a number value greater than zero.- Parameters:
scaleFormula
- The formula which should be used to determine the scale factor for this JavaBean.- Since:
- 7.4
- See Also:
-
getScaleFormula
Returns the formula used to determine the scaling factor of this JavaBean.- Returns:
- The formula used to determine the scaling factor of this JavaBean or
null
if no formula has been set. - Since:
- 7.4
- See Also:
-
parseElement
public NodeParser parseElement(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String, Object> parserMap) throws FatalParserExceptionFOR INTERNAL USE ONLY FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLParses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.
- Specified by:
parseElement
in interfaceNodeParser
- Overrides:
parseElement
in classAbstractFontElement
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.tag
- The XMLTag to be parsedatts
- The set of attributes in the current XMLTagparserMap
- The map of current Parser.- Returns:
- The NodeParser sub-element if one needed to be created, or null if none was created.
- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-
getSubComponents
Returns allReportComponent
s that are descendants of this one. E.G. this will return all Element of aSection
. But it's as well useful forCrossTab
s orText
elements which have additional elements.- Specified by:
getSubComponents
in classReportComponent
- Returns:
- a list with all sub components which can be empty as well; will be
null
if the component has no descendants
-