xworker.javafx.scene.chart.ChartActions Maven / Gradle / Ivy
package xworker.javafx.scene.chart;
import javafx.geometry.Side;
import javafx.scene.chart.Chart;
import org.xmeta.ActionContext;
import org.xmeta.Thing;
import xworker.javafx.beans.property.PropertyFactory;
import xworker.javafx.layout.RegionActions;
import xworker.javafx.util.JavaFXUtils;
public class ChartActions {
static{
PropertyFactory.regist(Chart.class, "titleProperty", o -> {
Chart obj = (Chart) o;
return obj.titleProperty();
});
PropertyFactory.regist(Chart.class, "animatedProperty", o -> {
Chart obj = (Chart) o;
return obj.animatedProperty();
});
PropertyFactory.regist(Chart.class, "titleSideProperty", o -> {
Chart obj = (Chart) o;
return obj.titleSideProperty();
});
PropertyFactory.regist(Chart.class, "legendSideProperty", o -> {
Chart obj = (Chart) o;
return obj.legendSideProperty();
});
PropertyFactory.regist(Chart.class, "legendVisibleProperty", o -> {
Chart obj = (Chart) o;
return obj.legendVisibleProperty();
});
}
public static void init(Chart node, Thing thing, ActionContext actionContext){
RegionActions.init(node, thing, actionContext);
if(thing.valueExists("animated")){
node.setAnimated(thing.getBoolean("animated"));
}
if(thing.valueExists("legendSide")){
node.setLegendSide(Side.valueOf(thing.getString("legendSide")));
}
if(thing.valueExists("legendVisible")){
node.setLegendVisible(thing.getBoolean("legendVisible"));
}
if(thing.valueExists("title")){
String title = JavaFXUtils.getString(thing, "title", actionContext);
if(title != null) {
node.setTitle(title);
}
}
if(thing.valueExists("titleSide")){
node.setTitleSide(Side.valueOf(thing.getString("titleSide")));
}
}
}