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

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

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

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

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

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

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

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