You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2015/01/04 11:25:35 UTC

[jira] [Commented] (ISIS-996) Not possible to "replace" components in Wicket viewer (workaround is to use "add")

    [ https://issues.apache.org/jira/browse/ISIS-996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14263824#comment-14263824 ] 

Martin Grigorov commented on ISIS-996:
--------------------------------------

org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistrar.ComponentFactoryList uses an ArrayList, and ArrayList#add() appends, so there must be something else that makes it work.

ComponentFactoryRegistrar.ComponentFactoryList#insert(0, componentFactory) would prepend.

> Not possible to "replace" components in Wicket viewer (workaround is to use "add")
> ----------------------------------------------------------------------------------
>
>                 Key: ISIS-996
>                 URL: https://issues.apache.org/jira/browse/ISIS-996
>             Project: Isis
>          Issue Type: Bug
>          Components: Viewer: Wicket
>    Affects Versions: viewer-wicket-1.7.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: viewer-wicket-1.9.0
>
>
> 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".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)