java-gnome version 4.0.19

org.gnome.notify
Class Notification

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.notify.Notification

public class Notification
extends Object

Notification represents an actual item to be displayed by notification system. You can simply create and display a Notification after the system is initialized with Notify.init().

Since:
4.0.12
Author:
Serkan Kaba
See Also:
Desktop Notifications Spec

Nested Class Summary
static interface Notification.Action
          Callback invoked when an added action is invoked.
static interface Notification.Closed
          Signal emmitted when a notification is closed.
 
Field Summary
static int NOTIFY_EXPIRES_DEFAULT
          Constant for default timeout duration.
static int NOTIFY_EXPIRES_NEVER
          Constant for infinite timeout duration.
 
Constructor Summary
Notification(String summary, String body, String icon)
          Create a new notification.
 
Method Summary
 void addAction(String actionID, String label, Notification.Action action)
          Add an action to a notification.
 void clearActions()
          Remove all added actions.
 void clearHints()
          Clear hints from the notification.
 void close()
          Hide the notification on screen.
 void connect(Notification.Closed handler)
          Hook up a handler to receive Notification.Closed events on this Notification.
 void setCategory(String category)
          Set the category of the notification which may later be used to display or filter out the notification.
 void setHint(String key, byte value)
          Sets a hint with a byte value.
 void setHint(String key, byte[] value)
          Sets a hint with a byte array data.
 void setHint(String key, double value)
          Sets a hint with a double value.
 void setHint(String key, int value)
          Sets a hint with an integer value.
 void setHint(String key, String value)
          Sets a hint with a string value.
 void setIcon(Pixbuf icon)
          Sets the icon of the notification from a Pixbuf.
 void setTimeout(int timeout)
          Set the timeout that the notification disappears in milliseconds.
 void setUrgency(Urgency urgency)
          Sets the urgency to one of LOW, NORMAL, or CRITICAL.
 void show()
          Display the notification on screen.
 void update(String summary, String body, String icon)
          Updates the notification with given parameters see Notification() for parameters.
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTIFY_EXPIRES_DEFAULT

public static final int NOTIFY_EXPIRES_DEFAULT
Constant for default timeout duration.

See Also:
Constant Field Values

NOTIFY_EXPIRES_NEVER

public static final int NOTIFY_EXPIRES_NEVER
Constant for infinite timeout duration.

See Also:
Constant Field Values
Constructor Detail

Notification

public Notification(String summary,
                    String body,
                    String icon)
Create a new notification.

The summary appears on the titlebar of notification and body appears as its text. Icon may be a string defining a theme icon or the filename identifying the icon that appears next to text.

Note that all but summary can be null.

Since:
4.0.19
Method Detail

addAction

public void addAction(String actionID,
                      String label,
                      Notification.Action action)
Add an action to a notification. Notification-daemon displays these as buttons.

Note that for some bizarre reason the new Notify-OSD of Ubuntu Linux does not support actions at all. To determine if notification system supports actions look for "actions" in capabilities.

Since:
4.0.12
See Also:
Notify.getServerCapabilities()

clearActions

public void clearActions()
Remove all added actions.

Since:
4.0.12

clearHints

public void clearHints()
Clear hints from the notification.

Since:
4.0.12

close

public void close()
Hide the notification on screen.

Since:
4.0.12

connect

public void connect(Notification.Closed handler)
Hook up a handler to receive Notification.Closed events on this Notification.

Since:
4.0.12

setCategory

public void setCategory(String category)
Set the category of the notification which may later be used to display or filter out the notification.
See the "Categories" section in Desktop Notifications Specification for predefined categories and their meanings.

Since:
4.0.12

setHint

public void setHint(String key,
                    byte value)
Sets a hint with a byte value.

Hints are interpreted by the notification system in various ways to modify the notification behavior and/or appearance. See the "Hints" section in Desktop Notifications Specification for standard hints and their interpretations.

Since:
4.0.12

setHint

public void setHint(String key,
                    byte[] value)
Sets a hint with a byte array data. See setHint() for further details.

Since:
4.0.12

setHint

public void setHint(String key,
                    double value)
Sets a hint with a double value. See setHint() for further details.

Since:
4.0.12

setHint

public void setHint(String key,
                    int value)
Sets a hint with an integer value. See setHint() for further details.

Example: "x" (sets the horizontal position of the notification)

Since:
4.0.12

setHint

public void setHint(String key,
                    String value)
Sets a hint with a string value. See setHint() for further details.

Example: "sound-file" (adds sound to the notification)

Since:
4.0.12

setIcon

public void setIcon(Pixbuf icon)
Sets the icon of the notification from a Pixbuf.

Since:
4.0.12

setTimeout

public void setTimeout(int timeout)
Set the timeout that the notification disappears in milliseconds. Use NOTIFY_EXPIRES_DEFAULT for the default timeout duration. Use NOTIFY_EXPIRES_NEVER for infinite timeout duration.

Since:
4.0.12

setUrgency

public void setUrgency(Urgency urgency)
Sets the urgency to one of LOW, NORMAL, or CRITICAL.

Since:
4.0.12

show

public void show()
Display the notification on screen.

Since:
4.0.12

update

public void update(String summary,
                   String body,
                   String icon)
Updates the notification with given parameters see Notification() for parameters.

Since:
4.0.12


java-gnome