Hello! I am trying to figure out how I can prevent some cells from connecting/resizing/cloning and dragging but I did not find out how to do this.

(I am using the JAVA API)

I would like build up some customized cells which provides some controls e.g. like a button. But the button (which is a cell with an image) should of course not be connectable or moveable...

I was trying to override the mxConnectionHandler, but there is no set method for it - so I can't. Is there any functionality which provides granulary control over operations on cells (connecting/cloning/moving...) cells?

I extended the mxGraph and set the following rules:


I thought this would in general prevent from cloning cells, but when I am trying to drag one of the childs cells it gets cloned on the mouse released position.

I am currently working on a graphically controlable Module system, where the view is based on JGraph... Here I have an Screenshot of my current implemented graph view to better understand what I am trying to implement: Example Screenshot

asked 26 Jun '12, 04:01

Samonosuke's gravatar image

accept rate: 0%

edited 26 Jun '12, 05:39

I have found a solution by my own! It was not that diffcult! :-)

I only had to override some methods of the mxGraph...

public boolean isCellCloneable(Object cell) {
    if(cell instanceof Icon || cell instanceof Module || cell instanceof Pin) return false;
    return super.isCellCloneable(cell);

public boolean isCellConnectable(Object cell) {
    if(cell instanceof Icon || cell instanceof Module) return false;
    return super.isCellConnectable(cell);

public boolean isCellEditable(Object cell) {
    if(cell instanceof Icon || cell instanceof Pin) return false;
    return super.isCellEditable(cell);

public boolean isCellLocked(Object cell) {
    if(cell instanceof Icon) return true;
    return super.isCellLocked(cell);

answered 26 Jun '12, 07:36

Samonosuke's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 26 Jun '12, 04:01

Seen: 2,214 times

Last updated: 26 Jun '12, 07:36