1

in my Dolphin Platform project, the XYChart.Series Object, which contains a series of XYChart.Data, does not seem to synchronize its datamodel.

My viewbinder binds the data of the BarChart with the PM and sets it to the BarChartObjekt

public class GesamtErgebnisViewBinder extends AbstractViewBinder<GesamtErgebnisModel> {
 @Override
    protected void init() {
       ....
        ObservableList<XYChart.Series<String, Integer>> data = FXWrapper.wrapList(getModel().getData()) 
        barChart.setData(data); 
    }
}

The model consists of an observable list of BarChart Data

@DolphinBean
public class GesamtErgebnisModel {

   ....

    private ObservableList<XYChart.Series<String, Integer>> data;

    ....
}

On the serverside I am computing the BarChart data to pass it to my model object.

@DolphinController("GesamtErgebnisController")
public class GesamtErgebnisController {

@Inject
private BeanManager beanManager;

@DolphinModel
private GesamtErgebnisModel model;
...
        taskExecutor.execute(GesamtErgebnisController.class, e -> {
            final Series<String, Integer> series = beanManager.create(XYChart.Series.class);
            rawFilterData.entrySet().stream().map((mitgliedToFilterResultEntry) -> {
                final XYChart.Data<String, Integer> datas = beanManager.create(XYChart.Data.class);
                ....
            }).forEach((datas) -> {
            series.getData().add(datas);
        });
        model.getData().add(series);
});

But the bar chart just stays empty. Just the category is visible. Because I thought maybe my data that I put together is flawed, I altered an example from the Oracle website and tested the data manually. On server side, this doesn´t work either.. same output. If I put this code on clientside inside the init method of my viewbinder, the data shows correctly. So there should be nothing wrong with the data being passed. Observerable lists with String i.e work just fine. Maybe I am missing something else?

4

1 回答 1

1

我认为在服务器上(或在共享模型中)使用 JavaFX 类不是一个好主意。使用 Dolphin 平台时,创建客户端 API 独立(表示)模型应该是最佳实践。您可以轻松地将此模型绑定到使用 UI-Toolkit 的特定类(如 JavaFX)的客户端模型。我为您的具体问题创建了一个示例,该示例在绑定到 Dolphin 平台模型的 JavaFX 客户端中使用 BarChart。你可以在 Github 上找到它

于 2015-12-16T09:27:56.827 回答