Package org.zkoss.zkex.zul
Class Jasperreport
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.Iframe
org.zkoss.zkex.zul.Jasperreport
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
public class Jasperreport
extends org.zkoss.zul.Iframe
The JasperReport component. It is used to generate a Jasper report into an
inline frame.
Available in ZK PE and ZK EE.
Note: this component is serializable only if the data source (getDatasource())
is serializable.
- Since:
- 3.0.2
- Author:
- gracelin
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA utility class to implementHtmlBasedComponent.getExtraCtrl().classNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the JasperReports Data Connection.net.sf.jasperreports.engine.JRDataSourceReturns the JasperReports DataSource.protected StringReturns the export file name for the download if any, the full name will be exportName + "." + format.Returns the output file locale.Returns the JasperReports Parameters.org.zkoss.util.media.MediaReturns a AMedia contains report's byte stream.getSrc()Returns the source (jasper file).getType()Returns the output file type.booleanReturns whether enable the hibernate data source.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) voidsetContent(org.zkoss.util.media.Media media) Sets the content directly.voidsetDataConnection(Connection connection) Sets the JasperReports Data Connection.voidsetDatasource(net.sf.jasperreports.engine.JRDataSource dataSource) Sets the JasperReports DataSource.voidsetExportName(String exportName) Sets the export file name for the download if any, the full name will be exportName + "." + format.voidsetHibernate(boolean hibernate) Sets whether enable the hibernate data source.voidvoidSet the factory to use your own exporter, reference toJasperreportExporterFactoryvoidSets the output file locale.voidsetParameters(Map<String, Object> parameters) Sets the JasperReports Parameters.voidSets the source (jasper file).voidSets the output file type.Methods inherited from class org.zkoss.zul.Iframe
getContent, getName, getScrolling, isAutohide, isChildable, service, setAutohide, setName, setScrollingMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, clone, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
Jasperreport
public Jasperreport() -
Jasperreport
-
-
Method Details
-
getSrc
Returns the source (jasper file).- Overrides:
getSrcin classorg.zkoss.zul.Iframe- Returns:
- src The compiled file (jasper file).
-
setSrc
Sets the source (jasper file).If src is changed, the whole component is redrawn.
- Overrides:
setSrcin classorg.zkoss.zul.Iframe- Parameters:
src- The compiled file (jasper file). If null or empty, nothing is included.
-
setContent
public void setContent(org.zkoss.util.media.Media media) Sets the content directly.Default: null.
Calling this method implies setSrc(null). In other words, the last invocation of
setContent(org.zkoss.util.media.Media)overrides the previoussetSrc(java.lang.String), if any.- Overrides:
setContentin classorg.zkoss.zul.Iframe- Parameters:
media- the media to display.- Since:
- 5.0.0
- See Also:
-
getParameters
Returns the JasperReports Parameters.Default: null.
-
setParameters
Sets the JasperReports Parameters. To provide exporter parameters, include an entry with key"exportParameter"and value as another parameter Map. For example:String key = JRXlsAbstractExporterParameter.PROPERTY_ONE_PAGE_PER_SHEET.toString(); Map parameters = new HashMap(); Map exportParams = new HashMap(); exportParams.put(key, false); parameters.put("exportParameter", exportParams); report.setParameters(parameters);- Parameters:
parameters- use to fill the report
-
setHibernate
public void setHibernate(boolean hibernate) Sets whether enable the hibernate data source.- Since:
- 5.0.1
-
isHibernate
public boolean isHibernate()Returns whether enable the hibernate data source.Default: false
- Since:
- 5.0.1
-
getDatasource
public net.sf.jasperreports.engine.JRDataSource getDatasource()Returns the JasperReports DataSource.Default: null.
-
setDatasource
public void setDatasource(net.sf.jasperreports.engine.JRDataSource dataSource) Sets the JasperReports DataSource.- Parameters:
dataSource- use to fill the report
-
setDataConnection
Sets the JasperReports Data Connection.- Parameters:
connection- use to fill the report- Since:
- 5.0.1
-
getDataConnection
Returns the JasperReports Data Connection.Default: null
- Since:
- 5.0.1
-
getType
Returns the output file type.Default: pdf.
- Since:
- 3.0.3
-
setType
Sets the output file type. Allowed type: pdf, xml, html, rtf, xls, jxl, csv and odt.- The PDF format.
- rtf
- The RTF format (Rich Text Format).
- xls
- The Microsoft Excel format generated with Apache POI.
- jxl
- The Microsoft Excel format generated with JExcelApi.
- csv
- The CSV format (Comma-Separated Values)
- odt
- The OpenOffice Writer format
- Parameters:
type- type of output file. If type is null, assign it a default value "pdf".- Since:
- 3.0.3
-
getLocale
Returns the output file locale.Default: null (means the ZK default,
Locales.getCurrent())).getLocale()getParameters()with a value
associated with JRParameter.REPORT_LOCALEWhat is used X ignored X null Y Y null null Locales.getCurrent()- Since:
- 3.0.4
-
setLocale
Sets the output file locale.- Parameters:
locale- the locale. If null, the ZK default is used (Locales.getCurrent()).- Since:
- 3.0.4
- See Also:
-
getExportName
Returns the export file name for the download if any, the full name will be exportName + "." + format. Note: exportName can not be empty or null. Default: "report".- Returns:
- export file name
- Since:
- 8.6.1
-
setExportName
Sets the export file name for the download if any, the full name will be exportName + "." + format. Note: exportName can not be empty or null.- Parameters:
exportName- the export file name- Throws:
IllegalArgumentException- if exportName is empty or null.- Since:
- 8.6.1
-
setJasperreporteExporterFactory
Set the factory to use your own exporter, reference toJasperreportExporterFactory- Parameters:
factory-
-
setJasperreporteExporterFactory
public void setJasperreporteExporterFactory(String clsnm) throws NoSuchMethodException, InstantiationException, InvocationTargetException, ClassNotFoundException, IllegalAccessException - Parameters:
clsnm-- Throws:
NoSuchMethodExceptionInstantiationExceptionInvocationTargetExceptionClassNotFoundExceptionIllegalAccessException- Since:
- 5.0.8
- See Also:
-
getJasperreporteExporterFactory
-
getEncodedSrc
- Overrides:
getEncodedSrcin classorg.zkoss.zul.Iframe
-
getExtraCtrl
- Specified by:
getExtraCtrlin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getExtraCtrlin classorg.zkoss.zul.Iframe
-
getReport
public org.zkoss.util.media.Media getReport()Returns a AMedia contains report's byte stream.- Since:
- 6.0.0
-
renderProperties
- Overrides:
renderPropertiesin classorg.zkoss.zul.Iframe- Throws:
IOException
-