Search in sources :

Example 1 with Radius

use of org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Radius in project kie-wb-common by kiegroup.

the class AbstractNodeBuilder method setSize.

protected void setSize(final BuilderContext context, final T node, final double width, final double height) {
    Object definition = node.getContent().getDefinition();
    Width w = null;
    Height h = null;
    Set<?> properties = context.getDefinitionManager().adapters().forDefinition().getProperties(definition);
    if (null != properties) {
        // Look for w/h or radius and set the values.
        for (Object property : properties) {
            if (property instanceof Radius) {
                Radius radius = (Radius) property;
                double r = getRadius(width, height);
                radius.setValue(r);
                break;
            }
            if (property instanceof Width) {
                w = (Width) property;
                w.setValue(width);
                if (h != null) {
                    break;
                }
            }
            if (property instanceof Height) {
                h = (Height) property;
                h.setValue(height);
                if (w != null) {
                    break;
                }
            }
        }
    }
}
Also used : Radius(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Radius) Height(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Height) Width(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Width)

Aggregations

Height (org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Height)1 Radius (org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Radius)1 Width (org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.Width)1