Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Tapestry webapp中设置t5/core/datefield的默认配置_Tapestry - Fatal编程技术网

如何在Tapestry webapp中设置t5/core/datefield的默认配置

如何在Tapestry webapp中设置t5/core/datefield的默认配置,tapestry,Tapestry,我发现最新的Tapestry5 jquery 4.1.2在其模块类中重写了核心日期字段via @Contribute(ModuleManager.class) public static void setupComponentsShims( MappedConfiguration<String, Object> configuration, @Inject @Path("/META-INF/modules/tjq/datefie

我发现最新的Tapestry5 jquery 4.1.2在其模块类中重写了核心日期字段via

@Contribute(ModuleManager.class)
    public static void setupComponentsShims(
            MappedConfiguration<String, Object> configuration,
            @Inject @Path("/META-INF/modules/tjq/datefield.js") Resource datefield,
            @Inject @Path("${jquery.assets.root}/vendor/jquery.mousewheel.js") Resource jquerymousewheel,
            @Symbol(JQuerySymbolConstants.ADD_MOUSEWHEEL_EVENT) boolean mouseWheelIncluded) {

        **configuration.add("t5/core/datefield",
        new JavaScriptModuleConfiguration(datefield));**

        if (mouseWheelIncluded)
            configuration.add("vendor/jquerymousewheel",
                    new JavaScriptModuleConfiguration(jquerymousewheel)
                            .dependsOn("jquery"));
    }
@contribution(ModuleManager.class)
公共静态无效设置组件HIMS(
映射配置配置,
@注入@Path(“/META-INF/modules/tjq/datefield.js”)资源日期字段,
@注入@Path(${jquery.assets.root}/vendor/jquery.mouseweel.js”)资源jquerymouseheel,
@符号(JQuerySymbolConstants.ADD_MOUSEWHEEL_事件)布尔值(包括MOUSEWHEEL){
**添加(“t5/core/datefield”,
新的JavaScriptModuleConfiguration(datefield))**
如果(包括鼠标滚轮)
添加(“供应商/jquerymousewheel”,
新的JavaScriptModuleConfiguration(jquerymousewheel)
.dependsOn(“jquery”);
}
我仍然希望使用tapestry core中的默认值。 如何在我的web应用程序中设置它,该应用程序也在使用Tapestry5 jquery库??现在我确实修改了Tapestry jquery库代码,但是应该有一种更简单的方法,而不是修改外部库代码


谢谢。

如您所见,
JQueryModule
中的覆盖是通过使用
ModuleManager
服务完成的

与其他贡献一样,您可以使用
配置覆盖此贡献。覆盖(…)
,即:

@Contribute(ModuleManager.class)
public void useCoreDateField(
        MappedConfiguration<String, Object> configuration,
        AssetSource assetSource)
{
    // Load core javascript for the component
    Resource dateField = assetSource.resourceForPath(
        "/META-INF/modules/t5/core/datefield.js");

    // Override the contribution
    configuration.override("t5/core/datefield",
        new JavaScriptModuleConfiguration(dateField));
}
@contribution(ModuleManager.class)
公共无效useCoreDateField(
映射配置配置,
资产来源(资产来源)
{
//加载组件的核心javascript
Resource dateField=assetSource.resourceForPath(
“/META-INF/modules/t5/core/datefield.js”);
//覆盖贡献
配置.覆盖(“t5/core/datefield”,
新的JavaScriptModuleConfiguration(dateField));
}
执行此操作后,不要忘记清除浏览器缓存