Visit Mozilla.org

nsINavHistoryResultViewer

From MDC

This article covers features introduced in Firefox 3

The nsINavHistoryResultViewer interface lets clients observe changes taking place on a query result as it updates itself as history and bookmark system events take place. Use the registerView() method to register this observer on a result.

Contents

nsINavHistoryResultViewer is defined in toolkit/components/places/public/nsINavHistoryService.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

[edit] Method overview

void addViewObserver(in nsINavHistoryResultViewObserver observer, in boolean ownsWeak);
void itemInserted(in nsINavHistoryContainerResultNode parent, in nsINavHistoryResultNode item, in unsigned long newIndex);
void itemRemoved(in nsINavHistoryContainerResultNode parent, in nsINavHistoryResultNode item, in unsigned long oldIndex);
void itemChanged(in nsINavHistoryResultNode item);
void itemReplaced(in nsINavHistoryContainerResultNode parent, in nsINavHistoryResultNode oldItem, in nsINavHistoryResultNode newItem, in unsigned long index);
void containerOpened(in nsINavHistoryContainerResultNode item);
void containerClosed(in nsINavHistoryContainerResultNode item);
void invalidateContainer(in nsINavHistoryContainerResultNode item);
void invalidateAll();
void removeViewObserver(in nsINavHistoryResultViewObserver observer);
void sortingChanged(in unsigned short sortingMode);

[edit] Attributes

Attribute Type Description
result nsINavHistoryResult The nsINavHistoryResult this viewer monitors. Although this attribute is read-write, you should not alter it directly; instead, use the nsINavHistoryResult.viewer attribute to set the viewer.

[edit] Methods

[edit] addViewObserver()

Adds the specified view observer to the view.

 void addViewObserver(
   in nsINavHistoryResultViewObserver observer,
   in boolean ownsWeak
 );
[edit] Parameters
observer
The nsINavHistoryResultViewObserver that will observe the view.
ownsWeak
If true, the observer must implement the nsISupportsWeakReference interface, and the result holds a weak reference to the observer.

[edit] containerClosed()

Called when a container node's state changes from closed to opened.

 void containerClosed(
   in nsINavHistoryContainerResultNode item
 );
[edit] Parameters
item
The container node whose state changed.

[edit] containerOpened()

Called when a container node's state changes from closed to opened.

 void containerOpened(
   in nsINavHistoryContainerResultNode item
 );
[edit] Parameters
item
The container node whose state changed.

[edit] itemInserted()

Called when an item is inserted into a container.

 void itemInserted(
   in nsINavHistoryContainerResultNode parent,
   in nsINavHistoryResultNode item,
   in unsigned long newIndex
 );
[edit] Parameters
parent
The container into which to insert the item.
item
The item to insert into the container; it may be either a leaf or another container.
newIndex
The index at which to insert the item.
[edit] Remarks

The item previously at the specified index (if any) as well as everything below it, is shifted down by one.

[edit] itemRemoved()

Called when an item is removed from a container.

 void itemRemoved(
   in nsINavHistoryContainerResultNode parent,
   in nsINavHistoryResultNode item,
   in unsigned long oldIndex
 );
[edit] Parameters
parent
The container from which the item was removed.
item
The item that was removed from the container. It may be either a container or a leaf.
oldIndex
The index from which the item was removed.
[edit] Remarks

This method is called after the item has been removed from the parent, but before any other action is taken (including zeroing out the item's parent reference).

[edit] itemChanged()

Called when an item has been changed and should be repainted.

 void itemChanged(
   in nsINavHistoryResultNode item
 );
[edit] Parameters
item
The item in need of repainting. If this item is a container, you only need to repaint the container itself (for example, disclosure triangles may need to be refreshed if their states have changed); its children will generate separate messages as appropriate.

[edit] itemReplaced()

Called when an item is being replaced with another item at the same location.

 void itemReplaced(in nsINavHistoryContainerResultNode parent,
   in nsINavHistoryResultNode oldItem,
   in nsINavHistoryResultNode newItem,
   in unsigned long index
 );
[edit] Parameters
parent
The container in which the item is being replaced.
oldItem
The item being replaced.
newItem
The item replacing the oldItem.
index
The index at which the item is located in the container.

[edit] invalidateAll()

Called when something has happened that requires that everything in the view be recomputed. For example, changing the sort order or changing collapse duplicates can affect all rows.

 void invalidateAll();
[edit] Parameters

None.

[edit] invalidateContainer()

Called when something has happened that requires that the contents of a container be rebuilt.

 void invalidateContainer(in nsINavHistoryContainerResultNode item);
[edit] Parameters
item
The container that should be rebuilt.

[edit] removeViewObserver()

Removes the specified view observer from this view. The observer must previously have been registered using the #addViewObserver() method.

 void removeViewObserver(
   in nsINavHistoryResultViewObserver observer
 );
[edit] Parameters
observer
The <code>nsINavHistoryResultViewObserverthat is to stop observing the view.

[edit] sortingChanged()

Called when the sorting order is changed to a particular mode. For trees, this would update the column headers to reflect the altered sorting.

 void sortingChanged(
   in unsigned short sortingMode
 );
[edit] Parameters
sortingMode
One of the nsINavHistoryQueryOptions.SORT_BY_* constants, indicating the softing mode.
[edit] Remarks

This method is only called to update the sorting user interface. [#invalidateAll()] is called as well if the sorting changes, in order to cause the contents to update properly.

[edit] Remarks

Remember, this isn't a real interface. This is where you would provide additional information about the interface as necessary.

[edit] See also

nsINavHistoryResult, nsITreeView