code: public static void setUserPreference(
              Element compViewNode, String attributeName, IPerson person) {
          Document doc = compViewNode.getOwnerDocument();
          NodeList nodes = doc.getElementsByTagName("layout");
  
          boolean layoutOwner = false;
          Attr attrib;
          Element e;
          // Search Elements in nodelist
          for (int i = 0; i < nodes.getLength(); i++) {
              e = (Element) nodes.item(i);
              attrib = e.getAttributeNodeNS(Constants.NS_URI, Constants.LCL_FRAGMENT_NAME);
              if (attrib != null) {
                  layoutOwner = true;
              }
          }
  
          if (!layoutOwner) {
              Element plfNode =
                      HandlerUtils.getPLFNode(
                              compViewNode,
                              person,
                              true, // create if not found
                              false);
              if (plfNode.getAttributeNodeNS(Constants.NS_URI, Constants.LCL_ORIGIN) != null)
                  EditManager.addPrefsDirective(plfNode, attributeName, person);
          }
      }
docs: Records changes made to element attributes that are defined as being part of a user's user
  preferences object and not part of the layout. These attributes are specified in the .sdf
  files for the structure and theme stylesheets. The value is not stored in the layout but the
  loading of user prefs joins to a layout struct and hence that struct must exist in the
  layout. This call gets that node into the PLF if not there already and prevents it from being
  removed if no other changes were made to it or its children by the user.