mozilla

Revision 138842 of nsIPlacesView

  • Revision slug: NsIPlacesView
  • Revision title: nsIPlacesView
  • Revision id: 138842
  • Created:
  • Creator: adw
  • Is current revision? No
  • Comment no wording changes

Revision Content

 {{ Outdated() }}

The nsIPlacesView 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.  Controllers should not be concerned with these details; controller code should not be required to decode the meaning of a selection depending on what kind of view produced the selection.  Rather, each view is responsible for translating its own selection format into one the controller can understand.  Views do this, and other things, by implementing the nsIPlacesView interface.

{{ Note("This interface does not exist in IDL at the moment.  It's currently implemented directly on each of the built-in Places views.") }}

Method overview

nsINavHistoryResultNode[] getDragableSelection();
nsINavHistoryResultNode[][] getRemovableSelectionRanges();
nsINavHistoryResult getResult();
nsINavHistoryContainerResultNode getResultNode();
nsINavHistoryResultNode[] getSelectionNodes();
void selectAll();

Attributes

Attribute Type Description
hasSelection boolean Whether or not there are selected items.  Read only.
insertionPoint InsertionPoint The InsertionPoint at which new items will be inserted upon drop, paste, or creation.  Read only.
place string The URI (as a string) of the Place that the view displays.  This may be modified dynamically to update the view.  See Displaying Places information using views for examples.
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.

Methods

getDragableSelection()

Returns an array of selected {{ Interface("nsINavHistoryResultNode") }} objects that can be dragged from the view.

nsINavHistoryResultNode[] getDragableSelection();
Parameters

None.

Return value

An array of nsINavHistoryResultNode objects.

getRemovableSelectionRanges()

Returns an array whose elements are themselves arrays of {{ Interface("nsINavHistoryResultNode") }} objects that can be removed from the view.  Each inner array represents a contiguous range of nodes that can be removed.

nsINavHistoryResultNode[][] getRemovableSelectionRanges();
Parameters

None.

Return value

An array of arrays of nsINavHistoryResultNode objects.

getResult()

Returns the {{ Interface("nsINavHistoryResult") }} object that the view displays.

nsINavHistoryResult getResult();
Parameters

None.

Return value

The nsINavHistoryResult object that the view displays.

getResultNode()

Returns the root node, an {{ Interface("nsINavHistoryContainerResultNode") }} object, of the view's result.

nsINavHistoryContainerResultNode getResultNode();
Paramters

None.

Return value

The root nsINavHistoryContainerResultNode of the view's result.

getSelectionNodes()

Returns an array of all currently selected {{ Interface("nsINavHistoryResultNode") }} objects of the view.  The nodes are not necessarily returned in the same order in which they occur in the model, or in the same container, or from the same provider.

nsINavHistoryResultNode getSelectionNodes();
Parameters

None.

Return value

An array of nsINavHistoryResultNode objects that are selected.

selectAll()

Selects all the nodes displayed in the view.

void selectAll();
Parameters

None.

See also

Revision Source

<p> {{ Outdated() }}</p>
<p>The <code>nsIPlacesView</code> interface provides a view-agnostic way to access information about a <a class="internal" href="/en/Displaying_Places_information_using_views" title="En/Displaying Places information using views">Places view</a>.</p>
<p>For example, the representation of selection differs between trees, menus, and other such lists.  Controllers should not be concerned with these details; controller code should not be required to decode the meaning of a selection depending on what kind of view produced the selection.  Rather, each view is responsible for translating its own selection format into one the controller can understand.  Views do this, and other things, by implementing the <code>nsIPlacesView</code> interface.</p>
<p>{{ Note("This interface does not exist in IDL at the moment.  It's currently implemented directly on each of the <a class="internal" href="/en/Displaying_Places_information_using_views" title="En/Displaying Places information using views">built-in Places views</a>.") }}</p>
<h2 name="Method_overview">Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>nsINavHistoryResultNode[] </code><a href="#getDragableSelection()"><code>getDragableSelection</code></a><code>();</code></td> </tr> <tr> <td><code>nsINavHistoryResultNode[][</code><code>] </code><a href="#getRemovableSelectionRanges()"><code>getRemovableSelectionRanges</code></a><code>();</code></td> </tr> <tr> <td><code>nsINavHistoryResult </code><a href="#getResult()"><code>getResult</code></a><code>();</code></td> </tr> <tr> <td><code>nsINavHistoryContainerResultNode </code><a href="#getResultNode()"><code>getResultNode</code></a><code>();</code></td> </tr> <tr> <td><code>nsINavHistoryResultNode[] </code><a href="#getSelectionNodes()"><code>getSelectionNodes</code></a><code>();</code></td> </tr> <tr> <td><code>void <a href="#selectAll.28.29">selectAll</a>();</code></td> </tr> </tbody>
</table><h2 name="Attributes">Attributes</h2>
<table class="standard-table"> <tbody> <tr> <td class="header">Attribute</td> <td class="header">Type</td> <td class="header">Description</td> </tr> <tr> <td><code>hasSelection</code></td> <td><code>boolean</code></td> <td>Whether or not there are selected items.  <em>Read only.</em></td> </tr> <tr> <td><code>insertionPoint</code></td> <td><code><a href="/en/InsertionPoint" title="en/InsertionPoint">InsertionPoint</a></code></td> <td>The <code>InsertionPoint</code> at which new items will be inserted upon drop, paste, or creation.  <span style="font-style: italic;">R</span><em>ead only</em>.</td> </tr> <tr> <td><code>place</code></td> <td><code>string</code></td> <td>The URI (as a string) of the Place that the view displays.  This may be modified dynamically to update the view.  See <a class="internal" href="/en/Displaying_Places_information_using_views#Connecting_a_view_to_its_data" title="en/Displaying Places information using views#Connecting a view to its data">Displaying Places information using views</a> for examples.</td> </tr> <tr> <td><code>selectedNode</code></td> <td><code><a href="/en/nsINavHistoryResultNode" title="en/nsINavHistoryResultNode">nsINavHistoryResultNode</a></code></td> <td>The selected node in the view.  If there are multiple selected nodes, this is the "pivot" node from which the selection began.  <em>Read only.</em></td> </tr> </tbody>
</table><h2 name="Methods">Methods</h2>
<h3 name="init.28.29">getDragableSelection()</h3>
<p>Returns an array of selected {{ Interface("nsINavHistoryResultNode") }} objects that can be dragged from the view.</p>
<pre class="eval">nsINavHistoryResultNode[] getDragableSelection();
</pre>
<h6 name="Parameters">Parameters</h6>
<p>None.</p>
<h6>Return value</h6>
<p>An array of <code>nsINavHistoryResultNode</code> objects.</p>
<h3 name="getRemovableSelection.28.29">getRemovableSelectionRanges()</h3>
<p>Returns an array whose elements are themselves arrays of {{ Interface("nsINavHistoryResultNode") }} objects that can be removed from the view.  Each inner array represents a contiguous range of nodes that can be removed.</p>
<pre class="eval">nsINavHistoryResultNode[][] getRemovableSelectionRanges();
</pre>
<h6 name="Parameters_3">Parameters</h6>
<p>None.</p>
<h6 name="Return_value_2">Return value</h6>
<p>An array of arrays of <code>nsINavHistoryResultNode</code> objects.</p><h3>getResult()</h3>
<p>Returns the {{ Interface("nsINavHistoryResult") }} object that the view displays.</p>
<pre>nsINavHistoryResult getResult();
</pre>
<h6>Parameters</h6>
<p>None.</p>
<h6>Return value</h6>
<p>The <code>nsINavHistoryResult</code> object that the view displays.</p>
<h3>getResultNode()</h3>
<p>Returns the root node, an {{ Interface("nsINavHistoryContainerResultNode") }} object, of the view's result.</p>
<pre>nsINavHistoryContainerResultNode getResultNode();
</pre>
<h6>Paramters</h6>
<p>None.</p>
<h6>Return value</h6>
<p>The root <code>nsINavHistoryContainerResultNode</code> of the view's result.</p>
<h3 name="getSelection.28.29">getSelectionNodes()</h3>
<p>Returns an array of all currently selected {{ Interface("nsINavHistoryResultNode") }} objects of the view.  The nodes are not necessarily returned in the same order in which they occur in the model, or in the same container, or from the same provider.</p>
<pre class="eval">nsINavHistoryResultNode getSelectionNodes();
</pre>
<h6 name="Parameters_4">Parameters</h6>
<p>None.</p>
<h6 name="Return_value_3">Return value</h6>
<p>An array of <code>nsINavHistoryResultNode</code> objects that are selected.</p>
<h3 name="selectAll.28.29">selectAll()</h3>
<p>Selects all the nodes displayed in the view.</p>
<pre class="eval">void selectAll();
</pre>
<h6 name="Parameters_5">Parameters</h6>
<p>None.</p><h2 name="See_also">See also</h2>
<ul> <li><a href="/en/Displaying_Places_information_using_views" title="en/Displaying_Places_information_using_views">Displaying Places information using views</a></li>
</ul>
Revert to this revision