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 2017/12/01 11:03:09 UTC

[isis] branch master updated (03acbe2 -> cc8a849)

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git.


    from 03acbe2  ISIS-1784: renames EnumWith and toFixtureScript to PersonaWith and toBuilderScript
     new ba12baf  ISIS-1786: adds support for isis.viewers.collectionLayout.defaultView config property
     new cc8a849  ISIS-1786: updates doc for new configuration property

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../guides/rgcfg/_rgcfg_configuring-core.adoc      | 28 +++++++++++++++++++
 .../layout/CollectionLayoutFacetFactory.java       |  2 +-
 ...aultViewFacetForCollectionLayoutAnnotation.java | 18 ++++++++----
 ...guration.java => DefaultViewConfiguration.java} | 32 ++++++++++++++--------
 .../DefaultViewConfiguration_parseValue_Test.java  | 30 ++++++++++++++++++++
 5 files changed, 92 insertions(+), 18 deletions(-)
 copy core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/{AuditObjectsConfiguration.java => DefaultViewConfiguration.java} (55%)
 create mode 100644 core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration_parseValue_Test.java

-- 
To stop receiving notification emails like this one, please contact
['"commits@isis.apache.org" <co...@isis.apache.org>'].

[isis] 02/02: ISIS-1786: updates doc for new configuration property

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit cc8a8495516c565f0134a8fd5aeb8a1e3500fe4e
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Dec 1 11:03:00 2017 +0000

    ISIS-1786: updates doc for new configuration property
---
 .../guides/rgcfg/_rgcfg_configuring-core.adoc      | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/adocs/documentation/src/main/asciidoc/guides/rgcfg/_rgcfg_configuring-core.adoc b/adocs/documentation/src/main/asciidoc/guides/rgcfg/_rgcfg_configuring-core.adoc
index 7b3cf1e..14beaec 100644
--- a/adocs/documentation/src/main/asciidoc/guides/rgcfg/_rgcfg_configuring-core.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/rgcfg/_rgcfg_configuring-core.adoc
@@ -758,6 +758,16 @@ See xref:../ugbtb/ugbtb.adoc#_ugbtb_programming-model_layout-metadata-reader[Lay
 (`LEFT`)
 |Default for label position for all properties if not explicitly specified using xref:../rgant/rgant.adoc#_rgant-PropertyLayout_labelPosition[`@PropertyLayout#labelPosition()`]
 
+
+Further discussion xref:rgcfg.adoc#__rgcfg_configuring-core_isis-viewers-propertyLayout-labelPosition[below].
+
+|`isis.viewers.` +
+`collectionLayout.defaultView`
+|`hidden`, `table` +
+(`hidden`)
+|(`1.16.0-SNAPSHOT`) Default for the default view for all (parented) collections if not explicitly specified using xref:../rgant/rgant.adoc#_rgant-CollectionLayout_defaultView[`@CollectionLayout#defaultView()`]
+
+Further discussion xref:rgcfg.adoc#__rgcfg_configuring-core_isis-viewers-collectionLayout-defaultView[below].
 |===
 
 
@@ -846,3 +856,21 @@ isis.viewers.propertyLayout.labelPosition=LEFT
 
 If these are not present then Apache Isis will render according to internal defaults.
 At the time of writing, this means labels are to the left for all datatypes except multiline strings.
+
+
+[[__rgcfg_configuring-core_isis-viewers-collectionLayout-defaultView]]
+=== `collectionLayout.defaultView` (`1.16.0-SNAPSHOT`)
+
+Prior to `1.16.0-SNAPSHOT`, the framework renders (parented) collections as "hidden", ie collapsed.
+This can be overridden on a case-by-case basis using the xref:../rgant/rgant.adoc#_rgant-CollectionLayout_defaultView[`@CollectionLayout#defaultView()`] or the corresponding `<collectionLayout defaultView="...">` element in the `Xxx.layout.xml` layout file.
+The framework provices only one other view, "table".
+
+If the majority of collections should be displayed as "table" form, then it is more convenient to specify the default view globally.
+This can be done using a configuration property in `isis.properties`:
+
+[source,ini]
+----
+isis.viewers.collectionLayout.defaultView=table
+----
+
+If this configuration property is not present then Apache Isis will render according to its historical default, namely "hidden".

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.

[isis] 01/02: ISIS-1786: adds support for isis.viewers.collectionLayout.defaultView config property

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit ba12bafffad33b603f63b0b782909584c6e0fe71
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Dec 1 10:51:53 2017 +0000

    ISIS-1786: adds support for isis.viewers.collectionLayout.defaultView config property
---
 .../layout/CollectionLayoutFacetFactory.java       |  2 +-
 ...aultViewFacetForCollectionLayoutAnnotation.java | 18 +++++---
 .../auditing/DefaultViewConfiguration.java         | 50 ++++++++++++++++++++++
 .../DefaultViewConfiguration_parseValue_Test.java  | 30 +++++++++++++
 4 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
index 2d7d8d2..1cc6c88 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
@@ -83,7 +83,7 @@ public class CollectionLayoutFacetFactory extends FacetFactoryAbstract implement
         // defaultView
         DefaultViewFacet defaultViewFacet = DefaultViewFacetOnCollectionFromLayoutProperties.create(properties, holder);
         if(defaultViewFacet == null) {
-            defaultViewFacet = DefaultViewFacetForCollectionLayoutAnnotation.create(collectionLayout, holder);
+            defaultViewFacet = DefaultViewFacetForCollectionLayoutAnnotation.create(collectionLayout, getConfiguration(), holder);
         }
         FacetUtil.addFacet(defaultViewFacet);
         
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
index 63c55d1..7d998f9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
@@ -22,9 +22,11 @@ package org.apache.isis.core.metamodel.facets.collections.layout;
 import com.google.common.base.Strings;
 
 import org.apache.isis.applib.annotation.CollectionLayout;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
 import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.domainobject.auditing.DefaultViewConfiguration;
 
 public class DefaultViewFacetForCollectionLayoutAnnotation extends DefaultViewFacetAbstract {
 
@@ -32,12 +34,16 @@ public class DefaultViewFacetForCollectionLayoutAnnotation extends DefaultViewFa
         super(value, holder);
     }
 
-    public static DefaultViewFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
-        if (collectionLayout == null) {
-            return null;
-        }
+    public static DefaultViewFacet create(
+            final CollectionLayout collectionLayout,
+            final IsisConfiguration configuration,
+            final FacetHolder holder) {
 
-        final String defaultView = Strings.emptyToNull(collectionLayout.defaultView());
-        return defaultView != null ? new DefaultViewFacetForCollectionLayoutAnnotation(defaultView, holder) : null;
+        String defaultView = Strings.emptyToNull(collectionLayout != null ? collectionLayout.defaultView() : null);
+        if (defaultView == null) {
+            final DefaultViewConfiguration setting = DefaultViewConfiguration.parse(configuration);
+            defaultView = setting.getDefaultView();
+        }
+        return new DefaultViewFacetForCollectionLayoutAnnotation(defaultView, holder);
     }
 }
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration.java
new file mode 100644
index 0000000..7c130a3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.domainobject.auditing;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+
+public enum DefaultViewConfiguration {
+    HIDDEN("hidden"),
+    TABLE("table");
+
+    private static final String DEFAULT_VIEW_KEY = "isis.viewers.collectionLayout.defaultView";
+
+    private final String defaultView;
+
+    DefaultViewConfiguration(
+            final String defaultView) {
+
+        this.defaultView = defaultView;
+    }
+
+    public String getDefaultView() {
+        return defaultView;
+    }
+
+    public static DefaultViewConfiguration parse(IsisConfiguration configuration) {
+        final String configuredValue = configuration.getString(DEFAULT_VIEW_KEY);
+        return DefaultViewConfiguration.parseValue(configuredValue);
+    }
+
+    static DefaultViewConfiguration parseValue(final String value) {
+        return value != null && value.trim().toLowerCase().equals("table") ? TABLE : HIDDEN;
+    }
+
+}
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration_parseValue_Test.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration_parseValue_Test.java
new file mode 100644
index 0000000..115f8c9
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobject/auditing/DefaultViewConfiguration_parseValue_Test.java
@@ -0,0 +1,30 @@
+package org.apache.isis.core.metamodel.facets.object.domainobject.auditing;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.isis.core.metamodel.facets.object.domainobject.auditing.DefaultViewConfiguration.*;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+
+public class DefaultViewConfiguration_parseValue_Test {
+
+
+    @Test
+    public void when_hidden() throws Exception {
+        Assert.assertThat(parseValue(null), is(equalTo(HIDDEN)));
+        Assert.assertThat(parseValue(""), is(equalTo(HIDDEN)));
+        Assert.assertThat(parseValue("hidden"), is(equalTo(HIDDEN)));
+        Assert.assertThat(parseValue("garbage"), is(equalTo(HIDDEN)));
+    }
+
+    @Test
+    public void when_table() throws Exception {
+        Assert.assertThat(parseValue("table"), is(equalTo(TABLE)));
+        Assert.assertThat(parseValue("TABLE"), is(equalTo(TABLE)));
+        Assert.assertThat(parseValue("tAbLe"), is(equalTo(TABLE)));
+        Assert.assertThat(parseValue("  table  "), is(equalTo(TABLE)));
+        Assert.assertThat(parseValue("  \ntable \n "), is(equalTo(TABLE)));
+    }
+
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.