Cannot expand tree nodes using t:tree tag
Hi, I have a question.
I am a beginner of JSF. I am trying to deploy a very simple tree using <t:tree> in my local tomcat server, similar to the following one:
http://www.irian.at/myfaces/tree.jsf
The result is that the tree is properly displayed, but I cannot expand the nodes when I click on the "+" icon of the nodes.
Can someone help me? Thanks a lot!
Take a look at Lilya Jsf Widgets and Ajax Capabilities at http://qlogic.ma/lilya
the new era of technology
Similar Messages
-
Issues in using JSF UI:Tree tag
Hi,
I am trying to work with Tree Structure using JSF UI tags. In Studio Creator i just created a JSP page and designed a Tree with two nodes under it. This is what i have in the body of my jsp.
<ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
<ui:form binding="#{Page1.form1}" id="form1">
<ui:tree binding="#{Page1.tree1}" id="tree1" style="left: 48px; top: 48px; position: absolute" text="L3">
<ui:treeNode binding="#{Page1.treeNode1}" expanded="true" id="treeNode1" style="width: 408px" text="Tree Node 1">
<f:facet name="image">
<ui:image binding="#{Page1.image1}" icon="TREE_DOCUMENT" id="image1"/>
</f:facet>
</ui:treeNode>
<ui:treeNode binding="#{Page1.treeNode2}" expanded="true" id="treeNode2" text="Tree Node 2">
<f:facet name="image">
<ui:image binding="#{Page1.image2}" icon="TREE_DOCUMENT" id="image2"/>
</f:facet>
</ui:treeNode>
</ui:tree>
</ui:form>
</ui:body>
But when i am trying to launch the jsp page from browser i am getting the below exception.
com.sun.rave.web.ui.appbase.ApplicationException
Caused by: java.lang.NullPointerException at java.io.File.(File.java:194) at com.sun.rave.web.ui.renderer.template.xml.XMLLayoutDefinitionManager.getLayoutDefinition(XMLLayoutDefinitionManager.java:142) at com.sun.rave.web.ui.component.TemplateComponentBase.getLayoutDefinition(TemplateComponentBase.java:150) at com.sun.rave.web.ui.renderer.template.TemplateRenderer.encodeBegin(TemplateRenderer.java:73) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
Any suggestion to solve this issue would be greatly helpful.Now with Unified EL - JSTL and JSF tags are supposed to work on one page.
If you want to use Unified EL you need
1) A container that is built on Servlet 2.5 / JSP 2.1 , and example of such a container is Tomcat 6.x
2) Probably need to upgrade to JSTL 1.2 , and JSF 1.2
3) If you're upgrading the container to Servlet 2.5 then web.xml should conform to Servlet 2.5 version.
4) Use correct taglib URIs for JSTL 1.2 and JSF 1.2
Read here: Summary of new features in JSP 2.1
http://java.sun.com/developer/technicalArticles/J2EE/jsp_21/index.html
JSP 2.1 Technology and JSF 1.2 Technology
http://java.sun.com/developer/community/chat/JavaLive/2004/jl1207.html
http://java.sun.com/products/jsp/index.jsp
Message was edited by:
appy77 -
ADF: Tree Refresh after Expanding a node. Please Frank have a look!
About this post:
Re: ADF: Tree Refresh after Expanding a node
Frank answered that he doesn't notice that behavior. I found out that this happens if an appication uses a custom skin.
In SRDemoSampleADFBC, SRManage.jspx (Management from menu), if you make the explorer window small enough not to cover the whole tree, you can notice this (the page jumps to the top).
Now if you change in adf-faces-config.xml the "skin-family" tag to "oracle", you will see that the tree component has changed (it has no triangle icons why this happens) and the page doesn't refresh.
MinasIt seems that there's more to the tree expansion icon than the skin definition. We're using the minimal skin and ADF puts out a special character to represent the disclosure symbol (which by the way, renders differently on IE6, than IE7, than Safari or Firefox on Mac). However, switching to the Oracle skin, the disclosure symbol comes out as a full-on image (triangle including the +). We have found this frustrating because the triangles seem not sufficiently suggestive to our users - but switching to the Oracle skin has other issues with white-on-white text.
But in any case, the tree refresh after node expansion is another annoyance as I described in the other thread linked here (including URL to see problem in action).
Cheers, Mark -
APEX Tree. Keep focus on expanded leaf node.
How do I prevent my tree from jumping back to the top when I expand a leav node that is below the screen scroll. I have a single parent of CORP with about 30 leaf nodes as its direct children. I have to scroll down to expand a node towards the bottom of the list. When I scroll down and expand, the page refreshes and jumps back to the top so now I have to scroll down again to expand the next node, etc. My current Tree Qurey is like
select CHILD_ID id,
PARENT_ID pid,
CASE WHEN CHILD_ID = :P23_TARGET THEN
CASE WHEN :P23_STATUS = 'Target Up' THEN
'<span styl="color:green;">' || ITEM_NAME || '</span>'
ELSE ITEM_NAME
END
ELSE
ITEM_NAME
END name,
'f?p=&APP_ID.:23:'||:SESSION||'::NO::P23_TARGET:'||CHILD_ID link,
null a1,
null a2
from CORP_SVR_HRCHY_VWHi,
You have to use the Anchor ID functionality of a browser - this allows you to add #id to the end of the url where id refers to the id attribute of the item that should receive the focus when the page is reloaded.
As an example: [http://apex.oracle.com/pls/otn/f?p=33642:200]
This, of course, requires a bit of setting up, but is easily doable.
For this example, my SQL statement for the tree is:
SELECT 1 ID, NULL PID, 'Top' NAME, NULL LINK, NULL A1, NULL A2 FROM DUAL
UNION ALL
select "EMPNO" id,
1 pid,
"ENAME" name,
'f?p=' || :APP_ID || ':200:' || :APP_SESSION || '::::P200_EMPNO:' || EMPNO || '#node' || EMPNO link,
'node' || EMPNO a1,
null a2
from "#OWNER#"."EMP"You will note that the URL contains *'#node' || EMPNO* at the end of the link - for an EMPNO of 1234, this would add *#node1234* to the end of the URL. You will also note that I've added *'node' || EMPNO* to the A1 column - whatever I add into this column becomes available for use in the output by referencing it as #A1# in the template. On the tree's template definition, wherever there is an A tag, I've included:
ID="#A1#"as an attribute of the tag. For example, on the "Name Link Anchor Tag" setting, I have:
<a href="#LINK#" ID="#A1#">#NAME#</a>and, wherever #A1# appeared outside of an A tag, I have removed it (otherwise, the "node1234" text would appear at that point in the page).
Andy -
Moving expanded tree nodes in a JTree
Hello.
I have built a JTree that represents my hard disks. The files are sorted alphabetically. I already have built methods to create and remove directories, using the removeNodeFromParent and insertNodeInto methods in DefaultTreeModel.
Now I would like to rename a directory, so (because of the sorting) sometimes nodes should move some indices up or down. When I use the methods mentioned above it just works okay, but when I have expanded the node to be renamed it and all of its children get collapsed.
My question is: does anyone know of a convenient method to use for this problem? Thanks in advance.
Kind regards, Levi.Hello guys,
thanks for all your replies. I've figured it out myself (not with the tree API, though) using two recursive methods.
Kind regards,
Levi -
Tree table-initially expand all nodes raises error when closing a node 11g
Hello,
Frank Nimphius posted a blog entry about how to initially display all the nodes in a tree or table here:
[http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/|http://thepeninsulasedge.com/frank_nimphius/2007/12/19/adf-faces-rc-initially-expanding-all-nodes-in-a-tree-or-tree-table/]
This works very well. However, when the user tries to close a node, a NullPointerException is thrown.
Below is the stacktrace.
Does anyone know how to work around that issue?
java.lang.NullPointerException
at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl$Search.find(RowKeySetTreeImpl.java:608)
at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl._setContained(RowKeySetTreeImpl.java:496)
at org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.add(RowKeySetTreeImpl.java:97)
at oracle.adfinternal.view.faces.renderkit.rich.TableRendererUtils.decodeDisclosedRowKeys(TableRendererUtils.java:774)
at oracle.adfinternal.view.faces.renderkit.rich.table.BaseTableRenderer.decodeIncompatiblePropertyKey(BaseTableRenderer.java:198)
at oracle.adf.view.rich.render.RichRenderer.decode(RichRenderer.java:203)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__rendererDecode(UIXComponentBase.java:1089)
at org.apache.myfaces.trinidad.component.UIXComponentBase.decode(UIXComponentBase.java:714)
at org.apache.myfaces.trinidad.component.UIXTreeTable.decode(UIXTreeTable.java:133)
at org.apache.myfaces.trinidad.component.UIXCollection.processDecodes(UIXCollection.java:193)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$ApplyRequestValuesCallback.invokeContextCallback(LifecycleImpl.java:1113)
at org.apache.myfaces.trinidad.component.UIXCollection.invokeOnComponent(UIXCollection.java:1030)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:153)
at oracle.adf.view.rich.component.fragment.UIXPageTemplate.invokeOnComponent(UIXPageTemplate.java:208)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:731)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:664)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:303)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:175)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
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:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:181)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:279)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:239)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:196)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at edu.wisc.csa.web.ApplicationSessionExpiryFilter.doFilter(ApplicationSessionExpiryFilter.java:66)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at edu.wisc.csa.web.ResponseHeaderFilter.doFilter(ResponseHeaderFilter.java:36)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:257)
at oracle.security.jps.wls.JpsWlsSubjectResolver.runJaasMode(JpsWlsSubjectResolver.java:250)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:100)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:65)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)OK I have tried Frank's suggestion about the 2 entries in the managed bean and it works but I cannot collapse my child node !
I have a Master-Detail-Detail setup.
In the Grandparent I have this :
RowKeySet rks = new RowKeySet(true);
table1.setDisclosureState(rks);
this.grandParentTable = table1;
and in my Parent table I have this :
RowKeySet rks = new RowKeySet(true);
table2.setDisclosureState(rks);
this.parentTable = table2;
ie the same.
In my child I have nothing just the default accessors.
The collapse works OK for the Grandparent but when I click Hide for the Parent it does not do anything - no error message either.
cheers -
Expand tree node by clicking onto the node label
I have followed this example to expand the nodes with a clic on the tree :
[http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf]
My code:
JSPX:
<af:resource type="javascript" source="js/glasspane.js"/>
<af:tree value="#{bindings.OpcionesPadreView1.treeModel}" var="node"
rowSelection="single" id="t1" partialTriggers=":::cbNuevCpta"
binding="#{pageFlowScope.GestionDocumentos.t1}"
selectionListener="#{bindings.OpcionesPadreView1.treeModel.makeCurrent}">
<f:facet name="nodeStamp">
<af:commandImageLink text="#{node.Gesdopcach}" id="ot1"
action="#{bindings.LoadDir.execute}"
actionListener="#{bindings.LoadFile.execute}"
icon="/images/GestionDocumentos/folder20x20.png"
partialSubmit="true">
</af:commandImageLink>
</f:facet>
<af:clientListener method="expandTree" type="selection"/>
</af:tree>
Js:
function expandTree(evt) {
alert('In');
var tree = event.getSource();
rwKeySet = event.getAddedSet();
var firstRowKey;
for (rowKey in rwKeySet) {
firstRowKey = rowKey;
if (tree.isPathExpanded(firstRowKey)) {
tree.setDisclosedRowKey(firstRowKey, false);
}else {
tree.setDisclosedRowKey(firstRowKey, true);
When i clic on the labels the tree doesn't expand, the alert also is not shown. The problem could be the <af:resource>, but i have this tag in all my pages and all javascripts work. I also changed the commandLink with an outputText, but doesn't work.
Edited by: Miguel Angel on 21/06/2012 12:53 PMAt least the call the javascript works, but this line doesn't work, anybody know why?:
rwKeySet = evt.getAddedSet(); -
Hi Experts,
Working jdev 11.1.1.3.0.
we are using tree component on the page which as 6 childs. so if i click on add button once it will add child to that node and once i click on save done will come back to tree page. so everything is working fine. but the problem is once the node is added child node is not expanding. to resolve this issue i am using tree object in session, but while using this process its taking lot of performance.
manually i can able to expand the tree but if once i add node to the parent tree and coming back to the page node is not expanding i have to manually expand it.
so can any one suggest me what could be the best approch to expand the tree.
Thanks,Hi,
Hope followings useful
http://andrejusb.blogspot.com/2010/02/how-to-traverse-adf-tree.html
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/20-expand-tree-node-from-label-169156.pdf
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/21-expand-tree-on-initial-render-169158.pdf -
is it possible to expand tree node on rollover instead of
clicking on the triangle?yes, that worked. thanks.
private function itemRollOverHandler(event:ListEvent):void{
tree.expandItem(event.itemRenderer.data, true, true);
I think I was looking for something like getItem(index)..
something similar to Flash AS 2 components. -
Fully expanded tree using tree model
Hi every body,
I have represented into jtree form after reading xml document using the tree model. But I want to displayed
the fully expanded tree at the screen when program run.
Please help me.
Thanks
Edited by: ahmadgee on Jul 11, 2008 3:42 AMThanks for your help
For get the the tree in expanded form, I am using the expandAPath funtion by the following way.
public class XMLTreePanel extends JPanel {
private JTree tree;
private XMLTreeModel model;
public XMLTreePanel() {
setLayout(new BorderLayout());
model = new XMLTreeModel();
tree = new JTree();
tree.setModel(model);
tree.setShowsRootHandles(true);
tree.setEditable(false);
expandAPath(tree);
JScrollPane pane = new JScrollPane(tree);
pane.setPreferredSize(new Dimension(300,400));
add(pane, "Center");
final JTextField text = new JTextField();
text.setEditable(false);
add(text, "South");
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
Object lpc = e.getPath().getLastPathComponent();
if (lpc instanceof XMLTreeNode) {
text.setText( ((XMLTreeNode)lpc).getText() );
public void expandAPath(JTree tree){
for(int i=1; i<tree.getRowCount(); ++i) {
tree.expandRow(i);
public void setDocument(Document document) {
model.setDocument(document);
public Document getDocument() {
return model.getDocument();
} -
Need to expand tree by passing treeId thr URL not by clicking manually.
Sub: Need to expand tree by passing Id thr URL.
Hi,
Here i have Library.java and ajaxTree.jsf files (collected from Jboss richfaces)
There is having a list of artist .
If u click on a particular artistname then the respective albums(with their checkboxes) will expand and show like a treenode.
just look at d url : "http://localhost:8080/richfaces-demo-3.2.1.GA/richfaces/tree.jsf?c=tree&albumIds=1001,1002,1005,1008,1009,1010&client=0"
I m passing album Ids and clientId in url browser and receiving in d Library.java.
I need to expand the required client tree to show albums without clicking on artistname rather by passing the clientId from Url.
I thnk one EventHandling class( PostbackPhaseListener.java ) is responsible for expanding but I m unable to understand.
How can I do it.
Plz help asap.
/###############ajaxTree.jsf##########Start##############/
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core">
<p>This tree uses "ajax" switch type, note that for collapse/expand operations it will be Ajax request to the server. You may see short delay in this case.</p>
<h:form>
<rich:tree style="width:300px" value="#{library.data}" var="item" nodeFace="#{item.type}">
<rich:treeNode type="artist" >
<h:outputText value="#{item.name}" />
</rich:treeNode>
<rich:treeNode type="album" >
<h:selectBooleanCheckbox value="#{item.selected}"/>
<h:outputText value="#{item.title}" />
</rich:treeNode>
</rich:tree>
<h:commandButton value="Update" />
</h:form>
</ui:composition>
/###############ajaxTree.jsf##########End##############/
/************************Library.java*********Start****************/
package org.richfaces.demo.tree;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.faces.context.FacesContext;
import org.richfaces.model.TreeNode;
public class Library implements TreeNode {
private static final long serialVersionUID = -3530085227471752526L;
private Map artists = null;
private Object state1;
private Object state2;
private Map getArtists() {
if (this.artists==null) {
initData();
return this.artists;
public void addArtist(Artist artist) {
addChild(Long.toString(artist.getId()), artist);
public void addChild(Object identifier, TreeNode child) {
getArtists().put(identifier, child);
child.setParent(this);
public TreeNode getChild(Object id) {
return (TreeNode) getArtists().get(id);
public Iterator getChildren() {
return getArtists().entrySet().iterator();
public Object getData() {
return this;
public TreeNode getParent() {
return null;
public boolean isLeaf() {
return getArtists().isEmpty();
public void removeChild(Object id) {
getArtists().remove(id);
public void setData(Object data) {
public void setParent(TreeNode parent) {
public String getType() {
return "library";
private long nextId = 0;
private long getNextId() {
return nextId++;
private Map albumCache = new HashMap();
private Map artistCache = new HashMap();
private Artist getArtistByName(String name, Library library) {
Artist artist = (Artist)artistCache.get(name);
if (artist==null) {
artist = new Artist(getNextId());
artist.setName(name);
artistCache.put(name, artist);
library.addArtist(artist);
return artist;
private Album getAlbumByTitle(String title, Artist artist) {
Album album = (Album)albumCache.get(title);
if (album==null) {
album = new Album(getNextId());
album.setTitle(title);
albumCache.put(title, album);
artist.addAlbum(album);
return album;
private void initData() {
artists = new HashMap();
InputStream is = this.getClass().getClassLoader().getResourceAsStream("org/richfaces/demo/tree/data.txt");
ByteArrayOutputStream os = new ByteArrayOutputStream();
byte[] rb = new byte[1024];
int read;
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
// System.out.println("request.getParameter(param) "+request.getParameter("param"));
//System.out.println("request.getParameter(client) "+request.getParameter("client"));
//System.out.println("request.getParameter() "+request.getParameter("c"));
try {
do {
read = is.read(rb);
if (read>0) {
os.write(rb, 0, read);
} while (read>0);
String buf = os.toString();
StringTokenizer toc1 = new StringTokenizer(buf,"\n");
String str1 = request.getParameter("albumIds");
int clientId1 =Integer.parseInt( request.getParameter("client"));
while (toc1.hasMoreTokens()) {
String str = toc1.nextToken();
StringTokenizer toc2 = new StringTokenizer(str, "\t");
String artistName = toc2.nextToken();
String albumTitle = toc2.nextToken();
String songTitle = toc2.nextToken();
toc2.nextToken();
toc2.nextToken();
String albumYear = toc2.nextToken();
Artist artist = getArtistByName(artistName,this);
Album album = getAlbumByTitle(albumTitle, artist);
String portfolios[] = new String[100];
Integer portfoliosId[] = new Integer[100];
int i = 0;
StringTokenizer st = new StringTokenizer(str1, ",");
while (st.hasMoreTokens()) {
portfolios[i] = st.nextToken();
if((songTitle.equals(portfolios))&&(!(songTitle == ""))){
//System.out.println("ifff");
album.setSelected(true);
i++;
album.setYear(new Integer(albumYear));
} catch (IOException e) {
throw new RuntimeException(e);
public Object getState1() {
return state1;
public void setState1(Object state1) {
this.state1 = state1;
public Object getState2() {
return state2;
public void setState2(Object state2) {
this.state2 = state2;
public void walk(TreeNode node, List<TreeNode> appendTo, Class<? extends TreeNode> type) {
if (type.isInstance(node)){
appendTo.add(node);
Iterator<Map.Entry<Object, TreeNode>> iterator = node.getChildren();
System.out.println("walk node.getChildren() "+node.getChildren());
while(iterator.hasNext()) {
walk(iterator.next().getValue(), appendTo, type);
public ArrayList getLibraryAsList(){
ArrayList appendTo = new ArrayList();
System.out.println("getLibraryAsList appendTo "+appendTo);
walk(this, appendTo, Song.class);
return appendTo;
/************************Library.java*********End****************/
/************************PostbackPhaseListener.java*********Start****************/
package org.richfaces.treemodeladaptor;
import java.util.Map;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
public class PostbackPhaseListener implements PhaseListener {
public static final String POSTBACK_ATTRIBUTE_NAME = PostbackPhaseListener.class.getName();
public void afterPhase(PhaseEvent event) {
public void beforePhase(PhaseEvent event) {
FacesContext facesContext = event.getFacesContext();
Map requestMap = facesContext.getExternalContext().getRequestMap();
requestMap.put(POSTBACK_ATTRIBUTE_NAME, Boolean.TRUE);
public PhaseId getPhaseId() {
return PhaseId.APPLY_REQUEST_VALUES;
public static boolean isPostback() {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null) {
ExternalContext externalContext = facesContext.getExternalContext();
if (externalContext != null) {
return Boolean.TRUE.equals(
externalContext.getRequestMap().get(POSTBACK_ATTRIBUTE_NAME));
return false;
/************************PostbackPhaseListener.java*********End****************/
Edited by: rajesh_forum on Sep 17, 2008 6:13 AM
Edited by: rajesh_forum on Sep 17, 2008 6:18 AMHi
Can somebody please look into this?
Thanks
Raj
Edited by: RajICWeb on Aug 9, 2009 4:38 AM -
The case of the mysterious non-expanding tree.
Hello all,
I've got a strange problem that I can't figure out. At it's
simplest, i've got a tree and two xml objects. In mx tag for the
tree I define one of the xml objects as the dataprovider,
additionally i've defined an event handler for the trees
creationComplete event that opens up the root nood. This works
great and is exactly what I want.
But...
I've also got a button, click on the button and it either a)
changes the dataprovider of the tree to the second xml object, or
b) change the xml in the dataprovider already assigned. Then,
because the data has changed and the tree re-renders it ends up
collapsed again so immediately after changing it's data I try to
open the root node but nothing happens. No errors, just nothing.
For the purpose of debugging i added a second button that
simply tries to expand the root node of the tree after i've changed
the trees data provider and it works fine. The line of code that
exists in both the first and second buttons and that should open
the tree only works in the second button for some reason. The only
thing I can think of is timing, perhaps when trying to expand the
node in the line of code directly following the change to the
dataprovider the data hasn't loaded into the tree yet so it can't
expand the node but, i've tried all sorts of event handlers and
they don't seem to work either.
Here's a link if someone wants to download my test.mxml file
and try it themselves. There's more comments in the code but it's a
super simple test page so it should be immediate where the problem
is...
http://www.binarydemon.com/test.mxml
Thanks in advance.
ZachThanks Tracy,
callLater() was exactly what I needed. I had no idea that
method even existed, most things have events that fire when
something important happens that I want to respond to, or are timed
better for me to respond to that I've yet to need callLater(). Of
course I'm still new at flex...
Best,
Zach. -
Expand tree in WebDynpro ABAP application
Hi,
Currently I am working on a WDA application which contains a UI ELEMENT TREE. The tree is generated dynamically at runtime.
I was guided by the example of SAP "WDT_TREE". After generating the tree looks like this:
TREE
| __ NODE1
| __ LEAF1
| __ LEAF2
| __ NODE2
| __ LEAF3
| __ Node3
| __ LEAF4
| __ LEAF5
| __ LEAF6
Now I have bound the "expanded" property of the node to a context element and execute the following action in the WDDOINIT:
* Fill tables with the structure of the tree
fill_foldertable( ).
fill_filetable( ).
lr_current_node = wd_context->get_child_node( 'FOLDER' ).
lr_current_element = lr_current_node->create_element( ).
lr_current_node->bind_element( lr_current_element ).
lr_current_node->set_lead_selection( lr_current_element ).
lr_current_element->set_attribute( name = 'TEXT' value = 'Products' ).
lr_current_element->set_attribute( name = 'IS_EXPANDED' value = 'X' ).
* Create the root node
create_node(
EXPORTING
cur_element = lr_current_element
parent_key = 'Categories' ).
Now the tree is expanded, but i can't see EAF1 and LEAF2. I get them only by clicking again on node1.
Any ideas?
Regards.Hi All,
I found the solution for my question. Expand tree in Webdynpro application
Soultion
In the context node i.e used as a source for tree, you create a attribute
Attribute Name: IS_BOOLEAN
Attribute type : WDY_BOOLEAN
Default Value : X
And in Context node Un check the Initialization lead selection.
Now bind the Expand property of TreeNodeType with 'IS_EXPAND' which you have created just now.
This way the whole tree will be expanded.
Regards,
Pavan Maddali -
Hi.
I’m trying to modify default sample from Workshop sp2 for netui:tree tag.
<netui:tree tree="{session.tree}" imageRoot="treeImages" style="tree-control"
action="treeState">
I need to change my fonts for tree and change default images to my own plus other
stuff.
I cannot find source for style="tree-control”, if it is xml / xslt transformation
where those files are?
Thankscheck whether you have any CSS conflicts
-
JTreeTable - cannot expand more than one node programatically..why??
Hi All,
I have a JTreeTable and all i want is to expand node1 and then expand node2.I used
tableModel.getTree().expandRow(0) and the next statement was
tableModel.getTree().expandRow(1)
Wiered thing is that only the first statement gets executed.But although the control goes into second statement it does not expand.I have a TreeWillExpandListner so, on tableModel.getTree().expandRow(0) statement the control comes into the TreeWillExpand() method, but on tableModel.getTree().expandRow(1) execution it does not come to the treeWillExpand() method.
Do you guys have any idea why is this happening..??
Thanks,
Ranjitha
Edited by: Ranjitha_Rao on Jan 31, 2008 9:23 AM
Edited by: Ranjitha_Rao on Jan 31, 2008 9:24 AMThis is strange, i just replaced the order so instead of:
m_tableModel.ExpandRow(0)
m_tableModel.ExpandRow(1)
i did
m_tableModel.ExpandRow(1)
m_tableModel.ExpandRow(0)
It works.Strange but its true.It looked like the tree structure change did not read the structure the same if you do it the first way.Well anyway my problem is solved
Maybe you are looking for
-
Bapi_salesorder_createfromdat2, zero price in conditions
Hi, I create salesorder with bapi_salesorder_createfromdat2 and give price for material in ORDER_CONDITION_IN table. When price is >0 it works OK. But I need in some cases to create orderline with 0 (zero) price. When entering 0 in COND_VALUE field i
-
Hai Adobe users, I am using accordion container.Normally in accordion using selectedindex=0 then first tab willbe open...but i want initially,all accordion tab willbe open.. How is it possible..plz guide me... Thanks & Regards, Sivamurugan
-
Restore-SBFarm - How to make this work?
Hi, I've read through some docs on the restore-sbfarm cmdlet, which according to Microsoft does the same as new-sbfarm except with existing databases (full of data one would assume). Restore-SBFarm I have tried to do this, but I keep running into an
-
Hi everybody I am creating a new project for the enhancement MM06E005, but i get an error message "SAP enhancement MM06E005 alraeady belongs to project ZEBP", does this means I wont be able to use this enhancement for my project?Should I search for a
-
Microsoft Office - Constant Update Problem | NEED HELP
Okay, so here is my problem - The website i have needs to be updated regulary by many different people and i know contribute can solve this. as the people who are updating this have no Web Experience, i thought using the Office Plug-in would help. Ca