Examples: BarColor property
This agent displays the bar color of each section in a rich text 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_SECTION)) {
do {
RichTextSection rtsection = (RichTextSection)rtnav.getElement();
System.out.println(
"Title = " + rtsection.getTitle());
System.out.println("\tBar color = " +
getColorString(rtsection.getBarColor()));
} while (rtnav.findNextElement());
}
else
System.out.println("No sections in Body");
} catch(Exception e) {
e.printStackTrace();
}
}
String getColorString(ColorObject color) {
String fc = null;
try {
switch (color.getNotesColor()) {
case RichTextStyle.COLOR_BLACK :
fc = "black"; break;
case RichTextStyle.COLOR_WHITE :
fc = "white"; break;
case RichTextStyle.COLOR_RED :
fc = "red"; break;
case RichTextStyle.COLOR_GREEN :
fc = "green"; break;
case RichTextStyle.COLOR_BLUE :
fc = "blue"; break;
case RichTextStyle.COLOR_MAGENTA :
fc = "magenta"; break;
case RichTextStyle.COLOR_YELLOW :
fc = "yellow"; break;
case RichTextStyle.COLOR_CYAN :
fc = "cyan"; break;
case RichTextStyle.COLOR_DARK_RED :
fc = "dark red"; break;
case RichTextStyle.COLOR_DARK_GREEN :
fc = "dark green"; break;
case RichTextStyle.COLOR_DARK_BLUE :
fc = "dark blue"; break;
case RichTextStyle.COLOR_DARK_MAGENTA :
fc = "dark magenta"; break;
case RichTextStyle.COLOR_DARK_YELLOW :
fc = "dark yellow"; break;
case RichTextStyle.COLOR_DARK_CYAN :
fc = "dark cyan"; break;
case RichTextStyle.COLOR_GRAY :
fc = "gray"; break;
case RichTextStyle.COLOR_LIGHT_GRAY :
fc = "light gray"; break;
default :
Integer i = new Integer(color.getNotesColor());
fc = i.toString();
}
} catch(Exception e) {
e.printStackTrace();
}
return(fc);
}
}