myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmarinsc...@apache.org
Subject svn commit: r433783 - in /myfaces/tomahawk/trunk/sandbox/core/src/main: java/org/apache/myfaces/custom/focus/ java/org/apache/myfaces/custom/ppr/ resources/org/apache/myfaces/custom/focus/resource/ resources/org/apache/myfaces/custom/ppr/resource/
Date Tue, 22 Aug 2006 22:37:49 GMT
Author: mmarinschek
Date: Tue Aug 22 15:37:48 2006
New Revision: 433783

URL: http://svn.apache.org/viewvc?rev=433783&view=rev
Log:
fixed missing license headers - class javadoc

Added:
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/focus/resource/focus.js
Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocus.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java
    myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocus.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocus.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocus.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocus.java
Tue Aug 22 15:37:48 2006
@@ -17,6 +17,8 @@
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIComponentBase;
+import javax.faces.component.ValueHolder;
+import javax.faces.component.UIInput;
 import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
 
@@ -24,14 +26,16 @@
  * @author Rogerio Pereira Araujo (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-public class HtmlFocus extends UIComponentBase
+public class HtmlFocus extends UIInput
 {
     public static final String COMPONENT_TYPE = "org.apache.myfaces.Focus";
     public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Focus";
     public static final String COMPONENT_FAMILY = "javax.faces.Output";
     
 	private String _for = null;
-	
+    private Boolean _rememberClientFocus=null;
+    private static final boolean DEFAULT_REMEMBER_CLIENT_FOCUS = true;
+
     public String getFamily()
     {
         return COMPONENT_FAMILY;
@@ -50,16 +54,23 @@
 		return vb != null ? (String) vb.getValue(getFacesContext()) : null;
 	}
 
+    public void setRememberClientFocus(boolean rememberClientFocus)
+    {
+        _rememberClientFocus = Boolean.valueOf(rememberClientFocus);
+    }
+
+    public boolean isRememberClientFocus()
+    {
+        if (_rememberClientFocus != null) return _rememberClientFocus.booleanValue();
+        ValueBinding vb = getValueBinding("rememberClientFocus");
+        Boolean v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
+        return v != null ? v.booleanValue() : DEFAULT_REMEMBER_CLIENT_FOCUS;
+    }
 
-	protected UIComponent findUIComponent()
+
+    protected UIComponent findUIComponent()
 	{
 		String forStr = getFor();
-		
-		// It's unclear to me whether the following is necessary or useful.
-        if(forStr == null) 
-        {
-            forStr = (String) this.getAttributes().get("for");
-        }
 
 		if (forStr == null)
 		{
@@ -78,10 +89,11 @@
 
 	public Object saveState(FacesContext context)
 	{
-		Object values[] = new Object[2];
+		Object values[] = new Object[3];
 		values[0] = super.saveState(context);
 		values[1] = _for;
-		return values;
+        values[2] = _rememberClientFocus;
+        return values;
 	}
 
 	public void restoreState(FacesContext context, Object state)
@@ -89,7 +101,8 @@
 		Object values[] = (Object[]) state;
 		super.restoreState(context, values[0]);
 		_for = (String) values[1];
-	}
+        _rememberClientFocus = (Boolean) values[2];
+    }
 
 }
  

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
Tue Aug 22 15:37:48 2006
@@ -23,7 +23,10 @@
 import javax.faces.render.Renderer;
 
 import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
 import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+import org.apache.myfaces.custom.dojo.DojoConfig;
 
 /**
  * @author Rogerio Pereira Araujo (latest modification by $Author$)
@@ -32,6 +35,18 @@
 public class HtmlFocusRenderer extends Renderer
 {
 
+    public void decode(FacesContext facesContext, UIComponent component)
+    {
+        RendererUtils.checkParamValidity(facesContext, component, HtmlFocus.class);
+
+        HtmlFocus focus = (HtmlFocus) component;
+
+        if(focus.isRememberClientFocus())
+        {
+            focus.setSubmittedValue(RendererUtils.getStringValue(facesContext, component));
+        }
+    }
+
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
             throws IOException
     {
@@ -44,6 +59,10 @@
 
         if(targetComponent != null)
         {
+            String javascriptLocation = (String)uiComponent.getAttributes().get(JSFAttr.JAVASCRIPT_LOCATION);
+            DojoUtils.addMainInclude(facesContext, uiComponent, javascriptLocation, new DojoConfig());
+            DojoUtils.addRequire(facesContext, uiComponent, "dojo.event.*");
+
             String clientId = targetComponent.getClientId(facesContext);
 
             ResponseWriter writer = facesContext.getResponseWriter();
@@ -52,6 +71,12 @@
             writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT,
null);
             writer.writeText("document.getElementById('" + clientId + "').focus()", null);
             writer.endElement(HTML.SCRIPT_ELEM);
+
+            writer.startElement(HTML.INPUT_ELEM, uiComponent);
+            writer.writeAttribute(HTML.TYPE_ATTR,HTML.INPUT_TYPE_HIDDEN,null);
+            writer.writeAttribute(HTML.ID_ATTR,uiComponent.getClientId(facesContext), JSFAttr.ID_ATTR);
+            writer.writeAttribute(HTML.VALUE_ATTR,clientId,JSFAttr.VALUE_ATTR);
+            writer.endElement(HTML.INPUT_ELEM);
         }
     }
 

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroup.java
Tue Aug 22 15:37:48 2006
@@ -1,3 +1,18 @@
+/**
+ * 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.
+ */
 package org.apache.myfaces.custom.ppr;
 
 import org.apache.myfaces.component.html.ext.HtmlPanelGroup;
@@ -5,11 +20,7 @@
 import javax.faces.context.FacesContext;
 
 /**
- * Created by IntelliJ IDEA.
- * User: Ernst
- * Date: 20.06.2006
- * Time: 03:30:13
- * To change this template use File | Settings | File Templates.
+ * @author Ernst Fastl
  */
 public class PPRPanelGroup extends HtmlPanelGroup
 {

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupRenderer.java
Tue Aug 22 15:37:48 2006
@@ -1,3 +1,18 @@
+/**
+ * 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.
+ */
 package org.apache.myfaces.custom.ppr;
 
 import org.apache.myfaces.renderkit.html.ext.HtmlGroupRenderer;
@@ -20,6 +35,9 @@
 import java.util.StringTokenizer;
 import java.util.TreeSet;
 
+/**
+ * @author Ernst Fastl
+ */
 public class PPRPanelGroupRenderer extends HtmlGroupRenderer
 {
     private static Log log = LogFactory.getLog(PPRPanelGroupRenderer.class);

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPanelGroupTag.java
Tue Aug 22 15:37:48 2006
@@ -1,3 +1,18 @@
+/**
+ * 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.
+ */
 package org.apache.myfaces.custom.ppr;
 
 import org.apache.myfaces.taglib.html.ext.HtmlPanelGroupTag;
@@ -5,11 +20,7 @@
 import javax.faces.component.UIComponent;
 
 /**
- * Created by IntelliJ IDEA.
- * User: Ernst
- * Date: 20.06.2006
- * Time: 03:25:46
- * To change this template use File | Settings | File Templates.
+ * @author Ernst Fastl
  */
 public class PPRPanelGroupTag extends HtmlPanelGroupTag
 {

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java
Tue Aug 22 15:37:48 2006
@@ -1,3 +1,18 @@
+/**
+ * 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.
+ */
 package org.apache.myfaces.custom.ppr;
 
 import org.apache.commons.logging.Log;
@@ -20,11 +35,7 @@
 import java.io.PrintWriter;
 
 /**
- * Created by IntelliJ IDEA.
- * User: Ernst
- * Date: 25.06.2006
- * Time: 17:28:15
- * To change this template use File | Settings | File Templates.
+ * @author Ernst Fastl
  */
 public class PPRPhaseListener implements PhaseListener
 {

Added: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/focus/resource/focus.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/focus/resource/focus.js?rev=433783&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/focus/resource/focus.js
(added)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/focus/resource/focus.js
Tue Aug 22 15:37:48 2006
@@ -0,0 +1,20 @@
+
+org_apache_myfaces_registerTagsWithFocus(hiddenClientId)
+{
+    dojo.event.connect(window, "onload", function(evt) {
+      var elementsArr = new dojo.collections.ArrayList();
+      elementsArr.addRange(document.getElementsByTagName("INPUT"));
+      elementsArr.addRange(document.getElementsByTagName("SELECT"));
+      elementsArr.addRange(document.getElementsByTagName("TEXTAREA"));
+      
+      for(var i=0;i<elementsArr.count;i++)
+      {
+        var elem = elementsArr.item(i);
+        dojo.event.connect(elem,"onfocus",function(evt)
+          {
+            document.getElementById(hiddenClientId).value=evt.target.getAttribute('id');
+          }
+        );
+      }
+    });
+}
\ No newline at end of file

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js?rev=433783&r1=433782&r2=433783&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/resources/org/apache/myfaces/custom/ppr/resource/ppr.js
Tue Aug 22 15:37:48 2006
@@ -1,3 +1,18 @@
+/**
+ * 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.
+ */
 //Declare the myfaces package in the JS Context
 
 dojo.provide("org.apache.myfaces");



Mime
View raw message