As I found out that the Latest Tapestry5-jquery 4.1.2 overrides the core datefield via in its Module class.
@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"));
}
I still wants to use the default one from tapestry core. How can I set it back in my web-app which is using the Tapestry5-jquery library also ?? For now i did modify the Tapestry-jquery lib code but there should an easier way rather than modifying the external lib code.
Thanks.
As you can see that override in the JQueryModule
is done by using mapped configuration to the ModuleManager
service.
As with other contributions you can override this one with configuration.override(...)
, i.e.:
@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));
}
Don't forget to clear the browser cache after you do this.