[ 25 posts ] Go to page Previous1, 2, 3 Next

Satyen Desai

YUI Developer

  • Username: sdesai
  • Joined: Tue Dec 09, 2008 4:17 pm
  • Posts: 302
  • GitHub: sdesai
  • Gists: sdesai
  • YUI Developer
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Thu Jul 12, 2012 9:30 am
+0-
Satyam wrote:
Regarding a), Gonzalo has 16 posts overall in this forum so just assuming he will reply to this, let alone read it is wishful thinking. (You, Satyen, are a quiet person and you are close to 300 posts and you joined just half a year before him). Trusting the component to someone who has no contact with the community is not a good idea.


All contributed components have an sponsor/owner on the YUI Team. I'll make sure the YUI owner responds if Gonzalo does not.

I haven't had a chance to read through the constructive part of your feedback, but will respond once I get a chance to if I have anything of value to add. As for the non-constructive parts, I can't really add anything of value there.

Allen Rabinovich

YUI Developer

  • YUI Developer
  • Offline
  • Profile
Tags:

Re: 3.6PR3 TreeView Feedback

Post Posted: Thu Jul 12, 2012 4:39 pm
+0-
I'd like to follow up with some updates first:
1. Gonzalo has moved on and he's no longer the official owner of TreeView. I am. Bear with me as I get on board and flex my neurons.
2. The TreeView was in a special PR release and hasn't been committed to master because we wanted to have more discussions and collect additional feedback. After gathering all the information, we have decided that it would be best to keep TreeView out of core for the 3.6 release. I will take it over as a gallery contribution, and continue working on it as a beta module there, with an understanding that in the future TreeView can become part of the core.

Brett -- great feedback. I would put the priority order on it as follows: (1) proper rich markup (more of a bug fix), (2) detailed events for all aspects of TreeView changes / interactions (also a bug fix), and (3) dynamic data loading. I'll put these at the top of my list for the next set of features to implement for the TreeView.

Satyam, per your posts, it appears that, aside from clearly fixable problems like improper markup and lack of sugar methods, you primarily take issue with the fact that there is an unnecessary differentiation among different type of subtrees (TreeLeafs vs. TreeViews). Is that a fair summary of your position? Beyond a semantic difference, what problems does such a differentiation cause? If the lazy rendering is properly implemented, is there still an issue with memory consumption? Additionally, let's not get into what's lacking in the TreeView right now -- that's a discussion for the 3.7.0 timeframe when I actually start building up the TreeView (so, for example, details on how to render from markup will be useful to think about at that point, but not right now).

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Thu Jul 12, 2012 6:01 pm
+0-
I started watching the TreeView Open Hours hoping to get some insight into this, by I haven't finished yet. I'll try to get more feedback once I have a better idea of what the objectives were.

The problem with TreeView/TreeLeaf is conceptual, but it has concrete consequences. Let's take this use case (I actually built one of these): a TreeView that represents the nodes in the DOM of a web page, inside a bookmarklet like Firebug Lite. We poll the DOM for changes and we find that a certain node now has children. If we had represented that node with a TreeLeaf, now we have to change it to a TreeView. We would have to default to TreeViews all the time. Then what's the advantage of using a TreeLeaf?

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Thu Jul 12, 2012 11:38 pm
+0-
@Allen,

Yes, the core of my complain is the TreeView/TreeLeaf separation. It is my objection now as it was a year and a half ago when I first said so. There are just two kind of objects in a tree, the object representing the tree as a whole and its root and then another object representing each and every node in the tree, which might have 0 or more children.

You can only break it into TreeView/TreeLeaf it you don't go beyond the most trivial examples where it doesn't really matter. Once you start adding all the methods and attributes that TreeView (the root) requires, then you start finding out that those features make no sense at the non-root level. At the other end, a node with or without children doesn't behave so different so it turns out it makes no sense differentiating in between leaf and non-leaf nodes.

Once we agree on that, then we can start talking about markup, features and enhancements, but if the basic architecture is failed, then there is no point in trying to fix it. If you design a car with the wheels on the roof, it doesn't make sense to talk about whether to put leather seats on it or not.

I'm happy the component has been delayed until 3.7.

I wonder what happened to all the tickets filed for YUI2 TreeView. There are just two tickets left in the database. That would have been a great source of information about what users needed. I have a copy of them in my email client, even the ones coming from the old YUI Trac system and, anyway, I remember the most crucial ones since I handled them (a part of my particular history of my involvement with the YUI library that is now wiped out), or at least I remember those that were the worst headaches.

Anyway, I don't know how bad it was to have all those YUI2 tickets in there but for components that existed in YUI2 and not yet in YUI3, as TreeView, and even those that do exist (after all, there is a lot of people using them out there) there was a lot of valuable information there. For a situation like this, having a list of all the feature requests would have been a good basis.

This is something the source code cannot provide as it is mostly very old code with every new feature placed on top of it with the utmost care to keep it backward compatible. The users guide and the API docs are a good reference, though. At least they show the features of it without showing the internals which might be quite disgusting if you look into them. The basic markup, all those one-row tables, one per node, was awful, but couldn't be touched. At a time when most components were subclasses of Element, TreeView couldn't be changed to use it.

However, it is still up and running, quite a feat!

Marco Asbreuk

YUI Contributor

  • Username: itsasbreuk
  • Joined: Mon Nov 16, 2009 5:14 am
  • Posts: 485
  • Location: Netherlands
  • Twitter: itsasbreuk
  • GitHub: ItsAsbreuk
  • Gists: ItsAsbreuk
  • IRC: Marco Asbreuk
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 1:57 am
+0-
I've read this discussion with great interrest for a while.
For I'm not developping in YUI as long as you guys, so I can't (and won't) judge the architecture.

But just want to share my 'view' onTreeview.

First @Satyam, there might be more treeviews in the library, but really, none of them work quite well. That's why I switched to YUI-Treeview after I saw Gonzalo's presentation at the YUI-conference 2010, almost 2 years ago. Needed it for a rich file-browser, so drag and drop, resorting leafs etc. was a requirement. These functionalities weren't there, but hey, it was still under construction and in the library, so no big deal. (YUI 3.3.0 wasn't released at that time.)

Since then: radiosilence. YUI 3.3.x no Treeview. I asked Gonzalo on his YUI3-Treeview forum when we could expect it. But no answer. YUI 3.4.x: no Treeview. YUI 3.5.x: no Treeview. YUI 3.6.0: yeah! all a sudden, like magic, I saw it in the staging-library! And an open-hours confersation as well!

But after that, looking at it's functionalities, I was a bit dissapointed. Still no rich userinterface posible. All the work seemed to be done under the hood. But that's Ok. Basic architecture is most important.

So now I read that the basic architecture has to be reconsidered... Well, I don't know if I should be happy or sad, really.

I think it might be a good descision to delay implementation. Even better is to redesign if needed. And perhaps the best descision is that Treeview has a new owner. I'm glad with that and hope it gets a boost now :)

Kind Regards,
Marco.


Last edited by itsasbreuk on Fri Jul 13, 2012 9:12 am, edited 1 time in total.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 2:56 am
+1-
A proposal:

All this discussion made me think about doing a couple of base objects: a flyweight manager extension and a flyweight node. There was another thread in the forum (viewtopic.php?f=92&t=10329&p=33732#p33732) that made me realize that there could be three components that could benefit from this:
* TreeView
* Menu
* Form

They all have an overall container and have a tree-like structure (forms have fields but also grouping elements such as fieldsets) and potentially many nodes, which should be lightweight. They also have a very interesting characteristic in that the focus of the component is usually set at a single child at a time (the form field with the focus, the TreeNode or MenuItem just clicked), thus, there is rarely any need to have instances of all nodes active at any one time, thus, they can all be pooled and managed by the flyweight manager.

The flyweight manager extension could be used to extend Widget which would make the main container for the whole component. It would accept a configuration object or a Dom Node reference or CSS selector to produce such a configuration object from the markup. It would make a clone of this object and keep it as the basis for the nodes in the component.

The extension would provide the methods to traverse this configuration object and slide the node instances on top of each. It would keep a pool of node instances by node type which would reuse to slide on top of the active node.

The extension would be the receptor of all events produced by the nodes, either DOM events capture via delegation or custom events fired by the node instances where the flyweightNode object would delegate (via EventTarget.addTarget method) to it. The extension would be responsible to locate the actual node and slide an instance for the corresponding node type on top of the node to pass as part of the event facade for such events.

The flyweight node instances would be based on BaseCore and would contain a private _node property which would be set by the flyweight manager to point to the node it has been slid over. Most attributes would access their values via this._node. flyweight nodes would have a few common attributes which do not come from this._node:
* depth (how far in the tree structure they are),
* index (its position within the array of children)
* root (a reference to the form, treeview or menu bar, that is, the widget extended via flyweight manager)
I am not including the children attribute in this list because that one is accessed via this._node just as the rest.

flyweight nodes would have a render method and a template attribute. The render method would use, in that order, its own template attribute or the static template for the whole node type or the default child template at the root. The default renderer would use Y.substitute with the template string and a reference to this._node as the source of values. A configuration attribute should be available to switch from this fast renderer to one which uses this.getAttrs instead of this._node as the second argument to Y.substitute. This would be needed for the few that need access to other calculated attributes such as depth or index, which are not available in this._node.

The flyweight manager extension would provide generic node traversal methods such as forEach, forEachByXXXX, which each of the derived classes might further supplement with extras such as forEachExpanded, forEachSelected, in the case of TreeView or forEachField (skipping over fieldsets and other containers, in the case of Form).

The flyweight nodes would have slideToNext, slideToPrevious, slideToParent, slideToFirstChild which would ask the flyweight manager to slide itself on top of the appropriate node (I called them moveTo on a previous post, but I think SlideTo is better suited). Those methods would return a boolean indicating success and this._node would be set to null in case of failure: early crashes help debugging. Nodes would also have forEachChildren methods.

If the developer wants to keep a reference to a particular node, both the root and the children would need to offer a variety of getNodeBy methods which would return a non-reusable instance of a node, permanently pointing to the given node. Such instances might be taken from the pool but never returned to it so it is never slid upon any other node so the reference given to the developer remains valid.

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 6:40 am
+0-
allenrabinovich wrote:
IBeyond a semantic difference, what problems does such a differentiation cause?

In my opinion, TreeView/TreeNode is a lot easier to think about generally, but specially in the implementation. For example, the implementation now has this lines:
Code:
this.BOUNDING_TEMPLATE = isBranch ? 'foo' : 'bar';
this.CONTENT_TEMPLATE = isBranch ? 'baz' : null;

Having a TreeView and TreeNodes eliminates the need for asking if a widget is a branch (a TreeNode is always a branch, a TreeView isn't). Besides, isn't it logical to conclude that if it's asking itself all the time if it's a branch or not, then the abstraction wasn't chosen correctly?

Another example is that TreeView has collapse/expand/toggleTreeState methods that do a lot of things mostly because it can refer to a child tree member or itself. TreeNodes allow us to think of them in the terms of any other widget. Like Satyen (with an "n") says, TreeNode should have a state with a visual representation:

Stateful TreeNode

Click here to see the revision history on this Gist.
(please note this is a mere conjecture, I haven't yet written any working code with this approach)

TreeView could have an API similar to the current implementation and be more explicit about what it does instead of having an optional parameter: TreeView#expandNode, TreeView#collapseNode, TreeView#toggleNodeCollapsed.

I believe this makes writing our own flavors easier.

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 8:54 am
+0-
As it turns out, all these three, TreeView, Menu and Form do have even more in common than I thought. It is obvious that TreeView and Menu have expanded and collapsed states, but I just realized Forms might as well, as large forms are often broken into collapsible panels. Whether they are shown accordion-style, tabview style or multi-page wizard, which is only a matter of defining which grouping control to use besides the standard fieldset, nodes on forms (grouping ones in this case) can also be collapsed or expanded just as those of a tree.

Since all of these have expanded/collapsed states, it is obvious that lazy rendering comes naturally to them. When navigating through its nodes, the flyweight manager should check their expanded state and visit their children only if it is true.

The configuration object, which serves as the basis to build the tree and whose nodes are the ones the flyweight nodes slide over, would have a rendered property which would tell them whether they have already been rendered or not.

The render method of each node would return a string which would be concatenated with those of its siblings and placed wherever is suitable in the parent. Such string would then go all the way up to the root object to be inserted in the innerHTML of its contentBox. Should there be any post-render DOM Node formatters to process, the flyweight manager would traverse the configuration object to see which nodes need that extra step and slide a node instance of the appropriate type on top of it to handle it.

And, BTW, I know there is already a Menu component and no plans for a Form component, I just list them to show the range of applications this flyweight manager extension/flyweight node can have. An accordion might also fall into this pattern, even if accordions naturally have a depth of 2 and only one child per branch, the first for the title bars, the second for the content. The same with TabView, one level for the tabs, a second for the panels.

Anyway, my point is, this mechanism provides for lazy rendering (only the visible nodes get rendered, you don't bother to render nodes with the display:none CSS attribute) and it has a minimum of node instantiations. My guess is that the pool of node instances for a tree would not be proportional to the number of tree nodes (or menu items) in it but to the depth of the tree and, in most cases just as deep as the deepest node ever rendered (assuming all nodes are of the same type). Anyway, the number of nodes on the pool should be configurable and if the pool is already at that level, the freed node would be simply dumped instead of pushed back into the pool. This does not count the node instances the developer has specifically requested via one of the getNodeXxxx methods since those are not in the pool.

Marco Asbreuk

YUI Contributor

  • Username: itsasbreuk
  • Joined: Mon Nov 16, 2009 5:14 am
  • Posts: 485
  • Location: Netherlands
  • Twitter: itsasbreuk
  • GitHub: ItsAsbreuk
  • Gists: ItsAsbreuk
  • IRC: Marco Asbreuk
  • Offline
  • Profile
Tags:

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 9:43 am
+0-
In the last piece of my comment, I meant 'Even better is to redesign if needed' instead of 'Even better is to resign if needed'. Damn autocorrect...

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 638
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile
Tags:

Re: 3.6PR3 TreeView Feedback

Post Posted: Fri Jul 13, 2012 5:25 pm
+0-
itsasbreuk wrote:
In the last piece of my comment, I meant 'Even better is to redesign if needed' instead of 'Even better is to resign if needed'. Damn autocorrect...

I thought that was a little gloomy :P
  [ 25 posts ] Go to page Previous1, 2, 3 Next
Display posts from previous:  Sort by  
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