You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/01/25 10:31:42 UTC
[isis] branch maint-1.16.1 updated: ISIS-1851: refine the algorithm
for dynamically hiding property groups with 'nothing' in them
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maint-1.16.1
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/maint-1.16.1 by this push:
new 33bd9fd ISIS-1851: refine the algorithm for dynamically hiding property groups with 'nothing' in them
33bd9fd is described below
commit 33bd9fd932c223e2b6fc5606a670fe655241089b
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Jan 25 10:18:42 2018 +0000
ISIS-1851: refine the algorithm for dynamically hiding property groups with 'nothing' in them
---
.../components/entity/fieldset/PropertyGroup.java | 28 +++++++++++++++-------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
index 71b0ed3..6c30278 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
@@ -71,7 +71,8 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
private final FieldSet fieldSet;
private final boolean visible;
- private final List<ScalarPanelAbstract2> childComponents;
+ private final List<ScalarPanelAbstract2> childScalarPanelAbstract2s;
+ private final List<Component> childComponents;
public PropertyGroup(final String id, final EntityModel model, final FieldSet fieldSet) {
super(id, model);
@@ -79,6 +80,7 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
// the UI is only ever built once.
childComponents = buildGui();
+ childScalarPanelAbstract2s = FluentIterable.from(childComponents).filter(ScalarPanelAbstract2.class).toList();
final ImmutableList<ObjectAssociation> associations = getObjectAssociations();
this.visible = !associations.isEmpty();
@@ -90,9 +92,9 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
- private List<ScalarPanelAbstract2> buildGui() {
+ private List<Component> buildGui() {
- final List<ScalarPanelAbstract2> childComponents = Lists.newArrayList();
+ final List<Component> childComponents = Lists.newArrayList();
setOutputMarkupPlaceholderTag(true);
setOutputMarkupId(true);
@@ -112,9 +114,7 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
propertyRv.addOrReplace(propertyRvContainer);
final Component component = addPropertyToForm(getModel(), (OneToOneAssociation) association,
propertyRvContainer, memberGroupActions);
- if(component instanceof ScalarPanelAbstract2) {
- childComponents.add((ScalarPanelAbstract2) component);
- }
+ childComponents.add(component);
}
WebMarkupContainer panelHeading = new WebMarkupContainer("panelHeading");
@@ -233,7 +233,7 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
@Override
public void onConfigure() {
- for (final ScalarPanelAbstract2 childComponent : childComponents) {
+ for (final ScalarPanelAbstract2 childComponent : childScalarPanelAbstract2s) {
childComponent.configure();
}
super.onConfigure();
@@ -241,7 +241,19 @@ public class PropertyGroup extends PanelAbstract<EntityModel> implements HasDyna
@Override
public boolean isVisible() {
- for (final ScalarPanelAbstract2 childComponent : childComponents) {
+
+ // HACK: there are some components that are not ScalarPanelAbstract2's, eg the pdfjsviewer.
+ // In this case, don't ever hide.
+
+ // TODO: should remove this hack. We need some sort of SPI for ScalarPanelAbstract2's and any other component,
+ // (eg PdfJsViewer) that can implement. It's "probably" just a matter of having PdfJsViewer do its work in the
+ // correct Wicket callback (probably onConfigure).
+ if(childComponents.size() > childScalarPanelAbstract2s.size()) {
+ return true;
+ }
+ // HACK:END
+
+ for (final ScalarPanelAbstract2 childComponent : childScalarPanelAbstract2s) {
if(childComponent.isVisibilityAllowed()) {
return true;
}
--
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.