nsIPlacesView

  • Revision slug: NsIPlacesView
  • Revision title: nsIPlacesView
  • Revision id: 138819
  • Created:
  • Creator: Ben
  • Is current revision? No
  • Comment

Revision Content

Introduction

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.

API

init

void init(ViewConfig config);

  • config The configuration options to use. Can be null.

Initializes and configures the view. If null, the default configuration options are used.

result

readonly attribute nsINavHistoryResult result;

The result being shown.

hasSelection

readonly attribute boolean hasSelection;

Whether or not there are selected items.

hasSingleSelection

readonly attribute boolean hasSingleSelection;

Whether or not a single item is selected. This is an optimization.

getSelection

nsINavHistoryResultNode[] getSelection()

  • returns 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.

getRemovableSelection

nsINavHistoryResultNode[] getRemovableSelection()

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

getCopyableSelection

nsINavHistoryResultNodep[] getCopyableSelection()

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

This removes items that cannot be copied, e.g. folders, special queries, etc that have no paste-able representation.

selectedNode

readonly attribute nsINavHistoryResultNode selectedNode

The selected (current/pivot) node in the view.

selectedURINode

readonly attribute nsINavHistoryResultNode selectedURINode

The selected (current/pivot) node in the view that is a leaf item. null if the pivot is not a URI (XXXben - is this necessary?)

insertionPoint

readonly attribute InsertionPoint insertionPoint

The InsertionPoint where new items will be inserted upon drop/paste/creation.

firstDropIndex

attribute long firstDropIndex

The first index within the list where items can be inserted. Used to create a "readonly"/"special" at the top of the list. (XXXben - this is a model thing and should ideally not be configured by the views)

supportedDropTypes

attribute long supportedDropTypes

The set of MIME types that can be dropped at the top level within this view. See Places:View Configuration for more information.

supportedDropOnTypes

attribute long supportedDropOnTypes

The set of MIME types that can be dropped into containers at the top level of this view. See Places:View Configuration for more information.

excludeQueries

attribute boolean excludeQueries

Whether or not place: queries should be excluded from the display. See Places:View Configuration for more information.

dropOnFilterOptions

attribute long dropOnFilterOptions

selectAll

void selectAll();

Selects the contents of the view.

Revision Source

<h2 name="Introduction"> Introduction </h2>
<p>The PlacesView interface provides a View agnostic way to access information about a Places View. 
</p><p>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. 
</p><p>The PlacesView interface also provides methods for initialization etc. 
</p>
<h3 name="API"> API </h3>
<h4 name="init"> init </h4>
<p><code>void init(ViewConfig config);</code>
</p>
<ul><li> <b>config</b> The configuration options to use. Can be null. 
</li></ul>
<p>Initializes and configures the view. If null, the default configuration options are used. 
</p>
<h4 name="result"> result </h4>
<p><code>readonly attribute nsINavHistoryResult result;</code>
</p><p>The result being shown.
</p>
<h4 name="hasSelection"> hasSelection </h4>
<p><code>readonly attribute boolean hasSelection;</code>
</p><p>Whether or not there are selected items.
</p>
<h4 name="hasSingleSelection"> hasSingleSelection </h4>
<p><code>readonly attribute boolean hasSingleSelection;</code>
</p><p>Whether or not a single item is selected. This is an optimization. 
</p>
<h4 name="getSelection"> getSelection </h4>
<p><code>nsINavHistoryResultNode[] getSelection()</code>
</p>
<ul><li> <b>returns</b> An array of result nodes that are selected
</li></ul>
<p>The nodes are not necessarily consecutive in terms of the model, or in the same container or from the same provider.
</p>
<h4 name="getRemovableSelection"> getRemovableSelection </h4>
<p><code>nsINavHistoryResultNode[] getRemovableSelection()</code>
</p>
<ul><li> <b>returns</b> An array of result nodes that are selected, and can be removed.
</li></ul>
<h4 name="getCopyableSelection"> getCopyableSelection </h4>
<p><code>nsINavHistoryResultNodep[] getCopyableSelection()</code>
</p>
<ul><li> <b>returns</b> An array of result nodes that can be copied to the clipboard for pasting elsewhere.
</li></ul>
<p>This removes items that cannot be copied, e.g. folders, special queries, etc that have no paste-able representation.
</p>
<h4 name="selectedNode"> selectedNode </h4>
<p><code>readonly attribute nsINavHistoryResultNode selectedNode</code>
</p><p>The selected (current/pivot) node in the view. 
</p>
<h4 name="selectedURINode"> selectedURINode </h4>
<p><code>readonly attribute nsINavHistoryResultNode selectedURINode</code>
</p><p>The selected (current/pivot) node in the view that is a leaf item. null if the pivot is not a URI (XXXben - is this necessary?)
</p>
<h4 name="insertionPoint"> insertionPoint </h4>
<p><code>readonly attribute InsertionPoint insertionPoint</code>
</p><p>The InsertionPoint where new items will be inserted upon drop/paste/creation.
</p>
<h4 name="firstDropIndex"> firstDropIndex </h4>
<p><code>attribute long firstDropIndex</code>
</p><p>The first index within the list where items can be inserted. Used to create a "readonly"/"special" at the top of the list. (XXXben - this is a model thing and should ideally not be configured by the views)
</p>
<h4 name="supportedDropTypes"> supportedDropTypes </h4>
<p><code>attribute long supportedDropTypes</code>
</p><p>The set of MIME types that can be dropped at the top level within this view. See <a href="en/Places/View_Configuration">Places:View Configuration</a> for more information.
</p>
<h4 name="supportedDropOnTypes"> supportedDropOnTypes </h4>
<p><code>attribute long supportedDropOnTypes</code>
</p><p>The set of MIME types that can be dropped into containers at the top level of this view. See <a href="en/Places/View_Configuration">Places:View Configuration</a> for more information.
</p>
<h4 name="excludeQueries"> excludeQueries </h4>
<p><code>attribute boolean excludeQueries</code>
</p><p>Whether or not place: queries should be excluded from the display. See <a href="en/Places/View_Configuration">Places:View Configuration</a> for more information.
</p>
<h4 name="dropOnFilterOptions"> dropOnFilterOptions </h4>
<p><code>attribute long dropOnFilterOptions</code>
</p>
<h4 name="selectAll"> selectAll </h4>
<p><code>void selectAll();</code>
</p><p>Selects the contents of the view.
</p>
Revert to this revision