HELP PLEASE !!!!!

S

soup_or_power

I am trying to XML'fy the path info. The XML looks good. But am not
able to recreate the path. Can someone please help?



Enumeration expanded = getExpansionState(treeTable.getTree());

if (expanded != null) {



while (expanded.hasMoreElements()) {

TreePath treePath = (TreePath) expanded.nextElement();



String strarr = treePath.toString();

StringBuffer sb = new StringBuffer();

for (int i=0; i < strarr.length() ; i++)

{

char c=strarr.charAt(i);

if (c != '[' && c != ']') sb.append(c);

}

StringTokenizer st = new StringTokenizer(sb.toString(),
",");

while(st != null && st.hasMoreTokens()) {



ttsDefaults.addPathList(st.nextToken());

//tree.expandPath(treePath);

}

}

public static Enumeration getExpansionState(JTree tree) {



return tree.getExpandedDescendants(new
TreePath(tree.getModel().getRoot()));



}
//MG

Vector pathList = ttsDefaults.getPathList(); //read from XML

for (Enumeration e = pathList.elements(); e.hasMoreElements();)
{

TreeDataObject name = ( TreeDataObject )( e.nextElement());

TreeDataObject root =
(TreeDataObject)treeTableModel.getMainTreeNode();

TreePath path = TreeDataObject.getPathFromRoot(root, name);

System.out.println("TreePath:"+path.toString());

//select the path in the tree

treeTable.getTree().expandPath(path);



}
 
A

Andrew Thompson

I am trying ..

Yes, yes. Some people are, especially when they make three posts in
the space of 90 minutes in ever rising tones of desperation.

This is not a help desk to sort your problems, it is a discussion
forum. If you have a desperate and urgent need to get detailed
help with a problem, you may well have to go somewhere else
to find that help(, and probably pay money).
 
P

pit.grinja

Hi,
I am trying to XML'fy the path info. The XML looks good. What XML? I don´t see any.
But am not able to recreate the path. Can someone please help?
Enumeration expanded = getExpansionState(treeTable.getTree());
1. What is "treeTable"? Anyways, treeTable.getTree() seems to return a
JTree
if (expanded != null) {
while (expanded.hasMoreElements()) {
TreePath treePath = (TreePath) expanded.nextElement();
String strarr = treePath.toString();
StringBuffer sb = new StringBuffer();
for (int i=0; i < strarr.length() ; i++)
{
char c=strarr.charAt(i);
if (c != '[' && c != ']') sb.append(c);
}
StringTokenizer st = new StringTokenizer(sb.toString(), ",");
while(st != null && st.hasMoreTokens()) {
ttsDefaults.addPathList(st.nextToken()); 2. What is "ttsDefault" ?
//tree.expandPath(treePath);
}
}
public static Enumeration getExpansionState(JTree tree) {
return tree.getExpandedDescendants(new TreePath(tree.getModel().getRoot()));
}
//MG

Vector pathList = ttsDefaults.getPathList(); //read from XML 2a. What is "ttsDefaults"?

for (Enumeration e = pathList.elements(); e.hasMoreElements();)
{

TreeDataObject name = ( TreeDataObject )( e.nextElement()); 3. What is a "TreeDataObject"?
TreeDataObject root =
(TreeDataObject)treeTableModel.getMainTreeNode();
TreePath path = TreeDataObject.getPathFromRoot(root, name);
System.out.println("TreePath:"+path.toString());
//select the path in the tree
treeTable.getTree().expandPath(path);
}
Too many uncertainties - ooooh, can´t help....
BW
Piet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top