source: trunk/src/org/expeditee/gui/AttributeUtils.java@ 121

Last change on this file since 121 was 121, checked in by bjn8, 16 years ago

Added invalidation for graphics... biiiig commit. LOts of effeciency improvements - now can animate

File size: 22.7 KB
Line 
1package org.expeditee.gui;
2
3import java.awt.Color;
4import java.awt.Font;
5import java.awt.Point;
6import java.lang.reflect.InvocationTargetException;
7import java.lang.reflect.Method;
8import java.util.HashMap;
9import java.util.LinkedList;
10import java.util.List;
11
12import org.expeditee.io.Conversion;
13import org.expeditee.items.Item;
14import org.expeditee.items.Justification;
15import org.expeditee.items.Permission;
16import org.expeditee.items.Text;
17
18/**
19 * This class provides the methods to extract and set attributes of Items and
20 * Frames. These methods are called when a user merges a text item with
21 * <code>Attribute: Value</code> pairs.
22 *
23 * @author jdm18
24 *
25 */
26public class AttributeUtils {
27
28 public static final char SEPARATOR_CHAR = ':';
29
30 private static final String SEPARATOR_STRING = SEPARATOR_CHAR + " ";
31
32 private static final int GET_LENGTH = "get".length();
33
34 private static int SET_LENGTH = "set".length();
35
36 // List of method names to ignore when searching for a match
37 private static List<Method> _GetMethods = null;
38
39 private static HashMap<String, Method> _SetMethods = null;
40
41 // List of attributes which are ignored when copying.
42 private static List<String> _Ignore = null;
43
44 // List of method names to show in extraced lists even when they return
45 // null
46 // (Null is often used to indicate the default value is used)
47 private static List<Method> _AllowNull = null;
48
49 private static List<String> _ExtractIgnore = null;
50
51 // private static HashMap<String, String> _Abbreviations = null;
52
53 /**
54 * Initialises the _Ignore and _AllowNull lists.
55 */
56 private static void initLists() {
57
58 Class[] param = {};
59
60 try {
61 // TODO load these in with reflection...
62 // Set the shortcuts with annotation tags on the methods
63 _Ignore = new LinkedList<String>();
64 _Ignore.add("date");
65 _Ignore.add("datecreated");
66 _Ignore.add("d");
67 _Ignore.add("link");
68 _Ignore.add("l");
69 _Ignore.add("action");
70 _Ignore.add("a");
71 _Ignore.add("position");
72 _Ignore.add("pos");
73 _Ignore.add("p");
74 _Ignore.add("x");
75 _Ignore.add("y");
76
77 _ExtractIgnore = new LinkedList<String>();
78 _ExtractIgnore.add("x");
79 _ExtractIgnore.add("y");
80
81 _AllowNull = new LinkedList<Method>();
82 _AllowNull.add(Item.class.getMethod("getColor", param));
83 _AllowNull.add(Item.class.getMethod("getBackgroundColor", param));
84
85 _AllowNull.add(Frame.class.getMethod("getBackgroundColor", param));
86 _AllowNull.add(Frame.class.getMethod("getForegroundColor", param));
87
88 _GetMethods = new LinkedList<Method>();
89 _GetMethods.add(Item.class.getMethod("getDateCreated", param));
90
91 _GetMethods.add(Item.class.getMethod("getColor", param));
92 _GetMethods.add(Item.class.getMethod("getBackgroundColor", param));
93 _GetMethods.add(Item.class.getMethod("getAction", param));
94 _GetMethods.add(Item.class.getMethod("getData", param));
95 _GetMethods.add(Item.class.getMethod("getLink", param));
96 _GetMethods.add(Item.class.getMethod("getFillColor", param));
97 _GetMethods.add(Item.class.getMethod("getFillPattern", param));
98 _GetMethods.add(Item.class.getMethod("getThickness", param));
99
100 _GetMethods.add(Item.class.getMethod("getOwner", param));
101 _GetMethods.add(Item.class.getMethod("getLinkMark", param));
102 _GetMethods.add(Item.class.getMethod("getActionMark", param));
103
104 _GetMethods
105 .add(Item.class.getMethod("getActionCursorEnter", param));
106 _GetMethods
107 .add(Item.class.getMethod("getActionCursorLeave", param));
108 _GetMethods.add(Item.class.getMethod("getActionEnterFrame", param));
109 _GetMethods.add(Item.class.getMethod("getActionLeaveFrame", param));
110
111 _GetMethods.add(Item.class.getMethod("getTopShadowColor", param));
112 _GetMethods
113 .add(Item.class.getMethod("getBottomShadowColor", param));
114 _GetMethods.add(Item.class.getMethod("getArrow", param));
115
116 _GetMethods.add(Item.class.getMethod("getLinePattern", param));
117 _GetMethods.add(Item.class.getMethod("getLinkFrameset", param));
118 _GetMethods.add(Item.class.getMethod("getLinkTemplate", param));
119 _GetMethods.add(Item.class.getMethod("getPosition", param));
120 _GetMethods.add(Item.class.getMethod("getX", param));
121 _GetMethods.add(Item.class.getMethod("getY", param));
122
123 _GetMethods.add(Text.class.getMethod("getFamily", param));
124 _GetMethods.add(Text.class.getMethod("getFontStyle", param));
125 _GetMethods.add(Text.class.getMethod("getJustification", param));
126 _GetMethods.add(Text.class.getMethod("getWidth", param));
127 _GetMethods.add(Item.class.getMethod("getSize", param));
128
129 _GetMethods.add(Frame.class.getMethod("getOwner", param));
130 _GetMethods.add(Frame.class.getMethod("getPermission", param));
131 _GetMethods.add(Frame.class.getMethod("getDateCreated", param));
132 _GetMethods.add(Frame.class.getMethod("getLastModifyUser", param));
133 _GetMethods.add(Frame.class.getMethod("getLastModifyDate", param));
134 _GetMethods.add(Frame.class.getMethod("getForegroundColor", param));
135 _GetMethods.add(Frame.class.getMethod("getBackgroundColor", param));
136
137 Class[] pPoint = { Point.class };
138 Class[] pString = { String.class };
139 Class[] pInt = { int.class };
140 Class[] pFloat = { float.class };
141 Class[] pColor = { Color.class };
142 Class[] pBool = { boolean.class };
143 Class[] pArrow = { float.class, double.class };
144 Class[] pList = { List.class };
145 Class[] pIntArray = { int[].class };
146 Class[] pJustification = { Justification.class };
147 Class[] pPermission = { Permission.class };
148
149 _SetMethods = new HashMap<String, Method>();
150 _SetMethods.put("x", Item.class.getMethod("setX", pFloat));
151 _SetMethods.put("y", Item.class.getMethod("setY", pFloat));
152 _SetMethods.put("position", Item.class.getMethod("setPosition",
153 pPoint));
154 _SetMethods.put("p", Item.class.getMethod("setPosition", pPoint));
155 _SetMethods.put("pos", Item.class.getMethod("setPosition", pPoint));
156 _SetMethods.put("thickness", Item.class.getMethod("setThickness",
157 pFloat));
158 _SetMethods.put("t", Item.class.getMethod("setThickness", pFloat));
159
160 _SetMethods.put("color", Item.class.getMethod("setColor", pColor));
161 _SetMethods.put("c", Item.class.getMethod("setColor", pColor));
162
163 _SetMethods.put("backgroundcolor", Item.class.getMethod(
164 "setBackgroundColor", pColor));
165 _SetMethods.put("bgc", Item.class.getMethod("setBackgroundColor",
166 pColor));
167
168 _SetMethods
169 .put("action", Item.class.getMethod("setActions", pList));
170 _SetMethods.put("a", Item.class.getMethod("setActions", pList));
171 _SetMethods.put("d", Item.class.getMethod("setData", pList));
172 _SetMethods.put("data", Item.class.getMethod("setData", pList));
173
174 _SetMethods.put("link", Item.class.getMethod("setLink", pString));
175 _SetMethods.put("l", Item.class.getMethod("setLink", pString));
176
177 _SetMethods.put("fillcolor", Item.class.getMethod("setFillColor",
178 pColor));
179 _SetMethods.put("fc", Item.class.getMethod("setFillColor", pColor));
180
181 _SetMethods.put("fillpattern", Item.class.getMethod(
182 "setFillPattern", pString));
183 _SetMethods.put("fp", Item.class.getMethod("setFillPattern",
184 pString));
185
186 _SetMethods.put("owner", Item.class.getMethod("setOwner", pString));
187 _SetMethods.put("linkmark", Item.class.getMethod("setLinkMark",
188 pBool));
189 _SetMethods.put("lm", Item.class.getMethod("setLinkMark", pBool));
190 _SetMethods.put("actionmark", Item.class.getMethod("setActionMark",
191 pBool));
192 _SetMethods.put("am", Item.class.getMethod("setActionMark", pBool));
193
194 _SetMethods.put("actioncursorenter", Item.class.getMethod(
195 "setActionCursorEnter", pList));
196 _SetMethods.put("actioncursorleave", Item.class.getMethod(
197 "setActionCursorLeave", pList));
198 _SetMethods.put("actionenterframe", Item.class.getMethod(
199 "setActionEnterFrame", pList));
200 _SetMethods.put("actionleaveframe", Item.class.getMethod(
201 "setActionLeaveFrame", pList));
202
203 _SetMethods.put("topshadow", Item.class.getMethod(
204 "setTopShadowColor", pColor));
205 _SetMethods.put("bottomshadow", Item.class.getMethod(
206 "setBottomShadowColor", pColor));
207 _SetMethods.put("arrow", Item.class.getMethod("setArrow", pArrow));
208
209 _SetMethods.put("linepattern", Item.class.getMethod(
210 "setLinePattern", pIntArray));
211 _SetMethods.put("lp", Item.class.getMethod("setLinePattern",
212 pIntArray));
213
214 _SetMethods.put("linkframeset", Item.class.getMethod(
215 "setLinkFrameset", pString));
216 _SetMethods.put("lf", Item.class.getMethod("setLinkFrameset",
217 pString));
218 _SetMethods.put("linktemplate", Item.class.getMethod(
219 "setLinkTemplate", pString));
220 _SetMethods.put("lt", Item.class.getMethod("setLinkTemplate",
221 pString));
222
223 _SetMethods.put("family", Text.class
224 .getMethod("setFamily", pString));
225 _SetMethods.put("face", Text.class.getMethod("setFontStyle",
226 pString));
227 _SetMethods.put("fontstyle", Text.class.getMethod("setFontStyle",
228 pString));
229 _SetMethods.put("justification", Text.class.getMethod(
230 "setJustification", pJustification));
231 _SetMethods.put("width", Text.class.getMethod("setWidth", pInt));
232 _SetMethods.put("size", Item.class.getMethod("setSize", pFloat));
233 _SetMethods.put("s", Item.class.getMethod("setSize", pFloat));
234
235 _SetMethods.put("foregroundcolor", Frame.class.getMethod(
236 "setForegroundColor", pColor));
237 _SetMethods.put("fgc", Frame.class.getMethod("setForegroundColor",
238 pColor));
239 _SetMethods.put("backgroundcolor0", Frame.class.getMethod(
240 "setBackgroundColor", pColor));
241 _SetMethods.put("bgc0", Frame.class.getMethod("setBackgroundColor",
242 pColor));
243 _SetMethods.put("permission", Frame.class.getMethod(
244 "setPermission", pPermission));
245
246 } catch (SecurityException e) {
247 // TODO Auto-generated catch block
248 e.printStackTrace();
249 } catch (NoSuchMethodException e) {
250 // TODO Auto-generated catch block
251 e.printStackTrace();
252 }
253 }
254
255 /**
256 * Extracts a list of attributes from the given Object. Any method that
257 * starts with <code>get</code>, takes no arguments and is not found in
258 * the Ignore list will be run, All the attributes are then put into a Text
259 * Item of the form <Name>:<Value> If the value returned by the get method
260 * is null, then the attribute will not be included, unless the name of the
261 * method is found in the AllowNull list.
262 *
263 * @param toExtract
264 * The Object from which to extract the attributes
265 * @return A Text Item containing the extracted Attributes.
266 */
267 public static Item extractAttributes(Object toExtract) {
268 if (toExtract == null)
269 return null;
270
271 // ensure the lists are populated
272 if (_Ignore == null)
273 initLists();
274
275 // StringBuffer to store all the extracted Attribute:Value pairs
276 StringBuffer attributes = new StringBuffer();
277
278 // iterate through the list of methods
279 for (Method m : _GetMethods) {
280
281 // Make sure the classes of the methods match the item
282 if (m.getDeclaringClass().isAssignableFrom(toExtract.getClass())) {
283 try {
284 Object o = m.invoke(toExtract, (Object[]) null);
285
286 if (o == null) {
287 // methods that return null are only included if they
288 // are in the AllowNull list
289 if (_AllowNull.contains(m)) {
290 String name = m.getName().substring(GET_LENGTH)
291 .toLowerCase();
292 if (name.equals("color"))
293 o = "default";
294 else if (name.equals("backgroundcolor"))
295 o = "transparent";
296 else if (name.equals("foregroundcolor"))
297 o = "auto";
298 else
299 o = "";
300 } else {
301 continue;
302 }
303 }
304 // skip methods that are in the ignore lists
305 if (_ExtractIgnore.contains(m.getName().substring(
306 GET_LENGTH).toLowerCase())) {
307 continue;
308 }
309
310 if (o instanceof Integer) {
311 Integer i = (Integer) o;
312 if (i == Item.DEFAULT_INTEGER)
313 continue;
314 if (m.getName().endsWith("Justification")
315 && ((Justification) o).toString() != null)
316 o = ((Justification) o).toString();
317 // -1 indicates default value
318 else
319 o = i;
320 } else if (o instanceof Float) {
321 // -1 indicates default value
322 if (((Float) o) < 0.0001)
323 continue;
324 o = Math.round((Float)o);
325 } else if (o instanceof Double) {
326 // -1 indicates default value
327 if (((Double) o) < 0.0001)
328 continue;
329 } else if (o instanceof Color) {
330 // converts the color to the Expeditee code
331 o = Conversion.getExpediteeColorCode((Color) o);
332 if (o == null)
333 continue;
334 } else if (o instanceof Point) {
335 Point p = (Point) o;
336 o = Math.round(p.getX()) + " " + Math.round(p.getY());
337 } else if (o instanceof Font) {
338 Font f = (Font) o;
339
340 String s = f.getName() + "-";
341 if (f.isPlain())
342 s += "Plain";
343
344 if (f.isBold())
345 s += "Bold";
346
347 if (f.isItalic())
348 s += "Italic";
349
350 s += "-" + f.getSize();
351 o = s;
352 } else if (o instanceof Text) {
353 o = ((Text) o).getFirstLine();
354 } else if (o instanceof List) {
355 List list = (List) o;
356 for (Object ob : list)
357 attributes
358 .append(m.getName().substring(GET_LENGTH))
359 .append(SEPARATOR_STRING).append(ob)
360 .append('\n');
361 continue;
362 } else if (o instanceof int[]) {
363 StringBuffer sb = new StringBuffer();
364 int[] values = (int[]) o;
365 for (int i = 0; i < values.length; i++) {
366 sb.append(values[i]).append(' ');
367 }
368 sb.deleteCharAt(attributes.length() - 1);
369 o = sb.toString();
370 } else if (o instanceof Boolean) {
371 // true is the default for boolean values
372 if (((Boolean) o).booleanValue())
373 continue;
374 }
375 // Append the attributes
376 attributes.append(m.getName().substring(GET_LENGTH))
377 .append(SEPARATOR_STRING).append(o).append('\n');
378 } catch (Exception e) {
379 // TODO Auto-generated catch block
380 e.printStackTrace();
381 }
382 }
383 }
384
385 // if no attributes were extracted
386 if (attributes.length() <= 0)
387 return null;
388
389 while (attributes. charAt(attributes.length() - 1) == '\n')
390 attributes.delete(attributes.length() - 1, attributes.length());
391
392 // create the text Item
393 Frame current = DisplayIO.getCurrentFrame();
394 Item attribs = current.getStatsTextItem(attributes.toString());
395 return attribs;
396 }
397
398 /**
399 * Attempts to set the attribute in the given attribute: value pair. The
400 * value string should be formatted as follows:
401 * <code> Attribute: Value </code> Multiple values can be used if they are
402 * separated by spaces
403 *
404 * @param toSet
405 * The Item or Frame to set the attribute of
406 * @param attribs
407 * The Text item that contains the list of attributes to set
408 * @return True if the attribute(s) were sucessfully set, false otherwise
409 */
410 public static boolean setAttribute(Object toSet, Text attribs) {
411 // error checking
412 if (toSet == null || attribs == null)
413 return false;
414
415 if (_Ignore == null)
416 initLists();
417
418 // get the list of attribute: value pairs
419 List<String> values = attribs.getTextList();
420 // if no pairs exist, we are done
421 if (values.size() == 0
422 || (values.size() == 1 && values.get(0).length() == 0)) {
423 return false;
424 }
425
426 // loop through all attribute: value pairs
427 for (int i = 0; i < values.size(); i++) {
428 StringBuffer v = new StringBuffer(values.get(i));
429
430 // remove the annotation mark (if applicable)
431 if (v.indexOf("@") == 0)
432 v = v.deleteCharAt(0);
433
434 // check if the next string is another attribute to merge or a
435 // continuation
436 while (i < values.size() - 1) {
437 StringBuffer next = new StringBuffer(values.get(i + 1));
438
439 // if the next String has a colon, then it may be another
440 // attribute
441 if (next.indexOf("" + SEPARATOR_CHAR) >= 0) {
442 // if the attribute is the same as v, then it is a
443 // continuation
444 if (v.indexOf(getAttribute(next.toString())) == 0) {
445 // strip the attribute from next
446 next = new StringBuffer(getValue(next.toString()));
447 // if the attribute is not the same, then it may be a
448 // new method
449 } else {
450 // if this is indeed a method, then leave the while loop
451 // if(_SetMethods.containsKey(StripFromColon(next.toString()).toLowerCase())){
452 break;
453 // }
454 }
455 }
456
457 v.append("\n").append(next);
458 i++;
459 }
460
461 if (v.length() > 0
462 && !setAttribute(toSet, v.toString(), values.size() > 1)) {
463 // if no other attributes have been set
464 if (i == 0)
465 return false;
466 // otherwise, this is a list of attributes, so continue
467 else {
468 String stripped = getAttribute(v.toString());
469 if (stripped == null) {
470 // This happens when there is an attribute at the start
471 // Then a bunch of plain text
472 return false;
473 } else if (_Ignore.contains(stripped)) {
474 return false;
475 } else if (!(_SetMethods.containsKey(stripped))) {
476 // Display an error message if its not in our list of
477 // attributes to ignore when copying
478 MessageBay.warningMessage("Attribute: '"
479 + getAttribute(v.toString())
480 + "' does not exist.");
481 } else {
482 String types = "";
483 for (Class c : _SetMethods.get(stripped)
484 .getParameterTypes())
485 types += c.getSimpleName() + " ";
486 MessageBay.warningMessage("Wrong arguments for: '"
487 + getAttribute(v.toString()) + "' expecting "
488 + types.trim() + " found '"
489 + getValue(v.toString()) + "'");
490 }
491 }
492 } else if (v.length() == 0)
493 return false;
494 }
495
496 return true;
497 }
498
499 private static boolean setAttribute(Object toSet, String value,
500 boolean isAttributeList) {
501 // separate attribute and value from string
502 String attribute = getAttribute(value);
503 //Check that an attribute was found
504 if(attribute == null)
505 return false;
506 attribute = attribute.toLowerCase();
507
508 value = getValue(value);
509 assert(value != null);
510
511 // Some properties are ignored when multiple attributes are being set on
512 // an item at the same time
513 if (isAttributeList && _Ignore.contains(attribute)) {
514 // System.out.println("Attribute ignored: " + attribute);
515 return true;
516 }
517
518 // Separate multiple values if required
519 Method toRun = _SetMethods.get( attribute);
520
521 // if this is not the name of a method, it may be the name of an agent
522 if (toRun == null) {
523 // System.out.println("Attrib not found for: " + attribute);
524 return false;
525 }
526
527 // if there are duplicate methods with the same name
528 List<Method> possibles = new LinkedList<Method>();
529 if (toRun.getDeclaringClass().isInstance(toSet))
530 possibles.add(toRun);
531 int i = 0;
532 while (_SetMethods.containsKey(attribute + i)) {
533 if (_SetMethods.get(attribute + i).getDeclaringClass()
534 .isAssignableFrom(toSet.getClass()))
535 possibles.add(_SetMethods.get(attribute + i));
536 i++;
537 }
538
539 for (Method possible : possibles) {
540 Object current = null;
541 Object[] param = {};
542 // find the corresponding get method for this set method
543 // and get the current value of the attribute
544 for (Method m : _GetMethods) {
545 if (m.getDeclaringClass().isAssignableFrom(toSet.getClass())
546 && m.getName().substring(GET_LENGTH).equals(
547 possible.getName().substring(SET_LENGTH))) {
548 try {
549 current = m.invoke(toSet, param);
550 } catch (IllegalArgumentException e) {
551 // TODO Auto-generated catch block
552 e.printStackTrace();
553 } catch (IllegalAccessException e) {
554 // TODO Auto-generated catch block
555 e.printStackTrace();
556 } catch (InvocationTargetException e) {
557 // TODO Auto-generated catch block
558 e.printStackTrace();
559 }
560 break;
561 }
562
563 }
564
565 try {
566 Object[] params = Conversion.Convert(possible, value, current);
567
568 try {
569 possible.invoke(toSet, params);
570 return true;
571 } catch (IllegalArgumentException e) {
572 // TODO Auto-generated catch block
573 e.printStackTrace();
574 } catch (IllegalAccessException e) {
575 // TODO Auto-generated catch block
576 e.printStackTrace();
577 } catch (InvocationTargetException e) {
578 MessageBay.displayMessage(toSet.getClass()
579 .getSimpleName()
580 + " type does not support that attribute.");
581 // e.printStackTrace();
582 }
583 } catch (NumberFormatException e) {
584
585 }
586 }
587
588 return false;
589 }
590
591 /**
592 * Returns the part of the given string that is after the attribute value
593 * pair separator. If that character is not there it returns empty
594 * if it is an annotation item or the entire string if it is not.
595 *
596 * @param attributeValuePair
597 * the string to get the value from.
598 * @return the value from the attribute value pair.
599 */
600 public static String getValue(String toStrip) {
601 assert (toStrip != null);
602
603 toStrip = toStrip.trim();
604 if (toStrip.length() == 0)
605 return "";
606
607 int ind = toStrip.lastIndexOf(SEPARATOR_CHAR);
608 int lineSeparator = toStrip.indexOf(Character.LINE_SEPARATOR, ind);
609 // If it is an annotation item return the empty string
610 // Annotation items can not be values only
611 if (ind < 0 && toStrip.charAt(0) == '@') {
612 return "";
613 }
614 //If its one line then our value goes to the end of the string
615 if(lineSeparator < 0)
616 lineSeparator = toStrip.length();
617
618 return toStrip.substring(ind + 1, lineSeparator).trim();
619 }
620
621 /**
622 * Returns the part of the given string that is before the attribute value
623 * pair separator, or null if the given String does not include the
624 * separator.
625 *
626 * @param attributeValuePair
627 * The String to strip
628 * @return the attribute if there is one or null if there is not
629 */
630 public static String getAttribute(String attributeValuePair) {
631 if(attributeValuePair.length() <= 1)
632 return null;
633
634 attributeValuePair = attributeValuePair.trim();
635
636 int ind = attributeValuePair.indexOf(SEPARATOR_CHAR);
637 // If its an annotation there must be no space between the @ and colon
638 // and the first character after the annotation must be a letter
639 if (attributeValuePair.charAt(0) == '@') {
640 if (!Character.isLetter(attributeValuePair.charAt(1)))
641 return null;
642 for (int i = 2; i < ind; i++) {
643 if (!Character.isLetterOrDigit(attributeValuePair.charAt(i)))
644 return null;
645 }
646 if (ind < 1)
647 return attributeValuePair.substring(0);
648 }else if (ind < 1){
649 return null;
650 }
651
652 return attributeValuePair.substring(0, ind).trim();
653 }
654
655 /**
656 * Replaces the current value for the text item with the new value.
657 *
658 * @param text
659 * the item whos value is to be changed
660 * @param newValue
661 * the new value for the item
662 */
663 public static void replaceValue(Text text, String newValue) {
664 assert (newValue != null);
665
666 String oldText = text.getFirstLine();
667 String restOfText = text.getText().substring(oldText.length());
668 String attribute = getAttribute(oldText);
669
670 if (attribute == null)
671 attribute = text.getText().trim();
672
673 text.setText(attribute + SEPARATOR_STRING + newValue + restOfText);
674 }
675
676 /**
677 * Gets the value from an attribute value pair as a double.
678 *
679 * @param attributeValuePair
680 * the text to get the value from
681 * @return the double value or null if there is none
682 */
683 public static Double getDoubleValue(String attributeValuePair) {
684 String value = getValue(attributeValuePair);
685
686 assert (value != null);
687
688 try {
689 return Double.parseDouble(value);
690 } catch (Exception e) {
691 }
692 return null;
693 }
694}
Note: See TracBrowser for help on using the repository browser.