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 2015/04/23 15:36:26 UTC

[16/20] isis git commit: ISIS-1085: martin's review suggestions included

ISIS-1085: martin's review suggestions included


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9dfcf1be
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9dfcf1be
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9dfcf1be

Branch: refs/heads/master
Commit: 9dfcf1be1bc8467f5b61946612536a8cb0436c24
Parents: 1324b61
Author: Jörg Rade <jo...@kuehne-nagel.com>
Authored: Fri Apr 17 17:24:27 2015 +0200
Committer: Jörg Rade <jo...@kuehne-nagel.com>
Committed: Fri Apr 17 17:24:27 2015 +0200

----------------------------------------------------------------------
 .../isis/applib/annotation/ActionLayout.java    | 17 +++++----
 .../isis/applib/annotation/CssClassFa.java      |  8 +++--
 .../CssClassFaFacetOnMemberFactory.java         | 38 +++++++-------------
 ...ssClassFaFacetForViewModelLayoutFactory.java | 14 ++++----
 ...sFaFacetForDomainObjectLayoutAnnotation.java |  1 +
 .../DomainObjectLayoutFactoryTest.java          | 20 ++++++-----
 6 files changed, 47 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
index 81caef7..83d6d9c 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionLayout.java
@@ -1,4 +1,5 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
+/*
+ *  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
@@ -13,7 +14,8 @@
  * "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. */
+ *  under the License.
+ */
 
 package org.apache.isis.applib.annotation;
 
@@ -35,8 +37,9 @@ public @interface ActionLayout {
      * Whether (and how) this action can be bookmarked in the UI.
      *
      * <p>
-     * For bookmarkable actions, either {@link org.apache.isis.applib.annotation.BookmarkPolicy#AS_ROOT} and
-     * {@link org.apache.isis.applib.annotation.BookmarkPolicy#AS_CHILD} can be used (they are treated identically).
+     *     For bookmarkable actions, either {@link org.apache.isis.applib.annotation.BookmarkPolicy#AS_ROOT}
+     *     and {@link org.apache.isis.applib.annotation.BookmarkPolicy#AS_CHILD} can be used (they are treated
+     *     identically).
      * </p>
      */
     BookmarkPolicy bookmarking() default BookmarkPolicy.NEVER;
@@ -111,9 +114,9 @@ public @interface ActionLayout {
     // //////////////////////////////////////
 
     /**
-     * For actions of domain services that can be viewed and contributed (that is, whose {@link DomainService#nature()
-     * nature} is either {@link org.apache.isis.applib.annotation.NatureOfService#VIEW} or
-     * {@link org.apache.isis.applib.annotation.NatureOfService#VIEW_CONTRIBUTIONS_ONLY}), specifies how the
+     * For actions of domain services that can be viewed and contributed (that is, whose
+     * {@link DomainService#nature() nature} is either {@link org.apache.isis.applib.annotation.NatureOfService#VIEW}
+     * or {@link org.apache.isis.applib.annotation.NatureOfService#VIEW_CONTRIBUTIONS_ONLY}), specifies how the
      * contribution should be implemented, as an action, as an association, or as both.
      *
      * <p>

http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClassFa.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClassFa.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClassFa.java
index 809cbb5..8fb9791 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClassFa.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CssClassFa.java
@@ -1,4 +1,5 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
+/*
+ *  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
@@ -13,7 +14,8 @@
  * "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. */
+ *  under the License.
+ */
 
 package org.apache.isis.applib.annotation;
 
@@ -33,7 +35,7 @@ import java.lang.annotation.Target;
 public @interface CssClassFa {
 
     /**
-     * @deprecated - see {@link DomainObjectLayout#cssClassFa()}, @link ActionLayout#cssClassFa()}
+     * @deprecated - see {@link DomainObjectLayout#cssClassFa(),@link ViewModelLayout#cssClassFa(), @link ActionLayout#cssClassFa()}
      */
     @Deprecated
     String value();

http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/cssclassfa/annotprop/CssClassFaFacetOnMemberFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/cssclassfa/annotprop/CssClassFaFacetOnMemberFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/cssclassfa/annotprop/CssClassFaFacetOnMemberFactory.java
index f88406d..dac04be 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/cssclassfa/annotprop/CssClassFaFacetOnMemberFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/cssclassfa/annotprop/CssClassFaFacetOnMemberFactory.java
@@ -1,4 +1,5 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
+/*
+ *  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
@@ -13,7 +14,8 @@
  * "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. */
+ *  under the License.
+ */
 
 package org.apache.isis.core.metamodel.facets.members.cssclassfa.annotprop;
 
@@ -42,11 +44,10 @@ import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorFor
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 
-public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory,
-        MetaModelValidatorRefiner, IsisConfigurationAware {
+public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory, MetaModelValidatorRefiner, IsisConfigurationAware {
+    
+    private final MetaModelValidatorForDeprecatedAnnotation validator = new MetaModelValidatorForDeprecatedAnnotation(CssClassFa.class);
 
-    private final MetaModelValidatorForDeprecatedAnnotation validator = new MetaModelValidatorForDeprecatedAnnotation(
-            CssClassFa.class);
 
     public CssClassFaFacetOnMemberFactory() {
         super(FeatureType.ACTIONS_ONLY);
@@ -56,10 +57,6 @@ public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract impleme
     public void process(final ProcessMethodContext processMethodContext) {
         CssClassFaFacet cssClassFaFacet = createFromMetadataPropertiesIfPossible(processMethodContext);
         if (cssClassFaFacet == null) {
-            // cssClassFaFacet = validator.flagIfPresent(createFromAnnotationIfPossible(processMethodContext),
-            // processMethodContext);
-        }
-        if (cssClassFaFacet == null) {
             cssClassFaFacet = createFromConfiguredRegexIfPossible(processMethodContext);
         }
 
@@ -83,20 +80,13 @@ public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract impleme
         return properties != null ? new CssClassFaFacetOnMemberFromProperties(properties, holder) : null;
     }
 
-    // private CssClassFaFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
-    // final CssClassFa annotation = Annotations.getAnnotation(processMethodContext.getMethod(), CssClassFa.class);
-    // return annotation != null ? new CssClassFaFacetOnMemberAnnotation(annotation.value(), annotation.position(),
-    // processMethodContext.getFacetHolder()) : null;
-    // }
-
     // region > faIconFromPattern
 
     /**
      * The pattern matches definitions like:
      * <ul>
      * <li>methodNameRegex:cssClassFa - will render the Font Awesome icon on the left of the title</li>
-     * <li>methodNameRegex:cssClassFa:(left|right) - will render the Font Awesome icon on the specified position of the
-     * title</li>
+     *     <li>methodNameRegex:cssClassFa:(left|right) - will render the Font Awesome icon on the specified position of the title</li>
      * </ul>
      */
     private final static Pattern FA_ICON_REGEX_PATTERN = Pattern.compile("([^:]+):(.+)");
@@ -113,10 +103,8 @@ public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract impleme
                 String rest = value.substring(idxOfSeparator + 1);
                 position = CssClassFaPosition.valueOf(rest.toUpperCase());
             }
-            return new CssClassFaFacetOnMemberFromConfiguredRegex(value, position,
-                    processMethodContext.getFacetHolder());
-        }
-        else {
+            return new CssClassFaFacetOnMemberFromConfiguredRegex(value, position, processMethodContext.getFacetHolder());
+        } else {
             return null;
         }
     }
@@ -153,8 +141,7 @@ public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract impleme
     private static Map<Pattern, String> buildFaIconByPattern(String cssClassFaPatterns) {
         final Map<Pattern, String> faIconByPattern = Maps.newLinkedHashMap();
         if (cssClassFaPatterns != null) {
-            final StringTokenizer regexToFaIcons = new StringTokenizer(cssClassFaPatterns,
-                    ConfigurationConstants.LIST_SEPARATOR);
+            final StringTokenizer regexToFaIcons = new StringTokenizer(cssClassFaPatterns, ConfigurationConstants.LIST_SEPARATOR);
             final Map<String, String> faIconByRegex = Maps.newLinkedHashMap();
             while (regexToFaIcons.hasMoreTokens()) {
                 String regexToFaIcon = regexToFaIcons.nextToken().trim();
@@ -180,8 +167,7 @@ public class CssClassFaFacetOnMemberFactory extends FacetFactoryAbstract impleme
     // //////////////////////////////////////
 
     @Override
-    public void refineMetaModelValidator(final MetaModelValidatorComposite metaModelValidator,
-            final IsisConfiguration configuration) {
+    public void refineMetaModelValidator(final MetaModelValidatorComposite metaModelValidator, final IsisConfiguration configuration) {
         metaModelValidator.add(validator);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/cssclassfa/annotation/CssClassFaFacetForViewModelLayoutFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/cssclassfa/annotation/CssClassFaFacetForViewModelLayoutFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/cssclassfa/annotation/CssClassFaFacetForViewModelLayoutFactory.java
index 8bd9d96..22a7d7f 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/cssclassfa/annotation/CssClassFaFacetForViewModelLayoutFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/cssclassfa/annotation/CssClassFaFacetForViewModelLayoutFactory.java
@@ -18,7 +18,7 @@
 package org.apache.isis.core.metamodel.facets.object.cssclassfa.annotation;
 
 import org.apache.isis.applib.annotation.CssClassFaPosition;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.applib.annotation.ViewModelLayout;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacet;
 import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacetAbstract;
@@ -28,15 +28,15 @@ import com.google.common.base.Strings;
 
 public class CssClassFaFacetForViewModelLayoutFactory extends CssClassFaFacetAbstract {
 
-    public static CssClassFaFacet create(final DomainObjectLayout domainObjectLayout, final FacetHolder holder) {
-        if (domainObjectLayout == null) {
+    public static CssClassFaFacet create(final ViewModelLayout viewModelLayout, final FacetHolder holder) {
+        if (viewModelLayout == null) {
             return null;
         }
-        final String cssClassFa = Strings.emptyToNull(domainObjectLayout.cssClassFa());
-        final CssClassFaPosition position = domainObjectLayout.cssClassFaPosition();
-        return (CssClassFaFacet) (cssClassFa != null ? new CssClassFaFacetForViewModelLayoutAnnotation(cssClassFa,
+        final String cssClassFa = Strings.emptyToNull(viewModelLayout.cssClassFa());
+        final CssClassFaPosition position = viewModelLayout.cssClassFaPosition();
+        return cssClassFa != null ? new CssClassFaFacetForViewModelLayoutAnnotation(cssClassFa,
                 position,
-                holder) : null);
+                holder) : null;
     }
 
     private CssClassFaFacetForViewModelLayoutFactory(final String value, final CssClassFaPosition position,

http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFaFacetForDomainObjectLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFaFacetForDomainObjectLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFaFacetForDomainObjectLayoutAnnotation.java
index 0fd96cf..e6540f7 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFaFacetForDomainObjectLayoutAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/CssClassFaFacetForDomainObjectLayoutAnnotation.java
@@ -14,6 +14,7 @@
  * 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.domainobjectlayout;
 
 import org.apache.isis.applib.annotation.CssClassFaPosition;

http://git-wip-us.apache.org/repos/asf/isis/blob/9dfcf1be/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactoryTest.java
index 985f229..a9b8c80 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/domainobjectlayout/DomainObjectLayoutFactoryTest.java
@@ -1,4 +1,5 @@
-/* Licensed to the Apache Software Foundation (ASF) under one
+/*
+ *  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
@@ -13,7 +14,8 @@
  * "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. */
+ *  under the License.
+ */
 
 package org.apache.isis.core.metamodel.facets.object.domainobjectlayout;
 
@@ -68,11 +70,12 @@ public class DomainObjectLayoutFactoryTest extends AbstractFacetFactoryJUnit4Tes
             describedAs = "This is a description",
             named = "Name override",
             paged = 20,
-            plural = "Customers Plural Form")
+            plural = "Customers Plural Form"
+    )
     class Customer {
     }
-
-    @DomainObjectLayout()
+    @DomainObjectLayout(
+    )
     class CustomerWithDefaults {
     }
 
@@ -84,11 +87,12 @@ public class DomainObjectLayoutFactoryTest extends AbstractFacetFactoryJUnit4Tes
             describedAs = "This is a description",
             named = "Name override",
             paged = 20,
-            plural = "Customers Plural Form")
+            plural = "Customers Plural Form"
+    )
     class CustomerViewModel {
     }
-
-    @ViewModelLayout()
+    @ViewModelLayout(
+    )
     class CustomerViewModelWithDefaults {
     }