org.richfaces.component

## Class AbstractFileUpload

- java.lang.Object
- - javax.faces.component.UIComponent
  - - javax.faces.component.UIComponentBase
    - - org.richfaces.component.AbstractFileUpload

- All Implemented Interfaces:
    EventListener, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.TransientStateHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder
  Direct Known Subclasses:
    UIFileUpload

      public abstract class AbstractFileUpload
      extends javax.faces.component.UIComponentBase

  The <rich:fileUpload> component allows the user to upload files to a server. It features multiple uploads, progress bars, restrictions on file types, and restrictions on sizes of the files to be uploaded.

  Author:
    Konstantin Mishin, Lukas Fryc, Simone Cinti

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `COMPONENT_FAMILY`
    `static String` | `COMPONENT_TYPE`

    - ### Fields inherited from class javax.faces.component.UIComponent

      `ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFileUpload()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `acceptsFile(org.richfaces.model.UploadedFile file)` Checks whether this component can accept given `UploadedFile`..
    `void` | `addFileUploadListener(FileUploadListener listener)` Add a new `FileUploadListener` to the set of listeners interested in being notified when `org.richfaces.FileUploadEvent`s occur.
    `abstract String` | `getAcceptedTypes()` Defines comma separated list of file extensions accepted by component.
    `List<String>` | `getAcceptedTypesList()` Get a list of accepted types from `getAcceptedTypes()` attribute.
    `abstract String` | `getAddLabel()` The label for the Add button.
    `abstract String` | `getClearAllLabel()` The label for the Clear button.
    `abstract String` | `getClearLabel()` The label displayed for the Clear link
    `abstract String` | `getDeleteLabel()` The label displayed for the Delete link
    `abstract String` | `getDoneLabel()` The label displayed when a file is successfully uploaded.
    `FileUploadListener[]` | `getFileUploadListeners()` Return the set of registered `FileUploadListener`s for this `AbstractFileUpload` instance.
    `abstract String` | `getListHeight()` Defines height of file list.
    `abstract Integer` | `getMaxFilesQuantity()` Defines maximum number of files allowed to be uploaded.
    `abstract String` | `getOnclear()` Javascript code executed when a file is cleared
    `abstract String` | `getOnfileselect()` Javascript code executed when a file is selected
    `abstract String` | `getOnfilesubmit()` Javascript code executed when a file is submitted
    `abstract String` | `getOntyperejected()` Javascript code executed when a file does not meet the conditions stated by acceptedTypes parameter.
    `abstract String` | `getOnuploadcomplete()` Javascript code executed when a file upload is complete
    `abstract String` | `getServerErrorLabel()` The label displayed when a file upload fails due to a server error.
    `abstract String` | `getSizeExceededLabel()` The label displayed when a file exceeds the size limit.
    `abstract String` | `getUploadLabel()` The label for the Add button.
    `abstract boolean` | `isDisabled()` If "true", this component is disabled
    `abstract boolean` | `isImmediateUpload()` If "true" upload stats immediately after file selection
    `abstract boolean` | `isNoDuplicate()` If "true" duplicate file uploads are prevented
    `void` | `processEvent(javax.faces.event.ComponentSystemEvent event)`
    `void` | `queueEvent(javax.faces.event.FacesEvent event)` Increments number of `FileUploadEvent` which were queued
    `void` | `removeFileUploadListener(FileUploadListener listener)` Remove an existing `FileUploadListener` (if any) from the set of listeners interested in being notified when `FileUploadListener`s occur.

    - ### Methods inherited from class javax.faces.component.UIComponentBase

      `addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent`

    - ### Methods inherited from class javax.faces.component.UIComponent

      `encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getFamily, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### COMPONENT_TYPE

          public static final String COMPONENT_TYPE

      See Also:
        Constant Field Values

    - #### COMPONENT_FAMILY

          public static final String COMPONENT_FAMILY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractFileUpload

          public AbstractFileUpload()

  - ### Method Detail

    - #### getAcceptedTypes

          public abstract String getAcceptedTypes()

      Defines comma separated list of file extensions accepted by component. The component does not provide any feedback when rejecting file. For introducing feedback for rejection, use ontyperejected parameter.

    - #### getMaxFilesQuantity

          public abstract Integer getMaxFilesQuantity()

      Defines maximum number of files allowed to be uploaded. After a number of files in the list equals to the value of this attribute, "Add" button disappears and nothing could be uploaded even if you clear the whole list. In order to upload files again you should rerender the component. (Negative numbers means no limits; default value -1).

    - #### isDisabled

          public abstract boolean isDisabled()

      If "true", this component is disabled

    - #### isNoDuplicate

          public abstract boolean isNoDuplicate()

      If "true" duplicate file uploads are prevented

      Default is "false"

    - #### isImmediateUpload

          public abstract boolean isImmediateUpload()

      If "true" upload stats immediately after file selection

      Default is "false"

    - #### getOnfileselect

          public abstract String getOnfileselect()

      Javascript code executed when a file is selected

    - #### getOnfilesubmit

          public abstract String getOnfilesubmit()

      Javascript code executed when a file is submitted

    - #### getOntyperejected

          public abstract String getOntyperejected()

      Javascript code executed when a file does not meet the conditions stated by acceptedTypes parameter.

    - #### getOnuploadcomplete

          public abstract String getOnuploadcomplete()

      Javascript code executed when a file upload is complete

    - #### getOnclear

          public abstract String getOnclear()

      Javascript code executed when a file is cleared

    - #### getAddLabel

          public abstract String getAddLabel()

      The label for the Add button.

    - #### getUploadLabel

          public abstract String getUploadLabel()

      The label for the Add button.

    - #### getClearAllLabel

          public abstract String getClearAllLabel()

      The label for the Clear button.

    - #### getDoneLabel

          public abstract String getDoneLabel()

      The label displayed when a file is successfully uploaded.

    - #### getSizeExceededLabel

          public abstract String getSizeExceededLabel()

      The label displayed when a file exceeds the size limit.

    - #### getServerErrorLabel

          public abstract String getServerErrorLabel()

      The label displayed when a file upload fails due to a server error.

    - #### getClearLabel

          public abstract String getClearLabel()

      The label displayed for the Clear link

    - #### getDeleteLabel

          public abstract String getDeleteLabel()

      The label displayed for the Delete link

    - #### getListHeight

          public abstract String getListHeight()

      Defines height of file list.

      Default value is "210px".

    - #### processEvent

          public void processEvent(javax.faces.event.ComponentSystemEvent event)
                            throws javax.faces.event.AbortProcessingException

      Specified by:
        `processEvent` in interface `javax.faces.event.ComponentSystemEventListener`
      Overrides:
        `processEvent` in class `javax.faces.component.UIComponent`
      Throws:
        `javax.faces.event.AbortProcessingException`

    - #### addFileUploadListener

          public void addFileUploadListener(FileUploadListener listener)

      Add a new `FileUploadListener` to the set of listeners interested in being notified when `org.richfaces.FileUploadEvent`s occur.

      Parameters:
        `listener` - The `FileUploadListener` to be added
      Throws:
        `NullPointerException` - if `listener` is `null`

    - #### getFileUploadListeners

          public FileUploadListener[] getFileUploadListeners()

      Return the set of registered `FileUploadListener`s for this `AbstractFileUpload` instance. If there are no registered listeners, a zero-length array is returned.

    - #### removeFileUploadListener

          public void removeFileUploadListener(FileUploadListener listener)

      Remove an existing `FileUploadListener` (if any) from the set of listeners interested in being notified when `FileUploadListener`s occur.

      Parameters:
        `listener` - The `FileUploadListener` to be removed
      Throws:
        `NullPointerException` - if `listener` is `null`

    - #### getAcceptedTypesList

          public List<String> getAcceptedTypesList()

      Get a list of accepted types from `getAcceptedTypes()` attribute.

    - #### acceptsFile

          public boolean acceptsFile(org.richfaces.model.UploadedFile file)

      Checks whether this component can accept given `UploadedFile`.. First, the number of enqueued `FileUploadEvent` events can't exceed `getMaxFilesQuantity()`. Then, the file extension of uploaded file needs to be acceptable by this component (see `getAcceptedTypes()`).

    - #### queueEvent

          public void queueEvent(javax.faces.event.FacesEvent event)

      Increments number of `FileUploadEvent` which were queued
      Overrides:
        `queueEvent` in class `javax.faces.component.UIComponentBase`

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.