> I'd be interested in seeing an example of an application where views
need to move.
I have as part of my application a tree structure.
Just like in classic filesystem where you have folders and files
(although my nodes represent programs and program groups)
And I was about to implement a basic moving and copying of nodes under
folders by drag and drop.
Now the basic way to implement a tree is to create a structure like
<view name="root">
<view name="branch1">
<view name="branch1.2">
<view name="leaf1.2.1/>
<view name="leaf1.2.2/>
...
</view>
</view>
<view name="branch2">
...
</view>
...
</view>
So moving these nodes around would naturally be implemented by moving
the views around.
Now this can be done by destroying the old ones and creating the old
ones but then I would have to copy all properties
of the old views to new ones. Attributes are easy, but if some other
nodes/views have delegates listening to their events
that is a quite different ballgame. In a big application with complex
links ... a practical impossibility.
For now I will try a different strategy with my tree like the following:
The tree is presented to laszlo object model like this
<view name="root">
<view name="branch1" parent="root"/>
<view name="branch1.2" parent="branch1">
<view name="leaf1.2.1" parent="branch1.2"/>
<view name="leaf1.2.2" parent="branch1.2"/>
<view name="branch2" parent="root">
...
</view>
So all nodes are siblings that have enough of relatioship information
for a treelayout to lay them out visually in a tree.
And moving is just a matter of updating those attributes. So no
structural changes needed from laszlo's point of view.
I'll report if that works out well.
I quess if moving of nodes is to be implemented in laszlo one thing that
nodes should have (internally) is a unique non-changing id
that is used always to make relationships between nodes. Then structural
changes would not affect the links because they are based on a
non-changing id.
- rami