I need some help with Serialization of draw2d Layered Panes. I read about Serialization, and found that a Class can be serialized only if it implements Serializable
Interface, and all its fields are either themselves Serializable, or transient.
I have a very Complex Diagram that I need to serialize, and don't have a clue as to how to proceed? I found out that the LayeredPane class only contains one field of type List. In any case, can any one help with how one can write, say a recursive method or something, to make a LayeredPane Object Serializable?
@mKorbel A Sample scenario of the Problem I am facing is difficult to give, as its part of a really large application. Still, I've made up a case, which may give you an idea of the Problem:
public class Editor extends org.eclipse.ui.part.EditorPart {
org.eclipse.draw2d.FreeformLayer objectsLayer;
org.eclipse.draw2d.ConnectionLayer connectionLayer;
public void createPartControl(Composite parent) {
org.eclipse.draw2d.FigureCanvas canvas = new org.eclipse.draw2d.FigureCanvas(composite);
org.eclipse.draw2d.LayeredPane pane = new org.eclipse.draw2d.LayeredPane();
objectsLayer = new org.eclipse.draw2d.FreeformLayer();
connectionLayer = org.eclipse.draw2d.ConnectionLayer();
pane.add(objectsLayer);
pane.add(connectionLayer);
canvas.setContents(pane);
addFigures();
addConnections();
}
private void addFigures() {
// Adds Objects, i.e., org.eclipse.draw2d.Figure Objects, to the objectLayer
// which turn contains, 1 or more org.eclipse.draw2d.Panel Objects,
// with variable number of org.eclipse.draw2d.Label objects
}
private void addConnections() {
// Adds org.eclipse.draw2d.PolylineConnection objects to the connectionLayer
// between objects in the objectLayer
}
}