@postResize hook not working
Issue
The @postResize
hook does not work currently.
Possible culprit
(See example below.)
The method
public void resize(final int width, final int height)
of generated class
info.scce.cinco.product.test.some.impl.NodeAImpl
does call
this.postResize(this, deltaWidth, deltaHeight, 0, oldWidth, oldHeight)
but
public void postResize(final ModelElement modelElement, final int deltaWidth, final int deltaHeight, final int direction, final int oldWidth, final int oldHeight)
is not implemented in NodeAImpl
.
Instead the default implementation of
graphmodel.impl.NodeImpl
is used.
Example
Some.mgl
id info.scce.cinco.product.test
stylePath "model/Some.style"
graphModel SomeGraph {
diagramExtension "some"
containableElements (*)
}
@postResize("info.scce.cinco.product.test.hook.NodeAPostResize")
@style(labeledCircle, "A: ${label}")
node NodeA {
incomingEdges (*)
outgoingEdges (*)
attr EString as label
}
// ...
NodeAImpl.java
package info.scce.cinco.product.test.some.impl;
// ...
public class NodeAImpl extends NodeImpl implements NodeA {
// ...
public void resize(final int width, final int height) {
transact("Resize", () -> {
graphmodel.internal.InternalNode ime = (graphmodel.internal.InternalNode) getInternalElement();
int oldWidth = ((graphmodel.internal.InternalNode)getInternalElement()).getWidth();
int oldHeight = ((graphmodel.internal.InternalNode)getInternalElement()).getHeight();
int deltaWidth = width - ime.getWidth();
int deltaHeight = height - ime.getHeight();
if (deltaWidth != 0)
ime.setWidth(width);
if (deltaHeight != 0)
ime.setHeight(height);
if (deltaWidth != 0 || deltaHeight != 0) {
this.postResize(this, deltaWidth, deltaHeight, 0, oldWidth, oldHeight);
this.update();
}
});
}
// ...
}