You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ca...@apache.org on 2007/02/05 23:54:24 UTC
svn commit: r503914 - in
/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript:
./ ValidationScript.java ValidationScriptRenderer.java
ValidationScriptTag.java
Author: cagatay
Date: Mon Feb 5 14:54:23 2007
New Revision: 503914
URL: http://svn.apache.org/viewvc?view=rev&rev=503914
Log:
Add new component validationscript
Added:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java (with props)
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java (with props)
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java (with props)
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java?view=auto&rev=503914
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java Mon Feb 5 14:54:23 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.custom.clientvalidation.validationscript;
+
+import javax.faces.component.UIComponentBase;
+
+/**
+ * @author cagatay (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class ValidationScript extends UIComponentBase{
+
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.clientvalidation.ValidationScript";
+ public static final String COMPONENT_FAMILY = "org.apache.myfaces.clientvalidation";
+ public static final String DEFAULT_RENDERER = "org.apache.myfaces.clientvalidation.ValidationScriptRenderer";
+
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScript.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java?view=auto&rev=503914
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java Mon Feb 5 14:54:23 2007
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.custom.clientvalidation.validationscript;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+import org.apache.myfaces.custom.clientvalidation.common.CVUtils;
+import org.apache.myfaces.renderkit.html.util.AddResource;
+import org.apache.myfaces.renderkit.html.util.AddResourceFactory;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+
+/**
+ * @author cagatay (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class ValidationScriptRenderer extends Renderer {
+
+ public void encodeEnd(FacesContext context, UIComponent component)throws IOException {
+ RendererUtils.checkParamValidity(context, component,ValidationScript.class);
+
+ if (CVUtils.isCVEnabled()) {
+ CVUtils.queueCVCalls(context.getViewRoot());
+ CVUtils.encodeValidationScript(context);
+
+ encodeJavascript(context, component);
+ }
+ }
+
+ private void encodeJavascript(FacesContext context, UIComponent component)throws IOException {
+ //Common
+ AddResource addResource = AddResourceFactory.getInstance(context);
+ addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN,ValidationScript.class, "common.js");
+
+ //Converters and Validators
+ addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN,ValidationScript.class, "converters.js");
+ addResource.addJavaScriptAtPosition(context, AddResource.HEADER_BEGIN,ValidationScript.class, "validators.js");
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptRenderer.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java?view=auto&rev=503914
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java (added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java Mon Feb 5 14:54:23 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.myfaces.custom.clientvalidation.validationscript;
+
+import javax.faces.webapp.UIComponentTag;
+
+/**
+ * @author cagatay (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class ValidationScriptTag extends UIComponentTag {
+
+ public String getComponentType() {
+ return ValidationScript.COMPONENT_TYPE;
+ }
+
+ public String getRendererType() {
+ return ValidationScript.DEFAULT_RENDERER;
+ }
+
+}
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/validationscript/ValidationScriptTag.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision