Author: hlship
Date: Thu Oct  7 07:37:20 2010
New Revision: 1005348

URL: http://svn.apache.org/viewvc?rev=1005348&view=rev
Log:
TAP5-1298: Split BeanBlockContribution into two sub-classes

Added:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java
   (with props)
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java
   (with props)
Modified:
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/BeanBlockContribution.java
    
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/BeanBlockContribution.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/BeanBlockContribution.java?rev=1005348&r1=1005347&r2=1005348&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/BeanBlockContribution.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/BeanBlockContribution.java
 Thu Oct  7 07:37:20 2010
@@ -4,7 +4,7 @@
 // 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
+// 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,
@@ -21,7 +21,7 @@ import org.apache.tapestry5.ioc.internal
  * A contribution to the {...@link BeanBlockSource} service, defining a page 
name and block id (within the page) that can
  * edit or display a particular type of property.
  */
-public final class BeanBlockContribution
+public class BeanBlockContribution
 {
     private final String dataType;
 
@@ -31,6 +31,11 @@ public final class BeanBlockContribution
 
     private final boolean edit;
 
+    /**
+     * @deprecated Use {...@link 
DisplayBlockContribution#DisplayBlockContribution(String, String, String)} or
+     *             {...@link 
EditBlockContribution#EditorBlockContribution(String, String, String)} instead. 
To be
+     *             removed after Tapestry 5.2.
+     */
     public BeanBlockContribution(String dataType, String pageName, String 
blockId, boolean edit)
     {
         assert InternalUtils.isNonBlank(dataType);
@@ -45,7 +50,7 @@ public final class BeanBlockContribution
     /**
      * The type of data for which the indicated block will provide an editor 
or displayer for.
      */
-    public String getDataType()
+    public final String getDataType()
     {
         return dataType;
     }
@@ -53,7 +58,7 @@ public final class BeanBlockContribution
     /**
      * The id of the block within the page.
      */
-    public String getBlockId()
+    public final String getBlockId()
     {
         return blockId;
     }
@@ -63,7 +68,7 @@ public final class BeanBlockContribution
      * component (or set of field components). If false, the block is used to 
display the value of the property, usually
      * by applying some kind of formatting to the raw value.
      */
-    public boolean isEdit()
+    public final boolean isEdit()
     {
         return edit;
     }
@@ -71,7 +76,7 @@ public final class BeanBlockContribution
     /**
      * The logical name of the page containing the block.
      */
-    public String getPageName()
+    public final String getPageName()
     {
         return pageName;
     }

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java?rev=1005348&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java
 Thu Oct  7 07:37:20 2010
@@ -0,0 +1,36 @@
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.services;
+
+import org.apache.tapestry5.corelib.components.BeanDisplay;
+import org.apache.tapestry5.corelib.components.Grid;
+import org.apache.tapestry5.corelib.components.PropertyDisplay;
+
+/**
+ * Contribution to {...@link BeanBlockSource} identifying a block that is used 
to display a property.
+ * 
+ * @see BeanDisplay
+ * @see PropertyDisplay
+ * @see Grid
+ * @see PropertyOutputContext
+ * @since 5.2.2
+ */
+public class DisplayBlockContribution extends BeanBlockContribution
+{
+    public DisplayBlockContribution(String dataType, String pageName, String 
blockId)
+    {
+        super(dataType, pageName, blockId, false);
+    }
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/DisplayBlockContribution.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java?rev=1005348&view=auto
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java
 (added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java
 Thu Oct  7 07:37:20 2010
@@ -0,0 +1,36 @@
+// Copyright 2010 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.services;
+
+import org.apache.tapestry5.corelib.components.BeanEditForm;
+import org.apache.tapestry5.corelib.components.BeanEditor;
+import org.apache.tapestry5.corelib.components.PropertyEditor;
+
+/**
+ * Contribution to {...@link BeanBlockSource} identifying a block that is used 
to edit a property.
+ * 
+ * @see BeanEditor
+ * @see BeanEditForm
+ * @see PropertyEditor
+ * @see PropertyEditContext
+ * @since 5.2.2
+ */
+public class EditBlockContribution extends BeanBlockContribution
+{
+    public EditBlockContribution(String dataType, String pageName, String 
blockId)
+    {
+        super(dataType, pageName, blockId, true);
+    }
+}

Propchange: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/EditBlockContribution.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1005348&r1=1005347&r2=1005348&view=diff
==============================================================================
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
 Thu Oct  7 07:37:20 2010
@@ -610,8 +610,8 @@ public final class TapestryModule
         configuration.add("MixinAfter", new MixinAfterWorker());
         configuration.add("Component", new ComponentWorker(resolver));
         configuration.add("Mixin", new MixinWorker(resolver));
-        configuration.addInstance("ActivationRequestParameter", 
ActivationRequestParameterWorker.class,
-                "after:OnEvent");
+        configuration
+                .addInstance("ActivationRequestParameter", 
ActivationRequestParameterWorker.class, "after:OnEvent");
         configuration.addInstance("OnEvent", OnEventWorker.class);
         configuration.add("SupportsInformalParameters", new 
SupportsInformalParametersWorker());
         configuration.addInstance("InjectPage", InjectPageWorker.class);
@@ -722,7 +722,8 @@ public final class TapestryModule
         configuration.add(Calendar.class, "calendar");
     }
 
-    public static void 
contributeBeanBlockSource(Configuration<BeanBlockContribution> configuration)
+    @Contribute(BeanBlockSource.class)
+    public static void 
provideDefaultBeanBlocks(Configuration<BeanBlockContribution> configuration)
     {
         addEditBlock(configuration, "text");
         addEditBlock(configuration, "number");
@@ -752,7 +753,7 @@ public final class TapestryModule
 
     private static void addEditBlock(Configuration<BeanBlockContribution> 
configuration, String dataType, String blockId)
     {
-        configuration.add(new BeanBlockContribution(dataType, 
"PropertyEditBlocks", blockId, true));
+        configuration.add(new EditBlockContribution(dataType, 
"PropertyEditBlocks", blockId));
     }
 
     private static void addDisplayBlock(Configuration<BeanBlockContribution> 
configuration, String dataType)
@@ -763,7 +764,7 @@ public final class TapestryModule
     private static void addDisplayBlock(Configuration<BeanBlockContribution> 
configuration, String dataType,
             String blockId)
     {
-        configuration.add(new BeanBlockContribution(dataType, 
"PropertyDisplayBlocks", blockId, false));
+        configuration.add(new DisplayBlockContribution(dataType, 
"PropertyDisplayBlocks", blockId));
     }
 
     /**


Reply via email to