Class sap.ca.ui.AddPictureModule: sap/ca/ui/AddPicture

extends Control

Enables users to add pictures into a form. Contains PictureItem controls that describe the media. It is designed to be used simultaneously with the PictureViewer control

Deprecated API:Since version 1.26. As per central UX requirements, this control is replaced by sap.m.UploadCollection. Please use the new control if you start developing an application instead of using this AddPicture control.

Constructor Summary
new sap.ca.ui.AddPicture(sId?, mSettings?)Constructor for a new AddPicture.
Event Summary
fileNotSupported(oControlEvent)Image upload failed, only supports image format files
imageUploadFailed(oControlEvent)Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser
maxPictureLimitReached(oControlEvent)Indicates that the limit number of pictures has been reached
pictureAdded(oControlEvent)Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser
show(oControlEvent)Indicates that the user wishes to view the picture
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ca.ui.AddPicture.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ca.ui.AddPicture with name sClassName and enriches it with the information contained in oClassInfo.
sap.ca.ui.AddPicture.getMetadata()Returns a metadata object for class sap.ca.ui.AddPicture.
addPicture(oPicture)Adds some picture oPicture to the aggregation named pictures.
attachFileNotSupported(oData?, fnFunction, oListener?)Attach event handler fnFunction to the 'fileNotSupported' event of this sap.ca.ui.AddPicture.
attachImageUploadFailed(oData?, fnFunction, oListener?)Attach event handler fnFunction to the 'imageUploadFailed' event of this sap.ca.ui.AddPicture.
attachMaxPictureLimitReached(oData?, fnFunction, oListener?)Attach event handler fnFunction to the 'maxPictureLimitReached' event of this sap.ca.ui.AddPicture.
attachPictureAdded(oData?, fnFunction, oListener?)Attach event handler fnFunction to the 'pictureAdded' event of this sap.ca.ui.AddPicture.
attachShow(oData?, fnFunction, oListener?)Attach event handler fnFunction to the 'show' event of this sap.ca.ui.AddPicture.
bindPictures(sPath, oTemplate, oSorter, aFilters)Binder for aggregation pictures.
destroyPictures()Destroys all the pictures in the aggregation named pictures.
detachFileNotSupported(fnFunction, oListener)Detach event handler fnFunction from the 'fileNotSupported' event of this sap.ca.ui.AddPicture.
detachImageUploadFailed(fnFunction, oListener)Detach event handler fnFunction from the 'imageUploadFailed' event of this sap.ca.ui.AddPicture.
detachMaxPictureLimitReached(fnFunction, oListener)Detach event handler fnFunction from the 'maxPictureLimitReached' event of this sap.ca.ui.AddPicture.
detachPictureAdded(fnFunction, oListener)Detach event handler fnFunction from the 'pictureAdded' event of this sap.ca.ui.AddPicture.
detachShow(fnFunction, oListener)Detach event handler fnFunction from the 'show' event of this sap.ca.ui.AddPicture.
fireFileNotSupported(mArguments?)Fire event fileNotSupported to attached listeners.
fireImageUploadFailed(mArguments?)Fire event imageUploadFailed to attached listeners.
fireMaxPictureLimitReached(mArguments?)Fire event maxPictureLimitReached to attached listeners.
firePictureAdded(mArguments?)Fire event pictureAdded to attached listeners.
fireShow(mArguments?)Fire event show to attached listeners.
getButtonPageType()Getter for property buttonPageType.
getCompression()Getter for property compression.
getEditable()Getter for property editable.
getItemSize()Getter for property itemSize.
getMaxPictureNumber()Getter for property maxPictureNumber.
getPictureAlign()Getter for property pictureAlign.
getPictures()Getter for aggregation pictures.
getText()Getter for property text.
getUploadUrl()Getter for property uploadUrl.
getWidth()Getter for property width.
indexOfPicture(oPicture)Checks for the provided sap.ca.ui.PictureItem in the aggregation named pictures and returns its index if found or -1 otherwise.
insertPicture(oPicture, iIndex)Inserts a picture into the aggregation named pictures.
removeAllPictures()Removes all the controls in the aggregation named pictures.
removePicture(vPicture)Removes an picture from the aggregation named pictures.
setButtonPageType(sButtonPageType)Setter for property buttonPageType.
setCompression(sCompression)Setter for property compression.
setEditable(bEditable)Setter for property editable.
setItemSize(iItemSize)Setter for property itemSize.
setMaxPictureNumber(iMaxPictureNumber)Setter for property maxPictureNumber.
setPictureAlign(oPictureAlign)Setter for property pictureAlign.
setText(sValue)Set the text for the button
setUploadUrl(sUploadUrl)Setter for property uploadUrl.
setWidth(sWidth)Setter for property width.
unbindPictures()Unbinder for aggregation pictures.
Constructor Detail
new sap.ca.ui.AddPicture(sId?, mSettings?)
Constructor for a new AddPicture.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers.

If the name of a setting is ambiguous (e.g. a property has the same name as an event), then the framework assumes property, aggregation, association, event in that order. To override this automatic resolution, one of the prefixes "aggregation:", "association:" or "event:" can be added to the name of the setting (such a prefixed name must be enclosed in single or double quotes).

The supported settings are:

  • Properties
  • Aggregations
  • Associations
    • Events
      • show : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • pictureAdded : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • maxPictureLimitReached : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • imageUploadFailed : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
      • fileNotSupported : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
    Parameters:
    {string}sId? id for the new control, generated automatically if no id is given
    {object}mSettings? initial settings for the new control
    Deprecated:
    Since version 1.26. As per central UX requirements, this control is replaced by sap.m.UploadCollection. Please use the new control if you start developing an application instead of using this AddPicture control.
    Event Detail
    fileNotSupported(oControlEvent)
    Image upload failed, only supports image format files
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    {any}oControlEvent.getParameters.fileNames An array containing the file names that are not supported
    imageUploadFailed(oControlEvent)
    Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    maxPictureLimitReached(oControlEvent)
    Indicates that the limit number of pictures has been reached
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    pictureAdded(oControlEvent)
    Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    show(oControlEvent)
    Indicates that the user wishes to view the picture
    Parameters:
    {sap.ui.base.Event}oControlEvent
    {sap.ui.base.EventProvider}oControlEvent.getSource
    {object}oControlEvent.getParameters
    Method Detail
    sap.ca.ui.AddPicture.extend(sClassName, oClassInfo?, FNMetaImpl?): function
    Creates a new subclass of class sap.ca.ui.AddPicture with name sClassName and enriches it with the information contained in oClassInfo.

    oClassInfo might contain the same kind of informations as described in Element.extend.

    Parameters:
    {string}sClassName name of the class to be created
    {object}oClassInfo? object literal with informations about the class
    {function}FNMetaImpl? constructor function for the metadata object. If not given, it defaults to sap.ui.core.ElementMetadata.
    Returns:
    {function} the created class / constructor function
    sap.ca.ui.AddPicture.getMetadata(): sap.ui.base.Metadata
    Returns a metadata object for class sap.ca.ui.AddPicture.
    Returns:
    {sap.ui.base.Metadata} Metadata object describing this class
    addPicture(oPicture): sap.ca.ui.AddPicture
    Adds some picture oPicture to the aggregation named pictures.
    Parameters:
    {sap.ca.ui.PictureItem}oPicture the picture to add; if empty, nothing is inserted
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    attachFileNotSupported(oData?, fnFunction, oListener?): sap.ca.ui.AddPicture
    Attach event handler fnFunction to the 'fileNotSupported' event of this sap.ca.ui.AddPicture.
    . When called, the context of the event handler (its this) will be bound to oListener if specified otherwise to this sap.ca.ui.AddPicture.
    itself.

    Image upload failed, only supports image format files

    Parameters:
    {object}oData? An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener? Context object to call the event handler with. Defaults to this sap.ca.ui.AddPicture.
    itself.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    attachImageUploadFailed(oData?, fnFunction, oListener?): sap.ca.ui.AddPicture
    Attach event handler fnFunction to the 'imageUploadFailed' event of this sap.ca.ui.AddPicture.
    . When called, the context of the event handler (its this) will be bound to oListener if specified otherwise to this sap.ca.ui.AddPicture.
    itself.

    Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser

    Parameters:
    {object}oData? An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener? Context object to call the event handler with. Defaults to this sap.ca.ui.AddPicture.
    itself.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    attachMaxPictureLimitReached(oData?, fnFunction, oListener?): sap.ca.ui.AddPicture
    Attach event handler fnFunction to the 'maxPictureLimitReached' event of this sap.ca.ui.AddPicture.
    . When called, the context of the event handler (its this) will be bound to oListener if specified otherwise to this sap.ca.ui.AddPicture.
    itself.

    Indicates that the limit number of pictures has been reached

    Parameters:
    {object}oData? An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener? Context object to call the event handler with. Defaults to this sap.ca.ui.AddPicture.
    itself.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    attachPictureAdded(oData?, fnFunction, oListener?): sap.ca.ui.AddPicture
    Attach event handler fnFunction to the 'pictureAdded' event of this sap.ca.ui.AddPicture.
    . When called, the context of the event handler (its this) will be bound to oListener if specified otherwise to this sap.ca.ui.AddPicture.
    itself.

    Indicates that the image upload failed, only used as a fallback when FileReader is not supported by the browser

    Parameters:
    {object}oData? An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener? Context object to call the event handler with. Defaults to this sap.ca.ui.AddPicture.
    itself.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    attachShow(oData?, fnFunction, oListener?): sap.ca.ui.AddPicture
    Attach event handler fnFunction to the 'show' event of this sap.ca.ui.AddPicture.
    . When called, the context of the event handler (its this) will be bound to oListener if specified otherwise to this sap.ca.ui.AddPicture.
    itself.

    Indicates that the user wishes to view the picture

    Parameters:
    {object}oData? An application specific payload object, that will be passed to the event handler along with the event object when firing the event.
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener? Context object to call the event handler with. Defaults to this sap.ca.ui.AddPicture.
    itself.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    bindPictures(sPath, oTemplate, oSorter, aFilters): sap.ca.ui.AddPicture
    Binder for aggregation pictures.
    Parameters:
    {string}sPath path to a list in the model
    {sap.ui.core.Element}oTemplate the control template for this aggregation
    {sap.ui.model.Sorter}oSorter the initial sort order (optional)
    {array}aFilters the predefined filters for this aggregation (optional)
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    destroyPictures(): sap.ca.ui.AddPicture
    Destroys all the pictures in the aggregation named pictures.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    detachFileNotSupported(fnFunction, oListener): sap.ca.ui.AddPicture
    Detach event handler fnFunction from the 'fileNotSupported' event of this sap.ca.ui.AddPicture.

    The passed function and listener object must match the ones used for event registration.

    Parameters:
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener Context object on which the given function had to be called.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    detachImageUploadFailed(fnFunction, oListener): sap.ca.ui.AddPicture
    Detach event handler fnFunction from the 'imageUploadFailed' event of this sap.ca.ui.AddPicture.

    The passed function and listener object must match the ones used for event registration.

    Parameters:
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener Context object on which the given function had to be called.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    detachMaxPictureLimitReached(fnFunction, oListener): sap.ca.ui.AddPicture
    Detach event handler fnFunction from the 'maxPictureLimitReached' event of this sap.ca.ui.AddPicture.

    The passed function and listener object must match the ones used for event registration.

    Parameters:
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener Context object on which the given function had to be called.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    detachPictureAdded(fnFunction, oListener): sap.ca.ui.AddPicture
    Detach event handler fnFunction from the 'pictureAdded' event of this sap.ca.ui.AddPicture.

    The passed function and listener object must match the ones used for event registration.

    Parameters:
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener Context object on which the given function had to be called.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    detachShow(fnFunction, oListener): sap.ca.ui.AddPicture
    Detach event handler fnFunction from the 'show' event of this sap.ca.ui.AddPicture.

    The passed function and listener object must match the ones used for event registration.

    Parameters:
    {function}fnFunction The function to call, when the event occurs.
    {object}oListener Context object on which the given function had to be called.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    fireFileNotSupported(mArguments?): sap.ca.ui.AddPicture
    Fire event fileNotSupported to attached listeners.

    Expects following event parameters:

    • 'fileNames' of type any An array containing the file names that are not supported
    Parameters:
    {Map}mArguments? the arguments to pass along with the event.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    fireImageUploadFailed(mArguments?): sap.ca.ui.AddPicture
    Fire event imageUploadFailed to attached listeners.
    Parameters:
    {Map}mArguments? the arguments to pass along with the event.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    fireMaxPictureLimitReached(mArguments?): sap.ca.ui.AddPicture
    Fire event maxPictureLimitReached to attached listeners.
    Parameters:
    {Map}mArguments? the arguments to pass along with the event.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    firePictureAdded(mArguments?): sap.ca.ui.AddPicture
    Fire event pictureAdded to attached listeners.
    Parameters:
    {Map}mArguments? the arguments to pass along with the event.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    fireShow(mArguments?): sap.ca.ui.AddPicture
    Fire event show to attached listeners.
    Parameters:
    {Map}mArguments? the arguments to pass along with the event.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    getButtonPageType(): string
    Getter for property buttonPageType. The page container type in which the button is embedded : Tab or Form

    Default value is Tab

    Returns:
    {string} the value of property buttonPageType
    getCompression(): string
    Getter for property compression. Defines whether or not you want to maximize the compression. Possible values : "Low" (thumbnail size) or "High" (screen size)

    Default value is low

    Returns:
    {string} the value of property compression
    getEditable(): boolean
    Getter for property editable. Defines whether the button should appear or not.

    Default value is true

    Returns:
    {boolean} the value of property editable
    getItemSize(): int
    Getter for property itemSize. Defines thumbnail size (height / width) in Pixels

    Default value is 64

    Returns:
    {int} the value of property itemSize
    getMaxPictureNumber(): int
    Getter for property maxPictureNumber. Defines the maximum number of pictures you can add. Default is set to 10

    Default value is 10

    Returns:
    {int} the value of property maxPictureNumber
    getPictureAlign(): sap.ui.core.TextAlign
    Getter for property pictureAlign. The text of the button.

    Default value is Left

    Returns:
    {sap.ui.core.TextAlign} the value of property pictureAlign
    getPictures(): sap.ca.ui.PictureItem[]
    Getter for aggregation pictures.
    The list of pictures
    Returns:
    {sap.ca.ui.PictureItem[]}
    getText(): string
    Getter for property text. The text of the button.

    Default value is empty/undefined

    Returns:
    {string} the value of property text
    getUploadUrl(): string
    Getter for property uploadUrl. Url of server we wish to upload to, only used as a fallback when FileReader is not supported by the browser

    Default value is empty/undefined

    Returns:
    {string} the value of property uploadUrl
    getWidth(): sap.ui.core.CSSSize
    Getter for property width. The width of the control.

    Default value is 100%

    Returns:
    {sap.ui.core.CSSSize} the value of property width
    indexOfPicture(oPicture): int
    Checks for the provided sap.ca.ui.PictureItem in the aggregation named pictures and returns its index if found or -1 otherwise.
    Parameters:
    {sap.ca.ui.PictureItem}oPicture the picture whose index is looked for.
    Returns:
    {int} the index of the provided control in the aggregation if found, or -1 otherwise
    insertPicture(oPicture, iIndex): sap.ca.ui.AddPicture
    Inserts a picture into the aggregation named pictures.
    Parameters:
    {sap.ca.ui.PictureItem}oPicture the picture to insert; if empty, nothing is inserted
    {int}iIndex the 0-based index the picture should be inserted at; for a negative value of iIndex, the picture is inserted at position 0; for a value greater than the current size of the aggregation, the picture is inserted at the last position
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    removeAllPictures(): sap.ca.ui.PictureItem[]
    Removes all the controls in the aggregation named pictures.
    Additionally unregisters them from the hosting UIArea.
    Returns:
    {sap.ca.ui.PictureItem[]} an array of the removed elements (might be empty)
    removePicture(vPicture): sap.ca.ui.PictureItem
    Removes an picture from the aggregation named pictures.
    Parameters:
    {int|string|sap.ca.ui.PictureItem}vPicture the picture to remove or its index or id
    Returns:
    {sap.ca.ui.PictureItem} the removed picture or null
    setButtonPageType(sButtonPageType): sap.ca.ui.AddPicture
    Setter for property buttonPageType.

    Default value is Tab

    Parameters:
    {string}sButtonPageType new value for property buttonPageType
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setCompression(sCompression): sap.ca.ui.AddPicture
    Setter for property compression.

    Default value is low

    Parameters:
    {string}sCompression new value for property compression
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setEditable(bEditable): sap.ca.ui.AddPicture
    Setter for property editable.

    Default value is true

    Parameters:
    {boolean}bEditable new value for property editable
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setItemSize(iItemSize): sap.ca.ui.AddPicture
    Setter for property itemSize.

    Default value is 64

    Parameters:
    {int}iItemSize new value for property itemSize
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setMaxPictureNumber(iMaxPictureNumber): sap.ca.ui.AddPicture
    Setter for property maxPictureNumber.

    Default value is 10

    Parameters:
    {int}iMaxPictureNumber new value for property maxPictureNumber
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setPictureAlign(oPictureAlign): sap.ca.ui.AddPicture
    Setter for property pictureAlign.

    Default value is Left

    Parameters:
    {sap.ui.core.TextAlign}oPictureAlign new value for property pictureAlign
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setText(sValue)
    Set the text for the button
    Parameters:
    {string}sValue
    setUploadUrl(sUploadUrl): sap.ca.ui.AddPicture
    Setter for property uploadUrl.

    Default value is empty/undefined

    Parameters:
    {string}sUploadUrl new value for property uploadUrl
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    setWidth(sWidth): sap.ca.ui.AddPicture
    Setter for property width.

    Default value is 100%

    Parameters:
    {sap.ui.core.CSSSize}sWidth new value for property width
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining
    unbindPictures(): sap.ca.ui.AddPicture
    Unbinder for aggregation pictures.
    Returns:
    {sap.ca.ui.AddPicture}this to allow method chaining