Hi Dan,
Thanks for your help. Using "add" does the trick for ReferencePanel.
"replace" however also works for EntityIconAndTitlePanelFactory (for
example). It looks like there's an architectural difference between the
ReferencePanel and the EntityIconandTitlePanel.
Erik
n 01/04/2015 11:13 AM, Dan Haywood wrote:
Hi Erik,
I just tried this out using "replace", and reproduced the issue... so
thanks for bringing it to our attention.
In the meantime, using "add" rather than "replace" seems to work ok.
I've raised a ticket [2] to fix the issue with "replace", and I've updated
the website also [1].
Thx
Dan
[1]
http://isis.apache.org/components/viewers/wicket/customizing-the-viewer.html
[2] https://issues.apache.org/jira/browse/ISIS-996.
On 2 January 2015 at 16:40, Erik de Hair <[email protected]> wrote:
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