Complex xml in tree control

every example you see online is trivial and utterly useless
for practical programming purposes...typically you'll see something
like this:
<mx:XML format="e4x" id="myMenuModel">
<root label="Menu">
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem 1-A"/>
<menuitem label="SubMenuItem 2-A" />
</menuitem>
<menuitem label="MenuItem B"/>
<menuitem label="MenuItem C" type="check"/>
<menuitem type="separator"/>
<menuitem label="MenuItem D">
<menuitem label="SubMenuItem 1-D" type="radio"
groupName="one"/>
<menuitem label="SubMenuItem 2-D" type="radio"
groupName="one"/>
<menuitem label="SubMenuItem 3-D" type="radio"
groupName="one"/>
</menuitem>
</root>
</mx:XML>
...just hard coded simplistic xml which is fine and dandy if
you have a simple xml schema and all the leaves of your tree can be
keyed off the same "label" attribute. But what if you have a
complex, deeply nested XML file that doesn't follow this nice
pattern? What if I want to pull different attributes from different
levels in the tree to display, is that even possible? Or what if I
dont want to use the attribute at all for my display label in the
tree, what if I want to use an element node name? Like for example,
say I had:
<department label="marketing">
<employee name="Eric Cartman" Age="8">
<interest>
<type>food</type>
<name>cheesiepoofs</name>
</interest>
<interest>
<type>pets</type>
<name>mr. kitty</name>
</interest>
</employee>
Is there a way I can build my tree to use the department
'label' attribute for the top level, the employee 'name' attribute
for the second level and the <type> element nested under
<interest> for the third level?
I confess I'm a Flex newbie but any other language I've
worked provides a mechanism to tailor this sort of thing to
individual business cases. Any insight would be greatly
appreciated.
thank you.
S

Another approach is parse your complex xml into objects and
then create your own
tree datadescriptor. This is described in the help. Search on
"custom tree datadescriptor"
We use this approach because the xml we want to display in a
tree does not fit nicely. So we wrote a parser that converts the
xml into "TreeObjects" (our class) and created the custom tree
datadescriptor to handle it. When we create the tree object we can
control the data used for the label so it displays correctly.

Similar Messages

  • Dynamically Loading xml in tree  control

    Hi I am new to flex i need to load the following xml into tree
    <?xml  version="1.0" encoding="utf-8" ?>
    - <catalog>
    - <product>
    <name>laptop3</name>
    <price>"1256"</price>
    <qty>"45"</qty>
    </product>
    - <product>
    <name>"CAR"</name>
    <price>"45000"</price>
    <qty>"7"</qty>
    </product>
    - <product>
    <name>"Laptop2"</name>
    <price>"450011"</price>
    <qty>"7022888"</qty>
    </product>
    - <product>
    <name>"Laptop"</name>
    <price>"45000"</price>
    <qty>"70"</qty>
    </product>
    - <product>
    <name>"Laptop2"</name>
    <price>"45000"</price>
    <qty>"7022"</qty>
    </product>
    - <product>
    <name>"Laptop2"</name>
    <price>"45000"</price>
    <qty>"7022888"</qty>
    </product>
    </catalog>
    I am unable to load the exact xml structure ...
    Please help me
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:HTTPService id="srv" url="http://localhost:8080/SampleWebApp/test.jsp"/>
        <mx:DataGrid dataProvider="{srv.lastResult.catalog.product}" width="100%" height="100%"/>
        <mx:Tree labelField="@val" width="201" height="100%" showRoot="true"
        showInAutomationHierarchy="true" id="machineTree" dataProvider="{srv.lastResult.catalog.product}"></mx:Tree> 
        <mx:Button label="Get Data" click="srv.send()"/>
    </mx:Application>
    I am able to load into data grid , but not in tree help me

    The same as you have but with embeded XML.
    <mx:XML id="tstData">
    <catalog>
    <product>
    <name>laptop3</name>
    <price>"1256"</price>
    <qty>"45"</qty>
    </product>
    <product>
    <name>"CAR"</name>
    <price>"45000"</price>
    <qty>"7"</qty>
    </product>
    <product>
    <name>"Laptop2"</name>
    <price>"450011"</price>
    <qty>"7022888"</qty>
    </product>
    <product>
    <name>"Laptop"</name>
    <price>"45000"</price>
    <qty>"70"</qty>
    </product>
    <product>
    <name>"Laptop2"</name>
    <price>"45000"</price>
    <qty>"7022"</qty>
    </product>
    <product>
    <name>"Laptop2"</name>
    <price>"45000"</price>
    <qty>"7022888"</qty>
    </product>
    </catalog>
    </mx:XML>
    <mx:Tree labelFunction="treeLabel" width="201" height="100%" showRoot="true"
        showInAutomationHierarchy="true" id="machineTree" dataProvider="{tstData.product}">
    But it doesn't matter.
    try to debug. Add this
                   [Bindable]
                private var treeData:XMLListCollection;
                public function onResult(event:ResultEvent):void
                treeData = new XMLListCollection(XML(event.result).product); // debug here to see what you get and what is a type for this data
              <mx:HTTPService id="srv"  url="http://localhost:8080/SampleWebApp/test.jsp" result="onResult(event)"/>
    And treeData as a dataSource for Tree.

  • Complex xml in tree

    Hi there! I've been reading and googling for ages and I
    cannot find the solution to this problem, I want to load an xml
    into a <mx:tree> but i don't want to load all the xml
    structure. My xml look like this:
    <DataSet>
    <diffgr:diffgram>
    <NewDataSet>
    <Show>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    <episodes>
    <episode1>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    </episode1>
    <episode2>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    </episode2>
    <episode3>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the episode</Title>
    </episode3>
    </episodes>
    </Show>
    <Show>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    <episodes>
    <episode1>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    </episode1>
    <episode2>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the show</Title>
    </episode2>
    <episode3>
    <uselessProperty>asdasd</uselessProperty>
    <uselessProperty1>asdasd</uselessProperty1>
    <uselessProperty2>asdasd</uselessProperty2>
    <uselessProperty3>asdasd</uselessProperty3>
    <Title>Title of the episode</Title>
    </episode3>
    </episodes>
    </Show>
    </NewDataSet>
    </diffgr:diffgram>
    </DataSet>
    I want to know if there is any way I can show the title of
    the show and the titles of the episodes as its children. By this
    time I've been just able to show the whole xml in the tree, but i
    just need those properties. I cannot find information about xml
    that doesn't have this format:
    <node property1="property" property1="property"
    property4="property" property3="property">
    <child property1="property" property1="property"
    property4="property" property3="property"/>
    <child property1="property" property1="property"
    property4="property" property3="property"/>
    <child property1="property" property1="property"
    property4="property" property3="property"/>
    </node>
    Please help me, my eyes will start bleeding if keep googling
    another nite.

    I think you might need to transform your XML into XML
    suitable for the tree, rather than using the original XML
    directly.

  • Need help regarding tree control

    hello guys,
    i m working on one Flex slideshow application and i m using Xml loaded tree control with swf loader for this. i want to create next previus button for nevigate this slideshow but i dont know much about action script... please help me
    i will provide u code of my script if you need to correct it or suggest me how to make it.
    thanks in advance
    sagar

    here is sourcecode of my file
    <?xml version="1.0" encoding="utf-8"?>
    <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" showCloseButton="true" close="PopUpManager.removePopUp(this);" width="1366" height="768" title="Promotions" fontFamily="Verdana" fontSize="13">
        <mx:Script>
            <![CDATA[
                import mx.managers.PopUpManager;
                private function processLogin():void {
                    // Check credentials (not shown) then remove pop up.
                    PopUpManager.removePopUp(this);
             import mx.effects.easing.*;
                     //index button script
             private function toggleBtn(e:MouseEvent):void{
                if(e.currentTarget.label== 'Open')
                    panelOut.play();
                else
                   panelIn.play();
                    import mx.collections.ICollectionView;
                    import mx.events.ListEvent;
                    // tree control script
                private function tree_itemClick(evt:ListEvent):void {
                    var t:Tree = evt.currentTarget as Tree;
                    var dataObj:Object = evt.itemRenderer.data;
                    var item:Object = Tree(evt.currentTarget).selectedItem;
                    if (dataObj.hasOwnProperty("@src")) {
                        swfLoader.source = dataObj.@src;
                    } else if (t.dataDescriptor.isBranch(t.selectedItem)) {
                        swfLoader.source = null;
                        tree.expandItem(item, !tree.isItemOpen(item), true);
                        panel1.status = "";
                private function tree_labelFunc(item:Object):String {
                    var children:ICollectionView;
                    var suffix:String = "";
                    if (tree.dataDescriptor.isBranch(item)) {
                        children = tree.dataDescriptor.getChildren(item);
                        suffix = " (" + item.children().length() + ")";
                    return item.@label + suffix;
                private function swfLoader_complete(evt:Event):void {
                    panel1.status = (swfLoader.bytesTotal/1024).toFixed(2) + 'KB';
                private function init():void
                        systemManager.stage.displayState=flash.display.StageDisplayState.FULL_SCREEN;
            ]]>
            </mx:Script>
            <mx:XML id="dp" source="data/dp.xml" />
       <mx:Canvas x="30" y="-1" width="1315" height="725">
       <mx:Panel id="panel1"
                    width="1310"
                    height="712"
                    backgroundColor="white"
                    borderThickness="0"
                    borderThicknessBottom="0"
                    borderThicknessLeft="0"
                    borderThicknessRight="0"
                    borderStyle="none" cornerRadius="0"
                    headerHeight="0" left="2" y="3">
                <mx:SWFLoader id="swfLoader"
                        scaleContent="true"
                        complete="swfLoader_complete(event);" />
                <mx:ControlBar>
                </mx:ControlBar>
            </mx:Panel>
       </mx:Canvas>
    <mx:Move id="panelOut" target="{panel}" xTo="0" effectEnd="btn.label='Close'"
          duration="500"/>
       <mx:Move id="panelIn" target="{panel}" xTo="-283" effectEnd="btn.label='Open'"
          duration="500"/>      
       <mx:Canvas id="panel" width="314" height="725" x="-283" backgroundColor="#00A2FF" verticalCenter="-1">
          <mx:Grid x="10" y="10" width="299">
             <mx:GridRow width="100%" height="707">
                <mx:GridItem width="100%" height="100%">
                <mx:Tree id="tree"
                        dataProvider="{dp}"
                        labelFunction="tree_labelFunc"
                        showRoot="false"
                        width="269"
                        height="706"
                        itemClick="tree_itemClick(event);"  alpha="0.85" backgroundColor="#C0E1FF"/>
                </mx:GridItem>
                <mx:GridItem width="22" height="100%" verticalAlign="middle">
                   <mx:LinkButton label="" id="btn" width="22"  height="707"
                            click="toggleBtn(event)" icon="@Embed(source='assets/index.png')" enabled="true"/>
                   </mx:GridItem>
             </mx:GridRow>
          </mx:Grid>
           <!--Add the content of your sliding panel here  -->
            </mx:Canvas>
    </mx:TitleWindow>

  • How to binding incoming xml node list to the tree control as dataProvider

    Recently, I faced into one issue: I want to binding incoming xml node (it's not avaliable at start) list to the tree control as a dataProvider.
    Since the incoming xml node list is not avaliable at beginning but I needs to bind it to the tree, so I create one virtual one in the xml, and prepare to remove it before the tree is shown. (ready for the actual node adding). But It did not work.
    Please see the presudo-code here:
    1.  Model layer(CsModel.as)
    public class CsModel
            [Bindable]
            public var treeXML:XML=<nodes><car label="virtualOne" id="1">
                                   </car></nodes>;
            (Here, I want to build binding relationship on the <car/> node,
             one 'virtual/stub' node is set here with lable="virtualOne".
             But this node will be deleted after IdTree
             control is created completely.)      
            [Bindable]
            public var treeData:XMLList =new XMLListCollection(treeXML.car);
    2. view layer(treePage.mxml)
            private var _model:CsModel = new CsModel();
            private function addNode():void
                    var newNode:XML=<car/>;
                    newNode.@label="newOne";
                    newNode.@id=1;
                    _model.treeXML.appendChild(newNode);
                             private function cleanData():void
                                     delete _model.treeXML.car;
            <mx:VBox height="100%" width="100%">
            <mx:Button label="AddNode" click="addNode()" />
            <mx:Tree id="IdTree"  labelField="@label"
              creationComplete="cleanData()"
              dataProvider="{_model}"/>
        </mx:VBox>
    3. Top view layer (App.Mxml)
    <mx:application>
        <treePage />
    </mx:application>
    For method: cleanData(),It's expected that when the treePage is shown, we first delete the virutalOne to provide one 'clear' tree since we don't want show virtualOne to the user. The virutalOne node just for building the relationship between treeData and treeXML at beginning. But the side effect of this method, I found, is that the relationship between treeXML and treeData was cut off. And this leads to that when I added new node (by click the 'addNode' button) to the xmlXML, the xmlData was not affected at all !
    So Is there any other way to solve this issue or bind the incoming xml node list to the xmlListCollection which will be used as Tree control's dataProvider ?

    If u want to display the name : value then u can do like this
    <xsl:eval>this.selectSingleNode("name").nodeName</xsl:eval> : <xsl:value-of select="name" />

  • 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.png

    The 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

  • Tree control and XML

    Hi,
    I have an XML file. I want to display the nodes from the XML
    using a tree control.
    The structure of the XML is
    <grandparent>
    <parent>
    <child1> 1 </child1>
    <child2> 2 </child2>
    <child3> 3 </child3>
    </parent>
    <parent>
    <child1> 4 </child1>
    <child2> 5 </child2>
    <child3> 6 </child3>
    </parent>
    <parent>
    <child1> 7 </child1>
    <child2> 8 </child2>
    <child3> 9 </child3>
    </parent>
    </grandparent>
    Can I display the tree like
    grandparent
    parent
    1
    4
    7
    skipping some children.

    Two choices:
    1. pre-process the xml into a form the tree can render
    directly.
    2. Create a custom Tree Data Descriptor
    Tracy

  • Transfer tree control to subprogram as XML

    I've been pretty happy with the labview tree control except that there doensn't seem to be a method for transferring a complete tree from one vi to another. I finally wrote some functions for converting a tree to/from an xml string. To convert to xml, pass the tree refnum to the subvi and out comes xml. To convert back to a new tree, pass a refnum for a new tree and the xml string. I haven't done any optimization for speed or flexibility, (no documentation yet either) but it works pretty well. The attached code has everything you need - I hope someone else will find this useful. I'd love feedback if anyone tries it.
    thanks,
    George
    Attachments:
    tree-xml.zip ‏86 KB

    Hi, George,
    thank you for your answer. I use LabView tree and work with LabView 2013, maybe the tree itself is not uptodate, but after casting it works, I suppose, that it is just the XML string which you expect to get. I made an XML -display VI using LabView tools from the corresponding library - they are going from node to node getting names and attributes. As a result a tree with 2 columns is displayed. I can send you this VI to have a look at it.
    I found and loaded TestConfiguration.xml, it can be also displayed with my VI, though it uses XSD - my original file doesn't have any XSD, that#s why it may be differen in your solution and in what I have to do.
    I took my tree, "casted" it to your ref and than used "LoadXML" from the XML palett of LabView. I got the parsing error "Line 2, Column 2,  Message: Expected an element name", maybe that means, that some header info is not correct.
    As I see from you VI you convert the tree to an XML- string, and then you can save this string in a file, right? I thought of creating an XML -structure with nodes and attributes just from the tree, but obviously it is a very complicated way, isn't it? My problem is to save changes, which a user has done editing the Tree - it seems to be the simplest way to write donw the TREE  completely in an XML file, because the tree has all the info.  But maybe this way can#t be gone at all :-(.
    Please find attached the VI to display an XML file in a tree with 2 columns. I used this display form as an XML Notepad 2007 does it.
    Thanks
    Attachments:
    DisplayXMLFileAsTreeExample.vi ‏49 KB
    DisplayXML.lvproj ‏3 KB

  • XML for a Tree Control

    I am trying to create a Tree control for my application that lists account reps as branches with their clients as leaves below them.
    I created the xml below from a CGI script, but when the tree renders it the account reps are leaves and the clients don't show up at all. There is evidently something basic I am missing. Can anyone tell me what xml to do what I am shooting for should look like?
    <Result>
    <node>
      <label>Bill Smith</label>
      <data>AM|01</data>
        <node>
          <label>125 Company</label>
          <data>COMPID|2177</data>
        </node>
        <node>
          <label>ABC Manufacturing</label>
          <data>COMPID|2167</data>
        </node>
        <node>
          <label>Test Company</label>
          <data>COMPID|2172</data>
        </node>
    </node>
    <node>
      <label>Jane Jones</label>
      <data>AM|01</data>
        <node>
          <label>126 Company</label>
          <data>COMPID|2100</data>
        </node>
        <node>
          <label>XYZ Service Company</label>
          <data>COMPID|2101</data>
        </node>
        <node>
          <label>Test Company 2</label>
          <data>COMPID|2102</data>
        </node>
    </node>
    </Result>

    At this point it is just a test application so the code is pretty small. For retrieving the data, I pretty much copied code from one of the examples. I created an HTTP request since I plan to return results from a CGI interface rather than a web service. My data provider is derived from the lastResult property of the HTTPService "userRequest".
    <?xml version="1.0"?>
    <!-- containers\layouts\HDivBoxSimple.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" creationComplete="send_data()">
        <mx:Script>
            <![CDATA[
                private function send_data():void {
                    userRequest.send();
            ]]>
        </mx:Script>
        <mx:TitleWindow width="100%" height="100%" layout="absolute" title="Task Management" fontFamily="Verdana" fontSize="12" backgroundColor="#F0F0F0">
            <mx:HDividedBox x="0" y="30" width="100%" height="95%" >
                <mx:Tree width="15%" height="100%" id="treeCompList" dataProvider="{userRequest.lastResult.Result.node}" enabled="true"></mx:Tree>
                <mx:TileList width="60%" height="100%"></mx:TileList>
                <mx:DateChooser width="180"/>
            </mx:HDividedBox>
            <mx:Canvas x="0" y="-10" width="390" height="35">
                <mx:Button x="4" y="10" label="Reports"   cornerRadius="0"/>
                <mx:Button x="80" y="10" label="Due Today"   cornerRadius="0"/>
                <mx:Button x="174" y="10" label="Past Due"   cornerRadius="0"/>
                <mx:Button x="258" y="10" label="Events"   cornerRadius="0"/>
            </mx:Canvas>
        </mx:TitleWindow>
        <mx:HTTPService id="userRequest" url="http://192.168.1.20/cgiGroupFlex.exe" useProxy="false" method="POST">
            <mx:request xmlns="">
                <FUNCTION>GetAMCompList</FUNCTION>
                <FORMAT>TREE</FORMAT>
            </mx:request>
        </mx:HTTPService>
    </mx:Application>

  • Problems handling xml data for tree control.

    Hi,
    I have tried using tree control for displaying my xml data
    but I had a problem that i did not have labels in my xml data. A
    sample xml data is attached. So it displays the whole data at each
    level in the tree. The root label will be the entire the xml data
    and then one level down the remaining xml data and so on...
    How do i solve this issue i,e get the tags names itself as
    labels..
    Thanks in advance....

    An update after some efforts..
    Could get the folders perfectly i.e until the level of
    CPUTime perfectly but could not get the leaf: 32 since i used the
    following to set the label.
    I would like to know if there is a way to find out if a node
    is a leaf or folder and according set the label

  • Reading complex XML file in flex

    I have searched the web but found very primitive xml
    examples. I want to read a complex xml file which through
    httpservice .
    The xml file is ultimately going to become dataProvider of a
    tree. But I have no idea how to traverse this xml file. mentioned
    under are the xml file and HTTPService tag.
    I want to traverse it in the resultHandler function.
    Thank you very much

    Yes, as Greg says, use e4x.
    To do this you must set the HTTPService resultFormat="e4x";
    In you handler, do:
    var xmlResult= XML(event.result);
    trace(xmlResult.toXMLString());
    and away you go.
    Tracy

  • Tree control - How to get the full path of selected Item in tree control

    I am Flex newbie. When the user clicks the particular item in
    the tree control I just wanted to get it name along with it's full
    parent.
    Here is my XML
    var dirXML:XML=<root basename="/home/tcegrid">
    <Directories>
    <Dir Name=".autosave" />
    <Dir Name=".emacs.d" />
    <Dir Name="AnsysDistributed">
    <Dir Name="opt"/>
    <Dir Name="root" />
    </Dir>
    <Dir Name="postgres"/>
    <Dir Name="FineTurbo"/>
    <Directories>
    </root>
    The above XML is data provider for Tree control. When the
    user clicks the Dir Name called opt. I wanted it absolute path in
    XML. say Directories.Dir.Dir.@Name is opt
    Can any one tell me how to get this?

    "Thamizhannal" <[email protected]> wrote in
    message
    news:gam9q8$4es$[email protected]..
    >I am Flex newbie. When the user clicks the particular
    item in the tree
    >control
    > I just wanted to get it name along with it's full
    parent.
    > Here is my XML
    > var dirXML:XML=<root basename="/home/tcegrid">
    > <Directories>
    > <Dir Name=".autosave" />
    > <Dir Name=".emacs.d" />
    > <Dir Name="AnsysDistributed">
    > <Dir Name="opt"/>
    > <Dir Name="root" />
    > </Dir>
    > <Dir Name="postgres"/>
    > <Dir Name="FineTurbo"/>
    > <Directories>
    > </root>
    >
    > The above XML is data provider for Tree control. When
    the user clicks the
    > Dir
    > Name called opt. I wanted it absolute path in XML. say
    > Directories.Dir.Dir.@Name is opt
    > Can any one tell me how to get this?
    loop until the parent() property of the XML node is empty.
    HTH;
    Amy

  • How to render image in tree control without embed it

    Hello frndz i am working on tree control and want to show imagein its node through xml list collection.i have searched a lot for this but in every example with tree control images are embeded.i dont want to hardcode the image.Need to make the image comes from database(Xml).so is there any live or demo example for tree control.
    Thanks in Advance
       Vineet osho

    if you decompile the imaging.ear file, there is a web.xml file which you can add the following parameter:
    <context-param>
    <param-name>oracle.adf.view.rich.security.FRAME_BUSTING</param-name>
    <param-value>never</param-value>
    </context-param>
    or take a look at      Receiving "Warning: Unable to load content in a frame. Frame content will load at the top level." When Trying to Use the <af:inlineFrame> Component [ID 1266770.1] on Oracle Support.
    Make sure you take a copy of the imaging app before you make changes. You can then upload back through the weblogic console.
    Sudi

  • Binding ADF UI to a complex XML Type – Development Productivity, State Mgmt

    Binding ADF UI to a complex Web Service – Development Productivity, Managing State, Etc.
    For those scenarios when ADF UI has to be bound to a complex XML type, it seems that the direction taken by the ADF development team was to generate data-controls that map to complex XML types.
    The major problem with this approach is the fact that application server does not manage state. For example, If application has to submit a purchase order to a web service then application server has to manage the shopping card state until its ready to be submitted.
    In some previous forum threads it had been suggested that using generated data-controls is a “quick and dirty” solution for accessing web services and that a proper solution is to use generated Java Proxy Interface.
    That implies many manually constructed entity objects, associations and overridden doDML methods, which is far less productive compared to entity objects generated from a database schema.
    Suggestion and a Question for the ADF development team
    From the logical model standpoint, there is no difference in between the XML schema and DB schema. Therefore, it is possible to generate entity objects and associations for XML Types of XML schema the same way it’s done for tables of Database schema. The only difference is serialization of CRUD operations on entity objects.
    One way to handle this is:
    -     Generate Application Module for a complex XML type. This application module should have methods for marshaling to/from corresponding XML type.
    -     Generate entity object for each subtype within the complex XML type. In case of nested subtypes, generate association to a parent type.
    -     Generate data control with actions that are bound to web service operations and code that serializes request message from corresponding AM and de-serializes response message to corresponding AM.
    This way, ADF would offer the same productivity for the SOA development as one its currently offering for the ORM development.
    Until the time when something like this is available, what would be the best approach for binding ADF UI to web services?
    Feedback is greatly appreciated.
    Boro Petrovic
    Edited by: wds12518 on Jan 25, 2010 11:49 AM

    We have similar issues as our big portion of the UI is based on WS. We found that there is no easy way to map entity object structure to complex XML type (one EO can based on one flat type or domain can't be bound to UI directly). Oracle PMs, is there any better solution or future plans to address this issue?

  • Items in Tree control move around when data is submitted using custom ItemRenderer

    I'm working on a Tree control with an XMLListCollection as
    its dataProvider.
    The dataProvider has information looking like this :
    quote:
    <?xml version='1.0' encoding='utf-8'?>
    <INFO>
    <FIELD label="STR_USER_NAME"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_EMAIL"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_OPTIONAL"
    type="branch"
    value="0"
    >
    <FIELD label="STR_USER_ADDRESS"
    type="text"
    value=""
    >
    </FIELD>
    <FIELD label="STR_USER_POSTAL_CODE"
    type="text"
    value=""
    >
    </FIELD>
    </FIELD>
    </INFO>
    So in the Tree control I'd like the information to show up
    with a label and
    an
    editable textbox for each item :
    [Label] [textbox]
    To do this I made a tree like this :
    quote:
    <mx:Tree id="userTree"
    editable="true"
    rendererIsEditor="true"
    editorDataField="curVal"
    itemRenderer="{new ClassFactory(ItemRendererUser)}"
    itemEditEnd="e_ProcessData(event);"
    dataDescriptor="{new DataDescriptorUsers()}"
    showRoot="false"
    verticalScrollPolicy="{ScrollPolicy.AUTO}"
    />
    where the e_ProcessData() function looks like this (I used
    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=c
    elleditor_073_16.html#202105 as a guide) :
    quote:
    public function e_ProcessData(event:ListEvent):void
    event.preventDefault();
    userTree.editedItemRenderer.data.@value =
    ItemRendererUsers(event.currentTarget.itemEditorInstance).curVal;
    userTree.destroyItemEditor();
    userTree.dataProvider.notifyItemUpdate(userTree.editedItemRenderer);
    } // END OF e_ProcessData()
    I attached the rest of the files because they're a little
    bit longer.
    When I run the program, the data shows up fine when it is
    initialized the
    very
    first time, and I made a test button that just dumps the
    contents of the
    dataProvider in a trace statement to verify that the data has
    been set
    properly.
    The problem I've run into is whenever the textfield is
    edited, the item
    that
    I've selected jumps around the list.
    For example, if I edit the item "STR_USER_NAME" after I
    finish the edit, it
    will move from the very first position in the Tree to the
    bottom of the
    Tree.
    I traced the contents of the dataProvider and the
    dataProvider structure
    stays
    the same, with the "STR_USER_NAME" at the top, but if I look
    at the flex app
    in
    the web browser, its position is at the bottom of the Tree.
    This happens for every other item I try to edit... I read in
    the
    documentation
    that the ItemRenderers are recycled, so it means I should be
    checking to
    make
    sure the initial states are covered, but I'm not sure how
    this affects my
    application.
    Can anyone help me out with this ? Its very confusing - I've
    tried making
    an
    ItemRenderer using pure actionscript, mxml and the
    combination you see in
    this
    example and I always end up with the same behaviour - So I
    must be missing
    something critical...
    // ItemRendererUsers.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    verticalScrollPolicy="{ScrollPolicy.OFF}"
    horizontalScrollPolicy="{ScrollPolicy.OFF}"
    creationComplete="initItemRendererUsers();"
    >
    From my FAQ:
    Q: I've created a custom itemRenderer component to use in a
    List
    based component (Datagrid, TileList, HorizontalList, etc.).
    When my List
    first displays, everything looks fine, but when I scroll it
    or change the
    dataProvider, some of the itemRenderers show values or
    formatting that
    aren't right. How do I fix this?
    A: List-based components don't draw a renderer for every item
    in the
    dataProvider. Instead, they create enough to display what is
    on screen now,
    plus one or two more waiting in the wings. This means they
    recycle the
    renderers rather than creating new ones when you change
    dataProvider or
    scroll up and down. When you use a creationComplete event to
    set up the
    itemRenderer, that event doesn't happen again when the
    renderer is used for
    a different set of data. The solution to this is to override
    the set data
    protected function that most components have.
    For more information, check out the following resources:
    http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html?devcon=f1
    http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
    Please note, I post this FAQ weekly, and you can find a
    permanent copy of it
    here
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf

    "peterh8234" <[email protected]> wrote in
    message
    news:gaqttd$kft$[email protected]..
    > Yes - the set and get functions are listed down below.
    But the quirky
    > behaviour
    > is the same regardless of whether I override the set and
    get functions or
    > not.
    >
    > I noticed there was another variable called listData -
    should I be using
    > that
    > one or the data variable to read and write to the
    dataProvider ?
    >
    > // _data
    > [Bindable] public var _data:Object;
    > [Bindable("dataChange")]
    > //
    > override public function get data():Object
    > {
    > trace('[ItemRendererDefault.GET data()] called for {' +
    > _data.attribute("label") + '}.');
    > return _data;
    > } // END OF get data()
    >
    > //
    > override public function set data(value:Object):void
    > {
    > _data.@value = inputText.text;
    > trace('[ItemRendererDefault.SET data()] called for {' +
    > _data.attribute("label") + '}.');
    >
    > invalidateProperties();
    > } // END OF set data()
    Your set data needs to set a flag that gets picked up in
    commitProperties()
    and does your thing that you were doing before in
    creationComplete. You
    should see examples of this in the links I posted. Instead of
    this:
    _data.@value = inputText.text;
    you should look at implementing IDropInListItemRenderer,
    which will allow
    you to dynamically determine which field to look at, instead
    of hardcoding
    it. You also might wind up overwriting the stored value with
    a null value
    when the List passes the stored value in. I'd encourage you
    to really go
    through those links I posted and make sure you understand
    what they're
    saying. The itemRenderer life cycle is one of the hardest
    things to
    understand, but once you understand it, it makes many things
    in Flex much
    easier. It's worth investing the time.

Maybe you are looking for