ADF Tree (10.1.3) Programmatically select Tree node
Hi,
i want to pre-select a specific treenode in an af:tree programmatically. I got it nearly working with using a CoreTree-binding in the backing bean using set setFocusRowKey method. After that, the node is selected properly, but when selecting another node in the tree via the UI, the programmatically selected node is not deselected, means in the display is see two selected nodes.
Any ideas ?
Tia,
Andreas
Hi,
is this the same as
Re: Facing a problem in programmatically setting focus on a node in <af:tre
Frank
Similar Messages
-
Programmatically selecting a Tree node
Hi there,
Given a TreePath object, I need to know how to programmatically select a tree node on a JTree.
Here's the situation:
I have a simple text editor project which has a JTree on its interface representing the local file system. The program has a SaveAs dialog box which also has a duplicate JTree as the one on the main interface (directories only). As the user selects the directory in which they wish to save the open file in the SaveAs dialog box, I need somehow to programmatically cause the JTree on the main interface to correspondingly select the same directory. How is this done?
The whole point of this is so that I can then add a new leaf node to the tree at the specified directory location. I've tried simply setting the jTree1.setSelectionPath(...) method and even tried to call the valueChanged(...) method of the TreeSelectionListener object as you can see from the code snippet below, but none of these approaches have been successful.
Please advise,
Alan
public void createLeafNode()
jTree1.repaint();
if(path == null)
return;
jTree1.setSelectionPath(path);
//SelectionListener.valueChanged(new TreeSelectionEvent(jTree1, path, true, oldLeadPath, newLeadPath));
//System.out.println("path is: " + path.toString());
DefaultTreeNode parent = getTreeNode(path);
//System.out.println("parent is " + parent.toString());
//Create the child node
IconData idata = new IconData(ICON_LEAF, new FileNode(new SpecialFile(ref.FileOpen)));
DefaultTreeNode node = new DefaultTreeNode(idata);
parent.add(node);
//Tell the model that the tree structure has changed
model.nodeStructureChanged(parent);
path = path.pathByAddingChild(node);
jTree1.scrollPathToVisible(path);
//jTree1.repaint();Yes, I've tried setSelectionPath(TreePath path) numerous times, but it does nothing to select the node on the tree! You can see from the code I submitted that it is there commented out.
Ordinarily, when you click on a node on the tree it becomes the "active" node, evident because it becomes highlighted. But when I use setSelectionPath(TreePath path) method, giving it the path it needs, the node on the tree doesn't become the "active" node, therefore, not selected! Furthermore and subsequently, the rest of the code in the method createLeafNode() doesn't add a new node to the tree in the location specified by the TreePath object!
If you have used setSelectionPath(TreePath path) before successfully I would be interested in seeing a small sample program demonstrating its use. It would have to prove to me that you can select a node in the tree without physically clicking on any node in the tree with the mouse cursor, and add a new child node to that selected node.
I submit to you a small test program I put together that demonstrates the "typical setup". It requires the user to physically click on a node of the tree, then click on a button that adds a new node in the location of the selected node. If you can alter this program demonstrating that you can add a new node to the tree without my having to click on any node of the tree with my cursor, then I'll assign you the Duke Dollars and be forever humbled by your programming prowess.
Thanks for keeping on top of this thread as I've tried everything I can think of to try and make my program work. If you need to ask any questions please ask away. Perhaps there is something about my program that I've not explained yet that you're not aware of that I should have included. At this point I can't see the forest for the trees.
Alan
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JTree;
import javax.swing.event.*;
import javax.swing.tree.*;
public class AddNodeExample extends JFrame implements ActionListener
JTree jTree1 = null;
DefaultTreeModel model = null;
DefaultMutableTreeNode rootNode = null;
JScrollPane jScrollPane1 = null;
JLabel status = new JLabel("Status:");
TreePath path = null;
JButton add = new JButton("Add new node");
public static void main(String[] args)
AddNodeExample example = new AddNodeExample();
example.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public AddNodeExample()
super("Add Node To JTree Example");
setSize(400, 300);
jScrollPane1 = new JScrollPane();
add.addActionListener(this);
DefaultMutableTreeNode[] boys = new DefaultMutableTreeNode[6];
boys[0] = new DefaultMutableTreeNode("Harry");
boys[1] = new DefaultMutableTreeNode("Tom");
boys[2] = new DefaultMutableTreeNode("Jake");
boys[3] = new DefaultMutableTreeNode("Brian");
boys[4] = new DefaultMutableTreeNode("Alan");
boys[5] = new DefaultMutableTreeNode("Guy");
DefaultMutableTreeNode[] girls = new DefaultMutableTreeNode[6];
girls[0] = new DefaultMutableTreeNode("Debbie");
girls[1] = new DefaultMutableTreeNode("Jane");
girls[2] = new DefaultMutableTreeNode("Sally");
girls[3] = new DefaultMutableTreeNode("Jessica");
girls[4] = new DefaultMutableTreeNode("MoonUnit");
girls[5] = new DefaultMutableTreeNode("Sara");
rootNode = new DefaultMutableTreeNode("Students");
DefaultMutableTreeNode Boys = new DefaultMutableTreeNode("Boys");
DefaultMutableTreeNode Girls = new DefaultMutableTreeNode("Girls");
//Fill up the node for boys
for(int i = 0; i < boys.length; i++)
Boys.add(boys);
//Fill up the node for girls
for(int i = 0; i < girls.length; i++)
Girls.add(girls[i]);
//add Boys and Girls to rootNode
rootNode.add(Boys);
rootNode.add(Girls);
model = new DefaultTreeModel(rootNode);
jTree1 = new JTree(model);
jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTree1.putClientProperty("JTree.lineStyle", "Angled");
jTree1.addTreeSelectionListener(new TreeSelectionListener()
public void valueChanged(TreeSelectionEvent event)
path = event.getPath();
DefaultMutableTreeNode node = getTreeNode(path);
status.setText("Selected: " + (String)node.getUserObject());
jScrollPane1.getViewport().add(jTree1, null);
getContentPane().add(jScrollPane1, BorderLayout.CENTER);
getContentPane().add(add, BorderLayout.NORTH);
getContentPane().add(status, BorderLayout.SOUTH);
setVisible(true);
public DefaultMutableTreeNode getTreeNode(TreePath path)
return (DefaultMutableTreeNode)(path.getLastPathComponent());
public void actionPerformed(ActionEvent e)
jTree1.repaint();
if (path == null || path.getPathCount() < 1)
return;
DefaultMutableTreeNode treeNode = getTreeNode(path);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("My New Node");
treeNode.add(newNode);
model.nodeStructureChanged(treeNode);
path = path.pathByAddingChild(newNode);
jTree1.scrollPathToVisible(path); -
Tree Control Highlighti​ng Programmat​ically Selected Item
Does anyone know whether it is possible to highlight a programmatically selected item in the LV Tree Control, eg I have used the "Get Child" method to select an item - how do I then highlight this item on the tree?
Yes, you can write the value to a local variable for the tree control. This will have the effect of selecting the item--which will highlight just ike the user clicked on it.
By the way, "Get Child" doesn't select an item in any sort of useful sense--it just tells you what the child is. Actually, it tells you what the first child under the indicated Parent is.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Version: Jdeveloper 11.1.2.1.0
how to get programmatically tree node value.
i have tried but cann't read value from selected node.
please help me.
here is my application creation steps:
1. New Application
2. Fusion Web Application (ADF) Template
3. Create View Object VOTreeMst
Query:
Select Department_Name,Department_Id
From Departments
4. Create View Object VOTreeChd
Query:
Select Last_Name,Employee_Id,Department_Id
From Employees
5. Create View Link VLTreeMstChd
VOTreeMst.DepartmentId=VOTreeChd.DepartmentId
And Add to Application Module
6. Create page page1 in ViewController
New-->Web Tier-->JSF/Facelets-->Page
Selected Document Type JSP XML
7. Drag VOTreeMst1 From Data Controls into page1
and select Tree-->ADF Tree
8. ADD java Code into selection Listener
public void nodeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
CollectionModel collectionModel = (CollectionModel)tree.getValue();
treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
String rowType = rw.getStructureDef().getDefName();
if(rowType.equalsIgnoreCase("VOTreeMst")){
System.out.println("This row is a department: " + rw.getAttribute("DepartmentId"));
else if(rowType.equalsIgnoreCase("VOTreeChd")){
System.out.println("This row is an employee: " + rw.getAttribute("EmployeeId"));
else{
System.out.println("Huh ????");
// ... do more usefuls stuff here
9. when i click on first node it is working but i click on second node it is not working
error message::
<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
javax.el.ELException: java.lang.NullPointerException
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1589)
at org.apache.myfaces.trinidad.component.UIXTree.broadcast(UIXTree.java:237)
<RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
javax.el.ELException: java.lang.NullPointerException
I have also tried using following code but same problem
public void onTreeSelect(SelectionEvent selectionEvent) {
//original selection listener set by ADF
String adfSelectionListener = "#{bindings.VOTreeMst1.treeModel.makeCurrent}";
//make sure the default selection listener functionality is preserved.
//you don't need to do this for multi select trees as the ADF binding
//only supports single current row selection
/* START PRESERVER DEFAULT ADF SELECT BEHAVIOR */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class,
new Class[] { SelectionEvent.class });
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVER DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
//get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
//for single select configurations, thi sonly is called once
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding)((CollectionModel)tree.getValue()).getWrappedData();
JUCtrlHierNodeBinding nodeBinding = treeBinding.findNodeByKeyPath(key);
Row rw = nodeBinding.getRow();
//print first row attribute. Note that in a tree you have to determine the node
//type if you want to select node attributes by name and not index
System.out.println("row: " + rw.getAttribute(0));
But
If i create .jspx page From
Web Tier->Jsp->page Then it is working fine
when i create .jspx page From
Web Tier->JSF\Facelets->page Then it is not working
i need to get value from "Web Tier->JSF\Facelets->page"
is there any help please?You should try Franks generic selectionListener http://www.oracle.com/technetwork/developer-tools/adf/learnmore/25-generic-tree-selection-listener-169164.pdf. For help on hoe to get the selected tree node data check http://www.oracle.com/technetwork/developer-tools/adf/learnmore/26-get-selected-tree-node-data-169165.pdf
Timo -
Programmatically disclosing a node in tree
Hello Gurus,
I am new in adf and using jdev 11.1.2.3.
I am trying to disclose a node of tree on clicking commandImageLink added in tree. I am working with Dynamic UI shell. On navigation facet i have a tree. I want to disclose tree when click on link. Node code is working fine for root nodes but when i click on child node it raise a NPE. here is my code for tree and java script.
<af:tree value="#{bindings.rootNoods.treeModel}" var="node"
binding="#{backingBeanScope.Launcher.tree}" summary="Menu Tree"
rowSelection="single" id="t1" selectionListener="#{bindings.rootNoods.treeModel.makeCurrent}">
<af:clientListener method="expandNode" type="selection"/>
<f:facet name="nodeStamp">
<af:commandImageLink id="cil1"
actionListener="#{backingBeanScope.Launcher.showTab}"
text="#{node.Text}"
icon="#{node.Nodeimage}"
styleClass="leaf" >
</af:commandImageLink>
</f:facet>
</af:tree>
Here is java script.
<af:resource type="javascript">
function expandNode(evt){
var tree = evt.getSource();
var rwKeySet = evt.getAddedSet();
var firstRowKey;
for(rowKey in rwKeySet){
firstRowKey = rowKey;
break;
if (tree.isPathExpanded(firstRowKey)){
tree.setDisclosedRowKey(firstRowKey,false);
else{
tree.setDisclosedRowKey(firstRowKey,true);
</af:resource>
Here is my stack trace
<RichExceptionHandler> <_logUnhandledException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
java.lang.NullPointerException
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.findChildNode(JUCtrlHierNodeBinding.java:879)
at oracle.jbo.uicli.binding.JUCtrlHierBinding.bringNodeToRangeKeyPath(JUCtrlHierBinding.java:788)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.bringNodeToRangeKeyPath(FacesCtrlHierBinding.java:111)
at oracle.adfinternal.view.faces.model.binding.RowDataManager.setRowKey(RowDataManager.java:130)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setRowKey(FacesCtrlHierBinding.java:830)
at org.apache.myfaces.trinidad.component.UIXCollection.setRowKey(UIXCollection.java:513)
at org.apache.myfaces.trinidad.component.UIXCollection.processSaveState(UIXCollection.java:270)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:175)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at oracle.adfinternal.view.faces.taglib.region.IncludeTag$FacetWrapper.processSaveState(IncludeTag.java:668)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:215)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:175)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:175)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at org.apache.myfaces.trinidad.component.TreeState.saveState(TreeState.java:175)
at org.apache.myfaces.trinidad.component.UIXComponentBase.processSaveState(UIXComponentBase.java:1043)
at javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:1157)
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl.saveView(StateManagerImpl.java:193)
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:249)
at org.apache.myfaces.trinidadinternal.application.ViewDeclarationLanguageFactoryImpl$ChangeApplyingVDLWrapper.renderView(ViewDeclarationLanguageFactoryImpl.java:350)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:273)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:165)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:1035)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:342)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:236)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
<18-Dec-2013 4:06:51 o'clock PM EST> <Error> <HTTP> <BEA-101020> <[ServletContext@13230084[app:sasapp module:sasapp path:/sasapp spec-version:2.5]] Servlet failed with Exception
java.lang.NullPointerException
at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.findChildNode(JUCtrlHierNodeBinding.java:879)
at oracle.jbo.uicli.binding.JUCtrlHierBinding.bringNodeToRangeKeyPath(JUCtrlHierBinding.java:788)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding.bringNodeToRangeKeyPath(FacesCtrlHierBinding.java:111)
at oracle.adfinternal.view.faces.model.binding.RowDataManager.setRowKey(RowDataManager.java:130)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.setRowKey(FacesCtrlHierBinding.java:830)
Truncated. see log file for complete stacktrace
>
Thanks in advancehttps://blogs.oracle.com/jdevotnharvest/entry/how_to_programmatically_disclose_a
-
Tree Bean - how to select a node?
Can someone help how to select a node of the Tree based on the key programmatically?
Hi there..
I use a code like this..
[Bindable] public var selectedNode:XML;
[Bindable] public var mynewVar:String;
public function treeChanged(event:ListEvent) : void {
selectedNode = Tree(event.target).selectedItem as XML;
mynewVar = selectedNode.@nameofNode;
Cheers! -
How can I link to pages in a 2 level popup index/selection tree with java script?
I can do a single level popup index using the java script below (#1) and link the selections to pages but to change to a 2 level popup index selection tree as below (#2) I can't seem to figure out how to link to pages. Any help greatly appreciated. Thanks
1
var itemIndex = app.popUpMenu("INTRODUCTION", "ALPHABET", "GRAMMAR", "NUMBERS", "DATES & TIME", "GETTING TO KNOW PEOPLE", "PHRASES FOR LEARNING", "DIRECTIONS & TRANSPORTATION", "DESCRIBING THE TRAIL", "DO'S & DON'TS", "EQUIPMENT", "FOOD", "INTRODUCING A VILLAGE", "CULTURE AND ETHNIC GROUPS", "HANDICRAFTS", "TEMPLES & MONKS", "AGRICULTURE", "ANIMAL HUSBANDRY", "SCHOOL & EDUCATION", "LEADING A TREK", "NATIONAL PROTECTED AREAS", "IDENTIFYING WILDLIFE", "PLANTS & FORESTS", "BOATS", "CAVES", "HEALTH AND SAFETY")
switch (itemIndex) {
case "INTRODUCTION":
this.pageNum = 1
break
case "ALPHABET":
this.pageNum = 2
break
case "GRAMMAR":
this.pageNum = 5
break
case "NUMBERS":
this.pageNum = 30
break
case "DATES & TIME":
this.pageNum = 35
break
case "GETTING TO KNOW PEOPLE":
this.pageNum = 42
break
case "PHRASES FOR LEARNING":
this.pageNum = 56
break
case "DIRECTIONS & TRANSPORTATION":
this.pageNum = 59
break
case "DESCRIBING THE TRAIL":
this.pageNum = 63
break
case "DO'S & DON'TS":
this.pageNum = 68
break
case "EQUIPMENT":
this.pageNum = 74
break
case "FOOD":
this.pageNum = 83
break
case "INTRODUCING A VILLAGE":
this.pageNum = 96
break
case "CULTURE AND ETHNIC GROUPS":
this.pageNum = 105
break
case "HANDICRAFTS":
this.pageNum = 120
break
case "TEMPLES & MONKS":
this.pageNum = 126
break
case "AGRICULTURE":
this.pageNum = 131
break
case "ANIMAL HUSBANDRY":
this.pageNum = 140
break
case "SCHOOL & EDUCATION":
this.pageNum = 145
break
case "LEADING A TREK":
this.pageNum = 151
break
case "NATIONAL PROTECTED AREAS":
this.pageNum = 155
break
case "IDENTIFYING WILDLIFE":
this.pageNum = 161
break
case "PLANTS & FORESTS":
this.pageNum = 169
break
case "BOATS":
this.pageNum = 175
break
case "CAVES":
this.pageNum = 178
break
case "HEALTH AND SAFETY":
this.pageNum = 182
break
2
var aINTRODUCTION = ["INTRODUCTION", "How to Use This Book", "Format"];
var aALPHABET = ["ALPHABET", "Vowel Sounds", "Consonant Sounds"];
var itemIndex = app.popUpMenu(aINTRODUCTION, aALPHABET);
Thanks.Thanks. I've got it now. I was mistakenly renaming itemIndex to each section...Introduction, Alphabet
-
GetSelectedRowKeys() returns more than one on Single Selection Tree Table
Hi,
I found that this issue occurring after PS3 (I think.)
I have a tree table component, which allows single row selection. There is a listener on a column of the tree table as follows:
public void listenPackageUnit(ValueChangeEvent valueChangeEvent)
Object oldKey = getTreeComponent().getRowKey();
try
* Retrieve index of selected package unit
* NOTE: Subtract 1 to remove no selection value. This only
* needs to be done if attached LOV has No Selection option set.
if (valueChangeEvent.getNewValue() != null)
Row row = null;
String selectedPackageUnit = null;
int packageUnitIndex = (Integer) valueChangeEvent.getNewValue();
packageUnitIndex--;
* Due to the no selection item, we need to prevent search of regular
* iterator if index is < 0. In this case we know the user selected
* the no selection (blank) value.
if (packageUnitIndex >= 0)
* Using index, determine the value of the selected package unit
DCIteratorBinding packageUnitsIterator =
(DCIteratorBinding) PasUiADFUtil.resolveExpression("#{bindings.PackageUnitsIterator}");
Row newRow =
packageUnitsIterator.getRowAtRangeIndex(packageUnitIndex);
selectedPackageUnit = (String) newRow.getAttribute("LookupCode");
RowKeySet selection = this.getTreeComponent().getSelectedRowKeys();
if (selection != null && selection.getSize() > 0)
for (Object facesTreeRowKey: selection)
this.getTreeComponent().setRowKey(facesTreeRowKey);
JUCtrlHierNodeBinding rowData =
(JUCtrlHierNodeBinding) this.getTreeComponent().getRowData();
row = rowData.getRow();
setSelectedLabel((String) row.getAttribute("Label"));
setSelectedLabelType((String) row.getAttribute("LabelType"));
row.setAttribute("PackageUnit", selectedPackageUnit);
getTreeComponent().setRowKey(oldKey);
finally
getTreeComponent().setRowKey(oldKey);
The issue is that getSelectedRowKeys() returns more than one when the user selects a child row in the tree table.
It seems to be returning the total number counting from the top parent through the child.
(For example, if the child is the second generation, it returns 2, and if the third generation, it returns 3.)
This is causing the issue that the method tries to update the attribute of the parent row with a value for the child row. (And it fails, because the attribute is updateable only while new.)
I remember getSelectedRowKeys() always returned one, the selected child itself, when I coded this around October, 2010.
Is this a design change after PS3? Why does it return more than one though the tree table is for single selection?
How can I get around this issue?
It would be truly appreciated if we can get any quick help, since we are at final testing phase of our product.
Thank you,
TomoHi Vinod,
I found the solution. Thank you very much for your suggestions. :)
Now my listenSelection (custom listener of the tree table) looks like below:
public void listenSelection(SelectionEvent selectionEvent)
Row currentRow;
PasUiADFUtil.invokeEL("#{bindings.TransactionLabelTopLevelVO1.collectionModel.makeCurrent}",
new Class[] { SelectionEvent.class },
new Object[] { selectionEvent });
Object oldKey = getTreeComponent().getRowKey();
try
if (this.getTreeComponent() != null)
RowKeySet rks = this.getTreeComponent().getSelectedRowKeys();
Iterator keys = rks.iterator();
while (keys.hasNext())
List key = (List) keys.next();
this.getTreeComponent().setRowKey(key);
JUCtrlHierNodeBinding node =
(JUCtrlHierNodeBinding) this.getTreeComponent().getRowData();
if (node != null)
currentRow = node.getRow();
if (currentRow != null)
this.setSelectedRow(currentRow);
setSelectedLabel((String) currentRow.getAttribute("Label"));
setSelectedLabelType((String) currentRow.getAttribute("LabelType"));
String shippedItemFlag =
(String) currentRow.getAttribute("ShippedItemFlagValue");
if (shippedItemFlag != null && shippedItemFlag.equals("1"))
setDisableAdd(true);
else
setDisableAdd(false);
finally
getTreeComponent().setRowKey(oldKey);
/* Refresh Action menu and buttons */
RequestContext.getCurrentInstance().addPartialTarget(this.getActionMenu());
RequestContext.getCurrentInstance().addPartialTarget(this.getToolbar());
And my tree table is like below:
<af:treeTable value="#{bindings.TransactionLabelTopLevelVO1.treeModel}"
var="node" rowSelection="single" id="tt1"
contentDelivery="immediate" fetchSize="25"
emptyText="#{bindings.TransactionLabelTopLevelVO1.viewable ? commonFoundationMsgBundle.NO_DATA_TO_DISPLAY : commonFoundationMsgBundle.ACCESS_DENIED}"
selectionListener="#{pageFlowScope.MaintainTransactionSerialAssociationBean.listenSelection}"
binding="#{pageFlowScope.MaintainTransactionSerialAssociationBean.treeComponent}"
summary="#{maintainAssociationUiBundle.CONTAINER_SERIAL_HIERARCHY}">
<!-- Row Header -->
The listener is now always getting the currently selected row only.
Tomo -
Assigning Selected Tree Node Value To An Item
Hi guys,
I want to assign selected tree node's value to a page item. This item can be a textbox or a label (display only). How can i do that? I tried to use "Selected Node Page Item" property which is available on Tree Attributes. But I couldn't assign the value without refreshing whole page.
Do you have any idea?
Thanks.Hi ,
Thank you that was exactly what I was looking for. I couldn't find how to pass database column to javascript as an input parameter. So thanks for your help. I made a couple of correction :
1) I put additional ' characters to ('''||"NAME"||''') this part because my field is varchar.
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
NAME as title,
null as icon,
"ID" as value,
null as tooltip,
'javascript:setFObjName('''||"NAME"||''')' As link
from "#OWNER#"."TABLE_NAME"
start with "PID" is null
connect by prior "ID" = "PID"
2) In script I have added ' character before and after page item.
function setFObjName(pobjName){
$s('P1_OBJ_NAME', pobjName);
So it works. Thanks tfor your help. -
Display Tree Structure in a List / Select Box
I need info on the following
1.display tree structure inside a select/combo/list box.
2.Select a node element from the above tree structure.
Thanks in advanceHave you managed to do this?
Faaiez -
Referencing data outside the bursting select tree in the control file
BIP 5.6.3 / EBS 11.5.10.2 + EBS Bursting Integration patch
I am trying to burst to files in a directory whose name is in the XML, but outside of the bursting select tree, but I have having problems picking up the value.
XML Data:
<DATA>
_<CHECKS>
__<CHECK>
___<CHECK_NUMBER>1234</CHECK_NUMBER>
__<CHECK>
_<CHECKS>
_<DIRECTORY>/u01/DEV/checks/</DIRECTORY>
</DATA>
Bursting select request:
<xapi:request select="/DATA/CHECKS/CHECK">
I am trying to define the output file with:
<xapi:filesystem id="111" output="${../../DIRECTORY}/Check_${CHECK_NUMBER}.pdf"/>
But this isn't working (or ${DATA/DIRECTORY} or ${DATA[1]/DIRECTORY} which have been my only other thoughts with this XML structure) - it is leaving the directory blank and I am getting the following error in the bursting request:
[oracle.apps.xdo.template.FOProcessor][EXCEPTION] IOException is occurred in FOProcessor.setOutput(String) with '/Check_1234.pdf'.
[oracle.apps.xdo.template.FOProcessor][EXCEPTION] java.io.FileNotFoundException: /Check_1234.pdf (Permission denied)
Am I able to refer to DIRECTORY with the XML structure and request select as above or do I need to move DIRECTORY into the select tree and duplicate the value for each check?Hi,
Unfortunately it is not possible to select data from outside your ‘for each loop’ in the bursting file. So yes, you will need to move ‘DIRECTORY’ into the select tree.
Regards
Carl -
Problem when selecting child node in Hierarchical Tree
I have a hierarchical tree on a form populated thru a table query(form1). When I click on a child node, it opens form2 which contains a tab canvas. After closing forms, I return to the form1(containing Tree). At this point If I want to click on the same child node, I should be able to open form2 again. This doesn't happen.
I have the following code in my When-Tree-node_selected trigger:
Declare
htree item;
vnode_label varchar2(50);
node_clicked FTREE.NODE;
vnode_value number;
vnode_depth number;
v_type number;
v_value varchar2(100);
v_form_name varchar2(100);
v_alert_return number;
begin
-- Find the tree itself.
htree := FIND_ITEM('tree_block.tree');
node_clicked := :SYSTEM.TRIGGER_NODE;
vnode_value := FTREE.NODE_label;
-- Find the value of the node clicked on.
vnode_label := FTREE.GET_TREE_NODE_PROPERTY (htree,:SYSTEM.TRIGGER_NODE,FTREE.NODE_label);
vnode_depth := to_number(ftree.get_tree_node_property(htree,:SYSTEM.TRIGGER_NODE,ftree.Node_depth));
--Open form for node selected on tree and/or specific tab page
if vnode_depth <> 1 then
if :system.trigger_node_selected = 'TRUE' then CASE vnode_label
WHEN 'Personal' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Citizenship' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
WHEN 'Emergency Contact' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
if id_null(Find_form(v_form_name)) then
open_form(:global.application_path || v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);
else
go_form(v_form_name);
end if;
END IF;
elsif vnode_depth = 1 then
if :system.trigger_node_SELECTED = 'TRUE' then CASE vnode_label
WHEN 'EMPLOYEE INFO' then
v_form_name :='HR_PERSONAL_INFO_UPDATE';
vnode_label := 'Personal';
WHEN 'REPORTS' then
v_form_name :='HR_REPORTS';
vnode_label := '';
if id_null(Find_form(v_form_name)) then
v_form_name := :global.application_path || v_form_name;
open_form(v_form_name,ACTIVATE,NO_SESSION,SHARE_LIBRARY_DATA);--,p_list);
else
go_form(v_form_name);
end if;
end if;
end;
Can anyone please help me? I don't want the user to double click. They should only click once.
Thanks,
MercedesRight clicking does not change the current selection. The tree has no way to report what node was right clicked. Only work around is to left click the node you wish then right click it.
--pat -
Why only gets one node when select many nodes of tree in DWCS4 on Mac OS
I use tag <mm:treecontrol> to create tree in DWCS4 on Mac OS.
When I select many nodes in tree, but I only get one node by method: selectedNodes.
codes of created tree as following:
<mm:treecontrol name='tree' size='20' multiple noheaders>
<mm:treecolumn state='hidden'>
<mm:treenode value='A' state='expanded'></mm:treenode>
<mm:treenode value='B' state='expanded'></mm:treenode>
<mm:treenode value='C' state='expanded'></mm:treenode>
</mm:treecontrol>
Who can tell me reasons?
Thanks!
comments: if don't use tag <mm:treecolumn>, tree will not show on Mac OS.Hi macbig,
I finally got to look at my sister's computer. The HDD "Repair Disk" found missing threads, missing directory records, etc. and ended with:
Error: Disk Utility can't repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-
up files.
Then, I tried "Verify Disk" and it found invalid volume file count and ended with:
The volume Macintosh HD was found corrupted and needs to be repaired.
Error: This disk needs to be repaired. Click Repair Disk
I guess running Apple Hardware Test is not going to happen. :/
I've ordered online a new 2.5 disk, make a Maverick boot USB, and start from scratch. Do you have any other suggestions?
As for the corrupted old hard drive, do you have any suggestions of how to get out the data somehow?
Thank you so much! -
Error in Getting Selected Tree node From POPUPMENU
Environment: Forms 9i, 9i AS
The Folowing code is written with in POPUP MENU to get the selected tree node. It always returns 0. The samE code works fine with in any other TRIGGER. Is it Forms BUG?
v_sel_tree := ftree.GET_TREE_SELECTION(v_item,1);Whether or not it is a bug you need a workaround.
How about getting the when-tree-node-selected to set a package variable and look at its value in the pop-up menu code. -
Af:tree - how do I highlight the selected tree node?
af:tree
I checked the generated CSS file. I found that when a tree node is selected, the related CSS attribute is:
.xj:link{
font-family:Arial,Helvetica,Geneva,sans-serif;
font-size:10pt;
font-weight:normal;
color:#663300
I created a customized CSS attribute, but then all of the links have the customized CSS attributes.
How do I just highlight the selected tree node link?
Thanks,
--Toddtry doing the onclick javascript method
you have to place it on the node element and id must be made dynamic
for this use 'this.id'
by which the current id of the node is passed
and by capturing the id name in a var
use the same for invoking its selected property and make it true
like this
var currentid = this.id;
this.form.currentid.selected = true;
Maybe you are looking for
-
How do I get iTunes 11 back into the taskbar player?
I had the taskbar player for iTunes 10, and it was perfect. I'm using Windows 7, and now that I've updated to iTunes 11 I can't get the taskbar player back. The mini player is just not at all as useful as the taskbar player is, and I want the taskbar
-
Connection OK but no objects found (Oracle XE, Eclipse 3.3)
I've installed Eclipse 3.3 and added the DTP 1.5.0 tools. I've unzipped the Oracle DTP zip into the Eclipse installation directory and restarted Eclipse. I've also installed Oracle Express 10g. The listener is up and running OK. The connection seems
-
Adding steps for a background job
Hello All, I am creating a background job through a program and submitting another program for running in the background. I would like to add steps for the backgound job which I created trough my program. So background job will have different steps
-
Loading from library conflicts with loading external swf
I'm very new to ActionScript, so this might be incredibly basic. However, I've Googled and read myself into a coma and I'm not finding a solution. I have a movie with 6 navigation buttons. Four of them load external .swf slideshows, and they work fi
-
Folio Overlays Panel shows no options
I've placed interactive content in my documents, I've built the folio with all of the my articles and uploaded to the cloud, tested on my ipad etc. For some reason, when I click on the interactive content (video, sliding content, etc.) in Indesign an