`
liyixing1
  • 浏览: 957404 次
  • 性别: Icon_minigender_1
  • 来自: 江西上饶
社区版块
存档分类
最新评论

screen,menu,form等里面的action

 
阅读更多
以screen为例
其他类似

screen的action内容是由
ModelScreenAction负责处理的。
其他类似的还有
ModelFormAction
ModelMenuAction
ModelTreeAction

其方法
是读取每个子元素,并初始化处理方式的。
先看
property-map的处理是由 actions.add(new PropertyMap(modelScreen, actionElement));
PropertyMap负责处理的。
public static List<ModelScreenAction> readSubActions(ModelScreen modelScreen, Element parentElement) {
        List<ModelScreenAction> actions = FastList.newInstance();

        List<? extends Element> actionElementList = UtilXml.childElementList(parentElement);
        for (Element actionElement: actionElementList) {
            if ("set".equals(actionElement.getNodeName())) {
                actions.add(new SetField(modelScreen, actionElement));
            } else if ("property-map".equals(actionElement.getNodeName())) {
                actions.add(new PropertyMap(modelScreen, actionElement));
            } else if ("property-to-field".equals(actionElement.getNodeName())) {
                actions.add(new PropertyToField(modelScreen, actionElement));
            } else if ("script".equals(actionElement.getNodeName())) {
                actions.add(new Script(modelScreen, actionElement));
            } else if ("service".equals(actionElement.getNodeName())) {
                actions.add(new Service(modelScreen, actionElement));
            } else if ("entity-one".equals(actionElement.getNodeName())) {
                actions.add(new EntityOne(modelScreen, actionElement));
            } else if ("entity-and".equals(actionElement.getNodeName())) {
                actions.add(new EntityAnd(modelScreen, actionElement));
            } else if ("entity-condition".equals(actionElement.getNodeName())) {
                actions.add(new EntityCondition(modelScreen, actionElement));
            } else if ("get-related-one".equals(actionElement.getNodeName())) {
                actions.add(new GetRelatedOne(modelScreen, actionElement));
            } else if ("get-related".equals(actionElement.getNodeName())) {
                actions.add(new GetRelated(modelScreen, actionElement));
            } else {
                throw new IllegalArgumentException("Action element not supported with name: " + actionElement.getNodeName());
            }
        }

        return actions;
    }



PropertyMap 是ModelScreenAction的子类,它的实现如下

@Override
        public void runAction(Map<String, Object> context) {
            String globalStr = this.globalExdr.expandString(context);
            // default to false
            boolean global = "true".equals(globalStr);

            Locale locale = (Locale) context.get("locale");
            String resource = this.resourceExdr.expandString(context, locale);

            ResourceBundleMapWrapper existingPropMap = this.mapNameAcsr.get(context);
            if (existingPropMap == null) {
                this.mapNameAcsr.put(context, UtilProperties.getResourceBundleMap(resource, locale, context));
            } else {
                try {
                    existingPropMap.addBottomResourceBundle(resource);
                } catch (IllegalArgumentException e) {
                    // log the error, but don't let it kill everything just for a typo or bad char in an l10n file
                    Debug.logError(e, "Error adding resource bundle [" + resource + "]: " + e.toString(), module);
                }
            }

            if (global) {
                Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
                if (globalCtx != null) {
                    ResourceBundleMapWrapper globalExistingPropMap = this.mapNameAcsr.get(globalCtx);
                    if (globalExistingPropMap == null) {
                        this.mapNameAcsr.put(globalCtx, UtilProperties.getResourceBundleMap(resource, locale, context));
                    } else {
                        // is it the same object? if not add it in here too...
                        if (existingPropMap != globalExistingPropMap) {
                            try {
                                globalExistingPropMap.addBottomResourceBundle(resource);
                            } catch (IllegalArgumentException e) {
                                // log the error, but don't let it kill everything just for a typo or bad char in an l10n file
                                Debug.logError(e, "Error adding resource bundle [" + resource + "]: " + e.toString(), module);
                            }
                        }
                    }
                }
            }
        }
    }

这里顺带提下
最后会调用UtilProperties的resolvePropertiesUrl方法来生成实际的资源名字。
这个方法有代码

url = FlexibleLocation.resolveLocation(resourceName + ".properties");
            if (url != null) {
                return url;
            }
            // Check for Java XML properties file
            url = FlexibleLocation.resolveLocation(resourceName + ".xml");
            if (url != null) {
                return url;
            }

可见ofbiz10.4是先查询properties文件是否存在,再检查xml文件是否存在。
分享到:
评论

相关推荐

    ExpressBars Suite 6.34 + source code

    (Screen Shot) * Menu Usage Tracking (Just like MS Office®) (Screen Shot) * Comprehensive MRU support * Menu Animation * Full Control Over Bar Caption Orientation * Action List ...

    VB编程资源大全(英文源码 表单)

    Quick set up, color option, curor change, good for beginners, small projects &lt;END&gt;&lt;br&gt;30 , OpacityForm.zip Opacity Form Effect&lt;END&gt;&lt;br&gt;31 , MoveForm.zip Moves a form around the screen just by ...

    ODOO10菜单和界面

    &lt;menuitem action="odoo_action_amos_sale_views" id="menu_amos_sale_views" sequence="0"/&gt; ``` 从以上内容中,我们可以看到如何通过XML来创建和修改ODOO10的菜单和界面,以及如何为菜单项命名、定义序列和...

    web前端设计与开发期末作品 旅游咨询网站 HTML5期末大作业 HTML+CSS旅游社网站5个页面 关于制作网页主题论述

    &lt;form action="/submit" method="post"&gt; 姓名: 邮箱: 提交"&gt; &lt;/form&gt; ``` #### 4. 多媒体元素应用 - **音频与视频**:使用`&lt;audio&gt;`和`&lt;video&gt;`标签嵌入音频和视频文件。 - **Flash**:虽然...

    手机客户端标准界面模板,

    7. **表单输入(Form Inputs)**:用于收集用户数据,如文本框、选择器、开关等。 8. **悬浮操作按钮(Floating Action Button, FAB)**:通常用于添加或创建新项目,位于屏幕右下角,易于触达。 9. **提示与...

    Learning Material Design (pdf)

    Chapter 5, Lists, Cards, and Data, is where we see how the recycler view can be used to organize data in the form of a list, and how separate elds of mixed media can be applied to the card view widget...

    dreamweaver的各种组件

    Check Form 利用Check Form您可以真正检查表单填写的正确性,并且可以自定义报错信息! Animate Images 它可以使用JPG的格式也可以用动态的形式表现出来,并且您可以定义触发动作,获得最大的主动! Add Favourite...

    Bloodshed Dev-C++

    * New splash screen and association icons * Improved installer * Many bug fixes Version 4.9.8.7 * Added support for GCC &gt; 3.2 * Debug variables are now resent during next debug session * Watched ...

    计算机专业英语词汇.pdf

    这些词汇是计算机专业人士在阅读技术文档、编程、系统管理等场合中不可或缺的语言元素。词汇表中包含动词、名词、形容词和介词等,涵盖了计算机科学的各个方面。以下是一些精选的词汇及其含义和在计算机专业中的应用...

    曲线拟合工具CurveExpert 1.0

    on the menu bar. Nov. 4, 1995, v. 1.10: =========================================================================== New Features: + Previously undocumented logical functions can be used in ...

    VB编程资源大全(英文源码 其它)

    &lt;END&gt;&lt;br&gt;78,ShutDnCtl.zip This has been tested on Windows 9x, me, NT and 2000 operating systems.The actual shutdown process will perform the type of action selected by the user. &lt;END&gt;&lt;br&gt;79,Reboot...

Global site tag (gtag.js) - Google Analytics