You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/01/27 18:15:14 UTC
svn commit: r372917 - in /beehive/trunk/samples/netui-samples: src/
src/org/apache/beehive/samples/netui/actioninterceptors/
src/org/apache/beehive/samples/netui/customValidator/
src/org/apache/beehive/samples/netui/loginexample/ web/ web/_basicnesting...
Author: ekoneil
Date: Fri Jan 27 09:14:58 2006
New Revision: 372917
URL: http://svn.apache.org/viewcvs?rev=372917&view=rev
Log:
Fixing inconsistencies in sample names which were all lower case except for a handful that were camel case.
BB: self
Test: none -- the netui-samples build will be broken momentarily while I fix these paths
Added:
beehive/trunk/samples/netui-samples/web/_basicnesting/
- copied from r372916, beehive/trunk/samples/netui-samples/web/basicNesting/
beehive/trunk/samples/netui-samples/web/advanced/_clientsidevalidation/
- copied from r372916, beehive/trunk/samples/netui-samples/web/advanced/clientSideValidation/
beehive/trunk/samples/netui-samples/web/advanced/_customvalidator/
- copied from r372916, beehive/trunk/samples/netui-samples/web/advanced/customValidator/
Removed:
beehive/trunk/samples/netui-samples/web/advanced/clientSideValidation/
beehive/trunk/samples/netui-samples/web/advanced/customValidator/
beehive/trunk/samples/netui-samples/web/basicNesting/
Modified:
beehive/trunk/samples/netui-samples/src/log4j.xml
beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/actioninterceptors/MyInterceptor.java
beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/CustomRules.java
beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/MyFormBean.java
beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/loginexample/ExampleLoginHandler.java
beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/interceptme/Controller.java
beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/nested/Controller.java
beehive/trunk/samples/netui-samples/web/index.jsp
Modified: beehive/trunk/samples/netui-samples/src/log4j.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/src/log4j.xml?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/src/log4j.xml (original)
+++ beehive/trunk/samples/netui-samples/src/log4j.xml Fri Jan 27 09:14:58 2006
@@ -18,11 +18,6 @@
</layout>
</appender>
- <category name="ui.datagrid">
- <priority value="debug"/>
- <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
- </category>
-
<!-- Beehive, including Controls, NetUI, etc -->
<category name="org.apache.beehive">
<priority value="info"/>
Modified: beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/actioninterceptors/MyInterceptor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/actioninterceptors/MyInterceptor.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/actioninterceptors/MyInterceptor.java (original)
+++ beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/actioninterceptors/MyInterceptor.java Fri Jan 27 09:14:58 2006
@@ -23,21 +23,17 @@
import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain;
import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
-import java.net.URI;
-
/**
* This class is used by the "actioninterceptors" sample. It is registered in
* WEB-INF/beehive-netui-config.xml.
*/
-public class MyInterceptor extends ActionInterceptor
-{
+public class MyInterceptor extends ActionInterceptor {
/**
* Return a URI to a nested page flow, which will be "injected" before the desired action is run.
*/
public void preAction(ActionInterceptorContext context, InterceptorChain chain)
- throws InterceptorException
- {
+ throws InterceptorException {
System.out.println("in preAction() in " + getClass().getName());
InterceptorForward fwd = new InterceptorForward("/advanced/actioninterceptors/nested/Controller.jpf");
setOverrideForward(fwd, context);
@@ -48,8 +44,7 @@
* This is called after our "injected" nested page flow is done, and before the original desired
* action is run.
*/
- public void afterNestedIntercept(AfterNestedInterceptContext context) throws InterceptorException
- {
+ public void afterNestedIntercept(AfterNestedInterceptContext context) throws InterceptorException {
System.out.println("in afterNestedIntercept() in " + getClass().getName());
}
@@ -57,8 +52,7 @@
* This is called after the original desired action is run.
*/
public void postAction(ActionInterceptorContext context, InterceptorChain chain)
- throws InterceptorException
- {
+ throws InterceptorException {
System.out.println("in postAction() in " + getClass().getName());
chain.continueChain();
}
Modified: beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/CustomRules.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/CustomRules.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/CustomRules.java (original)
+++ beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/CustomRules.java Fri Jan 27 09:14:58 2006
@@ -1,5 +1,25 @@
+/*
+ * Copyright 2004-2005 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.
+ *
+ * $Header:$
+ */
package org.apache.beehive.samples.netui.customValidator;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
@@ -7,39 +27,32 @@
import org.apache.struts.action.ActionMessages;
import org.apache.struts.validator.Resources;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
/**
* This class contains custom rules for the "Custom Validator" sample.
*/
-public class CustomRules
-{
+public class CustomRules {
/**
* This is the method for the 'customRulePalindrome' rule. It passes validation only if the
* value is a palindrome String (reads the same backwards and forwards).
*/
- public static boolean validatePalindrome(Object bean, ValidatorAction va, Field field,
- ActionMessages errors, HttpServletRequest request,
- ServletContext servletContext)
- {
+ public static boolean validatePalindrome(Object bean,
+ ValidatorAction va,
+ Field field,
+ ActionMessages errors,
+ HttpServletRequest request,
+ ServletContext servletContext) {
String value;
- if (bean == null || bean instanceof String)
- {
+ if (bean == null || bean instanceof String) {
value = (String) bean;
}
- else
- {
+ else {
value = ValidatorUtil.getValueAsString(bean, field.getProperty());
}
- if (! GenericValidator.isBlankOrNull(value))
- {
- for (int i = 0, len = value.length(); i < len; ++i)
- {
- if (value.charAt(i) != value.charAt(len - i - 1))
- {
+ if (! GenericValidator.isBlankOrNull(value)) {
+ for (int i = 0, len = value.length(); i < len; ++i) {
+ if (value.charAt(i) != value.charAt(len - i - 1)) {
errors.add(field.getKey(), Resources.getActionError(request, va, field));
return false;
}
@@ -53,31 +66,28 @@
* This is the method for the 'customRuleDivisibleBy' rule. It passes validation only if the
* value is a number divisible by the value of variable <code>factor</code>.
*/
- public static boolean validateDivisibleBy(Object bean, ValidatorAction va, Field field,
- ActionMessages errors, HttpServletRequest request,
- ServletContext servletContext)
- {
+ public static boolean validateDivisibleBy(Object bean,
+ ValidatorAction va,
+ Field field,
+ ActionMessages errors,
+ HttpServletRequest request,
+ ServletContext servletContext) {
String value;
- if (bean == null || bean instanceof String)
- {
+ if (bean == null || bean instanceof String) {
value = (String) bean;
}
- else
- {
+ else {
value = ValidatorUtil.getValueAsString(bean, field.getProperty());
}
- if (! GenericValidator.isBlankOrNull(value))
- {
+ if (! GenericValidator.isBlankOrNull(value)) {
- try
- {
+ try {
String factor = field.getVarValue("factor");
if (Integer.parseInt(value) % Integer.parseInt(factor) == 0) return true;
}
- catch (NumberFormatException e)
- {
+ catch (NumberFormatException e) {
// error will be returned below
}
Modified: beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/MyFormBean.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/MyFormBean.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/MyFormBean.java (original)
+++ beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/customValidator/MyFormBean.java Fri Jan 27 09:14:58 2006
@@ -1,3 +1,20 @@
+/*
+ * Copyright 2004-2005 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.
+ *
+ * $Header:$
+ */
package org.apache.beehive.samples.netui.customValidator;
import org.apache.beehive.netui.pageflow.annotations.Jpf;
@@ -6,68 +23,61 @@
* This is the form bean for the "Custom Validator" sample. It defines its own message bundle, but
* you could also just use messages in the page flow's default message bundle.
*/
-@Jpf.FormBean(messageBundle="org.apache.beehive.samples.netui.resources.customvalidator.messages")
-public class MyFormBean
-{
+@Jpf.FormBean(messageBundle = "org.apache.beehive.samples.netui.resources.customvalidator.messages")
+public class MyFormBean {
private String _palindrome;
private String _divisibleBy3;
private String _palindromeDivisibleBy5;
@Jpf.ValidatableProperty(
- displayNameKey="displayname.palindrome",
- validateRequired=@Jpf.ValidateRequired(),
- validateCustomRules={
- @Jpf.ValidateCustomRule(rule="customRulePalindrome")
- }
+ displayNameKey = "displayname.palindrome",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateCustomRules = {
+ @Jpf.ValidateCustomRule(rule = "customRulePalindrome")
+ }
)
- public String getPalindrome()
- {
+ public String getPalindrome() {
return _palindrome;
}
- public void setPalindrome(String palindrome)
- {
+ public void setPalindrome(String palindrome) {
_palindrome = palindrome;
}
@Jpf.ValidatableProperty(
- displayNameKey="displayname.divisibleBy3",
- validateRequired=@Jpf.ValidateRequired(),
- validateCustomRules={
- @Jpf.ValidateCustomRule(
- rule="customRuleDivisibleBy",
- variables={@Jpf.ValidateCustomVariable(name="factor", value="3")}
- )
- }
+ displayNameKey = "displayname.divisibleBy3",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateCustomRules = {
+ @Jpf.ValidateCustomRule(
+ rule = "customRuleDivisibleBy",
+ variables = {@Jpf.ValidateCustomVariable(name = "factor", value = "3")}
+ )
+ }
)
- public String getDivisibleBy3()
- {
+ public String getDivisibleBy3() {
return _divisibleBy3;
}
- public void setDivisibleBy3(String divisibleBy3)
- {
+ public void setDivisibleBy3(String divisibleBy3) {
_divisibleBy3 = divisibleBy3;
}
@Jpf.ValidatableProperty(
- displayNameKey="displayname.palindromeDivisibleBy5",
- validateRequired=@Jpf.ValidateRequired(),
- validateCustomRules={
- @Jpf.ValidateCustomRule(
- rule="customRuleDivisibleBy",
- variables={@Jpf.ValidateCustomVariable(name="factor", value="5")}
- ),
- @Jpf.ValidateCustomRule(rule="customRulePalindrome")
- }
+ displayNameKey = "displayname.palindromeDivisibleBy5",
+ validateRequired = @Jpf.ValidateRequired(),
+ validateCustomRules = {
+ @Jpf.ValidateCustomRule(
+ rule = "customRuleDivisibleBy",
+ variables = {@Jpf.ValidateCustomVariable(name = "factor", value = "5")}
+ ),
+ @Jpf.ValidateCustomRule(rule = "customRulePalindrome")
+ }
)
- public String getPalindromeDivisibleBy5()
- {
+ public String getPalindromeDivisibleBy5() {
return _palindromeDivisibleBy5;
}
- public void setPalindromeDivisibleBy5(String palindromeDivisibleBy5)
- {
+ public void setPalindromeDivisibleBy5(String palindromeDivisibleBy5) {
_palindromeDivisibleBy5 = palindromeDivisibleBy5;
}
}
Modified: beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/loginexample/ExampleLoginHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/loginexample/ExampleLoginHandler.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/loginexample/ExampleLoginHandler.java (original)
+++ beehive/trunk/samples/netui-samples/src/org/apache/beehive/samples/netui/loginexample/ExampleLoginHandler.java Fri Jan 27 09:14:58 2006
@@ -28,48 +28,37 @@
public class ExampleLoginHandler
extends BaseHandler
- implements LoginHandler
-{
- private static class UserPrincipal
- implements Principal
- {
- public String getName()
- {
- return "good";
- }
- }
+ implements LoginHandler {
- public void login( FlowControllerHandlerContext context, String username, String password )
- throws LoginException
- {
- if ( username.equals( "good" ) && password.equals( "good" ) )
- {
- getSession( context ).setAttribute( "_principal", new UserPrincipal() );
- }
- else
- {
- throw new LoginException( username );
+ public void login(FlowControllerHandlerContext context, String username, String password)
+ throws LoginException {
+ if (username.equals("good") && password.equals("good")) {
+ getSession(context).setAttribute("_principal", new UserPrincipal());
}
+ else throw new LoginException(username);
}
- public void logout( FlowControllerHandlerContext context, boolean invalidateSessions )
- {
- getSession( context ).removeAttribute( "_principal" );
+ public void logout(FlowControllerHandlerContext context, boolean invalidateSessions) {
+ getSession(context).removeAttribute("_principal");
}
- public boolean isUserInRole( FlowControllerHandlerContext context, String roleName )
- {
+ public boolean isUserInRole(FlowControllerHandlerContext context, String roleName) {
return false;
}
- public Principal getUserPrincipal( FlowControllerHandlerContext context )
- {
- return ( Principal ) getSession( context ).getAttribute( "_principal" );
+ public Principal getUserPrincipal(FlowControllerHandlerContext context) {
+ return (Principal) getSession(context).getAttribute("_principal");
}
- private static HttpSession getSession( FlowControllerHandlerContext context )
- {
+ private static HttpSession getSession(FlowControllerHandlerContext context) {
assert context.getRequest() instanceof HttpServletRequest;
- return ( ( HttpServletRequest ) context.getRequest() ).getSession();
+ return ((HttpServletRequest)context.getRequest()).getSession();
+ }
+
+ private static class UserPrincipal
+ implements Principal {
+ public String getName() {
+ return "good";
+ }
}
}
Modified: beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/interceptme/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/interceptme/Controller.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/interceptme/Controller.java (original)
+++ beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/interceptme/Controller.java Fri Jan 27 09:14:58 2006
@@ -20,7 +20,6 @@
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import org.apache.beehive.netui.pageflow.PageFlowController;
-
/**
* Demonstration of Page Flow action interceptors.
*/
Modified: beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/nested/Controller.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/nested/Controller.java?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/nested/Controller.java (original)
+++ beehive/trunk/samples/netui-samples/web/advanced/actioninterceptors/nested/Controller.java Fri Jan 27 09:14:58 2006
@@ -20,7 +20,6 @@
import org.apache.beehive.netui.pageflow.annotations.Jpf;
import org.apache.beehive.netui.pageflow.PageFlowController;
-
/**
* Demonstration of Page Flow action interceptors.
*/
Modified: beehive/trunk/samples/netui-samples/web/index.jsp
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/netui-samples/web/index.jsp?rev=372917&r1=372916&r2=372917&view=diff
==============================================================================
--- beehive/trunk/samples/netui-samples/web/index.jsp (original)
+++ beehive/trunk/samples/netui-samples/web/index.jsp Fri Jan 27 09:14:58 2006
@@ -31,7 +31,7 @@
<b>NetUI Page Flow Core</b>
<br/>
<dl>
- <dt><netui:anchor href="basicNesting/main/MainFlow.jpf" value="Basic Nested Page Flow"/></dt>
+ <dt><netui:anchor href="basicnesting/main/MainFlow.jpf" value="Basic Nested Page Flow"/></dt>
<dd>Demonstrates the most basic nested page flow.</dd>
</dl>
<dl>
@@ -127,7 +127,7 @@
<dd>Demonstrates the enabling of Struts client-side validation in NetUI.</dd>
</dl>
<dl>
- <dt><netui:anchor href="advanced/customValidator/Controller.jpf" value="Custom Validator"/></dt>
+ <dt><netui:anchor href="advanced/customvalidator/Controller.jpf" value="Custom Validator"/></dt>
<dd>Demonstrates the use of custom Commons Validator rules through annotations.</dd>
</dl>
<dl>