You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
// 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();
The text was updated successfully, but these errors were encountered:
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.
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();
The text was updated successfully, but these errors were encountered: