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

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

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

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

public class LineToActions {
    static{
        PropertyFactory.regist(LineTo.class, "xProperty", o -> {
            LineTo obj = (LineTo) o;
            return obj.xProperty();
        });
        PropertyFactory.regist(LineTo.class, "yProperty", o -> {
            LineTo obj = (LineTo) o;
            return obj.yProperty();
        });
    }

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

        if(thing.valueExists("x")){
            node.setX(thing.getDouble("x"));
        }
        if(thing.valueExists("y")){
            node.setY(thing.getDouble("y"));
        }
    }

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

        LineTo node = new LineTo();
        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