org.zkoss.zkex.zul
Class Jasperreport

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.Iframe
              extended by org.zkoss.zkex.zul.Jasperreport
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Component, Scope, ComponentCtrl

public class Jasperreport
extends 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:
Serialized Form

Nested Class Summary
protected  class Jasperreport.ExtraCtrl
          A utility class to implement HtmlBasedComponent.getExtraCtrl().
 class Jasperreport.JasperreporteExporterImpl
           
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Jasperreport()
           
Jasperreport(java.lang.String src)
           
 
Method Summary
 java.sql.Connection getDataConnection()
          Returns the JasperReports Data Connection.
 net.sf.jasperreports.engine.JRDataSource getDatasource()
          Returns the JasperReports DataSource.
protected  java.lang.String getEncodedSrc()
          Returns the encoded src (Iframe.getSrc()).
 java.lang.Object getExtraCtrl()
          Returns the client control for this component.
 JasperreportExporterFactory getJasperreporteExporterFactory()
           
 java.util.Locale getLocale()
          Returns the output file locale.
 java.util.Map<java.lang.String,java.lang.Object> getParameters()
          Returns the JasperReports Parameters.
 Media getReport()
          Returns a AMedia contains report's byte stream.
 java.lang.String getSrc()
          Returns the source (jasper file).
 java.lang.String getType()
          Returns the output file type.
 void invalidate()
          Invalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependences later.
 boolean isHibernate()
          Returns whether enable the hibernate data source.
 void setContent(Media media)
          Sets the content directly.
 void setDataConnection(java.sql.Connection connection)
          Sets the JasperReports Data Connection.
 void setDatasource(net.sf.jasperreports.engine.JRDataSource dataSource)
          Sets the JasperReports DataSource.
 void setHibernate(boolean hibernate)
          Sets whether enable the hibernate data source.
 void setJasperreporteExporterFactory(JasperreportExporterFactory factory)
          Set the factory to use your own exporter, reference to JasperreportExporterFactory
 void setJasperreporteExporterFactory(java.lang.String clsnm)
           
 void setLocale(java.util.Locale locale)
          Sets the output file locale.
 void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
          Sets the JasperReports Parameters.
 void setSrc(java.lang.String src)
          Sets the source (jasper file).
 void setType(java.lang.String type)
          Sets the output file type.
 
Methods inherited from class org.zkoss.zul.Iframe
getAlign, getContent, getName, getScrolling, isAutohide, isChildable, renderProperties, service, setAlign, setAutohide, setName, setScrolling
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
clone, focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowRoots, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Jasperreport

public Jasperreport()

Jasperreport

public Jasperreport(java.lang.String src)
Method Detail

getSrc

public java.lang.String getSrc()
Returns the source (jasper file).

Overrides:
getSrc in class Iframe
Returns:
src The compiled file (jasper file).

setSrc

public void setSrc(java.lang.String src)
Sets the source (jasper file).

If src is changed, the whole component is redrawn.

Overrides:
setSrc in class Iframe
Parameters:
src - The compiled file (jasper file). If null or empty, nothing is included.
See Also:
Iframe.setContent(org.zkoss.util.media.Media)

setContent

public void setContent(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 previous setSrc(java.lang.String), if any.

Overrides:
setContent in class Iframe
Parameters:
media - the media to display.
Since:
5.0.0
See Also:
setSrc(java.lang.String)

getParameters

public java.util.Map<java.lang.String,java.lang.Object> getParameters()
Returns the JasperReports Parameters.

Default: null.


setParameters

public void setParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
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

public void setDataConnection(java.sql.Connection connection)
Sets the JasperReports Data Connection.

Parameters:
connection - use to fill the report
Since:
5.0.1

getDataConnection

public java.sql.Connection getDataConnection()
Returns the JasperReports Data Connection.

Default: null

Since:
5.0.1

getType

public java.lang.String getType()
Returns the output file type.

Default: pdf.

Since:
3.0.3

setType

public void setType(java.lang.String type)
Sets the output file type. Allowed type: pdf, xml, html, rtf, xls, jxl, csv and odt.
pdf
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

public java.util.Locale getLocale()
Returns the output file locale.

Default: null (means the ZK default, Locales.getCurrent())).

getLocale() getParameters() with a value
associated with JRParameter.REPORT_LOCALE
What is used
XignoredX
nullYY
nullnullLocales.getCurrent()

Since:
3.0.4

setLocale

public void setLocale(java.util.Locale locale)
Sets the output file locale.

Parameters:
locale - the locale. If null, the ZK default is used (Locales.getCurrent()).
Since:
3.0.4
See Also:
getLocale()

setJasperreporteExporterFactory

public void setJasperreporteExporterFactory(JasperreportExporterFactory factory)
Set the factory to use your own exporter, reference to JasperreportExporterFactory

Parameters:
factory -

getJasperreporteExporterFactory

public JasperreportExporterFactory getJasperreporteExporterFactory()

setJasperreporteExporterFactory

public void setJasperreporteExporterFactory(java.lang.String clsnm)
                                     throws java.lang.NoSuchMethodException,
                                            java.lang.InstantiationException,
                                            java.lang.reflect.InvocationTargetException,
                                            java.lang.ClassNotFoundException,
                                            java.lang.IllegalAccessException
Parameters:
clsnm -
Throws:
java.lang.NoSuchMethodException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
Since:
5.0.8
See Also:
setJasperreporteExporterFactory(JasperreportExporterFactory)

getEncodedSrc

protected java.lang.String getEncodedSrc()
Description copied from class: Iframe
Returns the encoded src (Iframe.getSrc()).

Overrides:
getEncodedSrc in class Iframe

getExtraCtrl

public java.lang.Object getExtraCtrl()
Description copied from class: HtmlBasedComponent
Returns the client control for this component. It is used only by component developers.

Default: creates an instance of HtmlBasedComponent.ExtraCtrl.

Specified by:
getExtraCtrl in interface ComponentCtrl
Overrides:
getExtraCtrl in class Iframe
Returns:
null if no special handling required. If the component requires some special controls, it could return an object that implements one or several interfaces in the org.zkoss.zk.ui.ext.render package. For example, Cropper.
See Also:
ComponentCtrl.getExtraCtrl()

getReport

public Media getReport()
Returns a AMedia contains report's byte stream.

Since:
6.0.0

invalidate

public void invalidate()
Description copied from interface: Component
Invalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependences later. And, the widget associated with this component and all its descendant at the client will be deleted and recreated, too.

If the application is totally controlled by the server side (i.e., you don't write client codes), you rarely need to access this method.

It can be called only in the request-processing and event-processing phases. However, it is NOT allowed in the rendering phase.

Specified by:
invalidate in interface Component
Overrides:
invalidate in class AbstractComponent


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo