public TemplateView(ConstraintTemplate anTemplate) {
   super();
   model = new AssignmentModel(anTemplate.getLanguage());
   view = new AssignmentModelView(model);
   template = anTemplate;
   model.addListener(view);
   if (anTemplate != null) {
     this.createCells();
   }
 }
  /**
   * Adds a template to a xml file.
   *
   * @param template template that should be added.
   */
  public void addTemplate(LanguageGroup parent, ConstraintTemplate template) {
    /*Element languageElement = this.getLanguageElement(template.getLanguage());
    Element newTemplate = this.factory.createTemplateElement(template);
    languageElement.appendChild(newTemplate);
    writeDocument();*/
    Element parentElement = getParentElement(parent, template.getLanguage());

    Element newTemplate = this.factory.createTemplateElement(template);
    parentElement.appendChild(newTemplate);
    writeDocument();
  }
  /**
   * Deletes a template from a xml file.
   *
   * @param template template that should be deleted
   * @return true if the template was succesfuly deleted
   */
  public boolean deleteTemplate(ConstraintTemplate template, LanguageGroup parent) {
    Element parentElement = getParentElement(parent, template.getLanguage());

    Element element = factory.getTemplateElement(template, parentElement);
    if (element != null) {
      this.deleteElement(element, parentElement);
      // factory.deleteElement(element, parentElement);
      writeDocument();
      return true;
    }
    return false;
  }
 /**
  * Edits/alters a template in a xml file.
  *
  * @param template template that should be edited
  * @return true if the template was succesfuly edited
  */
 public boolean editTemplate(ConstraintTemplate template, LanguageGroup parent) {
   /* Element languageElement = this.getLanguageElement(template.getLanguage());
   Element element = factory.getTemplateElement(template, languageElement);
   if (element != null) {
     factory.templateToElement(template, element);
     writeDocument();
     return true;
   }
   return false;*/
   Element parentElement = getParentElement(parent, template.getLanguage());
   Element element = factory.getTemplateElement(template, parentElement);
   if (element != null) {
     factory.templateToElement(template, element);
     writeDocument();
     return true;
   }
   return false;
 }