Visit Mozilla.org

The PlacesView interface

From MDC


The PlacesView interface provides a View agnostic way to access information about a Places View.

For example, the representation of selection differs between trees, menus and other such lists. The Controller should not be concerned with these details - there should not be much code there to decode the meaning of the selection depending on what View the user is performing actions on. Rather, each View is responsible for translating its own selection format into one the Controller can understand. The Views do this by implementing the PlacesView interface.

The PlacesView interface also provides methods for initialization etc.

Note: This interface does not exist in IDL at the moment. It's currently implemented in each of the widgets (menu, toolbar, tree).

Contents

[edit] Method overview

void init(ViewConfig config);
nsINavHistoryResultNode[] getSelection();
nsINavHistoryResultNode[] getRemovableSelection();
nsINavHistoryResultNode[] getCopyableSelection();
void selectAll();

[edit] Attributes

Attribute Type Description
dropOnFilterOptions long The filtering options to use when dropping items into containers at the top level of the view; read only.
excludeQueries boolean Whether or not to exclude place: queries from the display; read only.
firstDropIndex long The first index within the list at which items can be inserted. This is used to create a read-only or special area at the top of the list, and is generally used as part of the design model and should not be configured by the views; read only.
hasSelection boolean Whether or not there are selected items. Read only.
hasSingleSelection boolean Whether or not a single item is selected. Read only.
insertionPoint InsertionPoint The InsertionPoint at which new items will be inserted upon drop, paste, or creation; read only.
result nsINavHistoryResult The result being shown by the view; read only.
selectedNode nsINavHistoryResultNode The selected node in the view; if there are multiple selected nodes, this is the "pivot" node, from which the selection began. Read only.
selectedURINode nsINavHistoryResultNode The selected leaf item node in the view; if there are multiple selected nodes, this is the "pivot" node, from which the selection began. This value is null if the pivot is not a URI. Read only.
supportedDropOnTypes long The set of MIME types that can be dropped into containers at the top level of this view; read only. See Places:View Configuration for details.

[edit] Methods

[edit] init()

Initializes and configures the view.

void init(
  ViewConfig config
);
[edit] Parameters
config
The configuration options to use. If null, the default configuration options are used.

[edit] getCopyableSelection()

Returns a list of the selected items that can be copied, by excluding items such as folders and special queries that have no pasteable representation.

nsINavHistoryResultNode[] getCopyableSelection();
[edit] Parameters

None.

[edit] Return value

An array of result nodes that can be copied to the clipboard for pasting elsewhere.

[edit] getRemovableSelection()

Returns a list of the selected items that can be removed by excluding those that are read only.

nsINavHistoryResultNode[] getRemovableSelection();
[edit] Parameters

None.

[edit] Return value

An array of result nodes that are selected and can be removed.

[edit] getSelection()

Returns a list of all currently-selected items.

nsINavHistoryResultNode[] getSelection();
[edit] Parameters

None.

[edit] Return value

An array of result nodes that are selected

The nodes are not necessarily consecutive in terms of the model, or in the same container or from the same provider.

[edit] selectAll()

Selects the contents of the view.

void selectAll();
[edit] Parameters

None.

[edit] See also