kieler / klighd-vscode

Eclipse Public License 2.0
8 stars 6 forks source link

update properties to be accessed using <string,unknown> map #63

Closed Eddykasp closed 2 years ago

Eddykasp commented 2 years ago

This changes the way elk properties are accessed by the client. Instead of the NodeProperties class, properties are now a map<string, unknown>, where the key is the the fully qualified name such as "org.eclipse.elk.algorithm" Because the property types are now unknown, they have to be explicitly cast by the developer meaning the developer has to know the type of the property. Currently all the used properties are primitive types, but more complex types also exist and may need to be dealt with nicely. There may be some more checks necessary to ensure non-existent properties aren't being accessed, but I haven't found any such cases yet.

KGraphMappingUtil shows how the properties are being set in KlighD. This needs to be improved a bit and the duplicate properties being set in KGraphDiagramGenerator still need to be removed.

Eddykasp commented 2 years ago

Error when clicking and dragging on diagram due to properties.get not being defined, requires some default values.

Uncaught TypeError: targetNode.parent.properties.get is not a function
    at KlighdInteractiveMouseListener.mouseDown (klighd-interactive-m…listener.js?d9c1:99)
    at eval (mouse-tool.js?d5a7:82)
    at Array.map (<anonymous>)
    at MouseTool.handleEvent (mouse-tool.js?d5a7:82)
    at MouseTool.mouseDown (mouse-tool.js?d5a7:119)
    at invokeHandler (eventlisteners.js?7eb2:4)
    at handleEvent (eventlisteners.js?7eb2:18)
    at SVGSVGElement.handler (eventlisteners.js?7eb2:23)