Tree control with xml last node!
The question is how to view the tree lastleaf as last
nodename + nodevalue in an xmlobject?
<node1>
<node1a>10
</node1a>
</node1>
<node2>
<node2a>
<node2b>20
</node2b>
</node2a>
</node2>
I want the tree structure like:
Node1 (folder icon)
Node1a = 10 (doc icon)
Node2
Node2a
Node2b = 20 (doc icon)
In Flex the tree views:
Node1 (folder icon)
Node1a (folder icon)
10 (doc icon)
Node2
Node2a
Node2b (folder icon)
20 (doc icon)
in my app I get a result from a webservice that returns some
nodes that can have one or more values. Say Node1a can have 10, 34,
43, so in the tree leaf I it should view Node1a = 10, 34, 43.
Any suggestions?
The problem is when the value is between xml tags (
<node>value</node>) the node name gets folder icon and
value gets doc. icon.
With lot of last elements, one has to click every node to see
the values.
With labelFunction every leaf gets null value:
If hasComplex return localname
Else
Return localname + children
When I try to pars xml to new one, hasChildren returns true
for las element, and if there is no value the node shows null.
Then walking the xml recursively how do I insert the nodes in
new xml with the same structure but tags like (<node
data=”value” />)? (to XMLListCollection)
Hope it’s clearer
Similar Messages
-
Tree control with Nodes in ALV
Hi ABAP Gurus,
I am trying to create tree control with nodes in ALV. I have referred to standard BCALV_TREE* programs but new to OO programming. Not sure as to how I can display my internal table data than the SFLIGHT information in these programs. Can you please let me know how this can be done or if I can use any ALV function modules for the node display.
thanks,
ChaitanyaMaybe you could use this. Call this VI from a Value Change event of the tree.
Attachments:
Check_Tree_Items.vi 28 KB -
I was reading through Frank Nimphius's Blog and found the entry entitled "ADF Faces: Building a hierarchical tree from recursive tables - October 05, 2006" and found a tree example in which a tree leaf with no child nodes do not display the folder icon.
I've followed the instructions listed with adf:tree, CoreTree and ChildPropertyTreeModel, but my tree leaves with no child nodes still displays the folder icon.
How do I remove this icon when the node is a leaf with no children?
Thanks,
--ToddI figured it out.
I used the ChildPropertyTreeModel.isContainer() method.
--Todd -
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,
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 -
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>
************************************************************** -
Change the selection of tree control with a right click
How is it possible to change the item selected in a tree control (LabVIEW7) with a mouse right click ?
Filippo,
Here is a popup menu toolkit, with an additional example for a listbox. If I
understand your problem, it shouldn't be hard to change it to a tree
control.
Regards,
Wiebe.
"Filippo" wrote in message
news:[email protected]..
> Sorry for my english ! If you can send me an example, it could be very
> useful for me.
> My e-mail is : [email protected]
> Thanks.
> Regards,
>
> Filippo
[Attachment Menu 042004.zip, see below]
Attachments:
Menu_042004.zip 175 KB -
Don't see parent and child nodes in tree control with switcher, enclose xml
Hi, i.m a novice for jdev 11.1.1.2,
i need to create a tree menu, but when i put the switcher + n°2 face whith link object, inside the tree and
run my application i don't see the node, but i see the bookmarks that collapease and expand Why ????
Thanks for your help
Gio
enclose xml for better clarification:
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:messages id="m1"/>
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl4">
<af:panelSplitter id="ps1" splitterPosition="156"
inlineStyle="width:534px;">
<f:facet name="first">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl3">
<af:panelHeader text="panelHeader 1" id="ph1">
<f:facet name="context"/>
<f:facet name="menuBar"/>
<f:facet name="toolbar"/>
<f:facet name="legend"/>
<f:facet name="info"/>
<af:tree value="#{bindings.DepartmentsViewTree.treeModel}"
selectionListener="#{bindings.DepartmentsViewTree.treeModel.makeCurrent}"
rowSelection="single" id="t1" var="node">
<f:facet name="nodeStamp">
<af:switcher id="s1"
facetName="#{node.hierType.viewDefName}">
<f:facet name="DepartmentsView">
<af:panelGroupLayout id="pgl1">
<af:commandLink text="#{node}"
action="#{MainPageBean.departmentRegionLayout}"
id="cl1">
<af:setActionListener from="#{node.DepartmentId}"
to="#{pageFlowScope.TreeKey}"/>
</af:commandLink>
<af:commandLink text=" (Edit)"
action="createEdit" id="cl2">
<af:setActionListener from="#{node.DepartmentId}"
to="#{pageFlowScope.DeptTreeKey}"/>
</af:commandLink>
</af:panelGroupLayout>
</f:facet>
<f:facet name="EmployeesView">
<af:commandLink text="#{node}"
action="#{MainPageBean.employeeRegionLayout}"
id="cl3">
<af:setActionListener from="#{node.EmployeeId}"
to="#{pageFlowScope.TreeKey}"/>
</af:commandLink>
</f:facet>
</af:switcher>
</f:facet>
</af:tree>
</af:panelHeader>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout layout="scroll"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
id="pgl2">
<af:region value="#{bindings.dynamicRegion1.regionModel}"
id="dynam1" partialTriggers="::t1"/>
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
</af:panelGroupLayout>
<!-- id="af_one_column_stretched" -->
</f:facet>
</af:panelStretchLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>
Edited by: user595664 on 5-dic-2009 2.54
Edited by: user595664 on 5-dic-2009 2.57Hi,
you need to provide the full naming for the facet names. So instead of DepartmentsView you provide mypackage.DepartmentsView where you replace mypackage with the package structure of the the ViewObject
Frank -
Tree Control with mulitple columns
How can you retreive data from multiple columns? I can only retrieve data from first column in tree.
thx
Solved!
Go to Solution.You can set the Active Cell -> Active Column Number and then get the Active Cell -> String.
Regards, Vt133 -
Newbie: Using Fields with XML and Node.getNodeType()
How do I know what returned value from the getNodeType method corresponds to the field values? Looking at the documentation for the Node object I can see where the fields are listed, but there are no corresponding values?
For instance I used "getNodeType" on an Element Node and it returned a short value (1). How do I know that 1 corresponds to Element_Node?
Hope I explained this well enough... I'd appreciate any help.This is a common problem fo beginners. My best programming instructor said that you should never hard code literal numbers into a method. So to be more direct here's how you do it.
//some node is a reference to an instantiated node
if (someNode.getNodeType() == Node.ELEMENT_NODE) {
//this is an element node
//or
switch (someNode.getNodeType()) {
case ELEMENT_NODE:
//this node is an element node
break;
case ATTRIBUTE_NODE:
//this node is an attibute node
break;
} -
Hi,
I am writing a program and I need to dispaly two XMLs
(preferably in tree control). The leaf nodes in the two XMLs are
realted and I need to connect them with lines in the two trees. How
do I do this. Any poniters?
Regards,
RajI am tring for something like Araxis merge GUI.
-
Scaling in F.01 with ALV Tree Control
Hi Experts,
Is there any possibility of generating the financial statements in F.01 in ALV tree control with amount scaled to 3 or 5 zero's. When i try to use ALV with scaling, the scaling is reset to 0
Thanks in AdvanceNelow message will appear and not possible technically
Output option ALV Tree Control: Parameter Scaling set to 0/0
Message no. FR098
Diagnosis
You selected output option ALV Tree Control. For technical reasons, only the value 0/0 is possible for the parameter Scaling.
System Response
Parameter Scaling set to the value 0/0.
Procedure
If you want to compare the program output for output options ALV Tree Control and Classical list, you have to also set the parameter Scaling to '0/0' when running the program with output option Classical list. -
How to works with a tree control in LV7.1
Hi,
I am needing some help with a tree control.
I have a tree control with two colluns, and I would like to double click on a item in the first collun and this iten
must be send to the second collun in the first blank line avaible.
Can you guys help me with that ?
Thanks
EduardoHi
what erectly the problem is ?
Things are same in CE 7.1 also.
Check this [thread|Help on WebDynpro - Tree Structure in a Table;
BR
Satish Kumar
Edited by: satish jhariya on Mar 3, 2009 11:35 AM -
Not able to get the database data into the Tree Control
Hi Everybody,
I have to populate the tree control with nodes and items, which is to be populated from the database, and the tree control is <b>dynamic</b>. I mean, there is a <b>toolbar</b>, whenever a <b>pushbutton is clicked</b>, depending on that the tree contents has to be changed.
If anybody had worked with <b>CL_GUI_COLUMN_TREE</b> control to get the data from database, depending upon the <b>pushbutton selected in Toolbar</b>, please paste the seudocode for it.
Regards,
Abdul,
Intelligroup.
P.S: Helpful answers will be rewarded.have you seen this demo program
SAPCOLUMN_TREE_CONTROL_DEMO
Regards
Raja -
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
-
Update 7.5.2 breaks rtsp
7.5.2 firmware update breaks H.264 streaming video. It's not NAT port forwarding because I can stream using same playlist settings via tethered phone. I'm considering reinstalling previous firmware (I think that is 7.5.1 - comments?)
-
The white background screen for messages & emails are entirely too bright & bland. Will there be an update where the user can select their own color background for emails & text messages?
-
Is there a way to adjust the column width of only one cell
Using iWork '09: specifically Keynote '09 and want to adjust the column width of just one cell in the column, not the other cells in the whole column just this one individual cell. Have no idea how to do it though. Checked the manual and this discuss
-
Uploading Number with Two Decimal Places
I am trying to import data from my excel file to table in the database using SQL Developer. It is working fine except that in my excel file I have data with two decimal places, but during import it shows only one decimal place. Is there any way I can
-
Extract/download catalogs from SRM CCM2.0
Hello, Does anybody know how to download/extract catalogs from SRM CCM2.0 catalog? Regards, Vikas