Preface
Copy/Paste with multiselection in trees isn't simple. How it should work for Molybdenum is described in this document.
The user can select any arbitrary set of nodes (tests, commands, bricks, etc.) in the tree. The selection hasn't got to be continuous, neither
all children of a node have to be selected if the parent node is selected.
The Mission
Whatever the user is doing, it has to end up in a senseful result, without popups telling the user that
this or that is not possible in this or that situation.
Basic Principles
Operations:
cut is realized as a sequence of copy/remove, so we end up with three basic operations.
Source and Target:
Clipboard operations are realized as local operations currently. It is not possible to share data with other applications
over the clipboard.
Two trees can be source and target:
- The suite tree
- brick repository (repo) tree.
So we have 4 cases:
- from suite to suite
- from suite to repo
- from repo to repo
- from repo to suite
For some of this cases exceptions have to be applied. We will discuss this later.
Semantics
Copy has to be dome
that way, the semantics of remove/paste can be fulfilled.
Remove is easy
Every node selected has to be removed. Of course, if a parent node is selected, all children have to be removed as well.
Exception: Commands inside bricks in the suite tree are read only. For the remove operation, selected commands inside bricks
in the suite tree are ignored.
Paste is not easy
Modes
Paste will be done in two modes:
- hierarchical paste (common case)
- flat paste
The user can choose paste mode the GUI.
Target Position
It will be pasted after the selected node always. Seen from tree point of view this means: after a node or inside a node
as children.
There is no possibility to paste before a selected node currently. There is one case only where this is a problem:
it cannot be pasted before the very first node of the tree. This should be solved by introducing a read-only but selectable root node in both trees.
Flat Paste
Means: paste all commands after the selected node, regardless of possibly existing container nodes. If a test node in a suite is selected or a
brick node in the repo, the commands are pasted before the existing child nodes of the selected node.
It is not possible to copy commands inside a brick of a suite.
Hierarchical Paste
Hierarchical Paste tries to retain the tree structure for a paste. A hierarchical paste will always insert the nodes after the selected
node, never inside the selected node.
During the copy operation, the path to root will be stored as well. This allows us to construct a container for pasting, even if the container
itself was not selected during the copy operation.
Metadata Handling
Metadata are data like state, breakpoints, execution time, tags of tests and brick references.
| data |
action |
| state |
lost |
| breakpoints |
lost |
| execution time |
lost |
| tags |
copied |
| brick reference |
copied |
Postconditions
Any change in the brick repo tree has to be reflected by the suite currently loaded. This can be done by
re-resolving the bricks in the suite.
Random Thoughts
The current semantics is hardly relying on the tree structure with 2 levels only. Otherwise the semantics will not be unique
and intuitive. Why? ...