Visit Mozilla.org

XUL:notificationbox

From MDC

« XUL Reference home    [ Examples | Attributes | Properties | Methods | Related ]

notificationbox is used to display notifications above an element. Typically the element will be a browser, but any element may be used. The notification element is used for each notification, and will be created automatically for each item. Each notification will slide in and out as needed.

The notification box is a vertical box which may have children. The notifications appear at the top of the box. The notifications may be placed at the bottom by setting the dir attribute to reverse.

Properties
currentNotification, allNotifications, notificationsHidden
Methods
appendNotification, getNotificationWithValue, removeAllNotifications, removeCurrentNotification, removeNotification, removeTransientNotifications,

[edit] Examples

<notificationbox flex="1">
  <browser src="http://www.mozilla.org"/>
</notificationbox>

[edit] Attributes

Inherited from XUL element
align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

[edit] Properties

currentNotification
Type: notification element
The currently displayed notification element or null. This property is read-only.

allNotifications
Type: nodeList
NodeList of all notifications. This property is read-only.

notificationsHidden
Type: boolean
Indicating whether the notification area should be hidden.

[edit] Methods

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener, appendChild, dispatchEvent, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeEventListener, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS

appendNotification( label , value , image , priority , buttons )
Return type: element
Create a new notification and display it. If another notification is already present with a higher priority, the new notification will be added behind it.
  • label - label to appear on the notification
  • value - value used to identify the notification
  • image - URL of image to appear on the notification
  • priority - notification priority, see Priority Levels.
  • buttons - array of button descriptions to appear on the notification.
Priority Levels :
  • PRIORITY_INFO_LOW
  • PRIORITY_INFO_MEDIUM
  • PRIORITY_INFO_HIGH
  • PRIORITY_WARNING_LOW
  • PRIORITY_WARNING_MEDIUM
  • PRIORITY_WARNING_HIGH
  • PRIORITY_CRITICAL_LOW
  • PRIORITY_CRITICAL_MEDIUM
  • PRIORITY_CRITICAL_HIGH
  • PRIORITY_CRITICAL_BLOCK
Buttons :
The buttons argument is an array of button descriptions. Each description is an object with the following properties:
  • accessKey - the accesskey to appear on the button
  • callback - function to be called when the button is activated. This function is passed two arguments:
    • the <notification> the button is associated with
    • the button description as passed to appendNotification.
  • label - the label to appear on the button
  • popup - the id of a popup for the button. If null, the button is a button popup.

getNotificationWithValue( value )
Return type: notification element
Retrieve the notification with a particular value. The value is specified when adding the notification with appendNotification. If no matching value is found, returns null.

removeAllNotifications( immediate )
Return type: none
Remove all notifications. If immediate is true, the messages are removed immediately. If immediate is false, the notifications are removed using a slide transition.

removeCurrentNotification
Return type: none
Remove the current notification.

removeNotification( item )
Return type: element
Remove a notification, displaying the next one if the removed item is the current one.

removeTransientNotifications( )
Return type: none
Remove only those notifications that have a persistence value of zero, and decrements by one the persistence value of those that have a non-zero value.

[edit] Related

Elements
notification