Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comparison with SoftGems VirtualTreeView

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
JuhaManninen



Joined: 14 Mar 2008
Posts: 3
Location: Finland

PostPosted: Fri Mar 14, 2008 11:33 am    Post subject: Comparison with SoftGems VirtualTreeView Reply with quote

Hi,

You may be little biased on this topic but how would you compare your component with the VirtualTreeView component from SoftGems (by Mike Lischke) for Borland Delphi?
Are there any fundamental differences in the data model?
How about performance? SoftGems's VirtualTreeView is extremely fast!

Does your component internally have a tree data structure separated from the view, or are they together like in SoftGems's component? It has all the visual properties in every node.
Often I need just to scan the tree's data in a program without any UI. Then it would be nice to have those 2 things separated.
"Model - View" or how is it called ...


Regards,
Juha Manninen
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Mar 14, 2008 11:56 am    Post subject: Reply with quote

Quote:
You may be little biased on this topic but how would you compare your component with the VirtualTreeView component from SoftGems (by Mike Lischke) for Borland Delphi?


We probably are biased - but I can't really give you an opinion on comparison with the Soft Gems component, because I've never used it. We have had several customers who have used it tell us that Virtual Tree is similar in approach.

Quote:
Are there any fundamental differences in the data model?


Virtual Tree is completely data driven. Your application typically defines a hierarchical data model and you then define bindings that allow Virtual Tree to display a visual representation of your data.

Quote:
How about performance? SoftGems's VirtualTreeView is extremely fast!


Virtual Tree is also extremely quick. How quick depends mainly on your application data model and how quickly you can build it and deliver data. As far as Virtual Tree is concerned it can display 1 million nodes just as quickly as 30 - with a similar memory overhead.

Quote:
Does your component internally have a tree data structure separated from the view, or are they together like in SoftGems's component? It has all the visual properties in every node.


Virtual Tree does not have a separate tree structure of GUI objects that mirrors your application data model. Instead Virtual Tree uses the bindings you define to create the "View" of your data on the fly. Thus it only creates the GUI elements it requires for the current display (ie not a GUI element for each data element in the hierarchy)

Quote:
Often I need just to scan the tree's data in a program without any UI. Then it would be nice to have those 2 things separated.
"Model - View" or how is it called ...


The model is your applications responsibility and is completely separate from Virtual Tree. If you want to support automatic update of the view then you will need build your model using classes that support this (implementing IBindingList and INotifyPropertyChanged interfaces).
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
JuhaManninen



Joined: 14 Mar 2008
Posts: 3
Location: Finland

PostPosted: Fri Mar 14, 2008 12:53 pm    Post subject: Reply with quote

Thanks for the quick answer.

And yes, I understand that the Virtual Tree doesn't know anything about the actual data of my application, that's why it is called "virtual".
When I asked about "tree data structure" I actually meant the meta-data in each node that builds the tree, namely properties like Parent, Previous Sibling, Next Sibling and so on.
Once the virtual tree component maintains the tree structure using those internal variables, then it is possible to browse the data about like this:

Node := Tree.GetFirst;
while Node <> Nil do
begin
...
... Get data from Node and process it ...
...
Node := Tree.GetNext(Node); // or GetNextSibling...
end;

At this point there are event handlers defined to fetch the application data and it is not relevant here. It comes "automatically".

However, a node in SoftGems's VirtualTreeView not only has meta-data needed for tree structure, but it also defines its visual appearence. This is how a node is defined:

TVirtualNode = packed record
Index, // index of node with regard to its parent
ChildCount: Cardinal; // number of child nodes
NodeHeight: Word; // height in pixels
States: TVirtualNodeStates; // states describing various properties of the node (expanded, initialized etc.)
Align: Byte; // line/button alignment
CheckState: TCheckState; // indicates the current check state (e.g. checked, pressed etc.)
CheckType: TCheckType; // indicates which check type shall be used for this node
Dummy: Byte; // dummy value to fill DWORD boundary
TotalCount, // sum of this node, all of its child nodes and their child nodes etc.
TotalHeight: Cardinal; // height in pixels this node covers on screen including the height of all of its
// children
Parent, // reference to the node's parent (for the root this contains the treeview)
PrevSibling, // link to the node's previous sibling or nil if it is the first node
NextSibling, // link to the node's next sibling or nil if it is the last node
FirstChild, // link to the node's first child...
LastChild: PVirtualNode; // link to the node's last child...
Data: record end; // this is a placeholder, each node gets extra data determined by NodeDataSize
end;


For example "NodeHeight" and "CheckState" are purely visual properties.

The problem comes when you try to use the component as a part in a bigger data model. For example I have made an in-memory tree DB, where the application data comes from optimized flat tables and VirtualTreeView maintains the tree structure using clever (!) indexed link-fields. That is purely data-oriented.
Then I had to make some clumsy Viewer-classes which pretend to take care of viewing the data, while it is actually done by the same tree component already embedded in my tree class.

So, I would need the VirtualTreeView to be splitted into 2 components,
TreeDATA and TreeVIEW.


Regards,
Juha Manninen
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Mar 14, 2008 9:58 pm    Post subject: Reply with quote

Virtual Tree represents the current tree hierarchy using Row objects. These are separate to the GUI objects (RowWidgets) used to display the tree. A Row has a Parent and ChildRows and an Item property which returns the underlying application data object associated with the Row. The Row object maintains the state of the tree (is a node expanded, selected etc) but does not perform the drawing.

Virtual Tree does not create Row objects for every object in your data model. It only creates the Row objects required to display the currently displayed data. They are transient objects - they change as the tree is expanded etc. So while Row objects are useful if you want to traverse the currently displayed tree they are not good for traversing your data model. For instance unexpanded Rows don't have child rows.

Virtual Tree is really virtual - if you want to traverse your data heirarchy you need to use your data classes to do this. If your data originates in flat tables you may want to create separate hierarchical data class that represent the tree hierarchy and enable you to navigate it easily. This could be as simple as a class with an interface like:

Code:
class MyNode
{
    public MyNode Parent
    {}

    public List<MyNode> Children
    {}
   
}


Or you can use more complicated data structures. Have a look at some of our sample projects to get a better idea of this - the SimpleTree project is a good starting point.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
JuhaManninen



Joined: 14 Mar 2008
Posts: 3
Location: Finland

PostPosted: Wed Mar 26, 2008 8:52 am    Post subject: Reply with quote

Thanks for the answer.
I had one week holiday and only now got chance to read it.

Regards,
Juha Manninen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group