javauis/nokiauiapi_qt/javasrc/com/nokia/mid/ui/SoftNotification.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:10:53 +0300
changeset 79 2f468c1958d0
child 78 71ad690e91f5
permissions -rw-r--r--
Revision: v2.2.15 Kit: 201039
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
79
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
package com.nokia.mid.ui;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
/**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
 * <p>The <code>SoftNotification</code> is a class to manage soft
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
 * notifications. Soft notifications are reminders that inform the user of events
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
 * that have occurred in the user's absence, or while the user was busy with some
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
 * application. Text, and also graphics, can be used to communicate the message
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
 * to the user. Soft notifications are displayed as pop-ups in device home screen
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
 * (idle view).
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
 * Soft notifications are persistent and restarting the device does not delete
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
 * created soft notifications from the home screen.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
 * <p>The user can respond to the soft notification by using the softkeys. The
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
 * softkey 1 is used for activating a function, for example opening a message
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
 * that has arrived. Application that created the soft notification will be activated
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
 * when the soft notification is accepted by the user. The softkey 2 is used to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
 * discard the notification without taking any further action.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
 * <p>The application that launched a soft notification can control it and also
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
 * discard it. It is possible to use the Applications key during a soft
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
 * notification; in that case, the soft notification disappears, but reappears
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
 * when the user returns to the device home screen, unless the application
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
 * responsible for the notification has discarded it.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
 * <h3>Grouping soft notifications</h3>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
 * <p>Soft notifications can be displayed for the user in two different appearances:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
 * <li> <b>Ungrouped</b> soft notification (left figure): These notifications
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
 * contain one piece of information each. In ungrouped soft notification there can
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
 * be one or two lines of text and an image visible.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
 * Ungrouped appearance is used when there's
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
 * only one active soft notification or the topmost soft notification does not
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
 * support grouping.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
 * <li> <b>Grouped</b> soft notification (right figure): If there are several
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
 * soft notifications on the screen and they support grouping, the notifications
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
 * are grouped and shown as a list of notifications.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
 * Only one line of text is shown per a notification and there are no images visible.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
 * The user can pick up one notification at a time and react
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
 * to it. If user discards the notification group, then all the shown notifications
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
 * are discarded and are not to be shown again.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
 * <p><img src="images/ungrouped.jpg" alt="Image of ungrouped soft notification.">
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
 * <img src="images/grouped.jpg" alt="Image of grouped soft notification."></p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
 * <p>Soft notifications created through this API may be grouped with other
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
 * platform notifications if all of them supports grouping. A soft notification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
 * supports grouping if <code>groupText</code> is given in
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
 * {@link #setText(String text, String groupText)}</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
 * <h3>Persistent notifications</h3>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
 * <p>Soft notifications are persistent meaning that when an application
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
 * has created a notification and set it to the home screen, the notification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
 * exists in the home screen until:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
 * <li>User accepts the notification,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
 * <li>User dismisses the notification, or
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
 * <li>Application removes the notification</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
 * <p>A soft notification stays on the device home screen even if the application
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
 * is closed or the device is restarted.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
 * <p>Accepting (selecting) a soft notification created by an application causes
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
 * this application to be activated in the following ways:
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
 * <li>If the application was running on the background, it will be set to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
 * the foreground.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
 * <li>If the application was running and had registered a listener
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
 * for the notification,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
 * {@link SoftNotificationListener#notificationSelected(SoftNotification)}
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
 * is called.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
 * <li>If the application is not running, it will be started and set to the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
 * foreground.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
 * <p><b>Notice</b> that accepting a notification belonging to a closed application
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
 * causes only the application to be started but does not
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
 * generate any listener events for the application. This is because there cannot
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
 * be any listeners registered by the closed application.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
 * Thus, when an application is started by a notification, the application has
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
 * to decide which view is shown for the user without having the information about
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
 * the selected notification.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
 * <p>Dismissing a soft notification does not bring the application to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
 * the foreground or start the application neither. However, if a
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
 * listener has been set,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
 * {@link SoftNotificationListener#notificationDismissed(SoftNotification)}
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
 * is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
 * <p>Because soft notifications are persistent, they will remain on the home screen
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
 * even if the application is closed. It is possible to get access to these
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
 * notifications later when the application is restarted.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
 * For accessing notifications later, the application has to store the IDs of
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
 * the notifications to a permanent memory (for example, RecordStore).
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
 * When the application is
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
 * restarted, the application may recreate those notifications by using the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
 * stored IDs.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
 * <p><b>Notice</b> that since it is possible that the user has dismissed notifications
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
 * when the application was closed, it is not possible to know whether the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
 * recreated notification still exist on the device home screen.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
 * In many cases it may be worthile to first remove all those notifications
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
 * from the screen and then add only the needed ones back to the screen.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
 * <h3>Example of usage</h3>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
 * <code style="white-space: pre">
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
 *class SoftNoteExample implements SoftNotificationListener
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
 *    {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
 *    private SoftNotification iSoftNotification;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
 *    public SoftNoteExample()
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
 *        {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
 *        iSoftNotification = SoftNotification.newInstance();
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
 *        iSoftNotification.setListener( this );
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
 *        }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
 *    public void Show1NewMail() throws SoftNotificationException
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
 *        {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
 *        // Read image e.g. from the MIDlet JAR package or filesystem
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
 *        byte[] image = readImage( "mail.png" );
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
 *        // Supports grouping since groupText is given here.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
 *        iSoftNotification.setText( "You have 1 new mail", "1 new mail" );
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
 *        iSoftNotification.setSoftkeyLabels( "Show", "Exit" );
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
 *        iSoftNotification.setImage( image );
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
 *        iSoftNotification.post();
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
 *        }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
 *    public void notificationSelected(SoftNotification notification)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
 *        {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
 *        // called when user selects the soft notification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
 *        }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
 *    public void notificationDismissed(SoftNotification notification)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
 *        {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
 *        // called when user dismisses the soft notification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
 *        }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
 *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
 *    private byte[] readImage( String aImageName )
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
 *        {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
 *        // Read image e.g. from the MIDlet JAR package or filesystem.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
 *        byte[] imageData = ...
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
 *        //...
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
 *        return imageData;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
 *        }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
 *    }</code>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
 */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
public abstract class SoftNotification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165
{
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   166
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   167
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   168
     * Hidden default constructor.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   169
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   170
     * @see #newInstance()
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   171
     * @see #newInstance(int notificationId)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   172
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   173
    protected SoftNotification()
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   174
    {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   175
    }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   176
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
     * Returns a new instance of SoftNotification class with a reference to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
     * previous soft notification instance.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
     * <p>Identification is used to access a soft notification created by another
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
     * instance of SoftNotification. If the provided identification is valid and
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
     * such soft notification exists, it can be updated and removed through
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
     * this instance. If the identification is not valid or does not exist,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
     * it will be ignored and a new soft notification is created as defined in
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
     * {@link #newInstance()}.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
     * @param notificationId Identification of previous soft notification.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   189
     * @return An instance of SoftNotification class.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
     * @see #getId()
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
    public static SoftNotification newInstance(int notificationId)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
    {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
        return new SoftNotificationImpl(notificationId);
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
    }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
     * <p>Returns a new instance of SoftNotification class. This instance's
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
     * identification will be a nonvalid negative value until
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
     * {@link #post()} is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   202
     * @return an instance of SoftNotification class.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    public static SoftNotification newInstance()
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
    {
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
        return new SoftNotificationImpl();
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
    }
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   209
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
     * <p>Get soft notification identification of this instance. Soft notifications are
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   211
     * persistent, so client should store the identification, if it wants to access the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
     * soft notification from another instance e.g. after device is restarted.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   213
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   214
     * <p><b>Notice</b> that identification might change during the lifetime of the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   215
     * instance if {@link #post()} is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   216
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   217
     * @return Soft notification identification.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   218
     * @see #newInstance(int notificationId)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   219
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   220
    public abstract int getId();
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   221
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   222
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   223
     * <p>Shows a new soft notification or updates the content of previously posted
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   224
     * notification. If the application did not specify a valid identification in
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   225
     * the notification construction,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   226
     * then new identification will be generated on first call to post(). If
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   227
     * previously posted soft notification does not exist, a new one is created
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   228
     * and a new identification will be generated. Client needs to set the attributes
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   229
     * shown in the soft notification before calling post or the default values
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   230
     * will be used. This call does not reset assigned text, image or softkeys.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   231
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   232
     * <p><b>Notice</b> that identification of the soft notification may change every
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   233
     * time the function is called. So when needed, it is recommended to ask
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   234
     * the latest id from the notification by using {@link #getId()} function.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
     * @throws SoftNotificationException Thrown if posting operation fails.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
    public abstract void post() throws SoftNotificationException;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
     * <p>Removes the posted soft notification from the device home screen. If the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
     * soft notification has not been posted or it has already been removed,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
     * this call does nothing. Remove is automatically called when
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
     * the user accepts or dismisses the soft notification.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
     * @throws SoftNotificationException Thrown if removing the note fails.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
    public abstract void remove() throws SoftNotificationException;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   249
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   250
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   251
     * <p>Sets listener for the soft notification. Listener is notified when the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   252
     * user accepts or dismisses the soft notification. Setting a new listener will
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   253
     * overwrite the previous listener. Listener can be removed by setting it to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   254
     * <code>null</code>.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   255
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
     * @param listener Listener for the soft notification.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   257
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   258
    public abstract void setListener(SoftNotificationListener listener);
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   259
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   260
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   261
     * <p>Sets the text field to be displayed in the soft notification. The
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   262
     * platform may truncate the text to a suitable size to fit into the soft
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   263
     * notification. If the text is not set before calling {@link #post()}, the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   264
     * default value "" is used. An ungrouped soft notification has multiple lines
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   265
     * for the text, but a grouped notification has only one line.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   266
     * Therefore the text assigned for a grouped notification should be
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
     * shorter. Multiple lines can be created by adding a line break
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   268
     * (character <code>'\n'</code>) inside the string.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   269
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
     * <p>A notification supports grouping if <code>groupText</code> is
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   271
     * other than <code>null</code> or an empty string (<code>""</code>).</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   272
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   273
     * <p><b>Notice</b> that the modified soft notification data is not visible for
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   274
     * the user until {@link #post()} is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   275
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   276
     * @param text A text to be displayed in the soft notification when ungrouped
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   277
     *        soft notification is shown.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   278
     * @param groupText A text be to displayed in the soft notification when there are
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   279
     *        also other notifications visible (grouped form). The notification
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   280
     *        will not support grouping if <code>null</code> or an empty string
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   281
     *        (<code>""</code>) is used.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   282
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   283
     * @throws SoftNotificationException Thrown if setting text fails.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   284
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   285
    public abstract void setText(String text, String groupText)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   286
    throws SoftNotificationException;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   287
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   288
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   289
     * <p>Sets the textual labels for the softkeys. The platform may truncate the
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   290
     * text to a suitable size to fit to the softkey labels, so a relatively
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   291
     * short texts are preferred for the labels. If labels are not provided,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   292
     * then the default softkeys will be used (Show & Exit).</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   293
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   294
     * <p>The functionalities of these softkeys remain always the same even if
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   295
     * their texts are changed. Softkey 1 (Show) opens
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   296
     * up the application and dismisses the soft notification. Softkey 2 (Exit)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   297
     * dismisses the soft notification.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   298
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   299
     * <p><b>Notice</b> that the modified soft notification data is not visible for
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   300
     * the user until {@link #post()} is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   301
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   302
     * @param softkey1Label Text for the softkey 1.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   303
     * @param softkey2Label Text for the softkey 2.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   304
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   305
     * @throws SoftNotificationException Thrown if setting softkeys fails.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   306
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   307
    public abstract void setSoftkeyLabels(String softkey1Label, String softkey2Label)
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   308
    throws SoftNotificationException;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   309
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   310
    /**
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   311
     * <p>Sets an image to be displayed in the soft notification. The image can be
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   312
     * in any format that the platform's image decoder or SVG engine is able to
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   313
     * decode (for example, JPG, GIF, PNG, and SVG (even SVGS and MBM) images may
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   314
     * be supported in the platform). Image mask is used when available. </p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   315
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   316
     * <p>The image is given as a byte array, for example the data may be read directly
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   317
     * from the file system or MIDlet JAR package.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   318
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   319
     * <p>Images will be scaled to fit in the soft notification pop-up as the image
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   320
     * area of the notification is relatively small. For saving resources in scaling,
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   321
     * the size of the image should be kept small (preferably no larger than
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   322
     * 300x300 px).</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   323
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   324
     * <p>The function can also be used for removing an already set image from
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   325
     * the soft notification. This can be done by setting <code>null</code> instead
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   326
     * of any actual image.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   327
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   328
     * <p><b>Notice</b> that the modified soft notification data is not visible for
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   329
     * the user until {@link #post()} is called.</p>
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   330
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   331
     * @param image image to be displayed in the soft notification or
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   332
     *        <code>null</code> if any existing image should be removed
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   333
     *        from the notification.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   334
     *
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   335
     * @throws SoftNotificationException Thrown if setting image fails.
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   336
     */
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   337
    public abstract void setImage(byte[] image) throws SoftNotificationException;
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   338
    
2f468c1958d0 Revision: v2.2.15
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
}