Examples: HotspotText
- This agent displays the hotspot text of the first doclink in the
Body item.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
RichTextItem body = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = body.createNavigator();
if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) {
RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement();
String hot = rtlink.getHotSpotText();
if (hot.length() != 0)
System.out.println("Hotspot text = " + hot);
else
System.out.println("No hotspot text");
}
else
System.out.println("No doclinks in Body");
} catch(Exception e) {
e.printStackTrace();
}
}
}
- This agent changes the hotspot text of the first doclink in the
Body item.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
DocumentCollection dc = agentContext.getUnprocessedDocuments();
Document doc = dc.getFirstDocument();
RichTextItem body = (RichTextItem)doc.getFirstItem("Body");
RichTextNavigator rtnav = body.createNavigator();
if (rtnav.findFirstElement(RichTextItem.RTELEM_TYPE_DOCLINK)) {
RichTextDoclink rtlink = (RichTextDoclink)rtnav.getElement();
String hot = rtlink.getHotSpotText();
if (hot.length() != 0) {
rtlink.setHotSpotText(hot + "!");
doc.save(true, true);
}
else
System.out.println("No hotspot text");
}
else
System.out.println("No doclinks in Body");
} catch(Exception e) {
e.printStackTrace();
}
}
}
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.