Skip to Content

The JNet graphics package provides some funky graphics, such as the end to end monitoring display functions within PI (the product formerly known as XI). This blog is going to describe how to create some graphics through the JNet package, to present a display such as this:

image

This shows the SAP systems connected to an EP7 portal, in this case, one of our SAP training portal servers. Once displayed, the user can drag the boxes around and print the output and other fun things.

We need to get a few files into our NetWeaver Developer Studio project. They are available as attachments to SAP Note 783083. The specific files we need are JNet.jar and y.jar. Start by downloading these to a local drive.

Now, in your NWDS project, create a new folder under dist. I called mine pagelet and then I used the import function to add the 2 jar files to this folder.

The code I wrote is based on a portal component I wrote earlier that allowed me to see the SAP systems that are connected to my portal and show their details in a tree format. I have worked from this code.

The main activities are to create a specially formatted XML file, which I create in the pagelet folder as I know I can access it from JNet. The filename is based on the current date and time. Here’s the code to create the first part of the XML file:

     private BufferedWriter makeJNetHeader(IPortalComponentRequest request) {

          String pubPath = request.getPublicResourcePath();

          Date now = new Date();

          nowL = new Long(now.getTime());

          BufferedWriter out = null;

          String SID = System.getProperty(“SAPSYSTEMNAME”).toString();

          try {

               File file =

                    new File(

                         pubPath + “
pagelet
temp” + nowL.toString() + “.xml”);

               out =

                    new BufferedWriter(

                         new OutputStreamWriter(new FileOutputStream(file), “UTF8”));

               out.write(“”SID“”);
out.write(” “);

} catch (Exception e) {};
return out;
};

Basically it writes some special tags that will be processed by JNet at run time. One of these is the top level object, which is my portal. I’m going to hang my systems off this object. These are implemented as nodes.

For each system I want to display, I need to generate some tags.

     public void addSystem(IPortalComponentResponse response,

               BufferedWriter out,

               int counter, String system,String type, String SID, String client

               )

          {

          int col = 100+counter*200;

          Integer I = new Integer(col);

          try {

               out.write(

                    “<node type=\”BCNode\” id=\””system“\”>”);

               out.write(

                    “”I.toString()“,225”);
out.write(
SID“/”client” “type“”);
out.write(
system“</label> “);

               out.write(“</node> “);

               out.write(

                    “<edge type=\”BCLink\” id=\”l”system “\”>”);

               out.write(“

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Michael Nicholls Post author
    I have put together an example PAR file that makes use of the graphics library. The file can be downloaded from here until the end of 2006 (I hope!). The portal component shows graphically user/group/role assignments. I have tried it with recent support packages of EP7 and EP6 with no real problems. It’s quite a big PAR file, as it contains the libraries required.

    Good luck!

    (0) 
    1. WON HWANG
      Hello Michael,

      Would it be possible to send me the par file that makes use of JNet library? The par file that you posted in SDN is not available anymore.

      Thank you so much.

      Best regards,

      (0) 

Leave a Reply