cancel
Showing results for 
Search instead for 
Did you mean: 

UI Download element

Former Member
0 Kudos

Hi all ,

Can someone help me can i use UI download elements . it would be good if someone can post the code for the same . I couldnt understand mcuh through the documentation for the same .

Thanks & Regards,

Udai

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Can you elobarate your query..

Former Member
0 Kudos

BY this ,I meant FileDownload UI element available in Netweaver developer sutdio . Basically how do you download a file using that element .

regards,

Udai

Former Member
0 Kudos

Web Dynpro FileDownload API – IWDFileDownload

Definition

You can use the FileDownload UI element to load files from the server to the client. The data property determines the data source in the view context. The target property determines the ID of the target window in the browser. For more information about this UI element, see the Binding section below.

Description of the UI Element Properties

· data

Determines the data source of the files to be downloaded in the context.

· target

Determines the ID of the target window in the browser, if the link is activated. Either the users can specify the ID themselves or it has the value _blank, which opens an external, unnamed window.

· type

Describes the graphical representation of the FileDownload UI element. The type property can be filled with the following values and is represented by the enumeration type WDLinkType.

function

The UI element appears in the standard design and underlined.

navigation

The UI element appears underlined and in the color used for links that the user has already visited.

reporting

The UI element appears in the standard design and not underlined.

result

The UI element appears not underlined.

Overview of Inherited and Additional Properties

Name

Interface

Type

Initial Value

bindable

Value Required

data

IWDFileDownload

Object

bindable_mandatory

No

enabled

IWDUIElement

boolean

true

bindable

No

imageAlt

IWDAbstractCaption

String (TranslatableText)

bindable

No

imageFirst

IWDAbstractCaption

boolean

true

bindable

No

imageHeight

IWDLink

String

bindable

No

imageSource

IWDAbstractCaption

String

bindable

No

imageWidth

IWDLink

String

bindable

No

size

IWDLink

WDLinkSize

standard

bindable

No

target

IWDFileDownload

String

_BLANK

bindable

No

text

IWDLink

String (TranslatableText)

bindable

No

tooltip

IWDUIElement

String (TranslatableText)

bindable

No

type

IWDFileDownload

WDLinkType

navigation

bindable

No

visible

IWDUIElement

WDVisibility

visible

bindable

No

wrapping

IWDLink

boolean

false

bindable

No

Data Binding

At design time, you add the FileDownload UI element to an appropriate view. You then define a value attribute of type binary in the context of this view, also at design time; for the source text below the value attribute is called “FileDownload”.

The data property must be bound to this value attribute of data type binary, so that the file can be downloaded as a byte array. At runtime, the binary data type can be enhanced with data to allow the passing of related information when downloading a file. Using the IWDModifiableBinaryType data type, which represents an extension of the binary data type you can access the MIME type of the file, that is, either read or set the MIME type. To do this, you must implement the following source text in the wdDoInit method of the controller implementation, with which, on the one hand, the binary data type is enhanced at runtime and on the other hand, the file extension is passed on during download:

public void wdDoInit()

{

//@@begin wdDoInit()

// The FileDownload UI element requires:

IWDAttributeInfo attInfo = wdContext.nodeRoot().getNodeInfo().getAttribute("FileDownLoad");

binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();

// in addition the FileDownload UI element needs for defined resource types

binaryType.setFileName("Snow Trees.jpg");

binaryType.setMimeType(WDWebResourceType.JPG_IMAGE);

//The FileDownload UI element needs for undefined resource types

binaryType.setFileName("Snow Trees.xcc");

binaryType.setMimeType(new WDWebResourceType("xcc", "", true));

//@@end

}

Note that during the download, the MIME type of the file must be set in the controller implementation. Furthermore, you must pass on additional parameters to the setMimeType method, if the data type is not available in the Java Dictionary.

Methods in the Web Dynpro IWDFileDownload API

Method Name

Parameter

Return Value

Short Description

bindData

(String path)

Binds the value of the data property to the content element specified by the path.

bindingOfData

String

Returns the path of the content element to which the data property is bound. Returns NULL if no binding exists.

bindingOfTarget

String

Returns the path of the context element to which the target property is bound. Returns NULL if no binding exists.

bindingOfType

String

Returns the path of the context element to which the type property is bound. Returns NULL if no binding exists.

bindTarget

(String path)

Binds the target property to the context node specified by a path.

bindType

(String path)

Binds the type property to the context node specified by a path.

getData

Object

Returns the value of the data property.

getTarget

String

Returns the value of the target property.

getType

WDLinkType

Returns the value of the type property.

setData

(Object data)

Sets the value of the data property.

setTarget

(String target)

Sets the value of the target property.

setType

(WDLinkType type)

Sets the value of the type property.

Additional methods described in the following APIs are available using inheritance:

Hope this helps...