本文介绍了通过套接字ID的Hybris小部件连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个可以通过套接字与另一个进行通信的窗口小部件.我已经从此处中浏览了文档,但是我不明白他们的例子是如何工作的.我创建了definition.xml,在其中定义了输入/输出,mychat.zulcontroller.但是我无法在平台的任何位置找到标签<widget-connection>来看到小部件实际上是将输入/输出连接到某物..或者这不是上面标签的目的吗?

I'm trying to create a widget that can communicate with another one through sockets. I've followed the documentation from here but I couldn't understand how their example works. I've created the definition.xml where I've defined the inputs/outputs, mychat.zul and the controller. But I couldn't find anywhere in the platform the tag <widget-connection> to see that the widget is actually connecting the inputs/outputs to something.. or isn't this the purpose of the tag above?

我已经通过后台F4功能添加了小部件,但是只有在我添加了两个小部件并之间进行连接 SET 时,它们的示例才有效(因为我尝试调试程序,看看何时进入@SocketEvent方法,并且仅当我有2个小部件并设置outcomingMsgincomingMsg时才进入,但这还不足以仅设置具有相同sourceWidgetId和targetWidgetId的<widget-connection>吗? ).

I've added the widgets via backoffice F4 functionality but their example works only if I add two widgets and SET the connection between them (because I tried to debug the program and see when it enters in @SocketEvent method and it enters only when I have 2 widgets and set the outcomingMsg and incomingMsg, but isn't enough to only set the <widget-connection> with the same sourceWidgetId and targetWidgetId ?).

也许我不完全了解它是如何工作的.如果有人可以帮助我,我将不胜感激:)谢谢.

Maybe I don't understand completely how this works.. If someone can help me I would appreciate :) Thanks.

P.S.:我按照上面的教程中的步骤操作,我确信已经在正确的目录中创建了它们,否则根本无法使用.

P.S.: I followed the steps from the tutorial above, I am sure that I've created them in the right directory, otherwise it wouldn't work at all.

这是trainingbackoffice-backoffice-widgets.xml

<widget-connection sourceWidgetId="com.training.backoffice.widgets.mychat" outputId="outgoingMsg" targetWidgetId="com.training.backoffice.widgets.mychat" inputId="incomingMsg"/>

编辑:是否没有办法只有一个聊天窗口与其自身进行通信?

EDIT : Isn't there a way to have only one chat window to communicate with itself ?

推荐答案

已解决

<widget-connection>的工作与我预期的一样,但->我的窗口小部件未实例化,因此我通过在trainingbackoffice-backoffice-widgets.xml中实例化它来解决此问题,如下所示:

The <widget-connection> works as I expected BUT -> my widget wasn't instantiated, so I've solved the problem by instantiating it in trainingbackoffice-backoffice-widgets.xml like this:

<widget id="myChat" widgetDefinitionId="com.training.backoffice.widgets.mychat" />和这样的小部件连接:

<widget id="myChat" widgetDefinitionId="com.training.backoffice.widgets.mychat" /> and the widget connection like this:

<widget-connection sourceWidgetId="myChat" outputId="outgoingMsg" targetWidgetId="myChat" inputId="incomingMsg"/>

这篇关于通过套接字ID的Hybris小部件连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 01:38