xworker.javafx.scene.chart.BarChartActions Maven / Gradle / Ivy
package xworker.javafx.scene.chart;
import javafx.scene.chart.Axis;
import javafx.scene.chart.BarChart;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.beans.property.PropertyFactory;
public class BarChartActions {
static{
PropertyFactory.regist(BarChart.class, "categoryGapProperty", o -> {
BarChart obj = (BarChart) o;
return obj.categoryGapProperty();
});
PropertyFactory.regist(BarChart.class, "barGapProperty", o -> {
BarChart obj = (BarChart) o;
return obj.barGapProperty();
});
}
public static void init(BarChart node, Thing thing, ActionContext actionContext){
XYChartActions.init(node, thing, actionContext);
if(thing.valueExists("barGap")){
node.setBarGap(thing.getDouble("barGap"));
}
if(thing.valueExists("categoryGap")){
node.setCategoryGap(thing.getDouble("categoryGap"));
}
}
public static BarChart create(ActionContext actionContext){
Thing self = actionContext.getObject("self");
Axis xAxis = XYChartActions.getXAxis(self, actionContext);
Axis yAxis = XYChartActions.getYAxis(self, actionContext);
BarChart node = new BarChart(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;
}
}