Use is subject to License Terms. Your use of this web site or any of its contents or software indicates your agreement to be bound by these License Terms.

Copyright © 2002-2006 Sun Microsystems, Inc.; Nokia Corporation. All rights reserved. See the Copyright Notice and Specification License for more details.

MMAPI 1.2

javax.microedition.media
Interface Controllable

All Known Subinterfaces:
Player, SourceStream
All Known Implementing Classes:
DataSource

public interface Controllable

Controllable provides an interface for obtaining the Controls from an object like a Player. It provides methods to query all the supported Controls and to obtain a particular Control based on its class name.


Method Summary
 Control getControl(java.lang.String controlType)
          Obtain the object that implements the specified Control interface.
 Control[] getControls()
          Obtain the collection of Controls from the object that implements this interface.
 

Method Detail

getControls

Control[] getControls()
Obtain the collection of Controls from the object that implements this interface.

Since a single object can implement multiple Control interfaces, it's necessary to check each object against different Control types. For example:

Controllable controllable;
    :
Control cs[];
cs = controllable.getControls();
for (int i = 0; i < cs.length; i++) {
    if (cs[i] instanceof ControlTypeA)
        doSomethingA();
    if (cs[i] instanceof ControlTypeB)
        doSomethingB();
    // etc.
}

The list of Control objects returned will not contain any duplicates. And the list will not change over time.

If no Control is supported, a zero length array is returned.

Returns:
the collection of Control objects.
Throws:
java.lang.IllegalStateException - Thrown if getControls is called in a wrong state. See Player and DataSource for more details.

getControl

Control getControl(java.lang.String controlType)
Obtain the object that implements the specified Control interface.

If the specified Control interface is not supported then null is returned.

If the Controllable supports multiple objects that implement the same specified Control interface, only one of them will be returned. To obtain all the Control's of that type, use the getControls method and check the list for the requested type.

Parameters:
controlType - the class name of the Control. The class name should be given either as the fully-qualified name of the class; or if the package of the class is not given, the package javax.microedition.media.control is assumed.
Returns:
the object that implements the control, or null.
Throws:
java.lang.IllegalArgumentException - Thrown if controlType is null.
java.lang.IllegalStateException - Thrown if getControl is called in a wrong state. See Player and DataSource for more details.

MMAPI 1.2

Copyright © 2002-2006 Sun Microsystems, Inc.; Nokia Corporation. All rights reserved. See the Copyright Notice and Specification License for more details.

Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 135 specification.