Folder directory maps to tree control?
How can I maps folder directory to tree control? Is it even
possible? For example:
I want the tree to show all files and folders under
"C:\Documents and Settings\User\My Documents". Possible?
The Flashplayer Sandbox does not allow you to get information
of you file system directly, but there are severel ways to solve
the problem.
1.) you can use webservices which you communicate with (the
webservice can give you the information and then you have to handle
the webservice result)
2.) you can use coldfusion
3.) You can load a file form your system (with Urlrequest, or
httpservice) which represents your folder you want to display.
e.g.: you have a xml-file with all the required information,
then you parse through the xml-file, the disadvantage is, that you
always have to update you xml-file manually or with a script
Similar Messages
-
Unnecessar​y Code - Directory Hierarchy in Tree Control.vi Shipping Example
Hello,
Can you guys take a look at the shipping example Directory Hierarchy in Tree Control.vi (---\Program Files\National Instruments\LabVIEW 2010\examples\general\controls\Tree Control Directory.llb\Directory Hierarchy in Tree Control.vi on my machine) and let me know if you see some unnecessary code? I see what seems to be two different updates of the same front panel control in the TRUE frame of the case structure in the middle of the diagram. I can't think of the reason why you would need both updates of the Path to Start the Search control. I think one of the updates would be good enough.
Thanks!Sorry.
Here it is.
Attachments:
Directory Hierarchy in Tree Control BD.png 32 KB -
How to open the file in a tree control
I use a tree control to list all files in a selected directory, I checked the sample with LV (Directory hierarchy in tree control.vi) and want to add a function like following:
Atfer listing all files, if I click a file listed in the tree control, the computer can open the file automaticly.Hi,
you can use the "Open URL in Default Browser.vi" to open all the files you select in your tree.
Mike
Attachments:
Directory Hierarchy in Tree Control_LV85.vi 35 KB -
Hi friends.........
Iam using flex tree control data coming from coldfusion file to display grid. As i click the tree folder to change the data from dynamic from grid.
How to pass the folder id from coldfusion file.. Is it possible ?.. Means give any example please....
Any One Help Me......
With Regards.,
Lingu.......When you set the dataProvider for your tree control, you actually pass an array or arraycollection or whatever to that property. The array contains objects coming from your server, right? Each object should contain a property with the folder id, something like:
var arr:Array = [{id: 1, folderID: 34, name: "..."}, {id: 2, folderID: 4, name: "..."}, ...];
Now, when you click an item in your tree or your dataGrid, you can access the folder id by:
myTree.selectedItem.folderID
Hope this helps
Dany -
Flex tree control expanditem dynamically..?
Hi All.,
I have using tree control using to display. when i pass the data with folder id dynamically to expanding particular child node of tree.
How to extarct tree with dynamic...?
Below sample coding.....
<mx:tree id="folderTree" />
folderid=2618;
callLater(expandTree, [folderid]);
private function expandTree(folderid: Object) : void
folderTree.expandChildrenOf(folderTree.getChildAt(0), true);
folderTree.selectedItem = folderid;
but not extracting tree.
anyone help this problem
With Regards.,
LingsThanks buddy for the answer.
Unfortunately the answer came after quite long time of posting the message. Anyway I was able to open a tree on demand using HttpService and due to my new requirement I changed it to RemoteObject.
I my latest change I am able to populate tree nodes on demand and also the same solution if getting update from server via JMS using Consumer object.
I kind a like this solution because it took me good amount of effort to find the right solution.
If any one is intersted the he/she can reply to the post and I can provide code here or may at some location so that it can be easily downloaded.
The solution is Flex-Grails combination.
Thanks everybody. -
Issue : drag and drop from list control to tree control
Hi,
I was trying a drag and drop from list control to tree control. I have used some sample data to populate list and tree controls .
It is working fine . except one problem ..
Prob : when i drag an item to tree control .. it gets added .. now tree contains (X+1) data in list .. say X is the inital number of nodes in a tree node.
now if i drag another item from list to last item in the tree node .. i.e at X+1 index. .. it throws null pointer exception.
I am considerably new in flex programming . looking for help from experts ..
Below is my code :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.collections.ICollectionView;
import mx.core.UIComponent;
import mx.managers.DragManager;
import mx.events.DragEvent;
import mx.controls.Alert;
import mx.controls.Label;
import mx.events.CloseEvent;
private var homePath:String="/home/e311394/dndTest/";
private var destPath:String="/home/e311394/dndDest/";
private var eid:String="e311394";
private var actn:String;
[Bindable]
private var cm:ContextMenu;
private var cmi:ContextMenuItem;
[Bindable]
private var dp:ArrayCollection;
private function init():void
cmi=new ContextMenuItem("Remove");
cmi.enabled=true;
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItem_menuItemSelect);
cm=new ContextMenu();
cm.hideBuiltInItems();
cm.customItems=[cmi];
cm.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenuItem_menuSelect);
list.contextMenu=cm;
private function contextMenuItem_menuSelect(evt:ContextMenuEvent):void
list.selectedIndex=lastRollOverIndex;
private function contextMenuItem_menuItemSelect(evt:ContextMenuEvent):void
var loclSelectedRow:Object=list.selectedItem;
var lostrSelectedMenuItem:String;
lostrSelectedMenuItem=evt.target.caption;
if (loclSelectedRow != null)
var obj:Object=new Object()
obj.label=loclSelectedRow.label as String;
//Alert.show(obj.label);
if (lostrSelectedMenuItem == "Remove")
if(loclSelectedRow!=null)
var pth:String=homePath.concat(loclSelectedRow.label);
//Alert.show(pth);
//FlexDnDRemoteService.process(eid,"delete",pth,"-");
var coll:ArrayCollection=list.dataProvider as ArrayCollection;
if (coll.contains(loclSelectedRow))
coll.removeItemAt(coll.getItemIndex(loclSelectedRow));
public function onTreeDragEnter(event:DragEvent):void
event.preventDefault();
DragManager.acceptDragDrop(event.target as UIComponent);
tree.showDropFeedback(event);
protected function onTreeDragOver(event:DragEvent):void
event.preventDefault();
event.currentTarget.hideDropFeedback(event);
try
var index:int=tree.calculateDropIndex(event);
catch (e:Error)
DragManager.showFeedback(DragManager.NONE);
return;
tree.selectedIndex=index;
var draggedOverItem:Object=tree.selectedItem;
public function onTreeDragExit(event:DragEvent):void
event.preventDefault();
tree.hideDropFeedback(event);
private function showAlert():void
Alert.yesLabel="Move";
Alert.noLabel="Copy";
Alert.buttonWidth=70;
Alert.show("Copy / Move ?", "Confirm", Alert.YES | Alert.NO | Alert.CANCEL, this, alertListener, null, Alert.OK);
private function alertListener(eventObj:CloseEvent):void
var result:Boolean=false;
if (eventObj.detail == Alert.CANCEL)
//Alert.show("CANCEL");
return;
if (eventObj.detail == Alert.YES)
//Alert.show("YES");
result=true;
else if (eventObj.detail == Alert.NO)
//Alert.show("NO");
result=false;
var index:int=tree.calculateDropIndex(treedropevt);
//Alert.show("Drop Pos" + index.toString());
/* var treeList:ArrayCollection=tree.dataProvider as ArrayCollection;
Alert.show(" index"+index+"Length "+treeList.length);
if(index > treeList.length)
Alert.show("Returning");
return;
var items:Array=new Array();
if (treedropevt.dragSource.hasFormat("items"))
items=items.concat(treedropevt.dragSource.dataForFormat("items") as Array);
var parentItem:Object;
parentItem=getObjectTarget();
/* if (tree.dataDescriptor.isBranch(tree.indexToItemRenderer(index).data))
parentItem=tree.indexToItemRenderer(index).data;
else
var dropParentPackage:Object = tree.mx_internal::_dropData.parent as Object;
Alert.show("HAck"+dropParentPackage.toString());
parentItem=tree.getParentItem(tree.indexToItemRenderer(index).data);
//Alert.show("Lenght "+ObjectUtil.getClassInfo(parentItem).properties.length);
//Alert.show("Lenght "+ObjectUtil.getClassInfo(parentItem).properties.length);
var position:int=0;
/* if(ObjectUtil.getClassInfo(parentItem).properties.length==0)
Alert.show("Returning");
return;
if (parentItem != null)
try
while (tree.indexToItemRenderer(index).data != parentItem)
//Alert.show(tree.indexToItemRenderer(index).data.toString());
if (index > 0)
index--;
//Alert.show("Insiade");
position++;
catch (e:Error)
Alert.show("Catch" + index.toString());
return;
for each (var item:Object in items)
var obj:Object=new Object()
obj.label=item.label as String;
if (parentItem != null)
//Alert.show("ADDED");
tree.dataDescriptor.addChildAt(parentItem, obj, position++);
else
//Alert.show("PARENT NULL");
tree.dataDescriptor.addChildAt(tree.selectedItem, obj, position++);
var spth:String=homePath.concat(item.label);
//Alert.show(spth);
var dpth:String=destPath.concat(item.label);
//Alert.show(dpth);
if (result == true)
removeItems();
//FlexDnDRemoteService.process(eid,"move",spth,dpth);
else
//FlexDnDRemoteService.process(eid,"copy",spth,dpth);
tree.validateNow();
public function getObjectTarget():Object
var dropData:Object=tree.mx_internal::_dropData as Object;
if (dropData.parent != null)
return dropData.parent;
else
// if there is not parent (root of the tree), I take the root directly
var renderer:IListItemRenderer=tree.indexToItemRenderer(0);
return renderer.data;
public function removeItems():void
//remove moved elements
var items:Array=treedropevt.dragSource.dataForFormat("items") as Array;
var coll:ArrayCollection=list.dataProvider as ArrayCollection;
for each (var item:Object in items)
if (coll.contains(item))
coll.removeItemAt(coll.getItemIndex(item));
private var treedropevt:DragEvent;
public function onTreeDragDrop(event:DragEvent):void
treedropevt=event;
showAlert();
event.preventDefault();
tree.hideDropFeedback(event);
public function resultHandler(event:ResultEvent):void
Alert.show("Success", "Status");
public function faultHandler(event:FaultEvent):void
Alert.show(event.fault.faultString, "Failure");
]]>
</mx:Script>
<mx:ArrayCollection id="listDP">
<mx:Object label="File1.dnd"/>
<mx:Object label="File2.dnd"/>
<mx:Object label="File3.dnd"/>
<mx:Object label="File4.dnd"/>
<mx:Object label="File5.dnd"/>
</mx:ArrayCollection>
<mx:Number id="lastRollOverIndex"/>
<!--
<mx:ArrayCollection id="treeDP">
<mx:Object label="/home">
<mx:children>
<mx:Object label="dummy1.ks"/>
<mx:Object label="dummy2.ks"/>
<mx:Object label="e493126">
<mx:children>
<mx:ArrayCollection>
<mx:Object label="/home/e493126/sample1.ks"/>
</mx:ArrayCollection>
</mx:children>
</mx:Object>
</mx:children>
</mx:Object>
</mx:ArrayCollection>
-->
<mx:ArrayCollection id="treeDP">
<mx:Object label="/dndDest">
<mx:children>
<mx:ArrayCollection>
<mx:Object label="sample1.ks"/>
<mx:Object label="sample2.ks"/>
<mx:Object label="sample3.ks"/>
<mx:Object label="sample4.ks"/>
<mx:Object label="sample5.ks"/>
<mx:Object label="sample6.ks"/>
</mx:ArrayCollection>
</mx:children>
</mx:Object>
</mx:ArrayCollection>
<mx:List id="list"
itemRollOver="lastRollOverIndex = event.rowIndex"
width="50%"
dragEnabled="true"
dataProvider="{listDP}"
labelField="label"
allowMultipleSelection="true"
dragMoveEnabled="false">
</mx:List>
<mx:Tree id="tree"
width="50%"
dragEnabled="true"
dataProvider="{treeDP}"
dragEnter="onTreeDragEnter(event)"
dragOver="onTreeDragOver(event)"
dragExit="onTreeDragExit(event)"
dragDrop="onTreeDragDrop(event)"
labelField="label"
liveScrolling="true">
</mx:Tree>
<mx:RemoteObject id="FlexDnDRemoteService"
showBusyCursor="true"
destination="FlexDnD">
<mx:method name="process"
result="resultHandler(event)"
fault="faultHandler(event)"/>
</mx:RemoteObject>
</mx:Application>
Thanks,
RajivYa , i have searched and have used the same code.
But needed to customize few things like:
stop dnd in same tree
drop some item into a folder ..( onto it ) etc
have achieved the same .. but this issue ..
i think the tree dataprovider (contents internally is not being updated .. only the UI)
any suggestions ?
- Rajiv -
Problem in setting default index in Tree Control
hi all,
i am using flex2.0 final release and in my application i am
calling custom function in cretionComplete event
which set the default index in Tree control...but its not
working properly in final flex meanwhile this same thing i am using
in flex beta3 ...at that time its working properly but the problem
occur only in migration time so can any body tell me what happaning
here...
code....//here MailFolderLists is id of tree control
[Bindable]
public var XLC:XML;
public function initList(event:Event) : void
if(mx.utils.ObjectUtil.toString(event.target.lastResult).indexOf("NOK")==-1)
XLC = event.target.lastResult;
if(MailFolderLists.selectedIndex==-1) //its working
MailFolderLists.selectedIndex=0; // its not working
so plz give me solution aasp..
thanks in advancethanks buddy
ur suggestion work ....
one more thing i want to know if u have any idea related to
Tree.expandItem method it will work fine in beta3 but same prob not
work perfectly in final flex.....
i am using
MailFolderLists.expandItem(MailFolderLists.selectedItem,
true);
but not work every time i want the tree in expan position
every when i add and new node/folder into it..
so give me suggestion if u have any idea...
thanks -
Virtual-directory-mapping Security
How do I secure the folder and or files in a virtual-directory-mapping
Created a virtual-directory-mapping to store pdf files.
I use adf security.
I want to block access from someone entering http://host:port/context-root/pdfname.pdf
chuckHi Chuck,
You can use FormBased Authentication to protect the access to the virtual-directory like " *http://middlewaremagic.com/weblogic/?p=2034*
*Example:*
Inside your Virtual Directory Create a "pdf" directory and then place all your PDF files inside this directory
Then add the following kinf og entry in your "web.xml" file <url-pattern>pdf/*</url-pattern> restrict the access to pdf/* contents like below:
<?xml version='1.0' encoding='UTF-8'?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>Constraint-0</display-name>
<web-resource-collection>
<web-resource-name>Constraint-0</web-resource-name>
<url-pattern>pdf/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/failedlogin.html</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
</web-app>.
Thanks
Jay SenSharma -
Hi experts,
How to create tree node with folder symbol dynamically in alv tree control.
Thanks
Ramesh VRIt is just a tree structure display in ALV output mode
BCALV_TREE_DEMO Demo program for ALV tree control
Many times in Finance there are requirements where User wants to see balance sheet report based on cost center groups and cost centres within it in this form -
Could i show the dashed-line of Tree Control in Flex 1.5
For example, there is dashed-lines between folder and folder
in the Windows Explorer.I wonder whether i can set a property to
let the tree control show its dashed-line.
Thanks in advance.hi all
Please have a look and tell me why I am getting this error.
Thanx
kvijai -
Scrollbar in Tree Control = wonky
The TREE control scrollbar seems to have some ill-thought-out behavior.
1... Run the example TREE ENHANCEMENTS (Examples - Building UIs - Displaying Data - General )
2... Choose a folder on your machine with a few (3-5) folders in it but lots of files and folders contained within those folders.
3... Select the PATTERN as appropriate.
4... Run the VI. Your files should show up in the list, then the list collapses.
5... Expand the folders, so that there are more items in the list than it can display at one time.
6... The scrollbar appears (that's sensible).
7... Scroll down so that items disappear off the top.
8... Right click and choose CLOSE ALL ITEMS
--- I would expect the control to automatically move back up to the top, so you could see something, but it doesn't.
9... Play with the scrollbar thumb. Not exactly sensible.
Here is a JING to watch, showing this behavior.
The code that populates this tree is copied from the example (and modified to remove file extensions).
Once the tree is populated, the code is doing nothing (except waiting for a QUIT button).
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And TricksJust run the example I mentioned. It's not code that does it - it's the behavior of the tree control itself.
But you need to structure the folders so that you have a few (< # lines in tree) root-level folders, and many (> #lines in tree) sub-folders/files, whatever.
When you collapse the tree, I would expect the scrollbar to adapt to the new situation, and possibly disappear. Instead, it's working on old information, I suppose.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com
Blog for (mostly LabVIEW) programmers: Tips And Tricks -
Populate Flex tree control from mysql
Hi
I am just learning Flex and I started playing with the Tree
control. I am trying to populate the Tree from Mysql using php and
I am just hitting wall after wall.
Please Help
Thanks in advancequote:
Originally posted by:
ntsiii
Stop running and get a map (read the documents)
This is hardly a useful comment and must discourage new users
from asking questions. If you think the documentation relating to
the use of the tree control is straightforward then I beg to
differ.
If you are aware of a clear example of how to use the data
tree with a php backend returning a remote data object please
enlighten me. Meanwhile I continue my search but not within the
livedocs.
One site I have found that may be of use is
http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
Not everyone is an expert. -
Hi All,
I need to create a checkbox tree control to show the user and make him select the directory listing of application-home on the server side. I have a solution wherein I have to submit the page every time the checkbox is clicked, but that is not efficient.
I need to select all the child node checkboxes once the parent checkbox is selected and well I need to show the parent checkbox greyed if even one child is not selected and show the parent deselected if all child nodes are unclicked.
Please Help...
Thanks
Ultimate.U can handle all these by JavaScript. there's no time to sit and write code fer u, just try to show the way!
do some search on huge set of javascript codes/sample on net to handle those things.
--Behrad -
Tree control and XML dataprovider
Hi,
I am trying to get this xml ( http://mitjafelicijan.net/test.xml ) working with my tree control in my Flex app and cannot figure it out how exactly to do this.
my Flex code is this
<mx:Tree left="0" top="0" bottom="0" showRoot="true" id="trvTreeview" right="0"></mx:Tree>
and my AS code is this
var tmp:XML = XML(event.target.data);
trvTreeview.dataProvider = tmp.node;
I get such output
http://mitjafelicijan.net/tree.pngThe default data descriptor will see any child node as a child and claim that node is a folder. If the xml node used attributes like this:
Then there aren't any child nodes. However, if you can't change the XML structure you can create a custom TreeDataDescriptor that is smarter about hasChildren()
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Hi All,
I have a need for a tree control which supports having a
combobox. I've done extensive research on Google, but came up
empty. If anyone has or can point me to any examples, it would be
greatly appreciated.
Thanks in advance!
-jfHere's a follow-up to my first question.
I found an example of a tree with checkboxes and set out to
modify it so that it would fit my needs. I'm really stumped here,
because it will render a checkbox or radio button fine, but I can't
get it to render a combobox or button. I'd also like the combobox
and button to be on the right side of the parent/child label, is
that possible?
Any help anyone can provide is greatly appreciated.
Content of ComboBoxTreeRenderer:
package util
import mx.controls.Image;
import mx.controls.Tree;
import mx.controls.treeClasses.*;
import mx.collections.*;
import mx.controls.ComboBox;
import mx.controls.Button;
import mx.controls.RadioButton;
import mx.controls.listClasses.*;
import flash.events.Event;
import flash.events.MouseEvent;
import mx.events.FlexEvent;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.xml.*;
import mx.core.IDataRenderer;
public class ComboBoxTreeRenderer extends TreeItemRenderer
protected var myImage:Image;
// set image properties
protected var myComboBox:ComboBox;
protected var myRadioButton:RadioButton;
protected var myButton:Button;
public function ComboBoxTreeRenderer ()
super();
mouseEnabled = false;
override protected function createChildren():void
super.createChildren();
myRadioButton = new RadioButton();
addChild(myRadioButton);
myComboBox = new ComboBox();
addChild(myComboBox);
myButton = new Button();
myButton.setStyle( "label", "Button" );
addChild(myButton);
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data)
if (super.icon != null)
myRadioButton.x = super.icon.x;
myRadioButton.y = 2;
super.icon.x = myRadioButton.x + myRadioButton.width + 17;
super.label.x = super.icon.x + super.icon.width + 3;
else
myRadioButton.x = super.label.x;
myRadioButton.y = 2;
super.label.x = myRadioButton.x + myRadioButton.width + 17;
Content of comboBoxTree_test.mxml:
<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init();" >
<mx:Script>
<![CDATA[
import mx.collections.*;
[Bindable]
public var treeList:XMLList =
<>
<folder isBranch="true" label="Branch 1" >
<folder isBranch="false" label="Leaf 1" />
<folder isBranch="false" label="Leaf 2" />
</folder>
</>;
[Bindable]
public var folderCollection:XMLListCollection;
private function init() : void
folderCollection = new XMLListCollection(treeList);
comboBoxTree.dataProvider = folderCollection;
]]>
</mx:Script>
<mx:Tree
id="comboBoxTree"
itemRenderer="util.ComboBoxTreeRenderer"
labelField="@label"
width="100%" height="100%" >
</mx:Tree>
</mx:Application>
**************************************************************
Maybe you are looking for
-
Purchase orders and their open order quantity with their due delivery date
hi friends i need to build a query where i can see the purchase orders and their open order quantity and their respective due delivery dates.i have never done this. ME2M serves my requirement upto little but i cannot see the delivery dates in that re
-
when i did all that shows up in disk utility now is something called expansion and all my opitions are greyed out in the partation tab, it doesnt mount and idk what to do please help. Running macbook pro 2.53ghz late 2010 mountain lion 8gbs mem
-
Win 7 pro 32bit on early 2006 mac pro
do i have a chance at installing this without reburning the cd a la jowie?
-
Unable to purhase Adobe products "Adobe Photoshop Elements & Premiere Elements 12 "
I have been trying to purchase from "http://shop.adobe.com/store/adbehap/list/categoryID.62214900/ThemeID.25225600?id=HomeOffer sPage&SiteID=adbehap&Env=BASE". However, i keep getting an error "We're sorry. The payment method selected is not availabl
-
hi all, with KMS enabled E-Uae stops working correctly. only black screen is some way to run Euae without KMS disable ? thanks. radeon X700, rendering EXA.