You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/10/06 02:49:26 UTC
[1/9] git commit: Set a default CSS class for the Submit component
Remove configuration symbol;
always enable component id validation for event handler methods
Updated Branches:
refs/heads/5.4-js-rewrite c8fd64807 -> 51cb3a7cd
Set a default CSS class for the Submit component
Remove configuration symbol; always enable component id validation for event handler methods
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/51cb3a7c
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/51cb3a7c
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/51cb3a7c
Branch: refs/heads/5.4-js-rewrite
Commit: 51cb3a7cd7c0d2d80daa4ecc318a69a5868a85a6
Parents: e4788da
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Oct 5 17:46:07 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Oct 5 17:46:07 2012 -0700
----------------------------------------------------------------------
.../tapestry5/ComponentParameterConstants.java | 8 +++++
.../java/org/apache/tapestry5/SymbolConstants.java | 15 ---------
.../tapestry5/corelib/components/Submit.java | 11 +++++++
.../internal/transform/OnEventWorker.java | 23 ++++----------
.../apache/tapestry5/services/TapestryModule.java | 4 +-
5 files changed, 28 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/51cb3a7c/tapestry-core/src/main/java/org/apache/tapestry5/ComponentParameterConstants.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/ComponentParameterConstants.java b/tapestry-core/src/main/java/org/apache/tapestry5/ComponentParameterConstants.java
index f7a14d4..235efd0 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/ComponentParameterConstants.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/ComponentParameterConstants.java
@@ -107,4 +107,12 @@ public class ComponentParameterConstants
*/
public static final String ZONE_UPDATE_METHOD = "tapestry.components.zone_update_method";
+ /**
+ * Default CSS class for the {@link org.apache.tapestry5.corelib.components.Submit}
+ * component.
+ *
+ * @since 5.4.
+ */
+ public static final String SUBMIT_CSS_CLASS = "tapestry.components.submit_css_class";
+
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/51cb3a7c/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java b/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
index 94b1051..d903230 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
@@ -296,21 +296,6 @@ public class SymbolConstants
public static final String CLUSTERED_SESSIONS = "tapestry.clustered-sessions";
/**
- * The fix for <a href="https://issues.apache.org/jira/browse/TAP5-1596">TAP5-1596</a> means that component ids referenced
- * by event handler methods (either the naming convention, or the {@link org.apache.tapestry5.annotations.OnEvent} annotation)
- * can cause a page load error if there is no matching component in the component's template. Although this is correct behavior,
- * it can make the upgrade from 5.2 to 5.3 difficult if an existing app had some "left over" event handler methods. Changing
- * this symbol to {@code false} is a temporary approach to resolving this problem.
- * <p/>
- * This symbol will be <em>ignored</em> in release 5.4 and removed in 5.5.
- *
- * @since 5.3
- * @deprecated Deprecated in 5.3, a future release will always enforce that component ids referenced by event handler methods actually exist.
- */
- @Deprecated
- public static final String UNKNOWN_COMPONENT_ID_CHECK_ENABLED = "tapestry.compatibility.unknown-component-id-check-enabled";
-
- /**
* The name of a folder in which the Tapestry application executes. Prior to 5.3, a Tapestry application always responded to all
* URLs in the context under the context root; by setting this to the name of a folder, the T5 URLs will be inside that folder only, and should
* match a corresponding entry in the {@code web.xml} configuration file. This is useful when running multiple servlets within the same web application (such as when migrating
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/51cb3a7c/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java
index b97f9ee..1d83507 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Submit.java
@@ -94,6 +94,15 @@ public class Submit implements ClientElement
@Parameter(allowNull = false, defaultPrefix = BindingConstants.LITERAL)
private SubmitMode mode = SubmitMode.NORMAL;
+ /**
+ * CSS class for the element.
+ *
+ * @since 5.4
+ */
+ @Parameter(name = "class", defaultPrefix = BindingConstants.LITERAL,
+ value = BindingConstants.SYMBOL + ":" + ComponentParameterConstants.SUBMIT_CSS_CLASS)
+ private String cssClass;
+
@Environmental
private FormSupport formSupport;
@@ -160,6 +169,8 @@ public class Submit implements ClientElement
"name", name,
+ "class", cssClass,
+
"id", clientId);
if (disabled)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/51cb3a7c/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
index ba31f0d..c62e4a6 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
@@ -16,7 +16,6 @@ package org.apache.tapestry5.internal.transform;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.EventContext;
-import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ValueEncoder;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.RequestParameter;
@@ -26,7 +25,6 @@ import org.apache.tapestry5.func.Mapper;
import org.apache.tapestry5.func.Predicate;
import org.apache.tapestry5.internal.services.ComponentClassCache;
import org.apache.tapestry5.ioc.OperationTracker;
-import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.ioc.internal.util.TapestryException;
@@ -61,7 +59,7 @@ public class OnEventWorker implements ComponentClassTransformWorker2
private final OperationTracker operationTracker;
- private final boolean componentIdCheck;
+ private final boolean componentIdCheck = true;
private final InstructionBuilderCallback RETURN_TRUE = new InstructionBuilderCallback()
{
@@ -290,16 +288,12 @@ public class OnEventWorker implements ComponentClassTransformWorker2
});
}
- public OnEventWorker(Request request, ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, OperationTracker operationTracker,
-
- @Symbol(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED)
- boolean componentIdCheck)
+ public OnEventWorker(Request request, ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, OperationTracker operationTracker)
{
this.request = request;
this.valueEncoderSource = valueEncoderSource;
this.classCache = classCache;
this.operationTracker = operationTracker;
- this.componentIdCheck = componentIdCheck;
}
public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model)
@@ -332,15 +326,12 @@ public class OnEventWorker implements ComponentClassTransformWorker2
private void addComponentIdValidationLogicOnPageLoad(PlasticClass plasticClass, Flow<EventHandlerMethod> eventHandlerMethods)
{
- if (componentIdCheck)
- {
- ComponentIdValidator[] validators = extractComponentIdValidators(eventHandlerMethods);
+ ComponentIdValidator[] validators = extractComponentIdValidators(eventHandlerMethods);
- if (validators.length > 0)
- {
- plasticClass.introduceInterface(PageLifecycleListener.class);
- plasticClass.introduceMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_DESCRIPTION).addAdvice(new ValidateComponentIds(validators));
- }
+ if (validators.length > 0)
+ {
+ plasticClass.introduceInterface(PageLifecycleListener.class);
+ plasticClass.introduceMethod(TransformConstants.CONTAINING_PAGE_DID_LOAD_DESCRIPTION).addAdvice(new ValidateComponentIds(validators));
}
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/51cb3a7c/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
index 92a9fae..122a9e1 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
@@ -2180,10 +2180,10 @@ public final class TapestryModule
configuration.add(SymbolConstants.HOSTPORT, 0);
configuration.add(SymbolConstants.HOSTPORT_SECURE, 0);
- configuration.add(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED, true);
-
configuration.add(SymbolConstants.APPLICATION_FOLDER, "");
+ configuration.add(ComponentParameterConstants.SUBMIT_CSS_CLASS, "btn btn-primary");
+
// Grid component parameters defaults
configuration.add(ComponentParameterConstants.GRID_ROWS_PER_PAGE, GridConstants.ROWS_PER_PAGE);
configuration.add(ComponentParameterConstants.GRID_PAGER_POSITION, GridConstants.PAGER_POSITION);