Class MultiFileUploadField

    • Field Detail

      • UNLIMITED

        public static final int UNLIMITED
        Represents an unlimited max count of uploads
        See Also:
        Constant Field Values
      • RESOURCE_LIMITED

        public static final java.lang.String RESOURCE_LIMITED
        Resource key used to retrieve caption message for when a limit on the number of uploads is specified. The limit is represented via ${max} variable. Example: org.apache.wicket.mfu.caption.limited=Files (maximum ${max}):
        See Also:
        Constant Field Values
      • RESOURCE_UNLIMITED

        public static final java.lang.String RESOURCE_UNLIMITED
        Resource key used to retrieve caption message for when no limit on the number of uploads is specified. Example: org.apache.wicket.mfu.caption.unlimited=Files:
        See Also:
        Constant Field Values
    • Constructor Detail

      • MultiFileUploadField

        public MultiFileUploadField​(java.lang.String id)
        Constructor
        Parameters:
        id -
      • MultiFileUploadField

        public MultiFileUploadField​(java.lang.String id,
                                    int max)
        Constructor
        Parameters:
        id -
        max - max number of files a user can upload
      • MultiFileUploadField

        public MultiFileUploadField​(java.lang.String id,
                                    IModel<? extends java.util.Collection<FileUpload>> model)
        Constructor
        Parameters:
        id -
        model -
      • MultiFileUploadField

        public MultiFileUploadField​(java.lang.String id,
                                    IModel<? extends java.util.Collection<FileUpload>> model,
                                    int max)
        Constructor
        Parameters:
        id -
        model -
        max - max number of files a user can upload
      • MultiFileUploadField

        public MultiFileUploadField​(java.lang.String id,
                                    IModel<? extends java.util.Collection<FileUpload>> model,
                                    int max,
                                    boolean useMultipleAttr)
        Constructor
        Parameters:
        id -
        model -
        max - max number of files a user can upload
        useMultipleAttr - true in order to use the new HTML5 "multiple" <input> attribute. It will allow the users to select multiple files at once for multiple times if the browser supports it, otherwise it will work just as before - one file multiple times.
    • Method Detail

      • onBeforeRender

        protected void onBeforeRender()
        Description copied from class: Component
        Called on all visible components before any component is rendered.

        NOTE: If you override this, you *must* call super.onBeforeRender() within your implementation. Because this method is responsible for cascading Component.onBeforeRender() call to its children it is strongly recommended that super call is made at the end of the override.

        Changes to the component tree can be made only before calling super.onBeforeRender().
        Overrides:
        onBeforeRender in class Component
        See Also:
        Component.onBeforeRender()
      • isMultiPart

        public boolean isMultiPart()
        Overrides:
        isMultiPart in class FormComponent<java.util.Collection<FileUpload>>
        Returns:
        True if this component encodes data in a multipart form submit
      • convertValue

        protected java.util.Collection<FileUpload> convertValue​(java.lang.String[] value)
                                                         throws org.apache.wicket.util.convert.ConversionException
        Description copied from class: FormComponent
        Subclasses should overwrite this if the conversion is not done through the type field and the IConverter. WARNING: this method may be removed in future versions. If conversion fails then a ConversionException should be thrown
        Overrides:
        convertValue in class FormComponent<java.util.Collection<FileUpload>>
        Parameters:
        value - The value can be the getInput() or through a cookie
        Returns:
        The converted value. default returns just the given value
        Throws:
        org.apache.wicket.util.convert.ConversionException - If input can't be converted
      • forceCloseStreamsOnDetach

        protected boolean forceCloseStreamsOnDetach()
        The FileUploadField will close any input streams you have opened in its FileUpload by default. If you wish to manage the stream yourself (e.g. you want to use it in another thread) then you can override this method to prevent this behavior.
        Returns:
        true if stream should be closed at the end of request