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

xworker.javafx.scene.chart.NumberAxisActions Maven / Gradle / Ivy

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

import javafx.scene.chart.NumberAxis;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.beans.property.PropertyFactory;

public class NumberAxisActions {
    static{
        PropertyFactory.regist(NumberAxis.class, "tickUnitProperty", o -> {
            NumberAxis obj = (NumberAxis) o;
            return obj.tickUnitProperty();
        });
        PropertyFactory.regist(NumberAxis.class, "forceZeroInRangeProperty", o -> {
            NumberAxis obj = (NumberAxis) o;
            return obj.forceZeroInRangeProperty();
        });
    }

    public static void init(NumberAxis node, Thing thing, ActionContext actionContext){
        ValueAxisActions.init(node, thing, actionContext);

        if(thing.valueExists("forceZeroInRange")){
            node.setForceZeroInRange(thing.getBoolean("forceZeroInRange"));
        }
        if(thing.valueExists("tickUnit")){
            node.setTickUnit(thing.getDouble("tickUnit"));
        }
    }

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