public void doSave() {
    checkNotNull(current);

    // FIXME: Should not allow a record w/o a "name" to be saved.
    // FIXME: Need to implement some sort of form validation

    // Copy the view details into the current document
    current.setId(view.getId());
    current.setType(view.getType());
    current.setName(view.getName());
    current.setDescription(view.getDescription());
    current.setContent(view.getContent());

    // Save the document
    documentManagerLiaison.save(current);
  }
  public void doCancel() {
    if (current == null) {
      return;
    }

    if (current.isNew()) {
      // clear temporal document and hide the view
      documentManagerLiaison.remove(current);
      view.clear();
      view.asWidget().setVisible(false);
      attributesDataProvider.getList().clear();
      current = null;
    } else {
      // reset the view to the current data
      setDocument(current);
    }
  }
  public void setDocument(final Document document) {
    current = document;
    if (document != null) {
      // Fill up the form with the document details
      view.setId(document.getId());
      view.setType(document.getType());
      view.setName(document.getName());
      view.setDescription(document.getDescription());
      view.setContent(document.getContent());
      view.setNewDocument(document.isNew());
      attributesDataProvider.setList(document.getAttributes());

      // Make the view visible
      view.asWidget().setVisible(true);
    } else {
      // Clear the form and hide the view
      view.asWidget().setVisible(false);
    }
  }