-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement hierarchical data browsing #3
Comments
From written notes (2014): To abstract the UI, we need to represent our own tree structure & have an adapter at the end which converts into the concrete UI implementation. So we use the current query builder class. It gets us the data we want in a data table. We sort this data by each sort field in order. Then we group the data : first group followed by second group hierarchicaly below, followed by third etc. In the end we have a tree structure (either 1 deep i.e. a list, or N deep) that we give to the tree.
Let's think overall - we want to swap our UI implementation with a minimum of effort. Therefore we want to be determining our nodes hierarchy & then hand this off to a class to create the UI nodes - like how the How do we handle custom behaviours? e.g. if we wanted our implementation to handle determining whether a node has children when it hasn't been loaded yet? This kind of behaviour is not related to the UI, so is it the application that provides the implementation of this & couples it with the existing UI code? Yes. So if the concrete implementation of The adapter will need to notify on nodes added/removed and also expanded/contracted so the UI can update accordingly. Also the UI TreeNodes need to be notified of changes somehow. Not just text but colours/styles or whatever the concrete node creation provides. This will allow us to update nodes (& their hierarchies) if live changes occur in our application. For example the state of an object changes to 'complete' from 'pending' & its colour changes from orange to green or it relocates the node to another subtree. If it relocates to another tree it implies the node provider will have knowledge of the existing tree structure implying that the relationship is actually from the provider to the adapter; i.e. the adapter fires an event to get nodes & the provider responds. Actually this is OK because the adapter will have events for expand/contract/add/delete s othe provider can respond to expand & calculate the child nodes to then add as necessary, then the flow would be:
|
To save dumping my current brain, here's a similar thought process: In a nutshell, provide a viewmodel/adapter Node object with all hierarchy bundled into it and mimic the object in the UI. This works in WPF as per the article above and would be possible to make it work (a little more manually as per previous comment) in WinForms. See 1b70963 for the basis of this behaviour. |
In the previous version of the library (in SVN, not git; not included in commit history), the tree layout was defined by an XML template, with a callback for formatting when the threaded operation for loading child nodes had completed.
Problems with the old method:
UserControl
with a privateTreeView
so you couldn't do anything with the actual tree control. This is pretty much the issue - you have no control.OutOfMemoryException
for large data due to GDI objects exceeding 10,000 (a fault of the WinFormsTreeView
in fact).Aims:
The text was updated successfully, but these errors were encountered: