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

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

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

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

public class CylinderActions {
    static{
        PropertyFactory.regist(Cylinder.class, "heightProperty", o -> {
            Cylinder obj = (Cylinder) o;
            return obj.heightProperty();
        });
        PropertyFactory.regist(Cylinder.class, "radiusProperty", o -> {
            Cylinder obj = (Cylinder) o;
            return obj.radiusProperty();
        });
    }

    public static void init(Cylinder node, Thing thing, ActionContext actionContext){
        Shape3DActions.init(node, thing, actionContext);

        if(thing.valueExists("radius")){
            node.setRadius(thing.getDouble("radius"));
        }
        if(thing.valueExists("height")){
            node.setHeight(thing.getDouble("height"));
        }
    }

    public static Cylinder create(ActionContext actionContext){
        Thing self = actionContext.getObject("self");
        Cylinder node = new Cylinder();
        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