Skip to content

Commit

Permalink
Footnote/Endnote parts implement ContentAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
plutext committed May 29, 2012
1 parent c62ee01 commit 3ae1448
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
Expand Up @@ -21,14 +21,20 @@
package org.docx4j.openpackaging.parts.WordprocessingML;


import java.util.ArrayList;
import java.util.List;

import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
import org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware;
import org.docx4j.openpackaging.parts.PartName;
import org.docx4j.openpackaging.parts.relationships.Namespaces;
import org.docx4j.wml.CTEndnotes;
import org.docx4j.wml.CTFtnEdn;
import org.docx4j.wml.ContentAccessor;


public final class EndnotesPart extends JaxbXmlPartXPathAware<CTEndnotes> {
public final class EndnotesPart extends JaxbXmlPartXPathAware<CTEndnotes> implements ContentAccessor {

public EndnotesPart(PartName partName) throws InvalidFormatException {
super(partName);
Expand All @@ -50,5 +56,23 @@ public void init() {

}

/**
* Convenience method to getJaxbElement().getEndnote()
* @since 2.8.1
*/
public List<Object> getContent() {

if (this.getJaxbElement()==null) {
this.setJaxbElement( Context.getWmlObjectFactory().createCTEndnotes() );
}

List<Object> tmpList = new ArrayList<Object>();
for (CTFtnEdn o : this.getJaxbElement().getEndnote() ) {
tmpList.add(o);
}

return tmpList;
}


}
Expand Up @@ -21,14 +21,20 @@
package org.docx4j.openpackaging.parts.WordprocessingML;


import java.util.ArrayList;
import java.util.List;

import org.docx4j.jaxb.Context;
import org.docx4j.openpackaging.exceptions.InvalidFormatException;
import org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware;
import org.docx4j.openpackaging.parts.PartName;
import org.docx4j.openpackaging.parts.relationships.Namespaces;
import org.docx4j.wml.CTFootnotes;
import org.docx4j.wml.CTFtnEdn;
import org.docx4j.wml.ContentAccessor;


public final class FootnotesPart extends JaxbXmlPartXPathAware<CTFootnotes> {
public final class FootnotesPart extends JaxbXmlPartXPathAware<CTFootnotes> implements ContentAccessor {

public FootnotesPart(PartName partName) throws InvalidFormatException {
super(partName);
Expand All @@ -51,5 +57,22 @@ public void init() {

}

/**
* Convenience method to getJaxbElement().getFootnote()
* @since 2.8.1
*/
public List<Object> getContent() {

if (this.getJaxbElement()==null) {
this.setJaxbElement( Context.getWmlObjectFactory().createCTFootnotes() );
}

List<Object> tmpList = new ArrayList<Object>();
for (CTFtnEdn o : this.getJaxbElement().getFootnote() ) {
tmpList.add(o);
}

return tmpList;
}

}

0 comments on commit 3ae1448

Please sign in to comment.