Vertices and Edges (Cells) not movable by default in JGraph inside Intellij IDEA dialog

I just started using JGraph (mxGraph) for Java for visualization of data models. The Hello World example provided with the JGraph download works perfectly when run on its own as a Java Application. The Vertices and Edges are movable by clicking and moving on the graph. But when I do the same thing inside DialogWrapper or a JFrame dialog, everything works perfectly (as far as I checked) except the fact that the Vertices and Edges are not movable. I can resize them, connect the vertices, but I can't move them. Any IDEA ?

9 comments
Comment actions Permalink

Well, after some digging, I figured out the solution. Its seems that the Drag Listener for mxGraphComponent is causing this issue.
So, set disable the drag for mxGraphComponent.

mxGraphComponent graphComponent = new mxGraphComponent(graph); graphComponent.setDragEnabled(false);


Now, the cells can be moved.

0
Comment actions Permalink

I'd be interested in what sort of plugin you are developing that requires Graphing :)
I have investigated using JGraph, JUNG, and a few other frameworks for graphing libraries, but they all seem to have their downfalls!

I imagine you have ruled out the IJ Diagram API, because of the ultimate-edition requirements on end-users also?

0
Comment actions Permalink

Its for a Custom Editor. The idea is to edit an XML document graphically. Its a custom xml document that I am using that connects many projects.

Graph API in IntelliJ IDEA is just for the Ultimate edition, so I have look for other framworks. Every Graph framework have their downsides, but JGraphX suits my needs.

0
Comment actions Permalink

Hi.

It ill be good if u share sources of your plugin. Me interested using mxGraph in opensource projects (u can email me - and i ill say projects, email vistall.valeriy [at] gmail.com)

0
Comment actions Permalink

I second this notion! :)

I am still stuck between IJ Graphing Api vs OpenSource Graph Libraries; I am developing an open source application - but I don't want only ultimate-users to benefit from the plugin features!
It would be certainly be interesting to see how you get on with mxGraph - or if you use any alternatives instead :)

0
Comment actions Permalink

if u want use intro IDEA - use yGraph aka IntelliJ Graph API. I dont think that using mxGraph is a good idea


I known - that mxGraph need many correction, and many code implementation for good graph.  I known it, due i work with mxGraph too.

0
Comment actions Permalink

But yGraph is from the graphAPI which is present only in IntelliJ iDEA Ultimate. That's the reason I have to go into mxGraph. In a way, I seems good. Its better to have a tool that's not closely tied up with IntellliJ, so we can implement it in Eclipse as well.

As for the mxGraph code, I haven't yet reached anywhere with that. There's lot of playing around that I have to do, to get that working. Yes, mxGraph has its drawbacks and requires lots of implementations from our end. But that's kind of okie for what I am doing...

Will update you guys when I am done, i.e when I make some breakthrough :D

0
Comment actions Permalink

Guy - u can email me? (vistall.valeriy at gmail.com

0
Comment actions Permalink

each vertex have styles. you must add the style movable = 0.
that make your vertex cann´t drag it.

Example:

<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffffff; movable=0; " parent="1" vertex="1"><mxGeometry x="40" y="40" width="280" height="60" as="geometry"/></mxCell>

Example more properties, on style:

<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffffff;shadow=0;glass=0;strokeColor=#000000;gradientColor=none;labelBackgroundColor=none;labelBorderColor=none;movable=0;resizable=0;rotatable=0;deletable=0;editable=0;connectable=0;" parent="1" vertex="1"><mxGeometry x="40" y="40" width="280" height="60" as="geometry"/></mxCell>

0

Please sign in to leave a comment.