Mate:无法设置属性模型

发布于 2024-08-11 02:48:48 字数 1567 浏览 6 评论 0原文

我有一个带有模块的应用程序。每个模块都是完全独立的。他们之间没有共同的事件或其他任何事情。每个模块中都有一个 DataGrid 和一个 ContextMenu。所选数据的详细信息将在弹出窗口中打开。像往常一样,这些模块由 loalEventMap 和presentationModel 控制。

如果我立即关闭弹出窗口并再次打开它,则一切正常。但是,如果我更改弹出窗口中的一些数据,关闭它,卸载模块,再次加载模块,然后再次打开弹出窗口,Mate 会抛出以下错误:

  • 错误:无法在 CDBInputMask 上设置属性模型,因为不是 CDBPresentationModel 类型。提供的值的类型为 CDBPresentationModel
  • 目标:CDBInputMask
  • 目标键:型号
  • 标签:PropertyInjector
  • 文件:CDBLocalEventMap
  • 堆栈跟踪:类型错误:错误 #1034:类型强制失败:无法将 com.mycomp.myMod.ui.presenters::CDBPresentationModel@5d13cf1 转换为 com.mycomp.myMod.ui.presenters.CDBPresentationModel。 在 com.asfusion.mate.core::Binder/bind()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/core/Binder.as:90] 在 com.asfusion.mate.actions::PropertyInjector/run()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/actions/PropertyInjector.as:205]

我的实现:


open弹出窗口:

    inputMask = new CDBInputMask();
    PopUpManager.addPopUp(inputMask,this,true);

关闭弹出窗口:

 PopUpManager.removePopUp(inputMask);

inputMask = null; 注射器:

 <Injectors target="{CDBInputMask}" debug="true" dispatcherType="global" >

在 Mate-Forum 中,我发现了一个具有类似但不完全相同问题的线程。这里主持人的意思是它看起来像是试图在一个模块中实例化一个类两次。就我而言,PopUpManager 是一个单例类。所以看起来是同样的问题。第一次所有工作正常,第二次则崩溃,所有这些都是因为该类已经被注入。

我尝试使用带有跟踪功能的调试器来查看如何清除弹出窗口或清除模块。但我还没有找到解决办法。如果您需要任何进一步的代码,我会发布它。

提前致谢。 坦率

I have an application with modules. Every Module is completely self-contained. There are no shared events or anything else between them. In each modules there is a DataGrid and with a ContextMenu. The details of selected data open in a popup window. The modules are controlled by an loalEventMap and a presentationModel as usual.

If I closed a popup immediately and open it again, all works fine. But if I change some data in the popup, close it, unload my module, load the module again, and open the popup again, Mate throws the following error:

  • ERROR: Unable to set property model on CDBInputMask because is not type CDBPresentationModel. Provided value was of type CDBPresentationModel
  • TARGET: CDBInputMask
  • TARGET KEY: model
  • TAG: PropertyInjector
  • FILE: CDBLocalEventMap
  • STACK TRACE: TypeError: Error #1034: Type Coercion failed: cannot convert com.mycomp.myMod.ui.presenters::CDBPresentationModel@5d13cf1 to com.mycomp.myMod.ui.presenters.CDBPresentationModel.
    at com.asfusion.mate.core::Binder/bind()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/core/Binder.as:90]
    at com.asfusion.mate.actions::PropertyInjector/run()[/Users/Nahuel 1/Documents/Flex Builder 3/Mate_trunk/src/com/asfusion/mate/actions/PropertyInjector.as:205]

My implementation:


open Popup:

    inputMask = new CDBInputMask();
    PopUpManager.addPopUp(inputMask,this,true);

close Popup:

 PopUpManager.removePopUp(inputMask);

inputMask = null;
Injector:

 <Injectors target="{CDBInputMask}" debug="true" dispatcherType="global" >

In the Mate-Forum I found a thread with a similar, but not quite identical, problem. Here the moderator meant that it looks like it's trying to instantiate a class twice in a module. In my case, the PopUpManager is a singleton class. So it looks like the same problem. First time through all works fine, Second time through it crashes, all because the class is already injected.

I tried to use a debugger with tracing to see how I could clear the popup or clear the module. But I have not found a solution. If you need any further code, I'll post it.

Thanks in advance.
Frank

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

闻呓 2024-08-18 02:48:48

听起来像是应用程序域问题。

可能发生的情况是类定义在不同的安全域上被多次加载。尽管对象看起来属于同一类,但这将导致铸造问题。就 Flash 运行时而言,除非它们位于同一安全域,否则它们不是同一类型。

要解决此问题,请为加载程序提供一个包含您的主应用程序安全域的上下文(假设您正在使用 Loader 类来加载模块):

var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.loader(request, context);

Sounds like ApplicationDomain issues.

What is likely happening is that the class definitions are being loaded multiple times on different security domains. This will cause the casting issues despite the objects looking like they are of the same class. As far as the Flash runtime is concerned they are not the same type unless they are on the same security domain.

To resolve this give the loader a context with your main application's security domain used (assuming you are using the Loader class to load your modules):

var context:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader.loader(request, context);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文