• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Flyweight Tree (gallery-flyweight-tree) on cdn

    Last Updated: 05/3/13
    + 0 -

    Satyam

    YUI Contributor

    See 12 more by this user.

    Created: 09/7/12
    Last CDN Push: 05/10/13
    Build Tag: gallery-2013.05.10-00-54
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.10.0
    Free for use.

    This module is an extension to help in the handling of tree-like structures using the Flyweight pattern. It is the basis for gallery-fwt-treeview module, which is a subclass of Y.Widget though I would expect that it can also extend a subclass of Y.View.

    It contains a manager (FlyweightTreeManager) class extension which is the factory that provides instances of a node (FlyweightTreeNode) class, which inherits from Y.Base and represents each of the nodes in the tree.

    The manager stores the tree internally as a plain object with no methods, events or attributes. It creates and pools a limited number of node object instances which it positions over the internal nodes where the state information is stored. It can handle multiple node types (subclasses of FlyweightTreeNode) delivering the correct type for each node.

    The overall memory consumption is very low. Assuming all nodes are of the same type, the number of objects the pool might contain equal the depth of the tree, regardless of the number of nodes on the tree.

    • Tags:
    • satyam flyweight tree
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    This is a set of abstract classes not meant to be instanced directly.

    The sample below shows how the tree manager extension is used to extend Y.Widget and create Y.FWTreeView. while Y.FWTreeNode inherints from the tree node class.

    The actual implementation is not shown, see gallery-fwt-treeview.

    Code Sample

    <script src="http://yui.yahooapis.com/3.10.0/build/yui/yui-min.js"></script>
    YUI.add('gallery-fwt-treeview', function (Y, NAME) {
        Y.FWTreeView = Y.Base.create(
            NAME,
            Y.Widget,
            [Y.FlyweightTreeManager],
            {
                 // ......
            }
        );
        Y.FWTreeNode = Y.Base.create(
            NAME,
            Y.FlyweightNode,
            [],
            {
                 // ......
            }
        );
     
    }, '@VERSION@' ,
    {
        requires: ['gallery-flyweight-tree', 'widget', 'base-build']
    });
     

    © 2006-2013 Yahoo! Inc. All rights reserved.
    All code on this site is licensed under the BSD License unless stated otherwise.
    About This Site · Security Contact Info