Examples: FontStyle property (ViewColumn - Java™)
- This agent indicates whether bold is set and whether italic is
set.
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.getFontStyle() & ViewColumn.FONT_BOLD) != 0) System.out.println("Bold is set"); else System.out.println("Bold is not set"); if ((vc.getFontStyle() & ViewColumn.FONT_ITALIC) != 0) System.out.println("Italic is set"); else System.out.println("Italic is not set"); } catch(Exception e) { e.printStackTrace(); } } }
- This agent toggles the font style between bold and italic.
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.getFontStyle() == ViewColumn.FONT_BOLD) { vc.setFontStyle(ViewColumn.FONT_ITALIC); System.out.println("Italic is set"); } else { vc.setFontStyle(ViewColumn.FONT_BOLD); System.out.println("Bold is set"); } } catch(Exception e) { e.printStackTrace(); } } }
- To set a style without disturbing the others, use a logical construct
of the following form:
vc.getFontStyle() | ViewColumn.FONT_BOLD
To set two styles without disturbing the others, use a logical construct of the following form:
vc.getFontStyle() | ViewColumn.FONT_BOLD | ViewColumn.FONT_ITALIC
To unset a style without disturbing the others, use a logical construct of the following form:
vc.getFontStyle() & ~ViewColumn.FONT_BOLD
To unset two styles without disturbing the others, use a logical construct of the following form:
vc.getFontStyle() & (~(ViewColumn.FONT_BOLD | ViewColumn.FONT_ITALIC))