public void compose() {
    treeModel = DomModelUtils.toTreeModel(model);
    try {
      document = Binder.bind(this, true);
    } catch (JDOMException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }

    DomConverter.toSwing(model);
    if (model.getController() != null) {
      Binder.bind(model, model.getController());
    }
    JComponent root = model.getRootTag().getChildByName("body").getComponent();
    contentWrapper.add(root);
  }
 /**
  * Gets the selected node in the tags tree and applies all attributes fro the attributes list to
  * it. Do nothing if no node is selected.
  */
 public void apply() {
   JTree tree = (JTree) document.getTagById("tagsTree").getComponent();
   if (tree.getSelectionPath() != null) {
     DefaultMutableTreeNode node =
         (DefaultMutableTreeNode) tree.getSelectionPath().getLastPathComponent();
     Tag tag = (Tag) node.getUserObject();
     for (Attribute attr : attributes) {
       tag.setAttribute(attr.getName(), attr.getValue());
     }
     tag.applyAttributes(tag.getComponent());
   }
 }