{"id":42,"date":"2007-03-05T06:23:29","date_gmt":"2007-03-05T14:23:29","guid":{"rendered":"http:\/\/dougmccune.com\/blog\/2007\/03\/05\/new-flex-component-convertible-treelist\/"},"modified":"2007-03-05T22:26:01","modified_gmt":"2007-03-06T06:26:01","slug":"new-flex-component-convertible-treelist","status":"publish","type":"post","link":"https:\/\/dougmccune.com\/blog\/2007\/03\/05\/new-flex-component-convertible-treelist\/","title":{"rendered":"New Flex Component: Convertible TreeList"},"content":{"rendered":"<p>Here&#8217;s a Flex component I made a few weeks ago and never got around to blogging about. It&#8217;s included in the <a href=\"http:\/\/flexlib.net\">FlexLib<\/a> library. This is a component that combines the List and Tree controls that are included in the framework. This was inspired by the left nav menu of the new <a href=\"http:\/\/examples.adobe.com\/flex2\/consulting\/styleexplorer\/Flex2StyleExplorer.html\">Flex Style Explorer<\/a>. That app has a navigation menu that can be displayed either as a Tree control, if there is enough space, or a list of icons if we need to conserve space. I figured that was a great way to display the same data two ways. <\/p>\n<p>So you can have one component, set the dataprovider once, and you can switch it between showing the data as a Tree, text-only List, icon-only List, or a text and icon List. You can set the <strong>mode<\/strong> property of the control to determine how it displays. <\/p>\n<p><strong>So what?<\/strong><br \/>\nIt came to my attention today that the reason for this component isn&#8217;t as obvious as I thought. So I&#8217;ll try to explain. This component is for the situation where you have a list of items in a Tree, but you might want that Tree to take up much less horizontal space, so you want those items to be displayed as a straight List of text or icons instead. Normally what you would do is have two controls, a List control and a Tree control, set the dataproviders separately (since a List can&#8217;t take heirarchical data) and swap one out for the other if you wanted to change them. This component makes it so you don&#8217;t have to do any of that swapping yourself, it&#8217;s done for you, and all you have to do is set the <strong>mode<\/strong> property of the control. <\/p>\n<p>Take a look at the <a href=\"http:\/\/flexlib.googlecode.com\/svn\/trunk\/docs\/flexlib\/controls\/ConvertibleTreeList.html\">documentation on FlexLib<\/a>. Here&#8217;s a direct link to the <a href=\"http:\/\/flexlib.googlecode.com\/svn\/trunk\/src\/flexlib\/controls\/ConvertibleTreeList.as\">source code<\/a> of this component in FLexLib. The best way to get it though, is to check out FlexLib from the SVN repository. <\/p>\n<p>Here&#8217;s the example. The top component shows how you can dynamically set the mode. There are four options, Tree, text List, icon List, and full List. The bottom examples shows a more real-world example where you would want to change the mode depending on how much space you have available.<\/p>\n<p><div id=\"swf0cc71\">This movie requires Flash Player 9.<\/div>\n<script type=\"text\/javascript\">\n\tswfobject.embedSWF(\"http:\/\/flexlib.googlecode.com\/svn\/trunk\/examples\/ConvertibleTreeList\/ConvertibleTreeList_Sample.swf\", \"swf0cc71\", \"400\", \"500\", \"9.0.0\", \"\", {}, {wmode: \"window\", menu: \"false\", quality: \"high\", bgcolor: \"#FFFFFF\", allowScriptAccess: \"always\"}, {});\n<\/script>\n<\/p>\n<p>P.S. Thanks to <a href=\"http:\/\/www.jeffryhouser.com\/\">Jeffry Houser<\/a> for donating the <a href=\"http:\/\/flexlib.net\">flexlib.net<\/a> domain!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a Flex component I made a few weeks ago and never got around to blogging about. It&#8217;s included in the FlexLib library. This is a component that combines the List and Tree controls that are included in the framework. This was inspired by the left nav menu of the new Flex Style Explorer. That [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-flex"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dougmccune.com\/blog\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}