19 package com.nokia.microedition.m2g; |
19 package com.nokia.microedition.m2g; |
20 |
20 |
21 import org.w3c.dom.*; |
21 import org.w3c.dom.*; |
22 import org.w3c.dom.svg.*; |
22 import org.w3c.dom.svg.*; |
23 import org.w3c.dom.events.*; |
23 import org.w3c.dom.events.*; |
24 //import com.nokia.mj.impl.rt.legacy.ToolkitInvoker; |
|
25 import java.io.IOException; |
24 import java.io.IOException; |
26 import org.eclipse.swt.widgets.*; |
25 import org.eclipse.swt.widgets.*; |
27 //import org.eclipse.swt.widgets.Display; |
|
28 import com.nokia.mj.impl.utils.Logger; |
26 import com.nokia.mj.impl.utils.Logger; |
29 |
27 |
30 public class M2GSVGElement extends M2GObject implements SVGElement |
28 public class M2GSVGElement extends M2GObject implements SVGElement |
31 { |
29 { |
32 //-------------------------------------------------- |
30 //-------------------------------------------------- |
37 "The type is null."; |
35 "The type is null."; |
38 static final String LISTENER_IS_NULL_ESTR = |
36 static final String LISTENER_IS_NULL_ESTR = |
39 "The listener is null."; |
37 "The listener is null."; |
40 static final String CAPTURE_NOT_SUPPORTED_ESTR = |
38 static final String CAPTURE_NOT_SUPPORTED_ESTR = |
41 "The capture phase is not supported in SVG Tiny."; |
39 "The capture phase is not supported in SVG Tiny."; |
42 //static final String ESWT_PACKAGE = |
|
43 // "org.eclipse.swt.widgets.Display" ; |
|
44 |
|
45 /* Optimization: static finals changed to local variables |
|
46 static final String TRAIT_IS_NULL_ESTR = |
|
47 "The trait is null."; |
|
48 static final String TRAIT_NOT_SUPPORTED_ON_ELEM_ESTR = |
|
49 "The trait is not supported on this element."; |
|
50 static final String TRAIT_NOT_SUPPORTED_IN_NS_ESTR = |
|
51 "The trait is not supported in this namespace."; |
|
52 static final String GET_FLOAT_MISMATCH_ESTR = |
|
53 "Trait's computed value cannot be converted to a float."; |
|
54 static final String SET_FLOAT_MISMATCH_ESTR = |
|
55 "Trait's value cannot be specified as a float."; |
|
56 static final String GET_MATRIX_MISMATCH_ESTR = |
|
57 "Trait's computed value cannot be converted to a SVGMatrix."; |
|
58 static final String SET_MATRIX_MISMATCH_ESTR = |
|
59 "Trait's value cannot be specified as a SVGMatrix."; |
|
60 static final String GET_PATH_MISMATCH_ESTR = |
|
61 "Trait's computed value cannot be converted to a SVGPath."; |
|
62 static final String SET_PATH_MISMATCH_ESTR = |
|
63 "Trait's value cannot be specified as a SVGPath."; |
|
64 static final String GET_RECT_MISMATCH_ESTR = |
|
65 "Trait's computed value cannot be converted to a SVGRect."; |
|
66 static final String SET_RECT_MISMATCH_ESTR = |
|
67 "Trait's value cannot be specified as a SVGRect."; |
|
68 static final String GET_RGB_MISMATCH_ESTR = |
|
69 "Trait's computed value cannot be converted to a SVGRGBColor."; |
|
70 static final String SET_RGB_MISMATCH_ESTR = |
|
71 "Trait's value cannot be specified as a SVGRGBColor."; |
|
72 static final String NS_NOT_SUPPORTED_ESTR = |
|
73 "The namespace is not supported."; |
|
74 static final String GET_TRAIT_NS_STRING_MISMATCH_ESTR = |
|
75 "Trait's computed value cannot be converted to a String."; |
|
76 static final String SET_TRAIT_NS_STRING_MISMATCH_ESTR = |
|
77 "Trait's value cannot be specified as a String."; |
|
78 static final String ID_IS_NULL_ESTR = |
|
79 "The id is null."; |
|
80 static final String EXISTING_ELEM_ID_CHANGE_ESTR = |
|
81 "Existing element id cannot be changed."; |
|
82 static final String ELEM_ID_EXIST_IN_DOCUMENT_ESTR = |
|
83 "Element id already exists in the document."; |
|
84 static final String INVALID_INPUT_VALUE_ESTR = |
|
85 "The input value is an invalid value for the given trait."; |
|
86 static final String VALUE_IS_NULL_ESTR = |
|
87 "Value cannot be set to null."; |
|
88 static final String SET_READONLY_MISMATCH_ESTR = |
|
89 "Attempt to change readonly trait."; |
|
90 static final String INVALID_VALUE_ESTR = |
|
91 "The value is invalid."; |
|
92 static final String INVALID_USE_ELEMENT_ESTR = |
|
93 "The <use> element is hooked into the document tree and the the value of xlink:href is set invalid."; |
|
94 static final String CANNOT_REMOVE_NODE_ESTR = |
|
95 "Cannot remove this type of node."; |
|
96 static final String CANNOT_REMOVE_NOT_CHILD_ESTR = |
|
97 "Not a child of this node."; |
|
98 static final String CANNOT_REMOVE_NON_NULL_ID_ESTR = |
|
99 "The element being removed or one of its decendants have non-null id."; |
|
100 static final String INSERT_NODE_OF_THAT_TYPE_ESTR = |
|
101 "Cannot insert node of that type."; |
|
102 static final String APPEND_DOCUMENT_ESTR = |
|
103 "Cannot append Document elements."; |
|
104 static final String DOCUMENT_HIERARCHY_ESTR = |
|
105 "Hierarchy request error in Document."; |
|
106 static final String CHILD_IS_WRONG_TYPE_ESTR = |
|
107 "Child is wrong type (Document)."; |
|
108 static final String CHILD_BELONG_TO_DIFFERENT_DOCUMENT_ESTR = |
|
109 "Child belongs to different document."; |
|
110 static final String CHILD_NOT_FOUND_ESTR = |
|
111 "The child to insert before doesn't exist in this current node."; |
|
112 static final String INVALID_ELEMENT_ID_VALUE = |
|
113 "Invalid element id value."; |
|
114 */ |
|
115 |
40 |
116 //-------------------------------------------------- |
41 //-------------------------------------------------- |
117 // VARIABLES |
42 // VARIABLES |
118 //-------------------------------------------------- |
43 //-------------------------------------------------- |
119 protected M2GDocument iDocument; |
44 protected M2GDocument iDocument; |
765 } |
690 } |
766 String href = _getStringTrait( |
691 String href = _getStringTrait( |
767 getNativeSVGProxyHandle(), |
692 getNativeSVGProxyHandle(), |
768 ((M2GSVGElement)newChild).getHandle(), |
693 ((M2GSVGElement)newChild).getHandle(), |
769 M2GSVGConstants.AT_XLINKHREF); |
694 M2GSVGConstants.AT_XLINKHREF); |
770 // Need to call resource handler if element is elementindom, image, |
695 // call resource handler call if element is elementindom, image, |
771 // and if it has an href attribute |
696 // and if it has an href attribute |
772 if ((href != null) && |
697 if ((href != null) && |
773 (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_IMAGE) && |
698 (((M2GSVGElement)newChild).iElementTypeId == M2GSVGConstants.EL_IMAGE) && |
774 iDocument.isElementInDOM(((M2GSVGElement)newChild).getHandle())) |
699 iDocument.isElementInDOM(((M2GSVGElement)newChild).getHandle())) |
775 { |
700 { |
958 throw new DOMException( |
883 throw new DOMException( |
959 DOMException.INVALID_ACCESS_ERR, |
884 DOMException.INVALID_ACCESS_ERR, |
960 /*SF*/"The input value is an invalid value for the given trait."/*SF*/); |
885 /*SF*/"The input value is an invalid value for the given trait."/*SF*/); |
961 } |
886 } |
962 |
887 |
963 _setPathTrait( getNativeSVGProxyHandle(), |
888 _setPathTrait(getNativeSVGProxyHandle(), |
964 getHandle(), id, ((M2GSVGPath)path).getHandle()); |
889 getHandle(), id, ((M2GSVGPath)path).getHandle()); |
965 |
890 |
966 // inform observer about changes in DOM only if element is in DOM |
891 // inform observer about changes in DOM only if element is in DOM |
967 iDocument.notifyDOMChangeObserver(iNativeHandle); |
892 iDocument.notifyDOMChangeObserver(iNativeHandle); |
968 } |
893 } |