isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1388081 - in /incubator/isis/trunk/framework: applib/src/docbkx/guide/ applib/src/main/java/org/apache/isis/applib/annotation/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/ core/progmodel/src/main/java/or...
Date Thu, 20 Sep 2012 15:36:42 GMT
Author: danhaywood
Date: Thu Sep 20 15:36:41 2012
New Revision: 1388081

URL: http://svn.apache.org/viewvc?rev=1388081&view=rev
Log:
ISIS-264: @Paged annotation + fallback support

as provided by Jeroen van der Wal.

Added:
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/PagedFacetNone.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnCollectionFacetFactory.java
      - copied, changed from r1388050, incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnTypeFacetFactory.java
      - copied, changed from r1388050, incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java
Removed:
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java
Modified:
    incubator/isis/trunk/framework/applib/src/docbkx/guide/isis-applib.xml
    incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacet.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacetAbstract.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/FallbackFacetFactory.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedFacetAnnotation.java
    incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactoryTest.java
    incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java

Modified: incubator/isis/trunk/framework/applib/src/docbkx/guide/isis-applib.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/applib/src/docbkx/guide/isis-applib.xml?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/applib/src/docbkx/guide/isis-applib.xml (original)
+++ incubator/isis/trunk/framework/applib/src/docbkx/guide/isis-applib.xml Thu Sep 20 15:36:41
2012
@@ -7288,8 +7288,17 @@ public class Order {
     public List<LineItem> getDetails() {...}
 }</programlisting>
 
-        <para>This indicates a page size of 15 for parented collections, and a
-        page size of 30 for standalone collections.</para>
+        <para>This indicates a page size of 15 for parented collections, and a page
size of 30 for
+          standalone collections.</para>
+        <para>When ommitting a parameter value or ommitting the annotation completely,
the
+          configured defaults in <filename>isis.properties</filename> wil be
used.</para>
+        <para>For example:</para>
+        <para>
+          <programlisting>isis.viewers.paged.standalone=20
+isis.viewers.paged.parented=5</programlisting>
+        </para>
+        <para>This indicates a page size of 5 for parented collections and a page size
of 20 for
+          standalone collections.</para>
       </sect1>
 
       <sect1>

Modified: incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
(original)
+++ incubator/isis/trunk/framework/applib/src/main/java/org/apache/isis/applib/annotation/Paged.java
Thu Sep 20 15:36:41 2012
@@ -40,5 +40,5 @@ import java.lang.annotation.Target;
 @Target({ElementType.TYPE, ElementType.METHOD})
 public @interface Paged {
     
-    int value();
+    int value() default -1;
 }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacet.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacet.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacet.java
Thu Sep 20 15:36:41 2012
@@ -28,5 +28,4 @@ public interface PagedFacet extends Face
     
     int value();
     
-    int standalone();
 }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacetAbstract.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacetAbstract.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/paged/PagedFacetAbstract.java
Thu Sep 20 15:36:41 2012
@@ -29,24 +29,16 @@ public abstract class PagedFacetAbstract
         return PagedFacet.class;
     }
 
-    private final int parented;
-    private final int standalone;
+    private final int value;
 
-    public PagedFacetAbstract(final FacetHolder holder, int parented, int standalone) {
+    public PagedFacetAbstract(final FacetHolder holder, int value) {
         super(type(), holder, Derivation.DERIVED);
-        this.standalone = standalone;
-        this.parented = parented;
+        this.value = value;
     }
 
     @Override
     public int value() {
-        return parented;
+        return value;
     }
 
-    @Override
-    public int standalone() {
-        return standalone;
-    }
-
-    
 }

Modified: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/FallbackFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/FallbackFacetFactory.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/FallbackFacetFactory.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/FallbackFacetFactory.java
Thu Sep 20 15:36:41 2012
@@ -25,6 +25,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationAware;
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
@@ -38,7 +40,9 @@ import org.apache.isis.core.metamodel.fa
  * required by the Apache Isis framework itself.
  * 
  */
-public class FallbackFacetFactory extends FacetFactoryAbstract {
+public class FallbackFacetFactory extends FacetFactoryAbstract implements IsisConfigurationAware
{
+
+    private IsisConfiguration configuration;
 
     @SuppressWarnings("unused")
     private final static Map<Class<?>, Integer> TYPICAL_LENGTHS_BY_CLASS = new
HashMap<Class<?>, Integer>() {
@@ -75,12 +79,14 @@ public class FallbackFacetFactory extend
         final DescribedAsFacetNone describedAsFacet = new DescribedAsFacetNone(facetHolder);
         final NotPersistableFacetNull notPersistableFacet = new NotPersistableFacetNull(facetHolder);
         final TitleFacetNone titleFacet = new TitleFacetNone(facetHolder);
+        final PagedFacetNone pagedFacet = new PagedFacetNone(facetHolder, getConfiguration().getInteger("isis.viewers.paged.standalone"));
+        
 
         final Facet[] facets = new Facet[] { describedAsFacet,
                 // commenting these out, think this whole isNoop business is a
                 // little bogus
                 // new ImmutableFacetNever(holder),
-                notPersistableFacet, titleFacet, };
+                notPersistableFacet, titleFacet, pagedFacet};
         FacetUtil.addFacets(facets);
     }
 
@@ -103,6 +109,9 @@ public class FallbackFacetFactory extend
                 facets.add(new ActionDefaultsFacetNone(processMethodContext.getFacetHolder()));
                 facets.add(new ActionChoicesFacetNone(processMethodContext.getFacetHolder()));
             }
+            if (featureType.isCollection()) {
+                facets.add(new PagedFacetNone(processMethodContext.getFacetHolder(), getConfiguration().getInteger("isis.viewers.paged.parented")));
+            }
         }
 
         FacetUtil.addFacets(facets);
@@ -128,4 +137,13 @@ public class FallbackFacetFactory extend
         FacetUtil.addFacets(facets);
     }
 
+    @Override
+    public void setConfiguration(IsisConfiguration configuration) {
+        this.configuration = configuration;
+    }
+    
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
 }

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/PagedFacetNone.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/PagedFacetNone.java?rev=1388081&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/PagedFacetNone.java
(added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/fallback/PagedFacetNone.java
Thu Sep 20 15:36:41 2012
@@ -0,0 +1,11 @@
+package org.apache.isis.core.progmodel.facets.fallback;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
+
+public class PagedFacetNone extends PagedFacetAbstract {
+
+    public PagedFacetNone(FacetHolder holder, int value) {
+        super(holder, value);
+    }
+}

Copied: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnCollectionFacetFactory.java
(from r1388050, incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnCollectionFacetFactory.java?p2=incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnCollectionFacetFactory.java&p1=incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java&r1=1388050&r2=1388081&rev=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnCollectionFacetFactory.java
Thu Sep 20 15:36:41 2012
@@ -20,6 +20,8 @@
 package org.apache.isis.core.progmodel.facets.paged;
 
 import org.apache.isis.applib.annotation.Paged;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationAware;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
@@ -27,10 +29,13 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
 
-public class PagedAnnotationFacetFactory extends FacetFactoryAbstract {
+@Paged
+public class PagedAnnotationOnCollectionFacetFactory extends FacetFactoryAbstract implements
IsisConfigurationAware {
 
-    public PagedAnnotationFacetFactory() {
-        super(FeatureType.OBJECTS_AND_COLLECTIONS);
+    private IsisConfiguration configuration;
+
+    public PagedAnnotationOnCollectionFacetFactory() {
+        super(FeatureType.COLLECTIONS_ONLY);
     }
 
     @Override
@@ -46,7 +51,16 @@ public class PagedAnnotationFacetFactory
     }
 
     private PagedFacet create(final Paged annotation, final FacetHolder holder) {
-        return annotation == null ? null : new PagedFacetAnnotation(annotation.value(), annotation.value(),
holder);
+        return annotation != null ? new PagedFacetAnnotation(holder, annotation.value() ==
-1 ? getConfiguration().getInteger("isis.viewers.paged.parented") : annotation.value()) :
null;
+    }
+
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public void setConfiguration(IsisConfiguration configuration) {
+        this.configuration = configuration;
     }
 
 }

Copied: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnTypeFacetFactory.java
(from r1388050, incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnTypeFacetFactory.java?p2=incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnTypeFacetFactory.java&p1=incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java&r1=1388050&r2=1388081&rev=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactory.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationOnTypeFacetFactory.java
Thu Sep 20 15:36:41 2012
@@ -20,6 +20,8 @@
 package org.apache.isis.core.progmodel.facets.paged;
 
 import org.apache.isis.applib.annotation.Paged;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationAware;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
@@ -27,10 +29,13 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
 import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
 
-public class PagedAnnotationFacetFactory extends FacetFactoryAbstract {
+@Paged
+public class PagedAnnotationOnTypeFacetFactory extends FacetFactoryAbstract implements IsisConfigurationAware
{
 
-    public PagedAnnotationFacetFactory() {
-        super(FeatureType.OBJECTS_AND_COLLECTIONS);
+    private IsisConfiguration configuration;
+
+    public PagedAnnotationOnTypeFacetFactory() {
+        super(FeatureType.OBJECTS_ONLY);
     }
 
     @Override
@@ -46,7 +51,16 @@ public class PagedAnnotationFacetFactory
     }
 
     private PagedFacet create(final Paged annotation, final FacetHolder holder) {
-        return annotation == null ? null : new PagedFacetAnnotation(annotation.value(), annotation.value(),
holder);
+        return annotation != null ? new PagedFacetAnnotation(holder, annotation.value() ==
-1 ? getConfiguration().getInteger("isis.viewers.paged.standalone") : annotation.value())
: null;
+    }
+
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+    @Override
+    public void setConfiguration(IsisConfiguration configuration) {
+        this.configuration = configuration;
     }
 
 }

Modified: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedFacetAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedFacetAnnotation.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedFacetAnnotation.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/paged/PagedFacetAnnotation.java
Thu Sep 20 15:36:41 2012
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.fa
 
 public class PagedFacetAnnotation extends PagedFacetAbstract {
 
-    public PagedFacetAnnotation(int parented, int standalone, FacetHolder holder) {
-        super(holder, parented, standalone);
+    public PagedFacetAnnotation(FacetHolder holder, int value) {
+        super(holder, value);
     }
 }

Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactoryTest.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactoryTest.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/paged/PagedAnnotationFacetFactoryTest.java
Thu Sep 20 15:36:41 2012
@@ -36,13 +36,13 @@ import org.apache.isis.core.progmodel.fa
 
 public class PagedAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
 
-    private PagedAnnotationFacetFactory facetFactory;
+    private PagedAnnotationOnTypeFacetFactory facetFactory;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
-        facetFactory = new PagedAnnotationFacetFactory();
+        facetFactory = new PagedAnnotationOnTypeFacetFactory();
     }
 
     @Override

Modified: incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java?rev=1388081&r1=1388080&r2=1388081&view=diff
==============================================================================
--- incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
(original)
+++ incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
Thu Sep 20 15:36:41 2012
@@ -113,7 +113,8 @@ import org.apache.isis.core.progmodel.fa
 import org.apache.isis.core.progmodel.facets.object.validprops.ObjectValidPropertiesFacetFactory;
 import org.apache.isis.core.progmodel.facets.object.value.annotation.ValueFacetFactory;
 import org.apache.isis.core.progmodel.facets.object.viewmodel.annotation.ViewModelAnnotationFacetFactory;
-import org.apache.isis.core.progmodel.facets.paged.PagedAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.paged.PagedAnnotationOnCollectionFacetFactory;
+import org.apache.isis.core.progmodel.facets.paged.PagedAnnotationOnTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.param.choices.enums.ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory;
 import org.apache.isis.core.progmodel.facets.param.choices.method.ActionChoicesFacetFactory;
 import org.apache.isis.core.progmodel.facets.param.choices.methodnum.ActionParameterChoicesFacetFactory;
@@ -223,8 +224,9 @@ public class ProgrammingModelFacetsJava5
         // properties
         addFactory(PropertyAccessorFacetFactory.class);
         addFactory(PropertySetAndClearFacetFactory.class);
-        addFactory(PropertyModifyFacetFactory.class); // must come after
-                                                      // PropertySetAndClearFacetFactory
+        // must come after PropertySetAndClearFacetFactory
+        addFactory(PropertyModifyFacetFactory.class);
+        
         addFactory(PropertyValidateFacetFactory.class);
         addFactory(PropertyChoicesFacetFactory.class);
         addFactory(PropertyDefaultFacetFactory.class);
@@ -344,7 +346,9 @@ public class ProgrammingModelFacetsJava5
 
         addFactory(ParseableFacetFactory.class);
         addFactory(PluralAnnotationFacetFactory.class);
-        addFactory(PagedAnnotationFacetFactory.class);
+        addFactory(PagedAnnotationOnTypeFacetFactory.class);
+        addFactory(PagedAnnotationOnCollectionFacetFactory.class);
+
         addFactory(AutoCompleteAnnotationFacetFactory.class);
 
 



Mime
View raw message