Examples: NumberAttrib property (ViewColumn - Java)

  1. This agent displays the number attributes for a column.
    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("All Documents");
          ViewColumn vc = view.getColumn(6);
          if ((vc.getNumberAttrib() & ViewColumn.ATTR_PARENS) != 0)
            System.out.println("Parentheses on negative numbers");
          else
            System.out.println("No parentheses on negative numbers");
          if ((vc.getNumberAttrib() & ViewColumn.ATTR_PERCENT) != 0)
            System.out.println("Percent sign");
          else
            System.out.println("No percent sign");
          if ((vc.getNumberAttrib() & ViewColumn.ATTR_PUNCTUATED) != 0)
            System.out.println("Punctuated");
          else
            System.out.println("No punctuated");
            
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  2. This agent sets a column for parentheses on negative numbers, punctuation at thousandths, and not to display as a percentage.
    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("All Documents");
          ViewColumn vc = view.getColumn(6);
          vc.setNumberAttrib(ViewColumn.ATTR_PARENS |
            ViewColumn.ATTR_PUNCTUATED);
            
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  3. This agent sets a column to display as a percentage without losing any other attributes that are 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("All Documents");
          ViewColumn vc = view.getColumn(6);
          vc.setNumberAttrib(vc.getNumberAttrib() |
            ViewColumn.ATTR_PERCENT);
            
        } catch(Exception e) {
          e.printStackTrace();
        }
      }
    }
  4. To set a number attribute without disturbing the others, use a logical construct of the following form:
    vc.getNumberAttrib() | ViewColumn.ATTR_PARENS

    To set two number attributes without disturbing the others, use a logical construct of the following form:

    vc.getNumberAttrib() | ViewColumn.ATTR_PARENS |
    ViewColumn.ATTR_PUNCTUATED

    To unset a number attribute without disturbing the others, use a logical construct of the following form:

    vc.getNumberAttrib() & ~ViewColumn.ATTR_PARENS

    To unset two number attributes without disturbing the others, use a logical construct of the following form:

    vc.getNumberAttrib() & (~(ATTR_PARENS | ATTR_PUNCTUATED))