You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Daniel Keir Haywood (Jira)" <ji...@apache.org> on 2020/03/19 18:35:00 UTC
[jira] [Updated] (ISIS-996) Define component factories as Spring
@Components
[ https://issues.apache.org/jira/browse/ISIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Keir Haywood updated ISIS-996:
-------------------------------------
Fix Version/s: (was: 2.1.4)
Description:
was previously:
Not possible to "replace" components in Wicket viewer (workaround is to use "add")
~~~~~
As per [http://isis.markmail.org/thread/x3k2www3m2wfsgtv]
To recreate:
- copy ReferencePanelFactory to ReferencePanelFactory2
in (subclass of) IsisWicketApplication, add:
{code:java}
@com.google.inject.Singleton
public static class MyComponentFactoryRegistrar extends ComponentFactoryRegistrarDefault {
@Override
public void addComponentFactories(ComponentFactoryList componentFactories) {
super.addComponentFactories(componentFactories);
componentFactories.replace(new ReferencePanelFactory2());
}
}
{code}
and
{code:java}
final Module overrides = new AbstractModule() {
@Override
protected void configure() {
...
bind(ComponentFactoryRegistrar.class).
to(MyComponentFactoryRegistrar.class);
}
};
{code}
the issue is that "replace" ends up replacing all component factories of type ComponentType.SCALAR_NAME_AND_VALUE, whereas it should instead just replace the one for ReferencePanelFactory.
The workaround is easy enough: call "add" (which puts new factory at beginning of list) rather than "replace".
was:
As per http://isis.markmail.org/thread/x3k2www3m2wfsgtv
To recreate:
- copy ReferencePanelFactory to ReferencePanelFactory2
in (subclass of) IsisWicketApplication, add:
{code}
@com.google.inject.Singleton
public static class MyComponentFactoryRegistrar extends ComponentFactoryRegistrarDefault {
@Override
public void addComponentFactories(ComponentFactoryList componentFactories) {
super.addComponentFactories(componentFactories);
componentFactories.replace(new ReferencePanelFactory2());
}
}
{code}
and
{code}
final Module overrides = new AbstractModule() {
@Override
protected void configure() {
...
bind(ComponentFactoryRegistrar.class).
to(MyComponentFactoryRegistrar.class);
}
};
{code}
the issue is that "replace" ends up replacing all component factories of type ComponentType.SCALAR_NAME_AND_VALUE, whereas it should instead just replace the one for ReferencePanelFactory.
The workaround is easy enough: call "add" (which puts new factory at beginning of list) rather than "replace".
Issue Type: Improvement (was: Bug)
Priority: Major (was: Minor)
Summary: Define component factories as Spring @Components (was: Not possible to "replace" components in Wicket viewer (workaround is to use "add"))
> Define component factories as Spring @Components
> ------------------------------------------------
>
> Key: ISIS-996
> URL: https://issues.apache.org/jira/browse/ISIS-996
> Project: Isis
> Issue Type: Improvement
> Components: Isis Viewer Wicket
> Affects Versions: viewer-wicket-1.7.0
> Reporter: Daniel Keir Haywood
> Priority: Major
>
> was previously:
> Not possible to "replace" components in Wicket viewer (workaround is to use "add")
> ~~~~~
> As per [http://isis.markmail.org/thread/x3k2www3m2wfsgtv]
> To recreate:
> - copy ReferencePanelFactory to ReferencePanelFactory2
> in (subclass of) IsisWicketApplication, add:
> {code:java}
> @com.google.inject.Singleton
> public static class MyComponentFactoryRegistrar extends ComponentFactoryRegistrarDefault {
> @Override
> public void addComponentFactories(ComponentFactoryList componentFactories) {
> super.addComponentFactories(componentFactories);
> componentFactories.replace(new ReferencePanelFactory2());
> }
> }
> {code}
> and
> {code:java}
> final Module overrides = new AbstractModule() {
> @Override
> protected void configure() {
> ...
> bind(ComponentFactoryRegistrar.class).
> to(MyComponentFactoryRegistrar.class);
> }
> };
> {code}
> the issue is that "replace" ends up replacing all component factories of type ComponentType.SCALAR_NAME_AND_VALUE, whereas it should instead just replace the one for ReferencePanelFactory.
> The workaround is easy enough: call "add" (which puts new factory at beginning of list) rather than "replace".
--
This message was sent by Atlassian Jira
(v8.3.4#803005)