tesis-dynaware / graph-editor

Eclipse Public License 1.0
132 stars 42 forks source link

Pseudo pojo model #25

Open jmdsc opened 9 years ago

jmdsc commented 9 years ago

Hi, Instead of suggesting support for POJO based models and loosing features like undo and redo, what do you think of adding support so that users can attach their own pojos to GNode and GConnection...

// attach pojo to Gnode: MyNodeModel myNodeModel = new MyNodeModel(); myNodeModel.setAtt1("val"); myNodeModel.setAtt2(123);

GNode node = GraphFactory.eINSTANCE.createGNode(); node.setData(myNodeModel)

// to retrieve the attached pojo - perhaps after selection or something Object obj = node.getData(); // or preferably MyNodeModel myNodeModel = node.<MyNodeModel>getData();

// attach pojo to GCconnection graphEditor.setOnConnectionCreated((connection, command) -> { MyConnectionModel myConnectionModel = new MyConnectionModel(); myNodeModel.setAtt1("val"); myNodeModel.setAtt2(123); connection.setData(myConnectionModel); });

// to retrieve the attached pojo - perhaps after selection or something Object obj = connection.getData(); // or preferably MyConnectionModel myConnectionModel = connection.<MyConnectionModel>getData();

rmfisher commented 9 years ago

FYI I'm no longer working at the company that has the copyright on this code. I don't think there'll be any new features added in the near future. My advice would be to fork it and make any changes you wish. All the best.

jmdsc commented 9 years ago

Thanks for the reply Robert. Do you know if the copyright allows any fork of the code to change package names; would this be ok?

rmfisher commented 9 years ago

Yes I believe that is ok. See here:

https://tldrlegal.com/license/eclipse-public-license-1.0-(epl-1.0)