X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2FTypeInfo.java;h=26314fa48a016603a9b3d9066a8d6d59f13a2c90;hp=b3851b20e5cbca48437185c71696bd0857bc5407;hb=78e4af97505df331618f9c13dd5d98440d364764;hpb=6f8998d8ebfcbc5df86e867eab719789f8886787 diff --git a/src/be/nikiroo/jvcard/TypeInfo.java b/src/be/nikiroo/jvcard/TypeInfo.java index b3851b2..26314fa 100644 --- a/src/be/nikiroo/jvcard/TypeInfo.java +++ b/src/be/nikiroo/jvcard/TypeInfo.java @@ -3,6 +3,8 @@ package be.nikiroo.jvcard; public class TypeInfo { private String name; private String value; + private Data parent; + private boolean dirty; public TypeInfo(String name, String value) { this.name = name; @@ -16,4 +18,41 @@ public class TypeInfo { public String getValue() { return value; } + + /** + * Check if this {@link TypeInfo} has unsaved changes. + * + * @return TRUE if it has + */ + public boolean isDirty() { + return dirty; + } + + /** + * Notify that this element has unsaved changes, and notify its parent of + * the same if any. + */ + protected void setDirty() { + this.dirty = true; + if (this.parent != null) + this.parent.setDirty(); + } + + /** + * Notify this element and all its descendants that it is in pristine + * state (as opposed to dirty). + */ + void setPristine() { + dirty = false; + } + + /** + * Set the parent of this {@link TypeInfo}. + * + * @param parent + * the new parent + */ + void setParent(Data parent) { + this.parent = parent; + } } \ No newline at end of file