Alien-GvaScript

 view release on metacpan or  search on metacpan

lib/Alien/GvaScript/TreeNavigator.pod  view on Meta::CPAN


  var treeNavigator = new GvaScript.TreeNavigator(
        elem, 
        {opt1:"val1", opt2:"val2", ...}
  );

Creates the object that controls
navigation in the tree. Arguments are

=over

=item C<elem> 

the HTML element containing the
tree, or the id of that element.

=item C<options>

an optional inline object
specifying options. 

=back

The tree navigation object is returned, which may be
useful if you later want to act on the tree
programmatically (opening or closing nodes).

Unless otherwise specified, the method adds a tab
index to each label (so that the user can jump to the
next label through the C<TAB> key).
The method also registers C<onfocus>,
C<onblur>, C<onmouseover>, C<onmouseout>
and C<onclick> handlers for label elements.
Finally, as already mentioned, a new SPAN element is
automatically inserted before each label.

Available options are:

=head4 tabIndex

Which tabIndex will be assigned to node labels. If
labels should not participate in tabbing, specify a value of -1
(this is the default).

Setting C<< tabIndex >= 0 >> is especially useful for structuring
forms in treeNavigator sections : then 
the user will be able to smoothly tab from section headers
(i.e. treeNavigator labels) to form fields within these sections.

=head4 treeTabIndex

Which tabIndex will be assigned to the tree element
(if not already specified in markup).
The default is 0; specifying a higher value
would give a higher priority to the tree
navigator within the tabbing order.

Setting C<tabIndex> to a negative value means
that the tree navigator receives no focus.
In that case, the keymap created for
capturing keyboard events will be  bound globally
to the C<document> element (and therefore might
interact in unpredictable ways with other elements
capturing keys; so this is not a recommended setting). 



=head4 flashDuration

Duration (in milliseconds) of "flashing", i.e. visual feedback when a
key is pressed in a wrong context, like for example trying to open a
node which is already open; default is 200 ms.

=head4 flashColor

Color for "flashing", expressed as standard CSS color; default is red.

=head4 selectOnButtonClick

If true, clicking on a "+/-" button next to a label will not only open
or close the node, but will also select that node; default is true.

=head4 noPingOnFirstClick

If true, clicking on an unselected node will just select that node,
without firing the C<Ping> event. Since the node will then be selected,
a second clic (or a double-clic) will fire the event.

This option is C<false> by default.

=head4 selectFirstNode

If true (the default), the first node is selected and gets focus
just after constructing the tree navigator. 

=head4 createButtons

If true, creates the "+/-" buttons next to labels; default is true.

=head4 scrollingContainer

The id of the container where the tree overflows.
Default to C<tree.ownerDocument.documentElement>.

This is used for keyboard tree navigation autoscrolling.


=head4 autoScrollPercentage

Makes sure that the selected node is visible in the central area of 
its offset parent; if not, the parent is scrolled.
The percentage is the ratio between the parent height and the 
margin at which scrolling must occur (default is 20%);



=head4 keymap

A keymap object (see C<Keymap.js>). If that option is given, keyboard
handlers are pushed into that keymap; otherwise a new keymap is
created.



( run in 0.404 second using v1.01-cache-2.11-cpan-9bca49b1385 )