Creating the input field

The last section of our renderer creates the input field. It actually delegates the task to an existing Renderer which can create the input field for us. The TextRenderer is mapped to the TEXT_NODE Domain, so we simply set the Domain on our FieldBuilder instance and call the render function on that. The TextRenderer will create the form item and return the input box which is appended to the HTML document.

Figure 1. Rendering the input box
045      fieldBuilder.setDomain(context.getDomain("TEXT_NODE"));
046      DocumentFragment textFilter = 
047        fragment.getOwnerDocument().createDocumentFragment();
048      context.render(fieldBuilder.getComponent(), fragment, contract);
049
050      fragment.appendChild(textFilter);