Class Pdfviewer
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zkex.zul.Pdfviewer
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,Component
,Scope
,ComponentCtrl
,Pageable
public class Pdfviewer extends XulElement implements Pageable
A PDF file viewer.Only works for browsers supporting HTML5 (Firefox, Chrome, Opera, IE 11, Edge, Safari...).
Available in ZK PE and ZK EE.
Default
getZclass()
: z-pdfviewer.- Since:
- 9.0.0
- Author:
- rudyhuang
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Pdfviewer.ExtraCtrl
A utility class to implementHtmlBasedComponent.getExtraCtrl()
.-
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo
-
-
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
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, 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 Constructor Description Pdfviewer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beforeChildAdded(Component child, Component insertBefore)
Default: does nothing.boolean
firstPage()
Go to the first page.int
getActivePage()
Returns the active page (starting from 0).Media
getContent()
Returns the content set bysetContent(org.zkoss.util.media.Media)
.java.lang.Object
getExtraCtrl()
Returns the client control for this component.int
getPageCount()
Returns the number of pages.int
getPageSize()
Returns the number of items per page.PropertyAccess<?>
getPropertyAccess(java.lang.String prop)
Returns the corresponding property access object from the given property name, if any.int
getRotation()
Returns the rotation angle.java.lang.String
getSrc()
Returns the source URI of the PDF file.java.lang.String
getZclass()
Returns the ZK Cascading Style class for this component.double
getZoom()
Returns the zoom level.boolean
lastPage()
Go to the last page.boolean
nextPage()
Go to the next page.void
onChildAdded(Component child)
Default: handles special event listeners.void
onChildRemoved(Component child)
Default: handles special event listeners.boolean
previousPage()
Go to the previous page.protected void
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing tags and children.void
rotateClockwise()
Rotates 90 degrees clockwise.void
rotateCounterclockwise()
Rotates 90 degrees counterclockwise.void
service(AuRequest request, boolean everError)
Processes an AU request.void
setActivePage(int page)
Sets the active page (starting from 0).void
setContent(Media content)
Sets the content.void
setPageSize(int size)
Sets the number of items per page.void
setRotation(int rotation)
Sets the rotation angle.void
setSrc(java.lang.String src)
Sets the source URI of the PDF file.void
setZoom(double zoom)
Sets the zoom level.void
setZoom(java.lang.String zoom)
Sets the zoom level.boolean
zoomIn()
Zoom in by 10%.boolean
zoomOut()
Zoom out by 10%.-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods 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, 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, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, 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, 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
-
-
-
-
Method Detail
-
getSrc
public java.lang.String getSrc()
Returns the source URI of the PDF file.Default: null.
-
setSrc
public void setSrc(java.lang.String src)
Sets the source URI of the PDF file.Calling this method implies setContent(null). In other words, the last invocation of setSrc overrides the previous
setContent(org.zkoss.util.media.Media)
, if any.
-
getContent
public Media getContent()
Returns the content set bysetContent(org.zkoss.util.media.Media)
.Default: null.
Note: it won't fetch what is set thru by
setSrc(java.lang.String)
. It simply returns what is passed tosetContent(org.zkoss.util.media.Media)
.
-
setContent
public void setContent(Media content)
Sets the content.Calling this method implies setSrc(null). In other words, the last invocation of setContent overrides the previous
setSrc(java.lang.String)
, if any.
-
getActivePage
public int getActivePage()
Description copied from interface:Pageable
Returns the active page (starting from 0).- Specified by:
getActivePage
in interfacePageable
-
setActivePage
public void setActivePage(int page) throws WrongValueException
Description copied from interface:Pageable
Sets the active page (starting from 0).- Specified by:
setActivePage
in interfacePageable
- Throws:
WrongValueException
-
getZoom
public double getZoom()
Returns the zoom level.Default: 1.0.
-
setZoom
public void setZoom(double zoom)
Sets the zoom level.
-
setZoom
public void setZoom(java.lang.String zoom)
Sets the zoom level.- Parameters:
zoom
- fit-page-width or fit-page-height- Since:
- 9.6.0
-
getRotation
public int getRotation()
Returns the rotation angle.Default: 0.
-
setRotation
public void setRotation(int rotation)
Sets the rotation angle.- Parameters:
rotation
- rotation angle. Only 0, 90, 180 and 270 are accepted.
-
renderProperties
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
Description copied from class:HtmlBasedComponent
Renders the content of this component, excluding the enclosing tags and children.- Overrides:
renderProperties
in classXulElement
- Throws:
java.io.IOException
-
getPageSize
public int getPageSize()
Returns the number of items per page.Default: 1.
- Specified by:
getPageSize
in interfacePageable
-
setPageSize
public void setPageSize(int size) throws WrongValueException
Sets the number of items per page.It is readonly in pdfviewer.
- Specified by:
setPageSize
in interfacePageable
- Throws:
WrongValueException
-
getPageCount
public int getPageCount()
Description copied from interface:Pageable
Returns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCount
in interfacePageable
-
firstPage
public boolean firstPage()
Go to the first page.- Returns:
true
if the action was successful.
-
previousPage
public boolean previousPage()
Go to the previous page.- Returns:
true
if the action was successful.
-
nextPage
public boolean nextPage()
Go to the next page.- Returns:
true
if the action was successful.
-
lastPage
public boolean lastPage()
Go to the last page.- Returns:
true
if the action was successful.
-
zoomIn
public boolean zoomIn()
Zoom in by 10%.- Returns:
true
if the action was successful.
-
zoomOut
public boolean zoomOut()
Zoom out by 10%.- Returns:
true
if the action was successful.
-
rotateClockwise
public void rotateClockwise()
Rotates 90 degrees clockwise.
-
rotateCounterclockwise
public void rotateCounterclockwise()
Rotates 90 degrees counterclockwise.
-
service
public void service(AuRequest request, boolean everError)
Description copied from class:HtmlBasedComponent
Processes an AU request.Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
- Specified by:
service
in interfaceComponentCtrl
- Overrides:
service
in classHtmlBasedComponent
everError
- whether any error ever occurred before processing this request.- See Also:
AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
-
beforeChildAdded
public void beforeChildAdded(Component child, Component insertBefore)
Description copied from class:AbstractComponent
Default: does nothing.- Specified by:
beforeChildAdded
in interfaceComponentCtrl
- Overrides:
beforeChildAdded
in classAbstractComponent
- Parameters:
child
- the child to be added (never null).insertBefore
- another child component that the new child will be inserted before it. If null, the new child will be the last child.- See Also:
ComponentCtrl.beforeChildAdded(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
-
onChildAdded
public void onChildAdded(Component child)
Description copied from class:AbstractComponent
Default: handles special event listeners.- Specified by:
onChildAdded
in interfaceComponentCtrl
- Overrides:
onChildAdded
in classAbstractComponent
- See Also:
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)
-
onChildRemoved
public void onChildRemoved(Component child)
Description copied from class:AbstractComponent
Default: handles special event listeners.- Specified by:
onChildRemoved
in interfaceComponentCtrl
- Overrides:
onChildRemoved
in classAbstractComponent
- See Also:
ComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)
-
getZclass
public java.lang.String getZclass()
Description copied from class:HtmlBasedComponent
Returns the ZK Cascading Style class for this component. It usually depends on the implementation of the mold (AbstractComponent.getMold()
).Default: null (the default value depends on element).
HtmlBasedComponent.setZclass(java.lang.String)
) will completely replace the default style of a component. In other words, the default style of a component is associated with the default value ofHtmlBasedComponent.getZclass()
. Once it is changed, the default style won't be applied at all. If you want to perform small adjustments, useHtmlBasedComponent.setSclass(java.lang.String)
instead.- Overrides:
getZclass
in classHtmlBasedComponent
- See Also:
HtmlBasedComponent.getSclass()
-
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 interfaceComponentCtrl
- Overrides:
getExtraCtrl
in classHtmlBasedComponent
- 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()
-
getPropertyAccess
public PropertyAccess<?> getPropertyAccess(java.lang.String prop)
Description copied from interface:ComponentCtrl
Returns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccess
in interfaceComponentCtrl
- Overrides:
getPropertyAccess
in classXulElement
- Parameters:
prop
- the name of the property- Returns:
- null it means not to support for the property name.
-
-