Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-996

Define component factories as Spring @Components

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: viewer-wicket-1.7.0
    • Fix Version/s: 2.0.0-M4
    • Component/s: Isis Viewer Wicket
    • Labels:
      None

      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:

          @com.google.inject.Singleton
          public static class MyComponentFactoryRegistrar extends ComponentFactoryRegistrarDefault {
      
              @Override
              public void addComponentFactories(ComponentFactoryList componentFactories) {
                  super.addComponentFactories(componentFactories);
                  componentFactories.replace(new ReferencePanelFactory2());
              }
          }
      

      and

              final Module overrides = new AbstractModule() {
                  @Override
                  protected void configure() {
                       ...
                      bind(ComponentFactoryRegistrar.class).
                          to(MyComponentFactoryRegistrar.class);
                  }
              };
      

      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".

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hobrom Andi Huber
                Reporter:
                danhaywood Daniel Keir Haywood
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: