It seems odd that there are getState() and setState() functions on mxCell, but once the cell is created, the state for the cell is never used again.

\n

It appears (and maybe I am wrong) that once the mxCell is created, then the mxGraphView creates a state for the cell, which stores the style as an object. From this point on, the mxCell style does not seem to be used. This seems to be a 'disconnect' or inconsistency. I tried setting the style of an mxCell using cell.setStyle().. but, that had no effect. After some digging into the code, I found that the state.style is used in most cases.

\n

Could I get an explanation of the intent of these two different style values, and how the are intended to be used? If I change the style of a cell, what is the proper way to do so to insure that the change gets propagated.

asked 09 Jan '12, 08:55

kutenai's gravatar image

kutenai
6128
accept rate: 0%


After further digging, I have answered my own question.

\n

It seems that the proper way to update a cell style is to call mxGraphModel.setStyle(cell,style); This call will send an mxStyleChanged event. The mxStyleChanged event is handled in mxGraph.processChange (among other places). mxGraph.processChange will remove the state for the cell, forcing the mxCellState to be re-created the next time it is needed.
\n

link

answered 09 Jan '12, 09:14

kutenai's gravatar image

kutenai
6128
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:

×228
×2

Asked: 09 Jan '12, 08:55

Seen: 4,536 times

Last updated: 09 Jan '12, 09:14