Hi,

I tried to replace a component (just to try this out) but got stuck. As a first step I copied the ReferencePanelFactory (as PortalReferencePanelFactory, still using the ReferencePanal from Isis) and created a ComponenFactoryRegistrarDefault as PortalComponentFactoryRegistrar like documented at [1]. Then I configured the ComponenFactoryRegistrarDefault in the Wicket Application. As a result I get the message "??? ScalarModel objectAdapter oid: null" for each property when running the application.

Here's my code:

public class PortalReferencePanelFactory extends ComponentFactoryAbstract
{
    private static final long serialVersionUID = 1L;

    public PortalReferencePanelFactory() {
        super(ComponentType.SCALAR_NAME_AND_VALUE, ReferencePanel.class);
    }

    @Override
    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
final ObjectSpecification specification = scalarModel.getTypeOfSpecification();
        return appliesIf(!specification.containsFacet(ValueFacet.class));
    }

    @Override
public Component createComponent(final String id, final IModel<?> model) {
        final ScalarModel scalarModel = (ScalarModel) model;
        return new ReferencePanel(id, scalarModel);
    }
}

@Singleton
public class PortalComponentFactoryRegistrar extends ComponentFactoryRegistrarDefault
{
    @Override
public void addComponentFactories(ComponentFactoryList componentFactories) {
        super.addComponentFactories(componentFactories);
        componentFactories.replace(new PortalReferencePanelFactory());
    }
}

Should this be working?

Thanks,
Erik

[1] http://isis.apache.org/components/viewers/wicket/customizing-the-viewer.html

Reply via email to