| Did you know ... | Search Documentation: |
| Send methods |
The root of the tree may be deleted with this method. If this node
has no sons, tree<-root
will be set to @nil.
Otherwise the first son of this node will be made the new root of the
tree.
When the tree<-display_root
is deleted, it is set to the first parent of this node.
Bugs: Deleting the root of a tree that has multiple sons is not well defined.
->unlink ->delete_tree->unlink
->delete->event
is a little different from the other refinements of graphical->event
as class node is not a
subclass of graphical. It is invoked from tree->event
and allows for adding behaviour to nodes regardless of the underlying
graphicals.
The default method uses central handler
objects from the associated node<-tree:
a) If it is collapsed, run <-collapsed_handlers b) If it is a leaf, run <-leaf_handlers c) If it is the display_root, run <-root_handlers d) else, run <-node_handlers
In each of the cases a) to d), run means invoke the
following message for each of the members of the handler-chain:
`event ->post: graphical, recogniser`
If you wish to refine this method, please be aware that the normal
schema described with graphical->event
does not work for nodes. Here is a skeleton implementation:
:- pce_global(@my_node_recogniser,
make_my_node_recogniser).
make_my_node_recogniser(G) :-
...
event(Node, Ev:event) :->
( send_super(Node, event, Ev)
-> true
; send(Ev, post, Node?image,
@my_node_recogniser)
).
<-sons
of this node and finally runs code on the receiving node.
Note that multiple-inheritance will cause some nodes to be visited more than once. Argument binding:
@arg1: Node object.
See also node<-find.
NOTE: Upto version 5.0.9, the execution
order was different: code was first executed on the node and then on the node<-sons.
The current order allows for deleting nodes.
Diagnostics: Terminates immediately with failure if code could not be executed fro some node
Bugs:
node->for_all
is not safe when the executed code manipulates the subtree below this
node.
<-find ->for_some ->for_all->for_all,
but ignores the exit-status of the executed code. Succeeds always.
->for_all?- new(T, tree(new(Root, node(text(anything))))), send(Root, son, new(S0, node(text(living_thing)))), ...
<-convert->is_son->is_parentSucceeds without doing anything if the argument is already a son. Fails silently if one of the following is the case:
->sonBugs: Not well defined when the receiver node has multiple parents.
->move_after<-sons
chain. Otherwise it is added just in front of the before argument.
Diagnostics: # <Node> already in a tree Argument node is member of another tree.
-sons ->move<-nodes, just like chain->sort,
and update the hierarchy layout afterwards.Bugs: This method manipulates the images rather than the nodes as done by most of the other methods manipulating the layout of the hierarchy.
->swap_tree
<-sons
chain.<-parents
chain between both nodes->swap->delete:
removes node from the tree binding all sons to all parents of this node.
To remove an entire subtree, see node->delete_tree.
->deleteDiagnostics: Fails if node is not a direct parent or son of the argument.
->unzoom,
unzooming the tree to its root.
->zoom ->unzoom->zoom,
giving this node as the argument. This will make node the root of the
visible part of the hierarchy.
->unzoom ->zoom