You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2004/11/11 12:29:18 UTC
svn commit: rev 57426 - cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel
Author: sylvain
Date: Thu Nov 11 03:29:16 2004
New Revision: 57426
Modified:
cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
Log:
speedup getRequestParameterName by caching its result
Modified: cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java
==============================================================================
--- cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java (original)
+++ cocoon/trunk/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java Thu Nov 11 03:29:16 2004
@@ -73,7 +73,12 @@
* Storage for the widget allocated attributes
*/
private Map attributes;
-
+
+ /**
+ * Lazily computed request parameter name
+ */
+ private String requestParamName;
+
protected AbstractWidget(AbstractWidgetDefinition definition) {
this.state = definition.getState();
}
@@ -171,15 +176,22 @@
}
public String getRequestParameterName() {
- Widget myParent = getParent();
- if (myParent != null) {
- String parentFullId = myParent.getRequestParameterName();
- // the top level form returns an id == ""
- if (parentFullId.length() > 0) {
- return parentFullId + "." + getId();
+ if (this.requestParamName == null) {
+
+ // Default if no parent or parent with empty id
+ this.requestParamName = getId();
+
+ Widget myParent = getParent();
+ if (myParent != null) {
+ String parentFullId = myParent.getRequestParameterName();
+ // the top level form returns an id == ""
+ if (parentFullId.length() > 0) {
+ this.requestParamName = parentFullId + "." + getId();
+ }
}
}
- return getId();
+
+ return this.requestParamName;
}
public Widget lookupWidget(String path) {