tree structure visualization - java

I have an AST (abstract syntax tree) structure that I need to visualize. What to use for such visualization? I have heard about eclipse gmf, but after a short look on all that models and code generation I think that it is too complex for this problem.
My task is only show tree structure with some basic interactive functions: I need to show popup window with some additional information and that is all.
Do you think that eclipse Draw2D is enough? Moreover may be there are some out of the box solutions for visualizing a tree structure?

Try GraphViz. It's an open source graph visualization software that can be used to generate images (SVG, PNG, JPEG,etc) from graph structures (including ASTs).
You can find a Java-based alternative in Eclipse Zest, a group of visualization components for Eclipse

It's not particularly sexy, but if you're looking for a low barrier of entry, a swing JTree is pretty easy to get started with. The Swing Tutorials have several examples.

Related

Eclipse plugin\Java Library to create flow diagrams

I need to create flow diagrams based on specific inputs, using java code, what are best ways\plugins to achieve this.
something like the above diagram (For sample only it is taken from google images)
Also the diagrams should be editable after generation.
I would recommend Graphviz - the industry standard for graphs. It also has Java API (as well as perl, python, ruby etc.), so it possible to use it in Eclipse.
It uses DOT - a plain text graph description language. Small example:
digraph graphname {
a -> b -> c;
b -> d;
}
And the resulting graph:
Graphviz provides everything you need to create any kind of graphs. And yes, diagrams are editable.
Graphviz Eclipse plug-in: https://github.com/abstratt/eclipsegraphviz
Maybe something like https://github.com/jgraph/draw.io can solve your Problem. It is the sourcecode for https://www.draw.io/ which is a graphical Editor for creating diagrams.
So you can create an XML-File and upload it to your own version of draw.io and create the flowchart. Then you can edit it and save it to varoious file formats.
This is not the perfect answer, but maybe it is worth a try.
From the doc of JDiagram:
MindFusion.Diagramming for Java Swing (JDiagram for short) is a Java
class library that that lets you create and display various types of
diagrams and charts. The library includes model classes that describe
the structure and appearance of a flow diagram, and view classes that
can be integrated into any application that targets the Java Swing
framework
here are the examples, of what you can achieve with the library:
http://www.mindfusion.eu/onlinehelp/jdiagram/
There you could browse the tutorials and the doc.
I think this library might fit the bill...
https://eclipse.org/modeling/mdt/?project=xsd#xsd

Free XML based java gui language with builder

Is there a free decent java GUI descriptor language (probably XML based), which has a Glade-like (WYSIWYG) GUI builder?
Netbeans IDE. Whenever you use its GUI editor, it stores the GUI in XML, in a *.form file.
For example if your create a class com.some.package.MyForm which extends some Swing component or window, look for this file $SRCDIR/com/some/package/MyForm.java and $SRCDIR/com/some/package/MyForm.form.
The former is the actual Java class that gets compiled. The latter is a file that Netbeans uses to store the GUI in XML format. This is what netbeans uses to generate the auto-gen'd code that goes in the code fold to initiliase the GUI.
HTH
Edit:
I do acknowledge that the Netbeans IDE probably isn't the best one out there, and I personally use it only because it's already built into the IDE that I use anyway. For me it gets the job done, and I may sometimes have to manually apply tweaks in the code to get what I want. It's a no-frills, XML-based, Java GUI, WYSIWYG editor.
Sorry this is prob not the answer you were looking for but have you looked into using flex? The markup in Flex is all XML based and the builder is very good.
Blaze DS can then be used to communicate between flex and Java.
Dont know any pure xml layout frameworks off the top of my head. Whats your reason for wanting an XML based UI?
Simple googling yields me many like http://swingml.sourceforge.net/, http://jfcml.sourceforge.net/,http://cookxml.yuanheng.org/cookswing/etc.
You can try JavaFX, it is too a cool DSL way of representing the Swing components and it provides more of its own for API for animation and graphics usage.
Netbeans and eclipse have plugins/extensions to do DnD development for it.

Is there an API to draw a B-TREE?

That's a simple question: is there an API to draw a B-tree in Java? I just dont want to spend much time reinventing the wheel. I am not having trouble with the algorithm per si, mine works perfectly fine after a lot of reading (specially Lafore's Data Structures & Algorithms in Java), I just dont know how to print a B-tree in a good way.
Thanks in advance.
You've got a couple of options to "render" a graph to screen -
Graphviz has a Java API (Edit: an addon called LJV which gives the API).
I think you ought to be able to use the free version of JGraph to do the same.
I know people have had success with daVinci (now uDraw). I haven't used it since 2003, but from what I remember, you have to generate a bracketed text file for your tree and the program parses it. You should be able to output your text by doing a simple tree traversal.
Have a look at yEd. I'm pretty sure, licensing yFiles just for an API to display tree structures is a bit exaggerated, but the graph editor is free of license costs and you can use it to render your trees. I usually dump my raw graph data in one of the supported file formats, open the output file with yEd and let it do the layout.

Java Swing: Generating dynamic GUI forms from XML

I am writing this application in Java, where I have a JTree on the left of the JFrame, and the item selected in the JTree determines what appears on the right. This is similar to Edit --> Preferences in Thunderbird, and several other applications' preferences.
Anyhow the main difference is that in my app the stuff on the right is dynamic, and needs to be generated at run time using input from a file.
What I am after is various ways in which this can be accomplished, code snippets or existing frameworks / libraries if they exist.
The input file needs to be something higher level than the sort of XML generated during Serialization. No output capability is required.
Thanks
The JEasy Framework looks to do exactly what you're asking for.
But here's a whole list of similar projects: http://java-source.net/open-source/xml-user-interface-toolkits
There's a short description for each one and a link to their project page. You'll want to look at a handful of the ones that sound good to you, and then try one or two for yourself.
As of now i think one of the most actively used is Swixml. better support compared to JEasy.
have been using it for some while now, and is very easy to learn too
Perhaps it - http://www.soyatec.com/eface/ - XAML/WPF for Java.

Generating and visualising a decision tree

I wonder if anyone is able to help or advise with the following; I have to be able to take data from a data source and to be able to visualise that data as a decision trees on a web page all. This will be a single process which is seamless to an end user.
This will be done using JSPs and Java servlets but what concerns me are the underlying products. I'm thinking of passing the data to a Weka classifier and then doing something with the .dot file it creates, i.e. maybe feeding it to GraphViz or trying to use the Google Visualization API to present an interactive display.
But, can anyone tell me if this is a viable approach or suggest alternatives?
Thanks
Martin O'Shea.
I've had a lot of success creating data flow graphs with graphviz (I uploaded them with a script to a MoinMoin wiki and used the graphviz plugin). That plugin even allowed to have links in the graphs, so we could keep the individual graphs small.
For the UI we have added the JS stuff from http://www.mxgraph.com/ to display larger graphs to the user.
Your approach is viable however. GraphViz is a good tool.

Categories

Resources