Skip to content

Pseudo pojo model #25

Description

@jmdsc

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions