Show TOC

Bringing Files To Context Locate this document in the navigation structure

Use

The Resource Service allows you to create context attributes of type Resource to bring files to context. The Resource type is needed for UI elements that handle files, e. g. FileUpload , FileDownload or OfficeControl . The xml file you need to display a Gantt or Network UI element is also handled this way.

Procedure
  1. Create a context attribute of type Resource , as described in Binding UI Element Properties to Dictionary Types and call it dataSource .

  2. Store the file (in this case: word.doc) in the mime repository in the directory: <Your Start of the navigation path WD project>  Next navigation step Resources  Next navigation step  src  Next navigation step  mimes  Next navigation step  Components  Next navigation step  <your component>. End of the navigation path

  3. Insert the following code into the wdDoInit method:

    IWDWebModule module = wdComponentAPI.getDeployableObjectPart().getWebModule();

    String filename = WDURLGenerator. getResourcePath (module,"word.doc");

    IWDResource resource = WDResourceFactory. createMassDataResource (new FileInputStream(filename),WDWebResourceType. DOC );

    element.setDataSource(resource);