JAVA/CORBA CLASSES
Examples: BackgroundColor property
This agent prints the background color of a view.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
View view = db.getView("By Category");
String msg = null;
switch(view.getBackgroundColor()) {
case RichTextStyle.COLOR_BLACK :
msg = "black"; break;
case RichTextStyle.COLOR_WHITE :
msg = "white"; break;
case RichTextStyle.COLOR_RED :
msg = "red"; break;
case RichTextStyle.COLOR_GREEN :
msg = "green"; break;
case RichTextStyle.COLOR_BLUE :
msg = "blue"; break;
case RichTextStyle.COLOR_MAGENTA :
msg = "magenta"; break;
case RichTextStyle.COLOR_YELLOW :
msg = "yellow"; break;
case RichTextStyle.COLOR_CYAN :
msg = "cyan"; break;
case RichTextStyle.COLOR_DARK_RED :
msg = "dark red"; break;
case RichTextStyle.COLOR_DARK_GREEN :
msg = "dark green"; break;
case RichTextStyle.COLOR_DARK_BLUE :
msg = "dark blue"; break;
case RichTextStyle.COLOR_DARK_MAGENTA :
msg = "dark magenta"; break;
case RichTextStyle.COLOR_DARK_YELLOW :
msg = "dark yellow"; break;
case RichTextStyle.COLOR_DARK_CYAN :
msg = "dark cyan"; break;
case RichTextStyle.COLOR_GRAY :
msg = "gray"; break;
case RichTextStyle.COLOR_LIGHT_GRAY :
msg = "light gray"; break;
default :
msg = "unknown"; }
System.out.println
("Background color of \"By Category\" is " + msg);
} catch(Exception e) {
e.printStackTrace();
}
}
}
1. This agent toggles a view background among three colors.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
View view = null;
view = db.getView("All Documents");
if (view.getBackgroundColor() ==
RichTextStyle.COLOR_LIGHT_GRAY) {
view.setBackgroundColor(RichTextStyle.COLOR_YELLOW);
System.out.println("New color is yellow");
}
else if (view.getBackgroundColor() ==
RichTextStyle.COLOR_YELLOW) {
view.setBackgroundColor(RichTextStyle.COLOR_WHITE);
System.out.println("New color is white");
}
else {
view.setBackgroundColor(RichTextStyle.COLOR_LIGHT_GRAY);
System.out.println("New color is light gray");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
See Also
BackgroundColor property
Glossary
Help on Help
Open Full Help Window
Glossary
Help on Help
Open Full Help Window