Examples: FontColor property (ViewColumn - Java™)
- This agent prints the column information associated with fonts.
import lotus.domino.*; import java.util.Vector; 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("All Documents"); Vector columns = view.getColumns(); for (int i=0; i<columns.size(); i++) { ViewColumn column = (ViewColumn)columns.elementAt(i); String fc = null; switch (column.getFontColor()) { 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 : fc = "no color"; } String fs = null; if ((column.getFontStyle() & ViewColumn.FONT_BOLD) == ViewColumn.FONT_BOLD) fs = "bold"; else fs = "plain"; if ((column.getFontStyle() & ViewColumn.FONT_ITALIC) == ViewColumn.FONT_ITALIC) fs = fs + " italic"; if ((column.getFontStyle() & ViewColumn.FONT_UNDERLINE) == ViewColumn.FONT_UNDERLINE) fs = fs + " underline"; if ((column.getFontStyle() & ViewColumn.FONT_STRIKEOUT) == ViewColumn.FONT_STRIKEOUT) fs = fs + " strikeout"; System.out.println(column.getPosition() + " " + column.getFontFace() + " " + column.getFontPointSize() + " " + fs + " " + fc); } } catch(Exception e) { e.printStackTrace(); } } }
- This agent toggles a view column font color between black and
blue.
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"); ViewColumn vc = view.getColumn(1); if (vc.getFontColor() == RichTextStyle.COLOR_BLACK) { vc.setFontColor(RichTextStyle.COLOR_BLUE); System.out.println("Font color = blue"); } else { vc.setFontColor(RichTextStyle.COLOR_BLACK); System.out.println("Font color = black"); } } catch(Exception e) { e.printStackTrace(); } } }