Expand the tree like I want
A JTree like this:
0:model
0.1:jsp1
0.2:jsp2
I want to add jsp1's child node-jspchild1,so the tree will turn into:
0:model
0.1:jsp1
0.1.1:jspchild1
0.2:jsp2
But when I finished adding,the jsp1 is collapsed,how can I expand the tree to the level of my new node?Thank you.
tree.expandPath(new TreePath(((DefaultMutableTreeNode)jspchild1.getParent()).getPath()));Denis
Similar Messages
-
Macking button to expand the tree and collapse tree and another to add node
macking button to expand the tree and collapse tree and another to add node and saving the changes in the database ( this is problem)
and finally delete node from database
so what is proper code for those buttons
thanks my mail is :
[email protected]Hello,
Use the ftree package's functions
code to expand all nodes:
PROCEDURE explose_tree IS
node ftree.node;
htree ITEM;
state varchar2(30);
BEGIN
-- search the tree ID --
htree := Find_Item('BL_TREE.TREE_1');
-- search the root --
node := Ftree.Find_Tree_Node(htree, '');
-- expand all nodes --
WHILE NOT Ftree.ID_NULL(node) LOOP
state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
IF state = Ftree.COLLAPSED_NODE THEN
Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.EXPANDED_NODE);
END IF;
node := Ftree.Find_Tree_Node(htree, '', ftree.find_NEXT,Ftree.NODE_LABEL,'', node);
END LOOP;
END;and to collapse all nodes:
PROCEDURE Implose_tree IS
node ftree.node;
htree ITEM;
state varchar2(30);
BEGIN
-- search the root ID --
htree := Find_Item('BL_TREE.TREE_1');
-- search the root --
node := Ftree.Find_Tree_Node(htree, '');
-- Collapse all nodes --
WHILE NOT ftree.ID_NULL(node) LOOP
state := Ftree.Get_Tree_Node_Property(htree, node, Ftree.NODE_STATE);
IF state = Ftree.EXPANDED_NODE THEN
Ftree.Set_Tree_Node_Property(htree, node, Ftree.NODE_STATE, Ftree.COLLAPSED_NODE);
END IF;
node := Ftree.Find_Tree_Node(htree, '', Ftree.FIND_NEXT,Ftree.NODE_LABEL, '', node);
END LOOP;
END; Francois -
Hi,
I have a tree component in my Application and I have given the dataprovider as XMLListCollection. I would like to have the entire tree as expanded mode(all children) by default. To achieve this, I tried expandItem() method but I couldn't see the entire tree as expanded when I load my application.
Any solution will be helpful for me a lot!
Thanks in Advance,
Srinivasan SA more elegant solution ( in my opinion ) would be to extend the Tree component and implement the desired behavior in a much nicer fashion. It is true that we already have expandChildrenOf(); method that is really great, but if we want to have a nice feature that instantaneously expands or collapses the whole tree more easily ( without having to rewrite the same conditions and who knows what each time we want such a functionality ) then I think that it would be much nicer to extend the Tree component, add the desired feature and start using that custom component instead.
Here's a fast example ( make sure to place this class into a "components" folder if you want to test it ):
package components
import mx.controls.Tree;
* Custom <code>Tree</code> class with custom behavior.
public class ExpandableTree extends Tree
* Flag telling if the tree is expanded or not.
protected var _isExpanded:Boolean = false;
* Constructor.
public function ExpandableTree()
super();
* Used to expand or collapse the <code>Tree</code>.
* @param value Flag telling if we should expand or collapse the <code>Tree</code>.
protected function expandCollapseTree(value:Boolean):void
// Return if there's no data to expand or collapse.
if (this.dataProvider == null)
// The flag should be "false" if no expanding has occurred.
_isExpanded = false;
return;
// Expand or collapse the children.
this.expandChildrenOf(this.dataProvider[0], value);
// Overridden methods
* @inheritDoc
override protected function updateDisplayList(w:Number, h:Number):void
// Expand or collapse the Tree.
expandCollapseTree(_isExpanded);
super.updateDisplayList(w, h);
// Setters and getters
* Set a flag telling if the <code>Tree</code> should be expanded or callapsed.
public function set expanded(value:Boolean):void
// Make sure that the passed value is not the current state.
if (value == _isExpanded) return;
_isExpanded = value;
// Invalidate the display list to signal the change.
this.invalidateDisplayList();
* Returns the current state of the <code>Tree</code>.
public function get expanded():Boolean
return _isExpanded;
Obviously, you can always extend this "skeleton component" and add even more features. Also, there's another fast example to demonstrate the usage of the component I've just posted above ( it's really simple ):
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx = "http://www.adobe.com/2006/mxml"
xmlns:components = "components.*"
backgroundColor = "0xFFFFFF"
backgroundGradientColors = "[0xFFFFFF, 0xFFFFFF]"
layout = "vertical">
<mx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
<node label="Marketing"/>
<node label="Product Management"/>
<node label="Personal"/>
</node>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
</node>
</node>
<node label="Spam"/>
<node label="Sent"/>
</node>
</mx:XMLList>
<components:ExpandableTree
id = "cmpExpandableTree"
width = "400"
height = "300"
showRoot = "false"
expanded = "true"
labelField = "@label"
dataProvider = "{treeData}"/>
<mx:HBox width="400">
<mx:Button
label = "Collapse"
width = "100%"
click = "cmpExpandableTree.expanded = false;"/>
<mx:Button
label = "Expand"
width = "100%"
click = "cmpExpandableTree.expanded = true;"/>
</mx:HBox>
</mx:Application>
So, this would be the "neater solution" ( in my opinion ). But simply using expandChildrenOf(); and passing in the item from where you want to rest of the nodes to expand is just as valid.
With kind regards,
Barna Biro -
Lables fully not visible in the Tree node
Hi friends,
Some text in the tree node were not visible fully.
example : instead of documentation, it just displays doc...
instead of Library, it just displays lib....
And the problem doesn't appear continuously. Sometime the text is fully visible and some time it doesn't.
If I expand the tree the text is fully visible again. I couldn't reproduce the issue continuously. I tried tree.repaint(), tree.validate(), tree.invalidate(), tree.revaidate(). but it didn't work.
Anybody can suggest what would be the exact problem?
Thanks in advance.It's hard to say without seeing the code for TreeTable. But they probably have something like an addNode mothod for the TreeTableNode which will take care of all the updates for you. If you want to do it youself, you will probably have to get the data Model (tree.getModel()???)behind the TreeTable and use one of the fire... methods on it like fireRowChanged(???) or fireTableChanged(???). I would suspect Sun would do it this way.
-
My code to "select" an element in the Tree UI element is not consistently working
Hi,
I created a Web Dynpro component that does many things. One feature is do display information in a Tree UI element. I use the TreeNodeType and recursive context node to build a nice tree representing what the customer wants. Since this tree could get very large, I implemented a search feature to help users locate items in the tree. When found, I expand the tree, and call call set_lead_selection passing in the element where found. This seems to generally work fine (and highlights the highlights the desired TreeNodeType), but only when going farther down in the tree. If I change the search so that it should find something "higher up" in the tree, the search still works, and it finds the data, but calling the set_lead_selection does not seem to unhighlight a previously located TreeNodeType. I have added code to loop through all elements in the tree and call set_selected( ABAP_FALSE). This didn't seem to help. If I use the mouse and manually click on the root of the tree, it seems deselect previously highlight TreeNodeTypes, and the highlighting works again (but still just going forward).
I implemented a Find Next feature that starts where the last search left off, and looks farther down the tree. This works more consistent, but still occassionaly seems to "forget" to unhighlight a previously located TreeNodeType/element.
What am I doing wrong?
I am attaching a screen shot.Hi Perry,
Before setting the lead selection of found result, try to clear all the selected elements from context node.
Sample:
data lo_node type ref to if_wd_context_node.
lo_node = wd_context->get_child_node ( name = 'MY_NODE' ).
"Clear the current selection
lo_node->clear_selection( ).
" now, set the lead selection
lo_node->set_lead_selection( .... )
Hope this helps you.
Regards,
Rama -
Hi,
Database: ORacle 11g
Query1:
SELECT rank() OVER (PARTITION BY mgr ORDER BY empno) r,
empno, ename,mgr FROM emp
start with mgr=7839
connect by prior empno = mgr
Result set:
r empno ename mgr
1
7788
SCOTT
7566
2
7902
FORD
7566
1
7499
ALLEN
7698
2
7521
WARD
7698
3
7654
MARTIN
7698
4
7844
TURNER
7698
5
7900
JAMES
7698
1
7934
MILLER
7782
1
7876
ADAMS
7788
1
7566
JONES
7839
2
7698
BLAKE
7839
3
7782
CLARK
7839
1
7369
SMITH
7902
Query2:
SELECT LTRIM(SYS_CONNECT_BY_PATH(r, '.'), '.') node ,
LPAD (' ', 2 * (LEVEL - 1)) || mgr , struc.*
FROM
SELECT rank() OVER (PARTITION BY mgr ORDER BY empno) r,
empno, ename,mgr FROM emp
start with mgr=7839
connect by prior empno = mgr
) struc
start with mgr=7839
connect by prior empno = mgr
Result set:
node mgr r empno ename mgr
1
7839
1
7566
JONES
7839
1.1
7566
1
7788
SCOTT
7566
1.1.1
7788
1
7876
ADAMS
7788
1.2
7566
2
7902
FORD
7566
1.2.1
7902
1
7369
SMITH
7902
2
7839
2
7698
BLAKE
7839
2.1
7698
1
7499
ALLEN
7698
2.2
7698
2
7521
WARD
7698
2.3
7698
3
7654
MARTIN
7698
2.4
7698
4
7844
TURNER
7698
2.5
7698
5
7900
JAMES
7698
3
7839
3
7782
CLARK
7839
3.1
7782
1
7934
MILLER
7782
Is this representation of node column is correct?
Can anyone pplease explain to me step by step how the above query2 executes
ThanksHi,
GopalaKrishna wrote:
Hi Frank,
Actually I thought there might be some standard representation of node structure in hierarchical tree.That's why I have asked is that representation of node structure correct or not?
Sorry I am newbie in this concepts.
I was expecting the below type of result set but it turned out as above result set in original request.More over I did nt understand sys_connect_by_path at that time I will get back to you once I understand the previous request of mine where you explained it nicely...
1
7839
1.1
7566
1.1.1
7788
1.1.1.1
7876
1.1.2
7902
1.1.2.1
7369
1.2
7698
1.2.1
7900
1.2.2
7521
1.2.3
7499
1.2.4
7654
1.2.5
7844
1.3
7782
1.3.1
7934
Sometimes people attach numbers to the tree like you did, but most of the time they don't find it necessary.
So, you were expecting to see 14 rows of output, starting with the node that represents 'KING'. Instead, you got 13 rows, starting with the people who report directly to 'KING'. If you want to start with 'KING', then change the START WITH clause to start with 'KING':
WITH got_child_num AS
SELECT empno, mgr, ename
, ROW_NUMBER () OVER ( PARTITION BY mgr
ORDER BY empno
) AS child_num
FROM scott.emp
SELECT SUBSTR ( SYS_CONNECT_BY_PATH (child_num, '.')
, 2
) AS node
, LPAD ( ' '
, 2 * (LEVEL - 1)
) || empno AS iempno
, empno, ename, mgr
FROM got_child_num
START WITH mgr IS NULL
CONNECT BY mgr = PRIOR empno
Output:
NODE IEMPNO EMPNO ENAME MGR
1 7839 7839 KING
1.1 7566 7566 JONES 7839
1.1.1 7788 7788 SCOTT 7566
1.1.1.1 7876 7876 ADAMS 7788
1.1.2 7902 7902 FORD 7566
1.1.2.1 7369 7369 SMITH 7902
1.2 7698 7698 BLAKE 7839
1.2.1 7499 7499 ALLEN 7698
1.2.2 7521 7521 WARD 7698
1.2.3 7654 7654 MARTIN 7698
1.2.4 7844 7844 TURNER 7698
1.2.5 7900 7900 JAMES 7698
1.3 7782 7782 CLARK 7839
1.3.1 7934 7934 MILLER 7782
I find it rather neat how the first 2 columns stay a fixed difference apart in this output. As the node column gets bigger or smaller, there is correspondingly more or less padding in the iempno column. -
Hello
I want to get the tree like structure
My requirement is that when I write any jsp and put it in webapps's any
folder I should get tree like structure of the folders in which I am putting my jsp.
Foe example I have structure like
webapps
--rakesh_folder1
--rakesh_folder2
--rakesh_folder3
---rakesh_subfolder1
---rakesh_subfolder2
----(Here goes my jsp which would make to get sructure)
----my_other_file_1
----my_other_file_2
When I type http://localhost:8080/rakesh_folder3/rakesh_subfolder2/jspname
I want output as
--rakesh_folder3
---rakesh_subfolder2
----my_other_file_1 (size of file) (time stamp)
----my_other_file_2 (size of file) (time stamp)
How should I proceed ????????????????????
Tx in advance
Rakeshrakesh,
see if you have tree structure like this
C:\
Vivek
Rakesh
then C:\ is the root from where you are starting.
so just
<html>
<body>
C:\
&nbsp;&nbsp;&nbsp;Vivek
&nbsp;&nbsp;&nbsp;Rakesh
</body>
</html> -
Apple TV3 and the New iPad - I WANT to stream the sound only
Hey guys!
I've got the new iPad and apple tv 3 which is great together!
I have a receiver (which is located in the living room) with Zone2 option and also have outdoor speakers which are connected to that Zone2.
When I sit outside i want to use my great speaker system and use the outdoor speakers using AirPlay and ATV and stream the content to my ATV but the thing is that when i do that I lose my video on the device and the tv shows my video feed.
That of course is a problem coz I enjoy my great speakers but can't watch the video (like YouTube video or something else)...
Is there a way to stream the sound only to the ATV?
I found discussions of people who don't manage to stream their video to the ATV and only managed to stream their sound but that was an error and things like firmware update solved their problem...
Found no discussions of people who TRY to stream only the sound, like I want to...
Does anyone have an idea that can solve my problem?
Thanks a lot in advance!!!
GolanIt's actually very easy and doesn't even require splitting the video stream and extracting the audio track from it (which is pretty easy if you have a desktop computer).
If you don't want to play back protected content (non-music videos purchased from iTunes Store), all you need to do is getting GoodPlayer, letting it play audio in background (Settings > Background Audio) and connect to your ATV in non-AirPlay mirroring mode. It'll happily play back the audio track of the video while you can do anything in the foreground. (Note that, in addition to GoodPlayer, other background audio-playback players may also work - it's just that I've tested GoodPlayer in this regard between my ATV3 and iPad 3. Let me know if you need more - for example, a list - info on them.) -
Apple tv 3 and the New iPad - I WANT to stream only the sound
Hey guys!
I've got the new iPad and apple tv 3 which is great together!
I have a receiver (which is located in the living room) with Zone2 option and also have outdoor speakers which are connected to that Zone2.
When I sit outside i want to use my great speaker system and use the outdoor speakers using AirPlay and ATV and stream the content to my ATV but the thing is that when i do that I lose my video on the device and the tv (which is in the living room) shows my video feed.
That of course is a problem coz I enjoy my great speakers but can't watch the video (like YouTube video or something else)...
Is there a way to stream the sound only to the ATV?
I found discussions of people who don't manage to stream their video to the ATV and only managed to stream their sound but that was an error and things like firmware update solved their problem...
Found no discussions of people who TRY to stream only the sound, like I want to...
Does anyone have an idea that can solve my problem?
Thanks a lot in advance!!!
GolanIt's actually very easy and doesn't even require splitting the video stream and extracting the audio track from it (which is pretty easy if you have a desktop computer).
If you don't want to play back protected content (non-music videos purchased from iTunes Store), all you need to do is getting GoodPlayer, letting it play audio in background (Settings > Background Audio) and connect to your ATV in non-AirPlay mirroring mode. It'll happily play back the audio track of the video while you can do anything in the foreground. (Note that, in addition to GoodPlayer, other background audio-playback players may also work - it's just that I've tested GoodPlayer in this regard between my ATV3 and iPad 3. Let me know if you need more - for example, a list - info on them.) -
How to display grouped tracks tree-like?
I imported lots of classical CDs and I grouped some works using the 'Grouping' field of the song information dialog. The grouping I added appears in the column 'Grouping' , but however, I'd like to have the groupings displayed in a tree-like structure. I know iTunes can do that, because I have seen it in the music store (on some classical CDs).
Unfortunately, the help files and FAQs don't tell a lot about grouping.
How can I enable the tree-like display of groupings in my library?
FYI: I am using iTunes 6.0.1 on Mac OS X 10.0.3
Thanks for any help
MichaelI'd like to have the groupings displayed in a tree-like structure. I know iTunes can do that, because I have seen it in the music store (on some classical CDs).
Ohh! That would be Folder Structure then. A useful feature in other circumstances of running tracks together while in Party Shuffle or Shuffling a list. iTMS can obviously do it, but apparently not iTunes.
Suggest you log a request at http://www.apple.com/feedback/itunes.html
Grouping seems another way of making a regular or smart playlist, but would not affect how those songs get displayed in viewing the library. The word "grouping" gives the impression of doing somethiing more I think. -
Disabling the tree nodes.
hi,
Can anyone tell me , Is it possible to disable the tree nodes?How??so that user cannot perform any action
on tree nodes i.e, expanding the tree node or double clicking the tree node.
Thankx in advance,
Manish.hi,
Can anyone tell me , Is it possible to disable the tree nodes?How??so that user cannot perform any action
on tree nodes i.e, expanding the tree node or double clicking the tree node.
Thankx in advance,
Manish. -
11gR1: expanding the current node in a tree programmatically
Does anybody know how to programmatically expand the currently selected node in an af:tree in 11gR1? In all honesty I've searched a million OTN posts and tried a lot of examples but haven't got it working yet.
At it's most simple I have a tree:
<af:tree id="dirTree" value="#{bindings.NodesViewTree.treeModel}" var="node"
selectionListener="#{tbindings.NodesViewTree.treeModel.makeCurrent}" rowSelection="single"
binding="#{treeBean.dirTree}" >
<f:facet name="nodeStamp">
<af:outputText value="#{node.Name}" id="ot2"/>
</f:facet>
</af:tree>...of which the user can select a node, and the selectionListener updates the treeModel's current selected row.
I want a button whose actionListener programatically takes the current selected row and expands (aka discloses it). I've a bean like follows:
public class TreeBean {
private RichTree dirTree;
public void setDirTree(RichTree dirTree) { this.dirTree = dirTree; }
public RichTree getDirTree() { return dirTree; }
public void doSomething(ActionEvent actionEvent) {
RowKeySet selectedTreeNodes = dirTree.getSelectedRowKeys();
RowKeySet disclosedTreeNodes = dirTree.getDisclosedTreeNodes();
AdfFacesContext.getCurrentInstance().addPartialTarget(dirTree);
}But I can't figure out what to do from here?
Further to this say if we did manage to expand the current selected node, and I happened to know the oracle.jbo.Key of one of the expanded node's child nodes, how can I programatically select it.
As mentioned I know a search of the forums yields a few hits for this topic, but none have yet solved my issue, so I'm hoping somebody can address my problem afresh please.
Thanks for your assistance,
CM.After a lot of playing it appears the JS approach is a dead-end. Ultimately what I'm attempting to achieve is to allow the user to right click a node in a tree, create a new node, and select the new node for the user. This can't be achieved in JS as the main work of creating the node must be done from the bindings/binding classes only accessible in a backing bean.
So I've finally come up with a backing bean code solution where the user selects a node in a tree, and via a secondary action of selecting a context menu commandMenuItem the following code is executed. When I say "code solution", unfortunately I mean something that compiles & runs without throwing errors (hurrah!), but (sigh) doesn't work. I'm hoping somebody on the forum can give me a kick in the right direction please.
The code:
RichTree dirTree;
public void anotherExperimentalCreate(ActionEvent actionEvent) {
String parentNodeType = getSelectedNodeType();
if (parentNodeType.equals(DATABASE)) {
// create user - todo
} else if (parentNodeType.equals(FOLDER)) {
// Fetch data from parent row required for new row
oracle.jbo.domain.Number parentNodeId = getSelectedNodeId();
oracle.jbo.domain.Number parentNodeTypeId = getSelectedNodeTypeId();
DCIteratorBinding treeIterator = AdfUtils.findDCIteratorBinding(NODES_VIEW_TREE_ITERATOR);
RowSetIterator treeRsi = treeIterator.getRowSetIterator();
// Create new row
// Why rsi.createAndInitRow? See - http://radio.weblogs.com/0118231/stories/2003/01/17/whyDoIGetTheInvalidownerexception.html
Row newRow = treeRsi.createAndInitRow(new NameValuePairs(new String[]{"ParentNodeId"}, new Object[]{parentNodeId}));
oracle.jbo.domain.Number newNodeId = (oracle.jbo.domain.Number)newRow.getAttribute("NodeId");
newRow.setAttribute("ParentNodeId", parentNodeId);
newRow.setAttribute("NodeTypeId", parentNodeTypeId);
newRow.setAttribute("Name", "New Folder" + newNodeId.toString());
treeRsi.insertRow(newRow);
// Commit changes and refresh iterator so it places new child row at correct location in tree
FacesCtrlActionBinding commitBinding = AdfUtils.findFacesCtrlActionBinding("Commit");
commitBinding.execute();
treeIterator.executeQuery();
// Rebuild tree's current selected row by grabbing the current selected rows list (from which this action was invoked)
// and add the additional new row to the end, with the goal of making the new row selected.
// For "single" selection tree, and fact this routine can only be invoked via selecting a node, we only need
// first element from iterator
// Technique for casting to list derived from following OTN post:
// ADF Faces - type of key element!
List<Key> currentSelectedRowKeys = (List<Key>)dirTree.getSelectedRowKeys().iterator().next();
ArrayList<Key> newSelectedRowKeys = new ArrayList<Key>();
// Copy existing selected row keys to our new selected row key list
for (Key currentSelectRowKey : currentSelectedRowKeys) {
newSelectedRowKeys.add(currentSelectRowKey);
// Add our new row's key to the end of the list
newSelectedRowKeys.add(newRow.getKey());
RowKeySetTreeImpl newSelectedRowKeySetTree = new RowKeySetTreeImpl();
newSelectedRowKeySetTree.add(newSelectedRowKeys);
// **** doesn't work ****
dirTree.setSelectedRowKeys(newSelectedRowKeySetTree);
AdfFacesContext.getCurrentInstance().addPartialTarget(dirTree);
}As per the "doesn't work" annotation above, the problem is when the tree is refreshed via the PPR event, the tree hasn't selected the new row as passed to setSelectedRowKeys. Instead the state of the tree (expand/collapse) is the same as before the code is fired, though the new row is present as a child.
Has anybody any clues at all on what I can attempt to try next please?
Regards,
CM. -
How to create a tree structure,like I want to create Bill/Payment Tree
How to create a tree structure , like I want to create a Bill/Payment Tree containing a single node for all A/R related activities for a specific bill period, in reverse chronological order. Basically the tree should look like
+ Bill - Date: 03-17-2010 Complete
+++++ CR Note - Date: 05-04-2010 Complete
++++++++++ Pay - Date: 05-04-2010 Frozen
+ Bill - Date: 03-17-2010 Complete
+++++ Pay - Date: 05-04-2010 Frozen
And finally this should be attached as tab on the control centralThe FTree package provides functions to populate the tree - look for the topic "Manipulating a hierarchical tree at runtime
" in the online help this point to all the functions and triggers -
JTree - How to Expand all Nodes in the Tree
I have a tree that has one primary node, two sub-nodes, and multiple sub-sub-nodes under those. I want to expand (show) all these nodes in the tree when the tree first loads. I tried expandRow() but that only seems to expand one row at a time by entering a single integer for the row. Is there any way to expand all rows/nodes when loading the tree?
see
http://forum.java.sun.com/thread.jsp?forum=57&thread=148793 -
How to expand all the nodes in a tree while loading the tree initially
Hi All
Now i am able to display the tree strucute in webdynpro.
but it is displaying the tree initially in collapsed mode until/unless we click on the node root it will be expanded.
but my requirement is i wanted to display the tree in expanded mode by default at runtime initially.
can you please provide any setting to be done or any sample code on the same then it would be great help to me.??
Thanks
TrishaHi,
isLeaf is an attribute you need to create under "CatalogEntries" node. And "isRoot" is not requried.
Download the sample project "TutWD_TreeByNestingTableColumn". See the below link to dnld this project.
https://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/503f22f6-b978-2a10-bf97-ddc21267e752 [original link is broken]
Do the changes in sample project as below:
Invoke this method in the init method as below (as it is in the same project).
addCatalogEntries(wdContext.nodeCatalogEntries(), "ROOT");
Change the code in addCatalogEntries() method as below.
Here we are calling the addCatalogEntries() method recursively for all the parent elements and we are changing the setExpanded property to true.
public void addCatalogEntries( com.sap.tut.wd.treetable.wdp.IPrivateTreeTableView.ICatalogEntriesNode node, java.lang.String parentId )
//@@begin addCatalogEntries()
IPrivateTreeTableView.ICatalogEntriesElement newCatalogEntriesElement;
for (int i = 0; i < Catalog.getLength(); i++) {
if (parentId.equals(Catalog.getParentId(i))) {
// create new context node element
newCatalogEntriesElement = node.createCatalogEntriesElement();
node.addElement(newCatalogEntriesElement);
// provide node elements with data
newCatalogEntriesElement.setID(Catalog.getCATALOGID(i));
newCatalogEntriesElement.setTITLE(Catalog.getTITLE(i));
newCatalogEntriesElement.setDESCRIPTION(Catalog.getDESCRIPTION(i));
newCatalogEntriesElement.setAMOUNT(Catalog.getAMOUNT(i));
if ("ARTICLE".equals(Catalog.getCATALOGTYPE(i))) {
// checkbox is visible by default
newCatalogEntriesElement.setPUBLISHED(Catalog.getPUBLISHED(i));
// third level is last level
newCatalogEntriesElement.setIsLeaf(true);
} else {
// a CATEGORY does not use the checkbox column
newCatalogEntriesElement.setUsageOfPublishedAttribute(WDVisibility.BLANK);
newCatalogEntriesElement.setIsLeaf(false);
newCatalogEntriesElement.setChildrenLoaded(true);
newCatalogEntriesElement.setExpanded(true);
addCatalogEntries(newCatalogEntriesElement.nodeChildCatalogEntries(),newCatalogEntriesElement.getID());
Maybe you are looking for
-
Newbie question saving data to a VO
I have a datagrid with a list of files. I'd like the user to be able to select one or more files and add text/data in a form. On a click event I'd like to save the form data and to a VO for the selected file. Eventually I'll pass the an array of Asse
-
TNSLSNR encountered a problem and needs to close error
I have taken Reliance Netconnect Datacard connection 4 days back. Since 4 days i have been trying to install Oracle 9.2 on windows, I keep on getting the error "TNSLSNR has encountered error and needs to close " during database creation from Databas
-
I have a problem when I try ti upload a file
I have a JSP to upload files, it runs pepertly in windows, but when I tyr to run it in linux, it doesn't work <--- The Source JSP page---> <html> <head> <title>DATOS GENERALES</title> <link href="../estilos.css" rel="stylesheet" type="text/css"> <scr
-
Has anyone tried to build a better blog on BC using WebApps only?
In the past I have considered trying to get around some of the limitations of the BC blog system by using WebApps but felt wasn't really possible without a lot of hacks and work-arounds. But now we have some recent upgrades to BC that have me thinkin
-
Mail text viewing size versus sent item font size
Hi there, I recently tried to increase the font size on my iMac Mail application so that I can read the messages in my inbox a bit clearer - and with great success! I found the section in the 'Fonts & Colors' tab of Mail Preferences and increased my