com.nokia.mid.ui
Class TactileFeedback

java.lang.Object
  extended by com.nokia.mid.ui.TactileFeedback

public class TactileFeedback
extends java.lang.Object


Field Summary
static int FEEDBACK_STYLE_BASIC
          Constant for specifying basic tactile feedback style.
static int FEEDBACK_STYLE_SENSITIVE
          Constant for specifying sensitive tactile feedback style.
 
Constructor Summary
TactileFeedback()
          Constructs tactile feedback engine object.
 
Method Summary
 void directFeedback(int style)
          Triggers direct tactile feedback of the specified style.
 boolean isTouchFeedbackSupported()
          Queries the device if it supports tactile feedback.
 void moveFeedbackAreaToFirstPriority(java.lang.Object uiObject, int id)
          Moves the specified tactile feedback area to first priority.
 void registerFeedbackArea(java.lang.Object uiObject, int id, int x, int y, int width, int height, int style)
          Registers area within a UI component for tactile feedback.
 void removeFeedbackForComponent(java.lang.Object uiObject)
          Removes all tactile feedback for a UI component.
 void unregisterFeedbackArea(java.lang.Object uiObject, int id)
          Unregisters tactile feedback area within a UI component.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEEDBACK_STYLE_BASIC

public static final int FEEDBACK_STYLE_BASIC
Constant for specifying basic tactile feedback style. Actual style behaviour is set through device settings.

See Also:
Constant Field Values

FEEDBACK_STYLE_SENSITIVE

public static final int FEEDBACK_STYLE_SENSITIVE
Constant for specifying sensitive tactile feedback style. Actual style behaviour is set through device settings.

See Also:
Constant Field Values
Constructor Detail

TactileFeedback

public TactileFeedback()
Constructs tactile feedback engine object. The object may be used in both LCDUI and eSWT Java UI toolkits. TactileFeedback object must be constructed before using any tactile feedback methods.

Method Detail

directFeedback

public void directFeedback(int style)
                    throws java.lang.IllegalArgumentException
Triggers direct tactile feedback of the specified style.

Parameters:
style - The style of the direct feedback. Use predefined values FEEDBACK_STYLE_BASIC, FEEDBACK_STYLE_SENSITIVE. Actual style behavior is set through device settings.
Throws:
java.lang.IllegalArgumentException - if the style parameter has invalid type.

isTouchFeedbackSupported

public boolean isTouchFeedbackSupported()
Queries the device if it supports tactile feedback. It is safe to use this class even if the device does not support tactile feedback. Methods of this class can be called but this has no effect.

Returns:
true if the device supports tactile feedback, false otherwise.

registerFeedbackArea

public void registerFeedbackArea(java.lang.Object uiObject,
                                 int id,
                                 int x,
                                 int y,
                                 int width,
                                 int height,
                                 int style)
                          throws java.lang.IllegalArgumentException
Registers area within a UI component for tactile feedback. If areas overlap then the feedback is given from the last registered area. moveFeedbackAreaToFirstPriority can be used to bring a certain area covered by another area into action. If an area with specified id is already registered it is updated. When updating an existing area there is no need to unregister it before re-registering again with new coordinates and/or feedback style. The area specified by x, y, width and height parameters may be located on the screen just partially. In case of area registry for eSWT Control, the registry needs to be updated every time when the size or position of a UI component changes, or when e.g. a state of a UI component changes in such way that feedback type also changes. Typically the area update may be implemented in controlMoved and controlResized methods of ControlListener interface. The update of an area may be implemented by calling registerFeedbackArea with the same area id but new coordinates and/or feedback style. In case of area registry for LCDUI Canvas or CustomItem no further actions are required to update tactile feedback areas when a CustomItem is moved in a Form or when a Canvas is changed due to e.g. orientation switch.

Parameters:
uiObject - The UI component for tactile feedback registration. Valid object types are: javax.microedition.lcdui.Canvas, javax.microedition.lcdui.CustomItem, org.eclipse.swt.widgets.Control.
id - of the new tactile feedback area to be registered. Id's are used to identify particular tactile feedback area within one UI component. Id's do not need to be consecutive numbers.
x - x-coordinate of the top-left corner of tactile feedback rectangle to register.
y - y-coordinate of the top-left corner of tactile feedback rectangle to register.
width - of tactile feedback rectangle to register.
height - of tactile feedback rectangle to register.
style - of the feedback for specified area. Use predefined values FEEDBACK_STYLE_BASIC, FEEDBACK_STYLE_SENSITIVE. Actual style behaviour is defined through device settings.
Throws:
java.lang.IllegalArgumentException - if the uiObject parameter has invalid type.
java.lang.IllegalArgumentException - if the style parameter has invalid type.

unregisterFeedbackArea

public void unregisterFeedbackArea(java.lang.Object uiObject,
                                   int id)
                            throws java.lang.IllegalArgumentException
Unregisters tactile feedback area within a UI component.

Parameters:
uiObject - The UI component for tactile feedback area de-registration. Valid object types are: javax.microedition.lcdui.Canvas, javax.microedition.lcdui.CustomItem, org.eclipse.swt.widgets.Control.
id - of the tactile feedback area to be unregistered. Id's are used to identify particular tactile feedback area within one UI component. If given id was not registered by registerFeedbackArea then the call has no effect.
Throws:
java.lang.IllegalArgumentException - if the uiObject parameter has invalid type.

removeFeedbackForComponent

public void removeFeedbackForComponent(java.lang.Object uiObject)
Removes all tactile feedback for a UI component.

Parameters:
uiObject - The UI component for tactile feedback area de-registration. Valid object types are: javax.microedition.lcdui.Canvas, javax.microedition.lcdui.CustomItem, org.eclipse.swt.widgets.Control.
Throws:
java.lang.IllegalArgumentException - if the uiObject parameter has invalid type.

moveFeedbackAreaToFirstPriority

public void moveFeedbackAreaToFirstPriority(java.lang.Object uiObject,
                                            int id)
Moves the specified tactile feedback area to first priority. Priority is significant in case of overlapping tactile feedback areas. If the tactile feedback styles of registered areas are different, the feedback from first-priority area will be given.

Parameters:
uiObject - The UI component for tactile feedback area de-registration. Valid object types are: javax.microedition.lcdui.Canvas, javax.microedition.lcdui.CustomItem, org.eclipse.swt.widgets.Control.
id - of the tactile feedback area to be unregistered. Id's are used to identify particular tactile feedback area within one UI component. If given id was not registered by registerFeedbackArea then the call has no effect.
Throws:
java.lang.IllegalArgumentException - if the uiObject parameter has invalid type.


Copyright © 2012 Nokia Corporation. All rights reserved.

Nokia is registered trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Oracle Corporation. Other product and company names mentioned herein may be trademarks or trade names of their respective owners. This document is confidential information of Nokia Corporation.

Disclaimer
The information in this document is provided "as is," with no warranties whatsoever, including any warranty of merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specification, or sample. Furthermore, information provided in this document is preliminary, and may be changed substantially prior to final release.

Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to this document and implementation of any information presented in this document.

Nokia Corporation retains the right to make changes to this document at any time, without notice.

License
Subject to above disclaimer, a license is hereby granted to use this documentation solely under existing Limited License Agreement and non-disclosure agreement between the companies for the agreed application development for Series 40 Nokia phones. No other licenses e.g. to any intellectual property rights are granted herein. Any use of the screen shots of this documentation, including any icons thereof, is subject to Nokia's prior written approval.