use of org.uberfire.ext.wires.core.api.factories.ShapeDragProxy in project drools-wb by kiegroup.
the class BaseGuidedDecisionTreeNodeFactory method getDragProxy.
@Override
public ShapeDragProxy getDragProxy(final FactoryHelper helper, final ShapeDragProxyPreviewCallback dragPreviewCallback, final ShapeDragProxyCompleteCallback dragEndCallBack) {
final T shape = makeShape();
final Group group = new Group();
group.add(shape);
// Add a label to the drag proxy if needed
double dragProxyWidth = getWidth();
double dragProxyHeight = getHeight();
final String description = getNodeLabel(helper);
if (description != null) {
final Text nodeLabel = new Text(description, ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);
nodeLabel.setTextAlign(TextAlign.CENTER);
nodeLabel.setTextBaseLine(TextBaseLine.MIDDLE);
nodeLabel.setFillColor(Color.rgbToBrowserHexColor(0, 0, 0));
dragProxyWidth = getDragProxyWidth(nodeLabel);
dragProxyHeight = getDragProxyHeight(nodeLabel);
group.add(nodeLabel);
}
final double _dragProxyWidth = dragProxyWidth;
final double _dragProxyHeight = dragProxyHeight;
return new ShapeDragProxy() {
@Override
public Group getDragGroup() {
return group;
}
@Override
public void onDragPreview(final double x, final double y) {
dragPreviewCallback.callback(x, y);
}
@Override
public void onDragComplete(final double x, final double y) {
dragEndCallBack.callback(x, y);
}
@Override
public double getWidth() {
return _dragProxyWidth;
}
@Override
public double getHeight() {
return _dragProxyHeight;
}
};
}
Aggregations