author: Stefanie Bacher
To run a JNet or a JGantt in a Web Dynpro for Java application, you have to follow the steps described below. This example does not describe how to build the xml file for a Gantt or for a Network, it focuses on the Web Dynpro part. This example explains how to bind a Gantt UI element and its data source to the context. This works exactly the same way for the Network UI element.
Restriction in SAP NW 7.0
In this example the Active Control Framework (ACF) UI elements JNet and JGantt are bound to so-called immutable resource objects. Immutable resources can be displayed in JNet, JGantt or Office UI elments for read-only purposes but they cannot be edited by the user. Based on a restriction of the current Web Dynpro Java API in SAP NW 7.0 the
WDResourceFactory-API does not yet expose a factory method for creating mutable resource objects. In typical ACF scenrios a mutable resource is edited by the user on client-side. This Web Dynpro Java API restriction will be corrected in a higher SP stack of SAP NetWeaver 7.0. It is not given in SAP NetWeaver CE 7.1 where the factory method WDResourceFactory.createMassDataResource() is exposed.
You created a Web Dynpro project or DC together with the required components.
You inserted a Gantt UI element into your view. In this example, a file called gantt.xml is read. The file is stored in Mime Repository in directory <project name>/src/mimes/Components/<component name>. If you do so, you can refer to this file without specifying a directory.
I will provide a little sample gantt.xml soon, at the moment you can find one searching the Web Dynpro for Java forum .
And here it is: gantt.zip
Creating the Context
- Create a value node called DataSourceNode and an attribute called DataSource.
- Select the DataSourceNode, switch to the Properties view, select supplyFunction and create a supplyFunction called supplyDataSourceNode.
- Select the DataSource attribute and set the type to Resource. If you don't know how to do this, follow this link: Data Binding for Resource Property.
Bringing xml file to Context
- Insert the following code into the supply function:
Mapping the Event Parameters
For each event, you want to react on, you have to map the event parameters to eventhandler parameters. The following example will explain this just for the onRowAdded event.
- Create an action called RowAdded with default event handler
- Add the following parameters of type String
Now the event and the corresponding action have the same parameters.
3. Map these parameters in the wdDoModify() method: