All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xworker.javafx.scene.shape.ArcToActions Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package xworker.javafx.scene.shape;

import javafx.scene.shape.ArcTo;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.beans.property.PropertyFactory;

public class ArcToActions {
    static{
        PropertyFactory.regist(ArcTo.class, "radiusYProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.radiusYProperty();
        });
        PropertyFactory.regist(ArcTo.class, "radiusXProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.radiusXProperty();
        });
        PropertyFactory.regist(ArcTo.class, "largeArcFlagProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.largeArcFlagProperty();
        });
        PropertyFactory.regist(ArcTo.class, "XAxisRotationProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.XAxisRotationProperty();
        });
        PropertyFactory.regist(ArcTo.class, "xProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.xProperty();
        });
        PropertyFactory.regist(ArcTo.class, "yProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.yProperty();
        });
        PropertyFactory.regist(ArcTo.class, "sweepFlagProperty", o -> {
            ArcTo obj = (ArcTo) o;
            return obj.sweepFlagProperty();
        });
    }

    public static void init(ArcTo node, Thing thing, ActionContext actionContext){
        PathElementActions.init(node, thing, actionContext);

        if(thing.valueExists("largeArcFlag")){
            node.setLargeArcFlag(thing.getBoolean("largeArcFlag"));
        }
        if(thing.valueExists("radiusX")){
            node.setRadiusX(thing.getDouble("radiusX"));
        }
        if(thing.valueExists("radiusY")){
            node.setRadiusY(thing.getDouble("radiusY"));
        }
        if(thing.valueExists("sweepFlag")){
            node.setSweepFlag(thing.getBoolean("sweepFlag"));
        }
        if(thing.valueExists("XAxisRotation")){
            node.setXAxisRotation(thing.getDouble("XAxisRotation"));
        }
        if(thing.valueExists("x")){
            node.setX(thing.getDouble("x"));
        }
        if(thing.valueExists("y")){
            node.setY(thing.getDouble("y"));
        }

    }

    public static ArcTo create(ActionContext actionContext){
        Thing self = actionContext.getObject("self");

        ArcTo node = new ArcTo();
        init(node, self, actionContext);
        actionContext.g().put(self.getMetadata().getName(), node);

        actionContext.peek().put("parent", node);
        for(Thing child : self.getChilds()){
            child.doAction("create", actionContext);
        }

        return node;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy