Repository: isis Updated Branches: refs/heads/master 343c5a2c5 -> d099b31f5
ISIS-537: render "(none)" for references that are null. Project: http://git-wip-us.apache.org/repos/asf/isis/repo Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b4bd7a4f Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b4bd7a4f Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b4bd7a4f Branch: refs/heads/master Commit: b4bd7a4ffa6511480d0173378232bfc47045fda5 Parents: 343c5a2 Author: Dan Haywood <[email protected]> Authored: Mon Nov 24 23:45:12 2014 +0000 Committer: Dan Haywood <[email protected]> Committed: Mon Nov 24 23:45:12 2014 +0000 ---------------------------------------------------------------------- .../scalars/reference/ReferencePanel.html | 1 + .../scalars/reference/ReferencePanel.java | 32 ++++++++++++++------ .../entitysimplelink/EntityLinkSimplePanel.html | 2 +- .../entitysimplelink/EntityLinkSimplePanel.java | 5 ++- 4 files changed, 27 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/isis/blob/b4bd7a4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.html index b9e7697..41ec493 100644 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.html +++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.html @@ -37,6 +37,7 @@ </span> <span class="clearfix"></span> </div> + <span wicket:id="entityTitleIfNull">(none)</span> </div> </span> <span wicket:id="feedback" class="help-block"></span> http://git-wip-us.apache.org/repos/asf/isis/blob/b4bd7a4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java index 87ca557..eca7b0e 100644 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java +++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/reference/ReferencePanel.java @@ -66,7 +66,6 @@ public class ReferencePanel extends ScalarPanelAbstract { private static final String ID_AUTO_COMPLETE = "autoComplete"; private static final String ID_ENTITY_ICON_TITLE = "entityIconAndTitle"; -// private static final String ID_ENTITY_ICON_TITLE_AND_COPYLINK = "entityIconTitleAndCopylink"; private EntityLinkSelect2Panel entityLink; Select2Choice<ObjectAdapterMemento> select2Field; @@ -209,8 +208,9 @@ public class ReferencePanel extends ScalarPanelAbstract { final ObjectAdapter adapter = getModel().getPendingElseCurrentAdapter(); // syncLinkWithInput + final MarkupContainer componentForRegular = (MarkupContainer) getComponentForRegular(); if (adapter != null) { - if(getComponentForRegular() != null) { + if(componentForRegular != null) { final EntityModel entityModelForLink = new EntityModel(adapter); entityModelForLink.setContextAdapterIfAny(getModel().getContextAdapterIfAny()); @@ -218,14 +218,22 @@ public class ReferencePanel extends ScalarPanelAbstract { final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_AND_TITLE, entityModelForLink); -// final ComponentFactory componentFactory = -// getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_TITLE_AND_COPYLINK, entityModelForLink); final Component component = componentFactory.createComponent(entityModelForLink); - ((MarkupContainer)getComponentForRegular()).addOrReplace(component); + componentForRegular.addOrReplace(component); + + Components.permanentlyHide(componentForRegular, "entityTitleIfNull"); + } + + } else { - permanentlyHideEntityIconAndTitleIfInRegularMode(); + + if(componentForRegular != null) { + componentForRegular.addOrReplace(new Label("entityTitleIfNull", "(none)")); + //Components.permanentlyHide(componentForRegular, "entityTitleIfNull"); + Components.permanentlyHide(componentForRegular, ID_ENTITY_ICON_TITLE); + } } @@ -263,15 +271,21 @@ public class ReferencePanel extends ScalarPanelAbstract { // select2Field.clearInput(); } - - permanentlyHideEntityIconAndTitleIfInRegularMode(); - + + if(getComponentForRegular() != null) { + Components.permanentlyHide((MarkupContainer)getComponentForRegular(), ID_ENTITY_ICON_TITLE); + Components.permanentlyHide(componentForRegular, "entityTitleIfNull"); + } + + + // syncUsability if(select2Field != null) { final boolean mutability = entityLink.isEnableAllowed() && !getModel().isViewMode(); select2Field.setEnabled(mutability); } + Components.permanentlyHide(entityLink, "entityLinkIfNull"); } else { // this is horrid; adds a label to the id // should instead be a 'temporary hide' http://git-wip-us.apache.org/repos/asf/isis/blob/b4bd7a4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html index e72e0b7..047b75d 100644 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html +++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.html @@ -32,7 +32,7 @@ <div class="entityLinkSimplePanel entityLinkComponentType"> <div> <div wicket:id="entityIconAndTitle">[icon and title]</div> - <span wicket:id="entityTitleNull">(null)</span> + <span wicket:id="entityTitleNull">(none)</span> <div class="clearfix"></div> </div> </div> http://git-wip-us.apache.org/repos/asf/isis/blob/b4bd7a4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java ---------------------------------------------------------------------- diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java index 090e59e..cf04df6 100644 --- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java +++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java @@ -70,14 +70,13 @@ public class EntityLinkSimplePanel extends FormComponentPanelAbstract<ObjectAdap entityModelForLink.setRenderingHint(getEntityModel().getRenderingHint()); final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_AND_TITLE, entityModelForLink); - //final ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_TITLE_AND_COPYLINK, entityModelForLink); final Component component = componentFactory.createComponent(entityModelForLink); addOrReplace(component); permanentlyHide(ID_ENTITY_TITLE_NULL); } else { - // represent no object by a simple label displaying '(null)' - addOrReplace(new Label(ID_ENTITY_TITLE_NULL, "")); + // represent no object by a simple label displaying '(none)' + addOrReplace(new Label(ID_ENTITY_TITLE_NULL, "(none)")); permanentlyHide(ID_ENTITY_ICON_AND_TITLE); } }
