使用参数 returns 错误调用 Dolphin 平台操作
Calling Dolphin Platform Action with params returns error
更新:好的,所以我看到的错误来自我现在解决的另一个问题,但仍未调用操作。更新了错误日志
我开始使用 Dolphin 平台 (V 0.6.1) 创建一个应用程序,我需要调用服务器端操作 ("clicked"),它工作正常,但只要我想通过参数...我得到
CONTROLLER_ACTION_CALL_ERROR_BEAN error
我做错了什么?在 ControllerProxy 文档中,它说参数必须匹配名称和计数,它们确实如此......我也尝试只传递 MenuItemEntry,同样的错误......
控制器
@DolphinController("MasterController")
public class MasterController {
@DolphinModel
private MasterModel model;
@Autowired
private MitgliederRepository mitglieder;
//This fills the listview in the MasterView
@PostConstruct
public void init() {
for (Mitglieder next : mitglieder.findAll()) {
add(next.getVorname());
}
}
@Inject
private BeanManager beanManager;
@Inject
private TaskExecutor taskExecutor;
//creates Bean Items
public void add(String item) {
taskExecutor.execute(MasterController.class, c -> c.onAdded(item));
}
private void onAdded(String text) {
final MenuItemEntry toDoItem = beanManager.create(MenuItemEntry.class);
toDoItem.setText(text);
model.getMenuItems().add(toDoItem);
}
@DolphinAction("clicked")
public void clicked(@Param("name") String item, @Param("row") int row) {
model.getMenuItems().get(row).setText(item);
}
}
ViewBinder
public class MasterViewBinder extends AbstractViewBinder<MasterModel> {
....
@FXML
private SplitPane splitPaneMaster;
@FXML
private StackPane stackPaneContent;
@FXML
private ListView<MenuItemEntry> listViewMenu;
public void setContent(Pane node) {
stackPaneContent.getChildren().setAll(node);
}
public MasterViewBinder(ClientContext clientContext) {
super(clientContext, "MasterController");
}
@Override
protected void init() {
ObservableList<MenuItemEntry> list = FXWrapper.wrapList(getModel().getMenuItems());
getListViewMenu().setItems(list);
listViewMenu.setOnMouseClicked((MouseEvent event) -> {
ListView<MenuItemEntry> o = (ListView<MenuItemEntry>) event.getSource();
MenuItemEntry item = o.getSelectionModel().getSelectedItem();
int row = o.getSelectionModel().getSelectedIndex();
invoke("clicked",new Param("name", item.getText()), new Param("row", row));
});
}
}
型号
@DolphinBean
public class MenuItemEntry {
private Property<String> text;
public String getText() {
return text.get();
}
public void setText(String text) {
this.text.set(text);
}
public Property<String> getTextProperty() {
return text;
}
@Override
public String toString() {
return text.get();
}
}
@DolphinBean
public class MasterModel {
private ObservableList<MenuItemEntry> menuItems;
public ObservableList<MenuItemEntry> getMenuItems() {
return menuItems;
}
....
}
申请
public class Zapp extends Application {
private static ClientContext clientContext;
@Override
public void init() throws Exception {
ClientConfiguration config = new JavaFXConfiguration("http://localhost:8080/todo-app/dolphin");
clientContext = ClientContextFactory.connect(config).get();
}
@Override
public void start(Stage primaryStage) throws Exception {
URL url = Zapp.class.getResource("/sn/zapp/resources/views/Master.fxml");
FXMLLoader loader = new FXMLLoader(url);
MasterViewBinder viewController = new MasterViewBinder(clientContext);
loader.setController(viewController);
ContentNavigation.setMainController(viewController);
SplitPane splitPaneMaster = (SplitPane)loader.load();
viewController.setSplitPane(splitPaneMaster);
Scene scene = new Scene(splitPaneMaster);
primaryStage.setScene(scene);
primaryStage.show();
}
public static ClientContext getClientContext() {
return clientContext;
}
public static void main(String... args) {
launch(args);
}
}
服务器日志
2015-11-28 17:41:21.557 INFO 4116 --- [nio-8080-exec-2] o.o.core.server.ServerConnector : S: received Command: dolphin_platform_intern_release
2015-11-28 17:41:21.562 INFO 4116 --- [nio-8080-exec-3] o.o.core.server.ServerConnector : S: received Command: CreatePresentationModel pmId 667ab952-5617-487c-8a82-ddbcc8ed81c3 pmType @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ attributes [[baseValue:client, id:112C, propertyName:@@@ SOURCE_SYSTEM @@@, qualifier:null, tag:VALUE, value:client], [baseValue:null, id:113C, propertyName:valueType, qualifier:null, tag:VALUE, value:null], [baseValue:null, id:114C, propertyName:actionId, qualifier:null, tag:VALUE, value:null], [baseValue:null, id:115C, propertyName:value, qualifier:null, tag:VALUE, value:null]]
2015-11-28 17:41:21.565 INFO 4116 --- [nio-8080-exec-5] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:115C, null -> a1ef29a1-b543-4b94-963d-909772b31c54
2015-11-28 17:41:21.568 INFO 4116 --- [nio-8080-exec-7] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:113C, null -> 2
2015-11-28 17:41:21.572 INFO 4116 --- [nio-8080-exec-8] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:114C, null -> c02476a7-ad56-44fc-b65a-5e33e2e205ec
2015-11-28 17:41:21.575 INFO 4116 --- [nio-8080-exec-6] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:233S, 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5 -> c02476a7-ad56-44fc-b65a-5e33e2e205ec
2015-11-28 17:41:21.579 INFO 4116 --- [nio-8080-exec-9] o.o.core.server.ServerConnector : S: received Command: dolphin_platform_intern_callControllerAction
客户端日志
Nov 28, 2015 5:40:03 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:03 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: CreatePresentationModel pmId @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ pmType @@@ DOLPHIN_BEAN @@@ attributes [[propertyName:@@@ SOURCE_SYSTEM @@@, id:58C, qualifier:null, value:client, baseValue:client, tag:VALUE], [propertyName:@@@ JAVA_CLASS @@@, id:59C, qualifier:null, value:com.canoo.dolphin.impl.ControllerActionCallParamBean, baseValue:com.canoo.dolphin.impl.ControllerActionCallParamBean, tag:VALUE], [propertyName:value, id:60C, qualifier:null, value:0, baseValue:0, tag:VALUE], [propertyName:valueType, id:61C, qualifier:null, value:0, baseValue:0, tag:VALUE], [propertyName:actionId, id:62C, qualifier:null, value:0, baseValue:0, tag:VALUE]]
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: CreatePresentationModel pmId 879db4e5-8a8d-4835-8492-10088d0537a9 pmType @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ attributes [[propertyName:@@@ SOURCE_SYSTEM @@@, id:63C, qualifier:null, value:client, baseValue:client, tag:VALUE], [propertyName:valueType, id:64C, qualifier:null, value:null, baseValue:null, tag:VALUE], [propertyName:actionId, id:65C, qualifier:null, value:null, baseValue:null, tag:VALUE], [propertyName:value, id:66C, qualifier:null, value:null, baseValue:null, tag:VALUE]]
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:60C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:66C, null -> 6c07a93e-1aea-4652-a71f-2ac8f2900543
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:61C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:64C, null -> 2
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:62C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:65C, null -> 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:228S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:232S, null -> fa9d1424-0b00-4129-8e66-6538b33c1e8b
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:229S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:234S, null -> clicked
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:230S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:233S, null -> 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: dolphin_platform_intern_callControllerAction
此问题是基于 Dolphin 平台 (http://www.dolphin-platform.io). We released version 0.7 yesterday (http://www.guigarage.com/2015/12/dolphin-platform-0-7-has-been-released/) 中的错误,此版本已修复该错误。您显示的代码现在应该可以工作了;)
更新:好的,所以我看到的错误来自我现在解决的另一个问题,但仍未调用操作。更新了错误日志
我开始使用 Dolphin 平台 (V 0.6.1) 创建一个应用程序,我需要调用服务器端操作 ("clicked"),它工作正常,但只要我想通过参数...我得到
CONTROLLER_ACTION_CALL_ERROR_BEAN error
我做错了什么?在 ControllerProxy 文档中,它说参数必须匹配名称和计数,它们确实如此......我也尝试只传递 MenuItemEntry,同样的错误......
控制器
@DolphinController("MasterController")
public class MasterController {
@DolphinModel
private MasterModel model;
@Autowired
private MitgliederRepository mitglieder;
//This fills the listview in the MasterView
@PostConstruct
public void init() {
for (Mitglieder next : mitglieder.findAll()) {
add(next.getVorname());
}
}
@Inject
private BeanManager beanManager;
@Inject
private TaskExecutor taskExecutor;
//creates Bean Items
public void add(String item) {
taskExecutor.execute(MasterController.class, c -> c.onAdded(item));
}
private void onAdded(String text) {
final MenuItemEntry toDoItem = beanManager.create(MenuItemEntry.class);
toDoItem.setText(text);
model.getMenuItems().add(toDoItem);
}
@DolphinAction("clicked")
public void clicked(@Param("name") String item, @Param("row") int row) {
model.getMenuItems().get(row).setText(item);
}
}
ViewBinder
public class MasterViewBinder extends AbstractViewBinder<MasterModel> {
....
@FXML
private SplitPane splitPaneMaster;
@FXML
private StackPane stackPaneContent;
@FXML
private ListView<MenuItemEntry> listViewMenu;
public void setContent(Pane node) {
stackPaneContent.getChildren().setAll(node);
}
public MasterViewBinder(ClientContext clientContext) {
super(clientContext, "MasterController");
}
@Override
protected void init() {
ObservableList<MenuItemEntry> list = FXWrapper.wrapList(getModel().getMenuItems());
getListViewMenu().setItems(list);
listViewMenu.setOnMouseClicked((MouseEvent event) -> {
ListView<MenuItemEntry> o = (ListView<MenuItemEntry>) event.getSource();
MenuItemEntry item = o.getSelectionModel().getSelectedItem();
int row = o.getSelectionModel().getSelectedIndex();
invoke("clicked",new Param("name", item.getText()), new Param("row", row));
});
}
}
型号
@DolphinBean
public class MenuItemEntry {
private Property<String> text;
public String getText() {
return text.get();
}
public void setText(String text) {
this.text.set(text);
}
public Property<String> getTextProperty() {
return text;
}
@Override
public String toString() {
return text.get();
}
}
@DolphinBean
public class MasterModel {
private ObservableList<MenuItemEntry> menuItems;
public ObservableList<MenuItemEntry> getMenuItems() {
return menuItems;
}
....
}
申请
public class Zapp extends Application {
private static ClientContext clientContext;
@Override
public void init() throws Exception {
ClientConfiguration config = new JavaFXConfiguration("http://localhost:8080/todo-app/dolphin");
clientContext = ClientContextFactory.connect(config).get();
}
@Override
public void start(Stage primaryStage) throws Exception {
URL url = Zapp.class.getResource("/sn/zapp/resources/views/Master.fxml");
FXMLLoader loader = new FXMLLoader(url);
MasterViewBinder viewController = new MasterViewBinder(clientContext);
loader.setController(viewController);
ContentNavigation.setMainController(viewController);
SplitPane splitPaneMaster = (SplitPane)loader.load();
viewController.setSplitPane(splitPaneMaster);
Scene scene = new Scene(splitPaneMaster);
primaryStage.setScene(scene);
primaryStage.show();
}
public static ClientContext getClientContext() {
return clientContext;
}
public static void main(String... args) {
launch(args);
}
}
服务器日志
2015-11-28 17:41:21.557 INFO 4116 --- [nio-8080-exec-2] o.o.core.server.ServerConnector : S: received Command: dolphin_platform_intern_release
2015-11-28 17:41:21.562 INFO 4116 --- [nio-8080-exec-3] o.o.core.server.ServerConnector : S: received Command: CreatePresentationModel pmId 667ab952-5617-487c-8a82-ddbcc8ed81c3 pmType @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ attributes [[baseValue:client, id:112C, propertyName:@@@ SOURCE_SYSTEM @@@, qualifier:null, tag:VALUE, value:client], [baseValue:null, id:113C, propertyName:valueType, qualifier:null, tag:VALUE, value:null], [baseValue:null, id:114C, propertyName:actionId, qualifier:null, tag:VALUE, value:null], [baseValue:null, id:115C, propertyName:value, qualifier:null, tag:VALUE, value:null]]
2015-11-28 17:41:21.565 INFO 4116 --- [nio-8080-exec-5] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:115C, null -> a1ef29a1-b543-4b94-963d-909772b31c54
2015-11-28 17:41:21.568 INFO 4116 --- [nio-8080-exec-7] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:113C, null -> 2
2015-11-28 17:41:21.572 INFO 4116 --- [nio-8080-exec-8] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:114C, null -> c02476a7-ad56-44fc-b65a-5e33e2e205ec
2015-11-28 17:41:21.575 INFO 4116 --- [nio-8080-exec-6] o.o.core.server.ServerConnector : S: received Command: ValueChanged attr:233S, 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5 -> c02476a7-ad56-44fc-b65a-5e33e2e205ec
2015-11-28 17:41:21.579 INFO 4116 --- [nio-8080-exec-9] o.o.core.server.ServerConnector : S: received Command: dolphin_platform_intern_callControllerAction
客户端日志
Nov 28, 2015 5:40:03 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:03 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: CreatePresentationModel pmId @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ pmType @@@ DOLPHIN_BEAN @@@ attributes [[propertyName:@@@ SOURCE_SYSTEM @@@, id:58C, qualifier:null, value:client, baseValue:client, tag:VALUE], [propertyName:@@@ JAVA_CLASS @@@, id:59C, qualifier:null, value:com.canoo.dolphin.impl.ControllerActionCallParamBean, baseValue:com.canoo.dolphin.impl.ControllerActionCallParamBean, tag:VALUE], [propertyName:value, id:60C, qualifier:null, value:0, baseValue:0, tag:VALUE], [propertyName:valueType, id:61C, qualifier:null, value:0, baseValue:0, tag:VALUE], [propertyName:actionId, id:62C, qualifier:null, value:0, baseValue:0, tag:VALUE]]
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: CreatePresentationModel pmId 879db4e5-8a8d-4835-8492-10088d0537a9 pmType @@@ CONTROLLER_ACTION_CALL_PARAM_BEAN @@@ attributes [[propertyName:@@@ SOURCE_SYSTEM @@@, id:63C, qualifier:null, value:client, baseValue:client, tag:VALUE], [propertyName:valueType, id:64C, qualifier:null, value:null, baseValue:null, tag:VALUE], [propertyName:actionId, id:65C, qualifier:null, value:null, baseValue:null, tag:VALUE], [propertyName:value, id:66C, qualifier:null, value:null, baseValue:null, tag:VALUE]]
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:60C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:66C, null -> 6c07a93e-1aea-4652-a71f-2ac8f2900543
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:61C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:64C, null -> 2
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:62C, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:65C, null -> 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:228S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:232S, null -> fa9d1424-0b00-4129-8e66-6538b33c1e8b
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:229S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:234S, null -> clicked
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:230S, 0 -> 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: ValueChanged attr:233S, null -> 7ce31e6e-2f3d-4ad4-8e6d-458bf1ff9ac5
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: sending batch of size 1
Nov 28, 2015 5:40:04 PM java_util_logging_Logger$info call
INFORMATION: C: -> Command: dolphin_platform_intern_callControllerAction
此问题是基于 Dolphin 平台 (http://www.dolphin-platform.io). We released version 0.7 yesterday (http://www.guigarage.com/2015/12/dolphin-platform-0-7-has-been-released/) 中的错误,此版本已修复该错误。您显示的代码现在应该可以工作了;)