public void setPattern(String pattern) {
   DocumentTextNode textNode = getTextNode();
   if (textNode != null) {
     textNode.setText(pattern);
   } else {
     textNode = new DocumentTextNode(false);
     textNode.setText(pattern);
     setTextNode(textNode);
   }
 }