Package org.zkoss.zkmax.zul
Class Dropupload
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zkmax.zul.Dropupload
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
public class Dropupload
extends org.zkoss.zul.impl.XulElement
A component can handle drag files into it, and upload files to server.
Chrome (v.19+)
Firefox (v.13+)
Safari (5.1+)
Opera (12.1+)
IE (10+)
IE9
Opera (11.x)
Default HtmlBasedComponent.getZclass(): z-dropupload.
known supported browser :
known unsupported browser :
- Since:
- 6.5.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrlNested 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 TypeMethodDescriptionReturn acceptable file types.org.zkoss.zk.ui.ComponentReturn the anchor of dropupload.Return the detection area setting.intGet the maximum number of files user can upload at once, when number of upload files exceed the maxFileCount, nothing will be uploaded and onMaxFileCountExceed event will be triggered, developer can listen to onMaxFileCountExceed and get the number of upload files by callingEvent.getData()Default: -1intGet the max size setting of upload file, unit is "KB".Return the suppressed errors setting.booleanisNative()Return the setting that treat the upload file as binary or not.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) voidservice(org.zkoss.zk.au.AuRequest request, boolean everError) Process an AU request.voidSet acceptable file types.voidsetAnchor(org.zkoss.zk.ui.Component anchor) Set the anchor of dropupload, it allows the dropupload component to anchor to another component and overlay that component when the user drag & drops files to the browser.voidsetContent(String value) Set the content of component, it will be shown depend on detection setting.voidsetDetection(String value) Set drag detection area.voidsetMaxFileCount(int maxFileCount) Set the maximum number of files user can upload at once, when number of upload files exceed the maxFileCount, nothing will be uploaded and onMaxFileCountExceed event will be triggered, developer can listen to onMaxFileCountExceed and get the number of upload files by callingEvent.getData()voidsetMaxsize(int value) Set the max size of upload file, unit is "KB".voidsetNative(boolean value) Set the setting that treat the upload file as binary or not.voidsetSuppressedErrors(String suppressedErrors) Set the suppressed errors setting.voidsetSuppressedErrors(Collection<org.zkoss.zk.ui.ext.Uploadable.Error> suppressedErrors) Set the suppressed errors setting.voidsetViewerClass(String value) Set the custom upload viewer class name, if was not specified, will use ZK default upload viewer.Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, 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, isChildable, 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
-
Dropupload
public Dropupload()
-
-
Method Details
-
setMaxsize
public void setMaxsize(int value) Set the max size of upload file, unit is "KB". Notice: All the files in one drag-and-drop action must smaller than max size, or nothing will upload.- Parameters:
value- negative value is unlimited, 0 will useConfiguration.getMaxUploadSize()
-
getMaxsize
public int getMaxsize()Get the max size setting of upload file, unit is "KB". Refer tosetMaxsize(int)for more details. -
setDetection
Set drag detection area. When mouse drag over the detection area, it will show content. There are four accept value :- browser : whole browser, default value.
- none : disable detection.
- self : the Dropupload itself.
- $id : the id value of specified widget. If specified widget is not exist, will use default setting.
- Parameters:
value-
-
getDetection
Return the detection area setting. Refer tosetDetection(String)for more details. -
setViewerClass
Set the custom upload viewer class name, if was not specified, will use ZK default upload viewer.- Parameters:
value- custom upload viewer class name.
-
getViewerClass
- Returns:
- custom upload viewer class name.
-
setContent
Set the content of component, it will be shown depend on detection setting.- Parameters:
value- HTML string.- See Also:
-
getContent
- Returns:
- content of component.
-
setNative
public void setNative(boolean value) Set the setting that treat the upload file as binary or not. If true, treat file(s) as binary, i.e., not to convert it to image, audio or text files. -
isNative
public boolean isNative()Return the setting that treat the upload file as binary or not.- Returns:
- boolean
-
setAnchor
public void setAnchor(org.zkoss.zk.ui.Component anchor) Set the anchor of dropupload, it allows the dropupload component to anchor to another component and overlay that component when the user drag & drops files to the browser.- Parameters:
anchor- of dropupload
-
getAnchor
public org.zkoss.zk.ui.Component getAnchor()Return the anchor of dropupload.- Returns:
- Component
-
setMaxFileCount
public void setMaxFileCount(int maxFileCount) Set the maximum number of files user can upload at once, when number of upload files exceed the maxFileCount, nothing will be uploaded and onMaxFileCountExceed event will be triggered, developer can listen to onMaxFileCountExceed and get the number of upload files by callingEvent.getData()- Parameters:
maxFileCount- the maximum number of files user can upload at once, -1 means no limitation- Since:
- 8.5.2
-
getMaxFileCount
public int getMaxFileCount()Get the maximum number of files user can upload at once, when number of upload files exceed the maxFileCount, nothing will be uploaded and onMaxFileCountExceed event will be triggered, developer can listen to onMaxFileCountExceed and get the number of upload files by callingEvent.getData()Default: -1- Returns:
- the maximum number of files user can upload at once, -1 means no limitation
- Since:
- 8.5.2
-
getSuppressedErrors
Return the suppressed errors setting.Default: null
- Returns:
- the suppressed errors setting
- Since:
- 9.5.1
-
setSuppressedErrors
Set the suppressed errors setting. Specifies the suppressed uploading errors, separated by|(e.g. missing-required-component|illegal-upload).- Parameters:
suppressedErrors- the suppressed errors setting- Since:
- 9.5.1
- See Also:
-
Uploadable.Error
-
setSuppressedErrors
Set the suppressed errors setting. Specifies the suppressed uploading errors.- Parameters:
suppressedErrors- the suppressed errors setting- Since:
- 9.5.1
- See Also:
-
Uploadable.Error
-
setAccept
Set acceptable file types.- Parameters:
accept- acceptable file types- Since:
- 10.0.0
-
getAccept
Return acceptable file types.- Since:
- 10.0.0
-
renderProperties
- Overrides:
renderPropertiesin classorg.zkoss.zul.impl.XulElement- Throws:
IOException
-
service
public void service(org.zkoss.zk.au.AuRequest request, boolean everError) Process an AU request. It will handleEvents.ON_UPLOADand postUploadEvent.- Specified by:
servicein interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
servicein classorg.zkoss.zk.ui.HtmlBasedComponent- See Also:
-
HtmlBasedComponent.service(org.zkoss.zk.au.AuRequest, boolean)
-