Few days back we received a requirement from client to generate an image out of our existing work flow
definition. We started development using
JgraphX to generate image for existing work
flow. We wrote complete API tested this locally on Linux box, every thing is working properly. Once we deployed
this in cloud (Amazon instance in our case) it started throwing HeadlessException because cloud
instance is a Headless Environment.
Exception Log
Root Cause
We tried to search solution for this problem from Google and JGraph form as well, during the search we came across a thread in JGraphX form. Finally I went ahead and debugged the JGraphX code to figure out actual problem, so we can solve this issue. During debugging I came across a code in JGraphX library that it is trying to create Drag and Drop functionality, but I don't need this for my requirement. Same time I also came across a flag in Graph component to check isDragEnabled to validate that Drag and Drop service is required or not. This lib creates DragSource object irrespective of this flag is set or not.After digging into the JGraphX code, I solved this problem by overriding
installDragGestureHandler
method of mxGraphHandler
and createHandlers
method mxGraphComponent
class.
Disable Drag & Drop
OverrideinstallDragGestureHandler
implementation to blank because my application does not
require any Drag and Drop feature.
Install Drag Gesture Handler
MymxGraphHandler
MymxGraphComponent
3 Comments
Hi could you please help me, how to create workflow image using jGraph?
ReplyDeleteRajesh,
DeleteWhat exactly you want.. would you like to create a workflow image using jgraph library.... or you have any other question...
Thank you, I got the same problem and this page helped me.
ReplyDeleteIt is a shame this bug is not solved yet with the last version of mxGraph.
Post a Comment