| Home >> All >> org >> bdgp >> apps >> dagedit >> [ datamodel Javadoc ] |
Source code: org/bdgp/apps/dagedit/datamodel/DEEditHistory.java
1 package org.bdgp.apps.dagedit.datamodel; 2 3 import java.util.*; 4 import java.io.Serializable; 5 6 public class DEEditHistory implements Serializable { 7 8 protected Vector historyList; 9 protected Vector relationshipTypes; 10 protected Term root; 11 protected Term originalRoot; 12 13 protected String user; 14 protected Date date; 15 protected String version; 16 protected String comment; 17 18 protected boolean isActive = false; 19 20 protected String title = null; 21 protected TermRelationshipType defaultRelationshipType = null; 22 23 public void setIsActive(boolean isActive) { 24 this.isActive = isActive; 25 } 26 27 public boolean getIsActive() { 28 return isActive; 29 } 30 31 public String getComment() { 32 return comment; 33 } 34 35 public void setComment(String comment) { 36 this.comment = comment; 37 } 38 39 public String getVersion() { 40 return version; 41 } 42 43 public void setVersion(String version) { 44 this.version = version; 45 } 46 47 public Date getDate() { 48 return date; 49 } 50 51 public void setDate(Date date) { 52 this.date = date; 53 } 54 55 public String getUser() { 56 return user; 57 } 58 59 public void setUser(String user) { 60 this.user = user; 61 } 62 63 public DEEditHistory(Term root) { 64 this(root, true); 65 } 66 67 public DEEditHistory(Term root, boolean rememberOriginal) { 68 historyList = new Vector(); 69 relationshipTypes = new Vector(); 70 this.root = root; 71 if (rememberOriginal) 72 originalRoot = Term.cloneSubtree(root); 73 } 74 75 public TermRelationshipType getDefaultRelationshipType() { 76 return defaultRelationshipType; 77 } 78 79 public void setDefaultRelationshipType(TermRelationshipType trt) { 80 defaultRelationshipType = trt; 81 } 82 83 public Vector getRelationshipTypes() { 84 return relationshipTypes; 85 } 86 87 public void addRelationshipType(TermRelationshipType trt) { 88 relationshipTypes.add(trt); 89 } 90 91 public void setRelationshipTypes(Vector types) { 92 this.relationshipTypes = (Vector) types.clone(); 93 } 94 95 public void removeRelationshipType(TermRelationshipType trt) { 96 relationshipTypes.remove(trt); 97 } 98 99 public Term getRoot() { 100 return root; 101 } 102 103 public Term getOriginalRoot() { 104 return originalRoot; 105 } 106 107 public boolean isModified() { 108 return historyList.size() != 0; 109 } 110 111 public void flush() { 112 historyList.removeAllElements(); 113 } 114 115 public HistoryItem getItemAt(int index) { 116 return (HistoryItem) historyList.elementAt(index); 117 } 118 119 public int size() { 120 return historyList.size(); 121 } 122 123 public Enumeration getHistoryItems() { 124 return historyList.elements(); 125 } 126 127 public void addItem(HistoryItem item) { 128 historyList.addElement(item); 129 } 130 131 public void setHistoryList(Vector historyList) { 132 this.historyList = historyList; 133 } 134 135 public Vector getHistoryList() { 136 return historyList; 137 } 138 139 public void removeItem(HistoryItem item) { 140 historyList.removeElement(item); 141 } 142 143 public int indexOfItem(HistoryItem item) { 144 return historyList.indexOf(item); 145 } 146 147 public void setTitle(String title) { 148 this.title = title; 149 } 150 151 public String getTitle() { 152 if (title != null) 153 return title; 154 else if (getIsActive()) 155 return "Active history"; 156 else { 157 try { 158 java.text.SimpleDateFormat format = 159 new java.text. 160 SimpleDateFormat("hh:mm aaa, MMMMM dd, yyyy"); 161 return "Saved by "+user+" at "+format.format(date); 162 } catch (Exception e) { 163 return "History"; 164 } 165 } 166 } 167 168 public String toString() { 169 return getTitle(); 170 } 171 }