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 classPdfviewer.ExtraCtrlA 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 voidbeforeChildAdded(Component child, Component insertBefore)Default: does nothing.booleanfirstPage()Go to the first page.intgetActivePage()Returns the active page (starting from 0).MediagetContent()Returns the content set bysetContent(org.zkoss.util.media.Media).java.lang.ObjectgetExtraCtrl()Returns the client control for this component.intgetPageCount()Returns the number of pages.intgetPageSize()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.intgetRotation()Returns the rotation angle.java.lang.StringgetSrc()Returns the source URI of the PDF file.java.lang.StringgetZclass()Returns the ZK Cascading Style class for this component.doublegetZoom()Returns the zoom level.booleanlastPage()Go to the last page.booleannextPage()Go to the next page.voidonChildAdded(Component child)Default: handles special event listeners.voidonChildRemoved(Component child)Default: handles special event listeners.booleanpreviousPage()Go to the previous page.protected voidrenderProperties(ContentRenderer renderer)Renders the content of this component, excluding the enclosing tags and children.voidrotateClockwise()Rotates 90 degrees clockwise.voidrotateCounterclockwise()Rotates 90 degrees counterclockwise.voidservice(AuRequest request, boolean everError)Processes an AU request.voidsetActivePage(int page)Sets the active page (starting from 0).voidsetContent(Media content)Sets the content.voidsetPageSize(int size)Sets the number of items per page.voidsetRotation(int rotation)Sets the rotation angle.voidsetSrc(java.lang.String src)Sets the source URI of the PDF file.voidsetZoom(double zoom)Sets the zoom level.voidsetZoom(java.lang.String zoom)Sets the zoom level.booleanzoomIn()Zoom in by 10%.booleanzoomOut()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:PageableReturns the active page (starting from 0).- Specified by:
getActivePagein interfacePageable
-
setActivePage
public void setActivePage(int page) throws WrongValueExceptionDescription copied from interface:PageableSets the active page (starting from 0).- Specified by:
setActivePagein 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:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classXulElement- Throws:
java.io.IOException
-
getPageSize
public int getPageSize()
Returns the number of items per page.Default: 1.
- Specified by:
getPageSizein interfacePageable
-
setPageSize
public void setPageSize(int size) throws WrongValueExceptionSets the number of items per page.It is readonly in pdfviewer.
- Specified by:
setPageSizein interfacePageable- Throws:
WrongValueException
-
getPageCount
public int getPageCount()
Description copied from interface:PageableReturns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCountin interfacePageable
-
firstPage
public boolean firstPage()
Go to the first page.- Returns:
trueif the action was successful.
-
previousPage
public boolean previousPage()
Go to the previous page.- Returns:
trueif the action was successful.
-
nextPage
public boolean nextPage()
Go to the next page.- Returns:
trueif the action was successful.
-
lastPage
public boolean lastPage()
Go to the last page.- Returns:
trueif the action was successful.
-
zoomIn
public boolean zoomIn()
Zoom in by 10%.- Returns:
trueif the action was successful.
-
zoomOut
public boolean zoomOut()
Zoom out by 10%.- Returns:
trueif 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:HtmlBasedComponentProcesses an AU request.Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.
- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classHtmlBasedComponenteverError- 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:AbstractComponentDefault: does nothing.- Specified by:
beforeChildAddedin interfaceComponentCtrl- Overrides:
beforeChildAddedin 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:AbstractComponentDefault: handles special event listeners.- Specified by:
onChildAddedin interfaceComponentCtrl- Overrides:
onChildAddedin classAbstractComponent- See Also:
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)
-
onChildRemoved
public void onChildRemoved(Component child)
Description copied from class:AbstractComponentDefault: handles special event listeners.- Specified by:
onChildRemovedin interfaceComponentCtrl- Overrides:
onChildRemovedin classAbstractComponent- See Also:
ComponentCtrl.onChildRemoved(org.zkoss.zk.ui.Component)
-
getZclass
public java.lang.String getZclass()
Description copied from class:HtmlBasedComponentReturns 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:
getZclassin classHtmlBasedComponent- See Also:
HtmlBasedComponent.getSclass()
-
getExtraCtrl
public java.lang.Object getExtraCtrl()
Description copied from class:HtmlBasedComponentReturns the client control for this component. It is used only by component developers.Default: creates an instance of
HtmlBasedComponent.ExtraCtrl.- Specified by:
getExtraCtrlin interfaceComponentCtrl- Overrides:
getExtraCtrlin 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:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Overrides:
getPropertyAccessin classXulElement- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
-