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

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

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

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

public class StackedBarChartActions {
    static{
        PropertyFactory.regist(StackedBarChart.class, "categoryGapProperty", o -> {
            StackedBarChart obj = (StackedBarChart) o;
            return obj.categoryGapProperty();
        });
    }

    public static void init(StackedBarChart node, Thing thing, ActionContext actionContext){
        XYChartActions.init(node, thing, actionContext);

        if(thing.valueExists("categoryGap")){
            node.setCategoryGap(thing.getDouble("categoryGap"));
        }
    }

    public static StackedBarChart create(ActionContext actionContext){
        Thing self = actionContext.getObject("self");
        Axis xAxis = XYChartActions.getXAxis(self, actionContext);
        Axis yAxis = XYChartActions.getYAxis(self, actionContext);
        StackedBarChart node = new StackedBarChart(xAxis, yAxis);
        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