This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 1, 2012, 7:08 PM
63 Posts

Notes Form Hands over JavaApplet to Xpages

  • Category: Other Domino Designer Tooling
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: Java Applet,JavaAgent,Xpages
  • Replies: 0
Knowledge Sharing:
 
 

Java Applet/Xpages

Build Applet to Notes Form

And Xpages iFrame

Form Applet

System Requirements:

Download Domino Designer 8.5.2 Environment (DDE)

http://www.ibm.com/developerworks/downloads/ls/dominodesigner/

 

Introduction:

Load Java Applet as a Lotus Notes JavaAgent or Script Library, attach the Applet to a Notes form then write an iFrame tag into Xpages form to load Applet through.

 

Disclaimer:

Information contained in the following is presented as is. This tutorial assumes you have basic programming knowledge. All tutorials are based on an Eclipse/Eclipse-based software. Should you need to familiarize yourself with a certain Eclipse environment, prior to continuing this tutorial, please stop now and see a tutorial from this site...

 

Write JavaAgent Applet, load to Form/Xpages

Full code added below, jump ahead if necessary, areas of interest have been highlighted for your convenience. Below JavaAgent is pretty basic, please use instructions as guide to fully understand how this Applet loads.

 

awt.java

 

/**

 * Created from Copy: 2012.05.01.12.49.PM

 * Applet Test to include in Notes Form

 * then sucked into Xpages via iFrame

 *

 */

import lotus.domino.*;

import java.awt.*;

import java.awt.event.*;

 

/**

 * @author kcherizard

 * @version 2012.05.01.12.49.PM

 *

 */

public class awt extends AppletBase implements ActionListener {

      private static final long serialVersionUID = 1L;

      private Button b;

      private String text = "Oh My! Get a load of this!";

      Graphics g;

      public java.awt.TextArea ta;

      public Session s;

 

      public void notesAppletInit() {

            g = getGraphics();

            b = new Button("Get Döcu User");

            add(b);

            ta = new java.awt.TextArea(15, 30);

            add(ta);

            setVisible(true);

      }

 

      public void paint(Graphics g) {

            b.setLocation(0, 0);

            ta.setLocation(200, 0);

      }

 

      public void notesAppletStart() {

            try {

                  s = this.getSession();

                  b.addActionListener(this);

            } catch (NotesException e) {

                  text = e.id + " " + e.text;

            } catch (Exception e) {

                  e.printStackTrace();

            }

      }

 

      public void actionPerformed(ActionEvent e) {

            text = "What? I didn’t see anythingJ";

            getTheName();

            ta.append(text + "\n");

      }

 

      public void getTheName() {

            try {

                  if (isNotesLocal()) {

                        NotesThread.sinitThread();

                  }

                  text = "User " + s.getCommonUserName();

            } catch (NotesException e) {

                  text = e.id + " " + e.text;

            } catch (Exception e) {

                  e.printStackTrace();

            } finally {

                  if (isNotesLocal()) {

                        NotesThread.stermThread();

                  }

            }

      }

}

 

 

Build Xpages form with an iFrame

Full code added below, jump ahead if necessary, areas of interest have been highlighted for your convenience.

 

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

      <xp:span style="font-weight:bold">Applet from Notes form Embedded as an

            iFrame</xp:span>

      <xp:br style="font-weight:bold"></xp:br><xp:br></xp:br>

 

 

      <iframe src="http://localhost/docu.nsf/AppletForm?OpenForm"

            width="300" height="300"></iframe>

 

</xp:view>

 

 

The Steps:

 

JavaAgent

1.       Grab above code, plug it into a JavaAgent

2.       Give the is Agent full permissions

3.       Using code pane, right-click, run the code as Java Applet

4.       Provide your Applet loaded, save and keep code Open

 

Java Applet

5.       Go to Resources in DDE’s Application Navigator

6.       Add New Applet Resources to your project

7.       Navigate through Domino Directory, find workspace (../Data/workspace)

8.       Double-click the Bin folder to pick up the .class @ left

9.       Select class, choose Add/Replace File(s)

10.   File is now added to Current Libraries pane @ right

 

 

Notes Form

11.   Create a new form, enter some text in design pane

12.   Go to DDE’s menu bar, find Create option

13.   Choosing Java Applet loads a ‘Create Java Applet’ pop up

14.   From here you want to Locate the Applet

15.   Select class, choose Add/Replace File(s)

16.   Got to Libraries pane Dropdown to select the class

17.   You have added your Applet to the Form, now What?

18.   Well, right-click on this bad boy to see its properties

19.   Select ‘Applet uses Notes CORBA classes

 

Cheat Sheet: Java Applet Steps: Notes Client/Xpages Applet Tut

 

Conclusion:

You can now build Applets to your Notes Client and Xpages forms.  If trying sample code above on an actual Server (http://myservername/...) other than http://localhost/, you will get an IBM certification notice pop up, just say yes in this case.

 

TIP: You should leave your JavaAgent open to locate all .class files

 

References:

http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.designer.domino.main.doc%2FH_EXAMPLES_COMPILING_AND_RUNNING_JAVA.html

 

Questions, comments, please post a brief message. Thank you for coming...

 

 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal