ROCLASI:
Anyone know how (and if) to use the JTree bean. I would love to fill it with data and use it to navigate through hierachical data.
Is it even possible? Or does Servoy need to implement their version of this control.
Today I wrote a very basic method that uses Jtree as a navigator, but I don’t know if it’s possible to attach a Servoy method to an element of the tree.
There hasn’t been any comment of the questions in this tread…
I’m very interested in using the JTree bean, but no idea how to get it going and like ricardino asked: is it possible to let an element of the tree trigger Servoy Methods…
There hasn’t been any comment of the questions in this tread…
I’m very interested in using the JTree bean, but no idea how to get it going and like ricardino asked: is it possible to let an element of the tree trigger Servoy Methods…
Any comment appreciated
Paul
I haven’t used to many beans personally, but I can make an educated guess about how you’ll likely interact with them.
Since beans are small chunks of Java code then they likely work with explicit input and output parameters. You’ll need to determine what those parameters are and supply them to the bean. I haven’t read the following article but there is more there about beans.
I can imagine that some beans will take input that may be Java code itself so you may need to learn a bit about doing stuff in Java. Fortunately, moving from Javascript to PHP to Java is pretty similar. It’s all a matter of learning the nuances of the environment and syntax.
Doing a search for jtree on Google will give you some results and tutorials. Here is one I found right off the bat.
thanks for the response. I allready looked around on the net, but the docs there do not get me going… And the doc on Beans on Servoy Magazine does not tell me what I’m looking for either…
Ricardino, you say you wrote a basic method to use the JTree as navigator… would you be willing to share?
I’m trying to fill the tree with my own data, but haven’t figured it out.
Ricardino, you say you wrote a basic method to use the JTree as navigator… would you be willing to share?
I’m trying to fill the tree with my own data, but haven’t figured it out.
Paul
Sure. But I’ve only been able to put my values inside the tree, nothing more.
Put the bean on a form, give it a name and check the Property “Editable”.
Assign the names you want to the various elements, then uncheck the editability (to avoid user’s deletions or modifications).
The method (very “filemakerish” is
var modulo = elements.jtree.selectionPath
if ( utils.stringPatternCount(modulo, "anagrafica") > 0 )
{
globals.Vai_Anagrafica();
}
if ( utils.stringPatternCount(modulo, "anamnesi") > 0 )
{
globals.Vai_Anamnesi();
}
Ricardino, tnx for the info, I’ll continue my struggle from here onwards…
HJK: I have the same issue and judging from the comments on bean implementation, eveyone seems to have them.
Servoy people: Is it possible to use these beans inside Servoy? If so, could you give us some pointers as how to implement them?
The article on the Servoy Magazine website deals with beans that just display some data. I think what we’re all looking for is implementation of beans have more interaction with the application, like the JTree, JSeperator, Jsplitpane etc.
What I allready tried is searching the web, but all examples there do not seem to work. Now, I’m a novice here, but I think my problem lies in properly addressing the element through scripting.
The examples on the web (scripting wise) seem to be on another level as the scripting done in the method editor in Servoy.
What I’m first trying to do is just a simple Add of anaother ‘node’ to a tree. Can’t get this to work. Getting all kind of error messages…
Ideally, I want to fill the tree with my own data and trigger methods based of which ‘node’ is selected.
Currently swing components (JSplitPane/JTree) are difficult to use inside servoy. Because for that you really need a full fleged java IDE for that. Because those beans/components aren’t really for use by just settings some properties and it works..
We do have on the planning to give you a JTree component as a special Servoy element. That is then simple and easy to use.
And we will see if we also can do the same for the JSplitpane.
A JTree will not be really doable. It is the most complex bean of Swing . Beause what do you want to do with a jtree bean? Fill it with values and then what? When you click on a node you want to trigger an action? That is currently not possible.
A JSplitPane will be possible to use i think. Just do this:
drop a jsplitpane bean in the designer.. (name it split)
drop 2 fields or buttons/labels in the designer
and name one left and the other right.
then make a script
elements.split.rightComponent = elements.right;
elements.split.leftComponent = elements.left;
and attach that script to the onload method of that form.
I would like to use the tree as navigator, so yes, by selecting a node trigger a method. The feature that is interesting is that you can have different icon per ‘node’, something I wasn’t able to do in listview.
As for te Splitpane: the interesting bit will be if we can put two forms on there, for example two listviews. I tried this. It’s not possible directly, but if you place a tabpanel (with the form you want in your splitpanel) on the form you have your splitpane, you can get a form into the splitpane.
Haven’t tried if everything still works but at least it looks good…
Any idea when we can see JTree implementation in a beta?