|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.microedition.m2g; |
|
20 |
|
21 import org.w3c.dom.svg.*; |
|
22 import com.nokia.mj.impl.utils.Logger; |
|
23 |
|
24 |
|
25 /** |
|
26 * This interface represents an Animation element, |
|
27 * which contains methods to control the timing of |
|
28 * animations. |
|
29 */ |
|
30 public class M2GSVGAnimationElement |
|
31 extends M2GSVGElement |
|
32 implements SVGAnimationElement |
|
33 { |
|
34 //-------------------------------------------------- |
|
35 // METHODS |
|
36 //-------------------------------------------------- |
|
37 /** |
|
38 * Constructor |
|
39 * @param aElemnetHandle - |
|
40 * @param aDocument - |
|
41 */ |
|
42 public M2GSVGAnimationElement(int aElementHandle, M2GDocument aDocument) |
|
43 { |
|
44 super(aElementHandle, aDocument); |
|
45 } |
|
46 |
|
47 /** |
|
48 * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt() |
|
49 */ |
|
50 public void beginElementAt(float offset) |
|
51 { |
|
52 _beginElementAt( |
|
53 getNativeSVGProxyHandle(), |
|
54 getDocument().getHandle(), getHandle(), offset, |
|
55 getDocument().getRootElement().getCurrentTime() ); |
|
56 } |
|
57 |
|
58 /** |
|
59 * Same as the beginElementAt with offset 0.0f |
|
60 * @see org.w3c.dom.svg.SVGAnimationElement#beginElementAt() |
|
61 */ |
|
62 public void beginElement() |
|
63 { |
|
64 beginElementAt(0.0f); |
|
65 } |
|
66 |
|
67 /** |
|
68 * @see org.w3c.dom.svg.SVGAnimationElement#endElementAt() |
|
69 */ |
|
70 public void endElementAt(float offset) |
|
71 { |
|
72 short endAttribute = _getEnumTrait( |
|
73 getNativeSVGProxyHandle(), |
|
74 getHandle(), M2GSVGConstants.AT_END ); |
|
75 // NOTE Native SVG engine checks that element is active so |
|
76 // java side doesn't have to do that |
|
77 if (endAttribute == M2GSVGConstants.ANIM_INDEFINITE) |
|
78 { |
|
79 Logger.LOG(Logger.EJavaUI, Logger.EInfo, |
|
80 "endElementAt() - Cannot stop this animation, indefinite attribute"); |
|
81 } |
|
82 else |
|
83 { |
|
84 _endElementAt( |
|
85 getNativeSVGProxyHandle(), |
|
86 getDocument().getHandle(), getHandle(), |
|
87 (offset + getDocument().getRootElement().getCurrentTime()) ); |
|
88 } |
|
89 } |
|
90 |
|
91 |
|
92 //-------------------------------------------------- |
|
93 // NATIVE METHODS |
|
94 //-------------------------------------------------- |
|
95 private native void _beginElementAt( |
|
96 int aSvgProxyHandle, int aDocumentHandle, |
|
97 int aElementHandle, float aOffset, float aCurrentTime); |
|
98 |
|
99 private native void _endElementAt( |
|
100 int aSvgProxyHandle, int aDocumentHandle, |
|
101 int aElementHandle, float aOffset); |
|
102 |
|
103 private native boolean _isActive( |
|
104 int aSvgProxyHandle, int aElementHandle); |
|
105 } |