|
1 /* |
|
2 * Copyright (c) 2002 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: This class is an implementation of control |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.microedition.media.control; |
|
19 |
|
20 import javax.microedition.media.Player; |
|
21 |
|
22 public class ControlImpl implements javax.microedition.media.Control |
|
23 { |
|
24 protected Player iPlayer; |
|
25 protected int iControlHandle; |
|
26 protected int iEventSource; |
|
27 |
|
28 /** |
|
29 * Constructor |
|
30 */ |
|
31 public ControlImpl() |
|
32 { |
|
33 } |
|
34 |
|
35 /** |
|
36 * Called when the Player is disposed |
|
37 */ |
|
38 public void notifyDispose() |
|
39 { |
|
40 } |
|
41 |
|
42 /** |
|
43 * Set handles |
|
44 * @param aPlayer Player instance |
|
45 * @param aEventSource Handle to event source |
|
46 * @param aControlHandle Handle Handle to control |
|
47 */ |
|
48 public void setHandles(Player aPlayer, |
|
49 int aEventSource, |
|
50 int aControlHandle) |
|
51 { |
|
52 iPlayer = aPlayer; |
|
53 iEventSource = aEventSource; |
|
54 iControlHandle = aControlHandle; |
|
55 |
|
56 _setHandle(aEventSource, aControlHandle, this); |
|
57 } |
|
58 |
|
59 /** |
|
60 * Throws IllegalStateException if player is closed and control |
|
61 * cannot be used anymore. |
|
62 * @throws IllegalStateException if Player is closed. |
|
63 */ |
|
64 protected void checkState() |
|
65 { |
|
66 if (iPlayer.getState() == Player.CLOSED) |
|
67 { |
|
68 throw new IllegalStateException("Player is CLOSED."); |
|
69 } |
|
70 } |
|
71 |
|
72 private static native void _setHandle(int aEventSourceHandle, |
|
73 int aControlHandle, |
|
74 Object aControl); |
|
75 } |