I created a custom vertex with 4 ArrayLists as atributes. After saving the graph in an XML file, I remarked that the atributes are not wrote in the file. Is there a way to add them into the file when saving and showing their contents?

Using the java version of JGraphX.

Thank you for help.

asked 01 Oct '12, 12:45

rahma's gravatar image

rahma
116
accept rate: 0%

edited 01 Oct '12, 15:21


Did you register your custom object properly? See my answer here for an example: http://forum.jgraph.com/questions/4850/ioexception-when-trying-native-java-serialization

link

answered 01 Oct '12, 16:02

Lofi's gravatar image

Lofi
1.0k1221
accept rate: 37%

Thanks Lofi, but my custom vertex is inheriting from mxCell. And when I load the graph all cells are there except the custom one not visible. I added the registerCodecs() to my code when saving but it didn't work too.

(03 Oct '12, 14:05) rahma

You shouldn't inherit from mxCell. Instead you should make a custom object, e. g.:

public class MyObject implements Serializable {

private String name;

private List<string> list;

public MyObject() {

}

public String getName() { return name; }

public void setName(String name) { this.name = name; }

public List<string> getList() { return list; }

public void setList(List<string> list) { this.list = list; }

}

and use it as the cell's value.

(04 Oct '12, 00:47) Lofi
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
×79
×22
×16

Asked: 01 Oct '12, 12:45

Seen: 2,073 times

Last updated: 04 Oct '12, 00:48