Package org.odftoolkit.odfdom.dom.element.dc

Examples of org.odftoolkit.odfdom.dom.element.dc.DcCreatorElement


    // create annotation element
    OdfElement parentElement = getContainerElement();
    OdfFileDom dom = (OdfFileDom) parentElement.getOwnerDocument();
    OfficeAnnotationElement annotationElement = dom.newOdfElement(OfficeAnnotationElement.class);
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
    dcCreatorElement.setTextContent(creator);
    // set date
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = annotationElement.newDcDateElement();
    dcDateElement.setTextContent(dcDate);
    TextPElement notePElement = annotationElement.newTextPElement();
View Full Code Here


    OdfFileDom dom = (OdfFileDom) getOdfElement().getOwnerDocument();
    OfficeAnnotationElement annotationElement = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName
        .newName(OdfDocumentNamespace.OFFICE, "annotation"));
    getOdfElement().insertBefore(annotationElement, getOdfElement().getFirstChild());
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
    dcCreatorElement.setTextContent(creator);
    // set date
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = annotationElement.newDcDateElement();
    dcDateElement.setTextContent(dcDate);
    TextPElement notePElement = annotationElement.newTextPElement();
View Full Code Here

    TextPElement noteElement = OdfElement.findFirstChildNode(TextPElement.class, annotation);
    if (noteElement == null) {
      noteElement = annotation.newTextPElement();
    }
    noteElement.setTextContent(note);
    DcCreatorElement dcCreatorElement = OdfElement.findFirstChildNode(DcCreatorElement.class, annotation);
    if (dcCreatorElement == null) {
      dcCreatorElement = annotation.newDcCreatorElement();
    }
    dcCreatorElement.setTextContent(System.getProperty("user.name"));
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = OdfElement.findFirstChildNode(DcDateElement.class, annotation);
    if (dcDateElement == null) {
      dcDateElement = annotation.newDcDateElement();
    }
View Full Code Here

   * @return the creator of the current document;
   * <p>
   * <code>null</code>, if the element is not set.
   */
  public String getCreator() {
    DcCreatorElement creatorEle = OdfElement.findFirstChildNode(
        DcCreatorElement.class, mOfficeMetaElement);
    if (creatorEle != null) {
      return creatorEle.getTextContent();
    }
    return null;
  }
View Full Code Here

   * dc:creator}.
   *
   * @param creator set the specified creator. NULL will remove the element from the meta.xml.
   */
  public void setCreator(String creator) {
    DcCreatorElement creatorEle = OdfElement.findFirstChildNode(
        DcCreatorElement.class, mOfficeMetaElement);
    if (creator == null) {
      if (creatorEle != null) {
        mOfficeMetaElement.removeChild(creatorEle);
      }
    } else {
      if (creatorEle == null) {
        creatorEle = mOfficeMetaElement.newDcCreatorElement();
      }
      creatorEle.setTextContent(creator);
    }
  }
View Full Code Here

    OdfFileDom dom = (OdfFileDom) getOdfElement().getOwnerDocument();
    OfficeAnnotationElement annotationElement = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName
        .newName(OdfDocumentNamespace.OFFICE, "annotation"));
    getOdfElement().insertBefore(annotationElement, getOdfElement().getFirstChild());
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
    dcCreatorElement.setTextContent(creator);
    // set date
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = annotationElement.newDcDateElement();
    dcDateElement.setTextContent(dcDate);
    TextPElement notePElement = annotationElement.newTextPElement();
View Full Code Here

    TextPElement noteElement = OdfElement.findFirstChildNode(TextPElement.class, annotation);
    if (noteElement == null) {
      noteElement = annotation.newTextPElement();
    }
    noteElement.setTextContent(note);
    DcCreatorElement dcCreatorElement = OdfElement.findFirstChildNode(DcCreatorElement.class, annotation);
    if (dcCreatorElement == null) {
      dcCreatorElement = annotation.newDcCreatorElement();
    }
    dcCreatorElement.setTextContent(System.getProperty("user.name"));
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = OdfElement.findFirstChildNode(DcDateElement.class, annotation);
    if (dcDateElement == null) {
      dcDateElement = annotation.newDcDateElement();
    }
View Full Code Here

   * @return the creator of the current document;
   * <p>
   * <code>null</code>, if the element is not set.
   */
  public String getCreator() {
    DcCreatorElement creatorEle = OdfElement.findFirstChildNode(
        DcCreatorElement.class, mOfficeMetaElement);
    if (creatorEle != null) {
      return creatorEle.getTextContent();
    }
    return null;
  }
View Full Code Here

   * dc:creator}.
   *
   * @param creator set the specified creator. NULL will remove the element from the meta.xml.
   */
  public void setCreator(String creator) {
    DcCreatorElement creatorEle = OdfElement.findFirstChildNode(
        DcCreatorElement.class, mOfficeMetaElement);
    if (creator == null) {
      if (creatorEle != null) {
        mOfficeMetaElement.removeChild(creatorEle);
      }
    } else {
      if (creatorEle == null) {
        creatorEle = mOfficeMetaElement.newDcCreatorElement();
      }
      creatorEle.setTextContent(creator);
    }
  }
View Full Code Here

    OdfFileDom dom = (OdfFileDom) getOdfElement().getOwnerDocument();
    OfficeAnnotationElement annotationElement = (OfficeAnnotationElement) OdfXMLFactory.newOdfElement(dom, OdfName
        .newName(OdfDocumentNamespace.OFFICE, "annotation"));
    getOdfElement().insertBefore(annotationElement, getOdfElement().getFirstChild());
    // set creator
    DcCreatorElement dcCreatorElement = annotationElement.newDcCreatorElement();
    if (creator == null) {
      creator = System.getProperty("user.name");
    }
    dcCreatorElement.setTextContent(creator);
    // set date
    String dcDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date());
    DcDateElement dcDateElement = annotationElement.newDcDateElement();
    dcDateElement.setTextContent(dcDate);
    TextPElement notePElement = annotationElement.newTextPElement();
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.dc.DcCreatorElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.