Examples: setHSL method

This form action uses the "Hue," "Saturation," and "Luminance" items in a document as parameters to setHSL, and writes the resulting property values to the "NotesColor," "Red," "Green," "Blue," "Hue," "Saturation," and "Luminance" items.

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here) 
      ColorObject color = session.createColorObject();
      DocumentCollection dc = agentContext.getUnprocessedDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null)
      {
        int h = doc.getItemValueInteger("Hue");
        int s = doc.getItemValueInteger("Saturation");
        int l = doc.getItemValueInteger("Luminance");
        color.setHSL(h, s, l);
        Integer i = new Integer(color.getNotesColor());
        doc.replaceItemValue("NotesColor", i);
        i = new Integer(color.getRed());
        doc.replaceItemValue("Red", i);
        i = new Integer(color.getGreen());
        doc.replaceItemValue("Green", i);
        i = new Integer(color.getBlue());
        doc.replaceItemValue("Blue", i);
        i = new Integer(color.getHue());
        doc.replaceItemValue("Hue", i);
        i = new Integer(color.getSaturation());
        doc.replaceItemValue("Saturation", i);
        i = new Integer(color.getLuminance());
        doc.replaceItemValue("Luminance", i);
        doc.save(true, true);
        doc = dc.getNextDocument(doc);  
      }

    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}