You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/02/25 05:57:24 UTC
svn commit: r155306 - in incubator/beehive/trunk/netui/src:
compiler/org/apache/beehive/netui/compiler/
compiler/org/apache/beehive/netui/compiler/genmodel/
compiler/org/apache/beehive/netui/compiler/grammar/
pageflow/org/apache/beehive/netui/pageflow/
pageflow/org/apache/beehive/netui/pageflow/internal/
tags-html/org/apache/beehive/netui/tags/html/
Author: rich
Date: Thu Feb 24 20:57:20 2005
New Revision: 155306
URL: http://svn.apache.org/viewcvs?view=rev&rev=155306
Log:
Fixes for:
- http://issues.apache.org/jira/browse/BEEHIVE-178 : Unable to override jpfScopeID from button when already set on form
- http://issues.apache.org/jira/browse/BEEHIVE-177 : targetScope attribute on button not setting jpfScopeId unless action attribute is also set
- http://issues.apache.org/jira/browse/BEEHIVE-215 : Forward member restoreQueryString did not get to written into struts config
DRT/BVT: netui (WinXP)
BB: self (linux)
Modified:
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/CompilerUtils.java Thu Feb 24 20:57:20 2005
@@ -180,6 +180,10 @@
public static DeclaredType getDeclaredType( AnnotationMirror annotation, String memberName, boolean defaultIsNull )
{
AnnotationValue value = getAnnotationValue( annotation, memberName, defaultIsNull );
+
+ // If the type is the string "<error>", it means that there is already an error related to the type itself.
+ if ( value != null && ERROR_TYPE_STR.equals( value.getValue() ) ) return null;
+
assert value == null || value.getValue() instanceof DeclaredType : value.getValue().getClass().getName();
return value != null ? ( DeclaredType ) value.getValue() : null;
}
@@ -992,7 +996,7 @@
public String getQualifiedName()
{
- return "<error>";
+ return ERROR_TYPE_STR;
}
public Collection< TypeParameterDeclaration > getFormalTypeParameters()
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/diagnostics.properties Thu Feb 24 20:57:20 2005
@@ -197,8 +197,10 @@
This action has the {0} attribute set to true, but the {1} attribute may cause the value of member field {2} \
to be modified.
-error.integer-attribute-not-in-range = Attribute "{0}" must be an integer value from {1} through {2}.
+error.integer-attribute-not-in-range = Attribute {0} must be an integer value from {1} through {2}.
error.validation-bundle-support = \
The PageFlowController validator version attribute must be more recent than 1.0 to use the {0} attribute on \
the annotation, {1}.
+
+error.attr-depends-on-attr-value = The {0} attribute requires a value of {1} for attribute {2}.
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/genmodel/GenForwardModel.java Thu Feb 24 20:57:20 2005
@@ -97,15 +97,14 @@
else if ( navigateTo.equals( NAVIGATE_TO_PREVIOUS_ACTION_STR ) )
{
setReturnToAction( true );
- boolean restore =
- CompilerUtils.getBoolean( annotation, RESTORE_QUERY_STRING_ATTR, false ).booleanValue();
- setRestoreQueryString( restore );
}
else
{
assert false : "unknown value for navigateTo: \"" + navigateTo + "\"";
}
+ boolean restore = CompilerUtils.getBoolean( annotation, RESTORE_QUERY_STRING_ATTR, false );
+ setRestoreQueryString( restore );
setPath( navigateTo ); // set the actual navigateTo value as the path -- the runtime expects it there
}
else if ( tilesDefinition != null )
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/ForwardGrammar.java Thu Feb 24 20:57:20 2005
@@ -91,7 +91,7 @@
addMemberType( REDIRECT_ATTR, new AnnotationMemberType( null, this ) );
addMemberType( EXTERNAL_REDIRECT_ATTR, new AbsolutePathType( null , this ) );
addMemberType( NAVIGATE_TO_ATTR, new EnumType( NAVIGATE_TO_VALS, DEPRECATED_NAVIGATE_TO_VALS, null, this ) );
- addMemberType( RESTORE_QUERY_STRING_ATTR, new AnnotationMemberType( VERSION_9_0_STRING, this ) );
+ addMemberType( RESTORE_QUERY_STRING_ATTR, new RestoreQueryStringType() );
addMemberArrayGrammar( ACTION_OUTPUTS_ATTR, new ActionOutputGrammar( env, diags, runtimeVersionChecker ) );
}
@@ -158,6 +158,32 @@
{
addError( annotation, "error.action-invalid-form-bean-type", formBeanType.toString() );
}
+ }
+ }
+
+ protected class RestoreQueryStringType
+ extends AnnotationMemberType
+ {
+ public RestoreQueryStringType()
+ {
+ super( ForwardGrammar.this.getRequiredRuntimeVersion(), ForwardGrammar.this );
+ }
+
+ public Object onCheck( AnnotationTypeElementDeclaration valueDecl, AnnotationValue member,
+ AnnotationMirror[] parentAnnotations, MemberDeclaration classMember,
+ int annotationArrayIndex )
+ {
+ AnnotationMirror parentAnnotation = parentAnnotations[ parentAnnotations.length - 1 ];
+ String navigateToVal = CompilerUtils.getEnumFieldName( parentAnnotation, NAVIGATE_TO_ATTR, true );
+
+ if ( ! NAVIGATE_TO_PREVIOUS_ACTION_STR.equals( navigateToVal ) )
+ {
+ addError( member, "error.attr-depends-on-attr-value", RESTORE_QUERY_STRING_ATTR,
+ ANNOTATION_INTERFACE_PREFIX + NAVIGATE_TO_ENUM + '.' + NAVIGATE_TO_PREVIOUS_ACTION_STR,
+ NAVIGATE_TO_ATTR );
+ }
+
+ return null;
}
}
Modified: incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java (original)
+++ incubator/beehive/trunk/netui/src/compiler/org/apache/beehive/netui/compiler/grammar/TypeNameType.java Thu Feb 24 20:57:20 2005
@@ -20,6 +20,7 @@
import org.apache.beehive.netui.compiler.AnnotationMemberType;
import org.apache.beehive.netui.compiler.CompilerUtils;
import org.apache.beehive.netui.compiler.AnnotationGrammar;
+import org.apache.beehive.netui.compiler.JpfLanguageConstants;
import com.sun.mirror.declaration.AnnotationValue;
import com.sun.mirror.declaration.AnnotationMirror;
import com.sun.mirror.declaration.MemberDeclaration;
@@ -53,6 +54,12 @@
int annotationArrayIndex )
{
Object val = value.getValue();
+
+ if ( JpfLanguageConstants.ERROR_TYPE_STR.equals( val ) )
+ {
+ // This means that there is already an error related to the type itself.
+ return null;
+ }
if ( val instanceof PrimitiveType )
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java Thu Feb 24 20:57:20 2005
@@ -815,7 +815,7 @@
/**
* Tell whether this Forward will store the original query string on the page restored through
- * {@link Jpf.NavigateTo#currentPage} or {@link Jpf.NavigateTo#previousPage}.
+ * {@link Jpf.NavigateTo#previousAction}.
*/
public boolean doesRestoreQueryString()
{
Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java Thu Feb 24 20:57:20 2005
@@ -380,10 +380,7 @@
{
String actionURI = prevActionInfo.getActionURI();
- if ( _log.isDebugEnabled() )
- {
- _log.debug( "return-to-action: " + actionURI );
- }
+ if ( _log.isDebugEnabled() ) _log.debug( "return-to-action: " + actionURI );
//
// If there's no form specified in this return-to-action forward, then use the original form that was saved
@@ -396,10 +393,7 @@
}
String query = pageFlowFwd.getQueryString();
- if ( query == null )
- {
- query = "";
- }
+ if ( query == null ) query = "";
//
// If the restoreQueryString attribute was set, use the query string from the original action URI.
@@ -408,11 +402,7 @@
if ( restoreQueryString )
{
String prevQuery = prevActionInfo.getQueryString();
-
- if ( prevQuery != null )
- {
- query += ( query.length() > 0 ? "&" : "?" ) + prevQuery;
- }
+ if ( prevQuery != null ) query += ( query.length() > 0 ? "&" : "?" ) + prevQuery;
}
ActionForward fwd = new ActionForward( actionURI + query, pageFlowFwd.getRedirect() );
Modified: incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java?view=diff&r1=155305&r2=155306
==============================================================================
--- incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java (original)
+++ incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Button.java Thu Feb 24 20:57:20 2005
@@ -295,6 +295,15 @@
_popupSupport.addParams(this, request);
}
+ // targetScope implies an extra parameter. If there's no action on this button, get the action from the
+ // nearest form, so we can construct an action url with our extra parameter.
+ if (_targetScope != null && _action == null) {
+ Form parentForm = getNearestForm();
+ if (parentForm != null) {
+ _action = parentForm.getAction();
+ }
+ }
+
if (_action != null) {
boolean isAction = PageFlowTagUtils.isAction(request, _action);
if (isAction) {