Changeset 5877
- Timestamp:
- 2003-11-18T15:32:46+13:00 (20 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/MetaEditPane.java
r5809 r5877 233 233 this.element = element; 234 234 // Transform the raw text to be GREENSTONE and DOM compatible - as that will be its next destination immediately after being added to the value model 235 this.value = Codec.transform(value, Codec.REMOVE_SQUARE_BRACKET); 235 this.value = Codec.transform(value, Codec.ENCODE_PATH); 236 this.value = Codec.transform(this.value, Codec.REMOVE_SQUARE_BRACKET); 236 237 this.value = Codec.transform(this.value, Codec.TEXT_TO_DOM); 237 238 } … … 1198 1199 TreePath path = tree.getSelectionPath(); 1199 1200 GValueNode node = (GValueNode) path.getLastPathComponent(); 1200 setSelectedValue(node.getFullPath( false));1201 setSelectedValue(node.getFullPath(true)); 1201 1202 } 1202 1203 } -
trunk/gli/src/org/greenstone/gatherer/util/Codec.java
r5835 r5877 38 38 public class Codec { 39 39 40 static final public String DECODE_PATH = "DECODE_PATH"; 40 41 static final public String DOM_TO_GREENSTONE = "DOM_TO_GREENSTONE"; 41 42 static final public String DOM_TO_TEXT = "DOM_TO_TEXT"; 43 static final public String ENCODE_PATH = "ENCODE_PATH"; 42 44 static final public String GREENSTONE_TO_DOM = "GREENSTONE_TO_DOM"; 43 45 static final public String GREENSTONE_TO_TEXT = "GREENSTONE_TO_TEXT"; … … 58 60 TRANSFORMS = new HashMap(); 59 61 62 String[] decode_path = { 63 "\\|", "\\\\" 64 }; 65 TRANSFORMS.put(DECODE_PATH, decode_path); 66 decode_path = null; 67 60 68 // Translate DOM encoded text into Greenstone encoding 61 69 String[] dom_to_greenstone = { … … 64 72 "<", "<", 65 73 """, "\\\\\"", 66 "&", "&", 67 "\\|", "\\\\" 74 "&", "&" 68 75 }; 69 76 // removed "\n", "\\\\n", - config files are allowed new lines … … 81 88 "<", "<", 82 89 """, "\"", 83 "&", "&", 84 "\\|", "\\\\" 90 "&", "&" 85 91 }; 86 92 TRANSFORMS.put(DOM_TO_TEXT, dom_to_text); 87 93 dom_to_text = null; 94 95 String[] encode_path = { 96 "\\\\", "\\|" 97 }; 98 TRANSFORMS.put(ENCODE_PATH, encode_path); 99 encode_path = null; 88 100 89 101 // Transform Greenstone encoded text to DOM encoding … … 93 105 ">", ">", 94 106 "\\\\\"", """, 95 "\\\\\'", "'", 96 "\\\\", "\\|" 107 "\\\\\'", "'" 97 108 }; 98 109 // removed"\\\\n", "\n", added "\\\\", "\\|" … … 109 120 "[", "\\[", 110 121 "]", "\\]" 111 112 122 }; 113 123 // removed "\\\\n", "\n", "\\|", "\\\\" … … 130 140 ">", ">", 131 141 "\"", """, 132 "\'", "'", 133 "\\\\", "\\|", 142 "\'", "'" 134 143 }; 135 144 TRANSFORMS.put(TEXT_TO_DOM, text_to_dom); … … 171 180 172 181 static public String transform(String raw, String transform) { 173 ///ystem.err.println(" transforming "+transform);182 ///ystem.err.println("Transforming by "+transform+":\n" + raw); 174 183 String processed = (String) CACHE.get(transform, raw); 175 184 if(processed == null) { … … 183 192 } 184 193 } 185 // /atherer.println("*** Transform: " + transform + " ***");186 // /atherer.println("*** Raw : '" + raw + "'");187 // /atherer.println("*** Processed: '" + processed + "'");194 //Gatherer.println("\n*** Transform: " + transform + " ***"); 195 //Gatherer.println("*** Raw : '" + raw + "'"); 196 //Gatherer.println("*** Processed: '" + processed + "'"); 188 197 // If cache is at maximum size, empty it and start again 189 198 if(CACHE.size() == MAX_CACHE_SIZE) { -
trunk/gli/src/org/greenstone/gatherer/valuetree/GValueNode.java
r5805 r5877 192 192 } 193 193 if(as_text) { 194 return Codec.transform(path.toString(), Codec.GREENSTONE_TO_TEXT); 194 String temp = Codec.transform(path.toString(), Codec.GREENSTONE_TO_TEXT); 195 return Codec.transform(temp, Codec.DECODE_PATH); 195 196 } 196 197 else { … … 339 340 if(name.equals("Subject")) { 340 341 result = MSMUtils.getValue(element); 342 result = Codec.transform(result, Codec.DECODE_PATH); 341 343 switch(decode_type) { 342 344 case GValueNode.GREENSTONE:
Note:
See TracChangeset
for help on using the changeset viewer.