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:

setDisconnectOnMove(false);
setDropEnabled(false);
setAllowNegativeCoordinates(false);
setSwimlaneNesting(true);
setCellsCloneable(false);
setCellsDisconnectable(false);
setAllowLoops(false);
setSplitEnabled(false);

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

Samonosuke
12
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...

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

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

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

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

answered 26 Jun '12, 07:36

Samonosuke's gravatar image

Samonosuke
12
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

By RSS:

Answers

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

Tags:

×194
×66
×45
×13

Asked: 26 Jun '12, 04:01

Seen: 2,214 times

Last updated: 26 Jun '12, 07:36