Save annotation range in outline object
This commit is contained in:
parent
167555ebbe
commit
e7f4f3c46e
2 changed files with 9 additions and 5 deletions
|
@ -134,11 +134,10 @@ public class Document {
|
|||
String author = (String) annotationProperties.getPropertyValue("Author");
|
||||
if (author != null && author.equals(METADATA_EXTENSION)) {
|
||||
String content = (String) annotationProperties.getPropertyValue("Content");
|
||||
System.out.println("Content " + content);
|
||||
OutlineElement lastElement = outline.get(outline.size()-1);
|
||||
lastElement.readMetadata(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
e.printStackTrace();
|
||||
} catch (WrappedTargetException e) {
|
||||
|
|
|
@ -20,14 +20,19 @@ public class OutlineElement {
|
|||
|
||||
private XTextRange textRange;
|
||||
private boolean hasMetadataStorage = false;
|
||||
private XTextRange metadataTextRange = null;
|
||||
private XTextRange annotationStart = null;
|
||||
private XTextRange annotationEnd = null;
|
||||
|
||||
public OutlineElement(XTextRange textRange) {
|
||||
this.textRange = textRange;
|
||||
this.name = textRange.getString();
|
||||
this.metadata = new ArrayList<MetadataElement>();
|
||||
annotationStart = textRange.getStart();
|
||||
}
|
||||
|
||||
public void setAnnotationAnchorEnd(XTextRange anchor) {
|
||||
this.annotationEnd = anchor;
|
||||
}
|
||||
|
||||
public void readMetadata(String data) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(data);
|
||||
|
@ -44,7 +49,7 @@ public class OutlineElement {
|
|||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
public String metadataToString() {
|
||||
JSONObject json = new JSONObject();
|
||||
for (MetadataElement element : metadata) {
|
||||
json.put(element.getName(), element.getValue());
|
||||
|
|
Loading…
Add table
Reference in a new issue