Class Dropupload

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Component, Scope, ComponentCtrl

    public class Dropupload
    extends XulElement
    A component can handle drag files into it, and upload files to server.

    Default HtmlBasedComponent.getZclass(): z-dropupload.

    known supported browser :

  • Chrome (v.19+)
  • Firefox (v.13+)
  • Safari (5.1+)
  • Opera (12.1+)
  • IE (10+)
  • known unsupported browser :

  • IE9
  • Opera (11.x)
  • Since:
    6.5.0
    See Also:
    Serialized Form
    • Constructor Detail

      • Dropupload

        public Dropupload()
    • Method Detail

      • 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 use Configuration.getMaxUploadSize()
      • getMaxsize

        public int getMaxsize()
        Get the max size setting of upload file, unit is "KB". Refer to setMaxsize(int) for more details.
      • setDetection

        public void setDetection​(java.lang.String value)
        Set drag detection area. When mouse drag over the detection area, it will show content. There are four accept value :
        1. browser : whole browser, default value.
        2. none : disable detection.
        3. self : the Dropupload itself.
        4. $id : the id value of specified widget. If specified widget is not exist, will use default setting.
        Notice : The Dropupload with detection="browser" setting can't put together with other Dropupload that detection is not browser. If do so, the user can't drop file on it.
        Parameters:
        value -
      • getDetection

        public java.lang.String getDetection()
        Return the detection area setting. Refer to setDetection(String) for more details.
      • setViewerClass

        public void setViewerClass​(java.lang.String value)
        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

        public java.lang.String getViewerClass()
        Returns:
        custom upload viewer class name.
      • setContent

        public void setContent​(java.lang.String value)
        Set the content of component, it will be shown depend on detection setting.
        Parameters:
        value - HTML string.
        See Also:
        setDetection(String)
      • getContent

        public java.lang.String 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​(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 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 calling Event.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 calling Event.getData() Default: -1
        Returns:
        the maximum number of files user can upload at once, -1 means no limitation
        Since:
        8.5.2
      • getSuppressedErrors

        public java.lang.String getSuppressedErrors()
        Return the suppressed errors setting.

        Default: null

        Returns:
        the suppressed errors setting
        Since:
        9.5.1
      • setSuppressedErrors

        public void setSuppressedErrors​(java.lang.String suppressedErrors)
        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

        public void setSuppressedErrors​(java.util.Collection<Uploadable.Error> suppressedErrors)
        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

        public void setAccept​(java.lang.String accept)
        Set acceptable file types.
        Parameters:
        accept - acceptable file types
        Since:
        10.0.0
      • getAccept

        public java.lang.String getAccept()
        Return acceptable file types.
        Since:
        10.0.0