You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/01/30 03:59:04 UTC

svn commit: r616601 [3/7] - in /myfaces/tomahawk/branches/1_2_0: ./ assembly/ core/ core/src/main/conf/ core/src/main/java-templates/ core/src/main/java-templates/org/ core/src/main/java-templates/org/apache/ core/src/main/java-templates/org/apache/myf...

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlPanelGroup
+        extends javax.faces.component.html.HtmlPanelGroup
+        implements UserRoleAware, DisplayValueOnlyCapable
+{
+
+    public static final int DEFAULT_COLSPAN = Integer.MIN_VALUE;
+    public static final String BLOCK_LAYOUT = "block";
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Group";
+    
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlPanelGroupTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,61 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectBooleanCheckbox
+        extends javax.faces.component.html.HtmlSelectBooleanCheckbox
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Checkbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectBooleanCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,77 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectManyCheckbox
+        extends javax.faces.component.html.HtmlSelectManyCheckbox
+        implements UserRoleAware, DisplayValueOnlyCapable, ExtendedComponentBase, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Checkbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+    
+    private static boolean booleanFromObject(Object obj, boolean defaultValue)
+    {
+        if(obj instanceof Boolean)
+        {
+            return ((Boolean) obj).booleanValue();
+        }
+        else if(obj instanceof String)
+        {
+            return Boolean.valueOf(((String) obj)).booleanValue();
+        }
+
+        return defaultValue;
+    }
+    
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectManyListbox
+        extends javax.faces.component.html.HtmlSelectManyListbox
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Listbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyListboxTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectManyMenu
+        extends javax.faces.component.html.HtmlSelectManyMenu
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Menu";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectManyMenuTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectOneListbox
+        extends javax.faces.component.html.HtmlSelectOneListbox
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Listbox";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneListboxTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,62 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.ExtendedComponentBase;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectOneMenu
+        extends javax.faces.component.html.HtmlSelectOneMenu
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Menu";
+
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneMenuTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,212 @@
+/*
+ * 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.component.html.ext;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+import org.apache.myfaces.shared_tomahawk.component.EscapeCapable;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
+
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSelectOneRadio
+        extends javax.faces.component.html.HtmlSelectOneRadio
+        implements UserRoleAware, DisplayValueOnlyCapable, EscapeCapable
+{
+    
+    public static final String DEFAULT_RENDERER_TYPE ="org.apache.myfaces.Radio";
+
+    private static Log log = LogFactory.getLog(HtmlSelectOneRadio.class);
+    
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+
+    public boolean isRendered()
+    {
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public boolean isSetDisplayValueOnly()
+    {
+        return _displayValueOnlySet;
+    }        
+    
+    private static void callValidators(FacesContext context, UIComponent input, Object convertedValue)
+    {
+        if(!(input instanceof EditableValueHolder))
+            throw new FacesException("param input not of type EditableValueHolder, but of : "+input.getClass().getName());
+
+        EditableValueHolder holder = (EditableValueHolder) input;
+
+        Validator[] validators = holder.getValidators();
+        for (int i = 0; i < validators.length; i++)
+        {
+            Validator validator = validators[i];
+            try
+            {
+                validator.validate(context, input, convertedValue);
+            }
+            catch (ValidatorException e)
+            {
+                holder.setValid(false);
+                FacesMessage facesMessage = e.getFacesMessage();
+                if (facesMessage != null)
+                {
+                    facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
+                    context.addMessage(input.getClientId(context), facesMessage);
+                }
+            }
+        }
+
+        MethodBinding validatorBinding = holder.getValidator();
+        if (validatorBinding != null)
+        {
+            try
+            {
+                validatorBinding.invoke(context, new Object[] {context, input, convertedValue});
+            }
+            catch (EvaluationException e)
+            {
+                holder.setValid(false);
+                Throwable cause = e.getCause();
+                if (cause instanceof ValidatorException)
+                {
+                    FacesMessage facesMessage = ((ValidatorException) cause).getFacesMessage();
+                    if (facesMessage != null)
+                    {
+                        facesMessage.setSeverity(FacesMessage.SEVERITY_ERROR);
+                        context.addMessage(input.getClientId(context), facesMessage);
+                    }
+                }
+                else
+                {
+                    throw e;
+                }
+            }
+        }
+    }
+    
+    private static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
+    {
+        if(value instanceof Boolean)
+        {
+            return ((Boolean) value).booleanValue();
+        }
+        else if(value instanceof String)
+        {
+            return Boolean.valueOf((String) value).booleanValue();
+        }
+        else if(value != null)
+        {
+            log.error("value for attribute "+attribute+
+                    " must be instanceof 'Boolean' or 'String', is of type : "+value.getClass());
+
+            return defaultValue;
+        }
+
+        return defaultValue;
+    }
+    
+    /**
+     * Overridden method, as with extended seletOne, value doesn't necessarily
+     * have to be contained within select list, for example, when forceId="true" and
+     * forceIdIndex="false" then component may be used in datatable.
+     */
+    protected void validateValue(FacesContext context, Object value)
+    {
+        //Is this radio button used within a datatable (forceId=true and forceIdIndex=false)
+        boolean forceId = getBooleanValue(JSFAttr.FORCE_ID_ATTR,
+                this.getAttributes().get(JSFAttr.FORCE_ID_ATTR), false);
+
+//      see if the originally supplied id should be used
+        boolean forceIdIndex = getBooleanValue(JSFAttr.FORCE_ID_INDEX_ATTR,
+                this.getAttributes().get(JSFAttr.FORCE_ID_INDEX_ATTR), true);
+
+        boolean dataTable = forceId && !forceIdIndex;
+
+        if (!dataTable)
+        {
+            super.validateValue(context, value);
+        }
+        else
+        {
+            //Specific behavior for data tables, or other scenarios where forceId is
+            //true and forceIdIndex is false
+
+            //Check if empty
+            boolean empty = value == null
+                    || (value instanceof String && ((String) value).length() == 0);
+
+            //Check required and empty
+            if (isRequired() && empty)
+            {
+              //Only add this message once, not for every radio button in set
+                String clientId = this.getClientId(context);
+                Iterator messages = context.getMessages(clientId);
+                boolean messageExists = messages.hasNext();
+
+                if(!messageExists)
+                {
+                    //Add message
+                    FacesMessage message = MessageUtils.getMessage(REQUIRED_MESSAGE_ID, new Object[]{clientId});
+                    message.setSeverity(FacesMessage.SEVERITY_WARN);
+                    context.addMessage(clientId, message);
+
+                    setValid(false);
+                }
+                return;
+            }
+
+            //Call validators
+            if (!empty)
+            {
+                callValidators(context, this, value);
+            }
+        }
+    }    
+    
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/component/html/ext/HtmlSelectOneRadioTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.component.html.ext;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+
+/**
+ * A component that renders its child components into an in-memory buffer rather than
+ * render them directly to the response stream.
+ * <p>
+ * Property "into" is an EL expression that specifies where to store a String holding
+ * the results of rendering all the children of this component; this is assigned to
+ * after rendering of this component (and its children) is complete.
+ * <p>
+ * Typically, an h:output tag is then used later in the same page to output the buffer
+ * contents.
+ * <p>
+ * This can be useful with JSF1.1/JSP2.0 to work around the well-known problem where
+ * on first render of a page, a component "A" cannot reference a component "B" which is
+ * defined later in the page because it has not yet been created. A solution is to define
+ * "B" before "A", but wrapped in a Buffer component. Component A can then be rendered
+ * and successfully reference "B" because it now exists. And later in the page, the buffer
+ * contents can then be output, preserving the original layout.
+ * <p>
+ * This can also be useful when rendering the same data block multiple times within a page.
+ * For example, a datatable can be rendered with a datascroller both before and after it;
+ * first render the table into a buffer B1, then render the datascroller into a buffer B2,
+ * then output buffers B2,B1,B2.
+ * 
+ * @author Sylvain Vieujot (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class Buffer extends UIComponentBase{
+{
+    /**/private String _into = null;
+
+    void fill(String content, FacesContext facesContext){
+        ValueExpression intoVB;
+
+        if (_into == null) {
+            intoVB = getValueExpression("into");
+            _into = intoVB.getExpressionString();
+        } else {
+            intoVB = facesContext.getApplication().
+            getExpressionFactory().createValueExpression(
+                    facesContext.getELContext(), _into, Object.class );
+        }
+
+        intoVB.setValue(facesContext.getELContext(), content);
+    }
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/buffer/BufferTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java Tue Jan 29 18:58:48 2008
@@ -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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import javax.faces.component.UIComponentBase;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlCheckbox
+        extends UIComponentBase implements UserRoleAware
+{
+
+    public static final String FOR_ATTR = "for".intern();
+    public static final String INDEX_ATTR = "index".intern();
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/checkbox/HtmlCheckboxTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,194 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.custom.collapsiblepanel.HtmlHeaderLink;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlCollapsiblePanel
+        extends UIInput implements UserRoleAware
+{
+
+    private boolean _currentlyCollapsed;
+    
+    public void setCurrentlyCollapsed(boolean collapsed)
+    {
+        _currentlyCollapsed = collapsed;
+    }
+
+    public boolean isCurrentlyCollapsed()
+    {
+        return _currentlyCollapsed;
+    }
+    
+    //private static final Log log = LogFactory.getLog(HtmlCollapsiblePanel.class);
+
+    public void processDecodes(FacesContext context)
+    {
+        if (context == null) throw new NullPointerException("context");
+
+        initialiseVars(context);
+
+        if (!isRendered()) return;
+
+        try
+        {
+            decode(context);
+        }
+        catch (RuntimeException e)
+        {
+            context.renderResponse();
+            throw e;
+        }
+
+        UIComponent headerComponent = getFacet("header");
+
+        if(headerComponent != null)
+        {
+            for (Iterator it = headerComponent.getChildren().iterator(); it.hasNext(); )
+            {
+                UIComponent child = (UIComponent)it.next();
+
+                if(!(child instanceof HtmlHeaderLink))
+                {
+                    child.processDecodes(context);
+                }
+            }
+        }
+
+        if(isCurrentlyCollapsed())
+        {
+            UIComponent component = getFacet("closedContent");
+
+            if(component != null)
+            {
+                component.processDecodes(context);
+            }
+        }
+        else
+        {
+            for (Iterator it = getChildren().iterator(); it.hasNext(); )
+            {
+                UIComponent child = (UIComponent)it.next();
+                child.processDecodes(context);
+            }
+        }
+        
+        removeVars(context);
+    }
+
+    public String getClientId(FacesContext context)
+    {
+        return super.getClientId(context);
+    }
+
+    public void processUpdates(FacesContext context)
+    {
+        initialiseVars(context);
+
+        super.processUpdates(context);
+
+        removeVars(context);
+    }
+
+    private void initialiseVars(FacesContext context)
+    {
+        if(getVar()!=null)
+        {
+            context.getExternalContext().getRequestMap().put(getVar(),
+                            Boolean.valueOf(isCollapsed()));
+        }
+
+        if(getTitleVar()!=null)
+        {
+            context.getExternalContext().getRequestMap().put(getTitleVar(),
+                            getTitle());
+        }
+    }
+
+    private void removeVars(FacesContext context)
+    {
+        if(getVar()!=null)
+        {
+            context.getExternalContext().getRequestMap().remove(getVar());
+        }
+
+        if(getTitleVar()!=null)
+        {
+            context.getExternalContext().getRequestMap().remove(getTitleVar());
+        }
+    }
+
+    public void processValidators(FacesContext context)
+    {
+        initialiseVars(context);
+
+        super.processValidators(context);
+
+        removeVars(context);
+    }
+
+    public void encodeChildren(FacesContext context) throws IOException
+    {
+        initialiseVars(context);
+
+        super.encodeChildren(context);
+
+        removeVars(context);
+    }
+
+    public void updateModel(FacesContext context)
+    {
+        super.updateModel(context);
+    }
+
+    public boolean isCollapsed()
+    {
+        return isCollapsed(getValue());
+    }
+
+    public static boolean isCollapsed(Object collapsedValue)
+    {
+        Object value = collapsedValue;
+
+        if(value instanceof Boolean)
+        {
+            return ((Boolean) value).booleanValue();
+        }
+        else if (value instanceof String)
+        {
+            return Boolean.valueOf((String) value).booleanValue();
+        }
+
+        return true;
+    }
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import javax.faces.component.UIColumn;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlSimpleColumn
+        extends UIColumn implements HtmlColumn
+{
+    /**/ // lines starting with /**/ are magically ignored from the generated class
+    
+    /**/private String _groupByValue;
+    
+    public boolean isGroupByValueSet()
+    {
+        if (_groupByValue != null) return true;
+        ValueExpression vb = getValueExpression("groupByValue");
+        return vb != null;
+    }
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/column/HtmlSimpleColumnTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,206 @@
+/*
+ * 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.datalist;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.util._ComponentUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlDataList
+        extends org.apache.myfaces.component.html.ext.HtmlDataTableHack
+{
+	private static Log log = LogFactory.getLog(HtmlDataList.class);
+    private static final int PROCESS_DECODES = 1;
+    private static final int PROCESS_VALIDATORS = 2; // not currently in use
+    private static final int PROCESS_UPDATES = 3; // not currently in use
+
+    /**
+     * Throws NullPointerException if context is null.  Sets row index to -1, 
+     * calls processChildren, sets row index to -1.
+     */
+
+    public void processDecodes(FacesContext context)
+    {
+
+        if (context == null)
+            throw new NullPointerException("context");
+        if (!isRendered())
+            return;
+
+        setRowIndex(-1);
+        processChildren(context, PROCESS_DECODES);
+        setRowIndex(-1);
+    }
+
+    public void processUpdates(FacesContext context)
+    {
+        if (context == null)
+            throw new NullPointerException("context");
+        if (!isRendered())
+            return;
+
+        setRowIndex(-1);
+        processChildren(context, PROCESS_UPDATES);
+        setRowIndex(-1);
+    }
+
+    public void processValidators(FacesContext context)
+    {
+        if (context == null)
+            throw new NullPointerException("context");
+        if (!isRendered())
+            return;
+
+        setRowIndex(-1);
+        processChildren(context, PROCESS_VALIDATORS);
+        setRowIndex(-1);    }
+
+    /**
+     * Iterates over all children, processes each according to the specified 
+     * process action if the child is rendered.
+     */
+
+    public void processChildren(FacesContext context, int processAction)
+    {
+        // use this method for processing other than decode ?
+        int first = getFirst();
+        int rows = getRows();
+        int last = rows == 0 ? getRowCount() : first + rows;
+
+        if (log.isTraceEnabled())
+        {
+            log.trace("processing " + getChildCount()
+                            + " children: starting at " + first
+                            + ", ending at " + last);
+        }
+
+        for (int rowIndex = first; last == -1 || rowIndex < last; rowIndex++)
+        {
+
+            setRowIndex(rowIndex);
+
+            if (!isRowAvailable())
+            {
+                if (log.isTraceEnabled())
+                {
+                    log.trace("scrolled past the last row, aborting");
+                }
+                break;
+            }
+
+            for (Iterator it = getChildren().iterator(); it.hasNext();)
+            {
+                UIComponent child = (UIComponent) it.next();
+                if (child.isRendered())
+                    process(context, child, processAction);
+            }
+        }
+    }
+
+    /**
+     * Copy and pasted from UIData in order to maintain binary compatibility.
+     */
+
+    private void process(FacesContext context, UIComponent component,
+            int processAction)
+    {
+        switch (processAction)
+        {
+        case PROCESS_DECODES:
+            component.processDecodes(context);
+            break;
+        case PROCESS_VALIDATORS:
+            component.processValidators(context);
+            break;
+        case PROCESS_UPDATES:
+            component.processUpdates(context);
+            break;
+        }
+    }
+    
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(
+                this,getRenderer(context),context);
+
+        if(clientId==null)
+        {
+            return super.getClientId(context);
+        }
+        else
+        {
+            int rowIndex = getRowIndex();
+            if (rowIndex == -1)
+            {
+                return clientId;
+            }
+            else
+            {
+                return clientId + "_" + rowIndex;
+            }
+        }
+    }
+
+    public void setRowIndex(int rowIndex)
+    {
+        super.setRowIndex(rowIndex);
+        String rowIndexVar = getRowIndexVar();
+        String rowCountVar = getRowCountVar();
+        if (rowIndexVar != null || rowCountVar != null)
+        {
+            Map requestMap = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+            if (rowIndex >= 0)
+            {
+                //regular row index, update request scope variables
+                if (rowIndexVar != null)
+                {
+                    requestMap.put(getRowIndexVar(), new Integer(rowIndex));
+                }
+                if (rowCountVar != null)
+                {
+                    requestMap.put(getRowCountVar(), new Integer(getRowCount()));
+                }
+            }
+            else
+            {
+                //rowIndex == -1 means end of loop --> remove request scope variables
+                if (rowIndexVar != null)
+                {
+                    requestMap.remove(getRowIndexVar());
+                }
+                if (rowCountVar != null)
+                {
+                    requestMap.remove(getRowCountVar());
+                }
+            }
+        }
+    }
+
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datalist/HtmlDataListTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,534 @@
+/*
+ * 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.component.html.ext;
+
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.custom.datascroller.HtmlDataScroller;
+import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
+
+/**
+ * A component which works together with a UIData component to allow a
+ * user to view a large list of data one "page" at a time, and navigate
+ * between pages.
+ *  
+ * @author Thomas Spiegl (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlPanelLayout extends HtmlPanelGroup implements ActionSource
+{
+    private static final Log log = LogFactory.getLog(HtmlDataScroller.class);
+
+    private static final String FIRST_FACET_NAME = "first";
+    private static final String LAST_FACET_NAME = "last";
+    private static final String NEXT_FACET_NAME = "next";
+    private static final String PREVIOUS_FACET_NAME = "previous";
+    private static final String FAST_FORWARD_FACET_NAME = "fastforward";
+    private static final String FAST_REWIND_FACET_NAME = "fastrewind";
+
+    private static final String TABLE_LAYOUT = "table";
+    private static final String LIST_LAYOUT = "list";
+    private static final String SINGLE_LIST_LAYOUT = "singleList";
+    private static final String SINGLE_TABLE_LAYOUT = "singleTable";
+
+    public static final String FACET_FIRST = "first".intern();
+    public static final String FACET_PREVIOUS = "previous".intern();
+    public static final String FACET_NEXT = "next".intern();
+    public static final String FACET_LAST = "last".intern();
+    public static final String FACET_FAST_FORWARD = "fastf".intern();
+    public static final String FACET_FAST_REWIND = "fastr".intern();
+
+    // just for caching the associated uidata
+    private transient UIData _UIData;
+
+    private transient Boolean _listLayout;
+
+    private transient Boolean _singleElementLayout;
+
+    public boolean isListLayout()
+    {
+        if(_listLayout == null)
+        {
+            String layout=getLayout();
+            if(layout == null || layout.equals(TABLE_LAYOUT) || layout.equals(SINGLE_TABLE_LAYOUT))
+                _listLayout = Boolean.FALSE;
+            else if(layout.equals(LIST_LAYOUT) || layout.equals(SINGLE_LIST_LAYOUT))
+            {
+                _listLayout = Boolean.TRUE;
+            }
+            else
+            {
+                log.error("Invalid layout-parameter : "+layout +" provided. Defaulting to table-layout.");
+                _listLayout = Boolean.FALSE;
+            }
+        }
+
+        return _listLayout.booleanValue();
+    }
+
+    public boolean isSingleElementLayout()
+    {
+        if(_singleElementLayout == null)
+        {
+            String layout=getLayout();
+            if(layout == null || layout.equals(SINGLE_LIST_LAYOUT) || layout.equals(SINGLE_TABLE_LAYOUT))
+                _singleElementLayout = Boolean.TRUE;
+            else
+                _singleElementLayout = Boolean.FALSE;
+        }
+
+        return _singleElementLayout.booleanValue();
+    }
+
+    /**
+     * Catch any attempts to queue events for this component, and ensure
+     * the event's phase is set appropriately. Events are expected to be
+     * queued by this component's renderer.
+     * <p>
+     * When this component is marked "immediate", any ActionEvent will
+     * be marked to fire in the "apply request values" phase. When this
+     * component is not immediate the event will fire during the
+     * "invoke application" phase instead.
+     */
+    public void queueEvent(FacesEvent event)
+    {
+        if (event != null && event instanceof ActionEvent)
+        {
+            if (isImmediate())
+            {
+                event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+            }
+            else
+            {
+                event.setPhaseId(PhaseId.INVOKE_APPLICATION);
+            }
+        }
+        super.queueEvent(event);
+    }
+
+    /**
+     * Invoke any action listeners attached to this class.
+     * <p>
+     * After listener invocation, the associated UIData's properties get
+     * updated:
+     * <ul>
+     * <li>if the user selected an absolute page# then setFirst is called with
+     * uiData.getRows() * pageNumber.
+     * <li>if the user selected the "first page" option then setFirst(0) is called.
+     * <li>if the user selected the "previous page" option then setFirst is decremented
+     * by uiData.getRows().
+     * <li>if the user selected the "fast rewind" option then setFirst is decremented
+     * by uiData.getRows() * fastStep.
+     * <li>next, fast-forward and last options have the obvious effect.
+     * </ul>
+     */
+    public void broadcast(FacesEvent event) throws AbortProcessingException
+    {
+        super.broadcast(event);
+
+        if (event instanceof ScrollerActionEvent)
+        {
+            ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
+
+            broadcastToActionListener(scrollerEvent);
+            
+            // huh? getUIData never returns null.
+            UIData uiData = getUIData();
+            if (uiData == null)
+            {
+                return;
+            }
+
+            int pageindex = scrollerEvent.getPageIndex();
+            if (pageindex == -1)
+            {
+                String facet = scrollerEvent.getScrollerfacet();
+                if (FACET_FIRST.equals(facet))
+                {
+                    setFirst(uiData, 0);
+                }
+                else if (FACET_PREVIOUS.equals(facet))
+                {
+                    int previous = uiData.getFirst() - uiData.getRows();
+                    if (previous >= 0)
+                        setFirst(uiData, previous);
+                }
+                else if (FACET_NEXT.equals(facet))
+                {
+                    int next = uiData.getFirst() + uiData.getRows();
+                    if (next < uiData.getRowCount())
+                        setFirst(uiData, next);
+                }
+                else if (FACET_FAST_FORWARD.equals(facet))
+                {
+                    int fastStep = getFastStep();
+                    if (fastStep <= 0)
+                        fastStep = 1;
+                    int next = uiData.getFirst() + uiData.getRows() * fastStep;
+                    int rowcount = uiData.getRowCount();
+                    if (next >= rowcount)
+                        next = (rowcount - 1) - ((rowcount - 1) % uiData.getRows());
+                    setFirst(uiData, next);
+                }
+                else if (FACET_FAST_REWIND.equals(facet))
+                {
+                    int fastStep = getFastStep();
+                    if (fastStep <= 0)
+                        fastStep = 1;
+                    int previous = uiData.getFirst() - uiData.getRows() * fastStep;
+                    if (previous < 0)
+                        previous = 0;
+                    setFirst(uiData, previous);
+                }
+                else if (FACET_LAST.equals(facet))
+                {
+                    int rowcount = uiData.getRowCount();
+                    int rows = uiData.getRows();
+                    int delta = rowcount % rows;
+                    int first = delta > 0 && delta < rows ? rowcount - delta : rowcount - rows;
+                    if (first >= 0)
+                    {
+                        setFirst(uiData, first);
+                    }
+                    else
+                    {
+                        setFirst(uiData, 0);
+                    }
+                }
+            }
+            else
+            {
+                int pageCount = getPageCount();
+                if (pageindex > pageCount)
+                {
+                    pageindex = pageCount;
+                }
+                if (pageindex <= 0)
+                {
+                    pageindex = 1;
+                }
+                setFirst(uiData, uiData.getRows() * (pageindex - 1));
+            }
+        }
+    }
+
+    protected void setFirst(UIData uiData, int value) {
+        //there might be special cases where the first-property of the data-table
+        //is bound to a backing bean. If this happens, the user probably wants
+        //the data-scroller to update this backing-bean value - if not, you can always
+        //override this method in a subclass.
+        if(uiData.getValueBinding("first")!=null)
+        {
+            ValueBinding vb = uiData.getValueBinding("first");
+            vb.setValue(getFacesContext(),new Integer(value));
+        }
+        else
+        {
+            uiData.setFirst(value);
+        }
+    }
+
+    /**
+     * @param event
+     */
+    protected void broadcastToActionListener(ScrollerActionEvent event)
+    {
+        FacesContext context = getFacesContext();
+
+        MethodBinding actionListenerBinding = getActionListener();
+        if (actionListenerBinding != null)
+        {
+            try
+            {
+                actionListenerBinding.invoke(context, new Object[] {event});
+            }
+            catch (EvaluationException e)
+            {
+                Throwable cause = e.getCause();
+                if (cause != null && cause instanceof AbortProcessingException)
+                {
+                    throw (AbortProcessingException)cause;
+                }
+                throw e;
+            }
+        }
+        
+        ActionListener defaultActionListener
+                = context.getApplication().getActionListener();
+        if (defaultActionListener != null)
+        {
+            defaultActionListener.processAction((ActionEvent)event);
+        }
+    }
+
+    /**
+     * @return int
+     */
+    public UIData getUIData()
+    {
+        if (_UIData == null)
+        {
+            _UIData = findUIData();
+        }
+        return _UIData;
+    }
+
+    /**
+     * @return the page index of the uidata
+     */
+    public int getPageIndex()
+    {
+        UIData uiData = getUIData();
+        int rows = uiData.getRows();
+        if (0 == rows)
+        {
+            throw new FacesException("You need to set a value to the 'rows' attribute of component '" + uiData.getClientId(getFacesContext()) + "'" );
+        }
+
+        int pageIndex;
+        if (rows > 0)
+        {
+            pageIndex = uiData.getFirst() / rows + 1;
+        }
+        else
+        {
+            log.warn("DataTable " + uiData.getClientId(FacesContext.getCurrentInstance())
+                            + " has invalid rows attribute.");
+            pageIndex = 0;
+        }
+        if (uiData.getFirst() % rows > 0)
+        {
+            pageIndex++;
+        }
+        return pageIndex;
+    }
+
+    /**
+     * @return the page count of the uidata
+     */
+    public int getPageCount()
+    {
+        UIData uiData = getUIData();
+        int rows = uiData.getRows();
+        int pageCount;
+        if (rows > 0)
+        {
+            pageCount = rows <= 0 ? 1 : uiData.getRowCount() / rows;
+            if (uiData.getRowCount() % rows > 0)
+            {
+                pageCount++;
+            }
+        }
+        else
+        {
+            rows = 1;
+            pageCount = 1;
+        }
+        return pageCount;
+    }
+
+    /**
+     * @return int
+     */
+    public int getRowCount()
+    {
+        return getUIData().getRowCount();
+    }
+
+    /**
+     * @return int
+     */
+    public int getRows()
+    {
+        return getUIData().getRows();
+    }
+
+    /**
+     * @return int
+     */
+    public int getFirstRow()
+    {
+        return getUIData().getFirst();
+    }
+
+    /**
+     * Find the UIData component associated with this scroller.
+     * <p>
+     * If the "for" attribute is not null then that value is used to find the
+     * specified component by id. Both "relative" and "absolute" ids are allowed;
+     * see method UIComponent.findComponent for details.
+     * <p>
+     * If the "for" attribute is not defined, then this component is expected to
+     * be a child of a UIData component.
+     * 
+     * @throws IllegalArgumentException if an associated UIData component
+     * cannot be found.
+     */
+    protected UIData findUIData()
+    {
+        String forStr = getFor();
+        UIComponent forComp;
+        if (forStr == null)
+        {
+            // DataScroller may be a child of uiData
+            forComp = getParent();
+        }
+        else
+        {
+            forComp = findComponent(forStr);
+        }
+        if (forComp == null)
+        {
+            throw new IllegalArgumentException(
+                    "could not find UIData referenced by attribute dataScroller@for = '"
+                    + forStr + "'");
+        }
+        else if (!(forComp instanceof UIData))
+        {
+            throw new IllegalArgumentException(
+                "uiComponent referenced by attribute dataScroller@for = '"
+                + forStr + "' must be of type " + UIData.class.getName()
+                + ", not type " + forComp.getClass().getName());
+        }
+        return (UIData) forComp;
+    }
+
+    public void setFirst(UIComponent first)
+    {
+        getFacets().put(FIRST_FACET_NAME, first);
+    }
+
+    public UIComponent getFirst()
+    {
+        return (UIComponent) getFacets().get(FIRST_FACET_NAME);
+    }
+
+    public void setLast(UIComponent last)
+    {
+        getFacets().put(LAST_FACET_NAME, last);
+    }
+
+    public UIComponent getLast()
+    {
+        return (UIComponent) getFacets().get(LAST_FACET_NAME);
+    }
+
+    public void setNext(UIComponent next)
+    {
+        getFacets().put(NEXT_FACET_NAME, next);
+    }
+
+    public UIComponent getNext()
+    {
+        return (UIComponent) getFacets().get(NEXT_FACET_NAME);
+    }
+
+    public void setFastForward(UIComponent previous)
+    {
+        getFacets().put(FAST_FORWARD_FACET_NAME, previous);
+    }
+
+    public UIComponent getFastForward()
+    {
+        return (UIComponent) getFacets().get(FAST_FORWARD_FACET_NAME);
+    }
+
+    public void setFastRewind(UIComponent previous)
+    {
+        getFacets().put(FAST_REWIND_FACET_NAME, previous);
+    }
+
+    public UIComponent getFastRewind()
+    {
+        return (UIComponent) getFacets().get(FAST_REWIND_FACET_NAME);
+    }
+
+    public void setPrevious(UIComponent previous)
+    {
+        getFacets().put(PREVIOUS_FACET_NAME, previous);
+    }
+
+    public UIComponent getPrevious()
+    {
+        return (UIComponent) getFacets().get(PREVIOUS_FACET_NAME);
+    }
+
+    public boolean getRendersChildren()
+    {
+        return true;
+    }
+
+    /**
+     * @see javax.faces.component.ActionSource#getAction()
+     */
+    public MethodBinding getAction()
+    {
+        // not used
+        return null;
+    }
+
+    /**
+     * @see javax.faces.component.ActionSource#setAction(javax.faces.el.MethodBinding)
+     */
+    public void setAction(MethodBinding action)
+    {
+        throw new UnsupportedOperationException(
+                        "defining an action is not supported. use an actionlistener");
+    }
+
+    /**
+     * @see javax.faces.component.ActionSource#addActionListener(javax.faces.event.ActionListener)
+     */
+    public void addActionListener(ActionListener listener)
+    {
+        addFacesListener(listener);
+    }
+
+    /**
+     * @see javax.faces.component.ActionSource#getActionListeners()
+     */
+    public ActionListener[] getActionListeners()
+    {
+        return (ActionListener[]) getFacesListeners(ActionListener.class);
+    }
+
+    /**
+     * @see javax.faces.component.ActionSource#removeActionListener(javax.faces.event.ActionListener)
+     */
+    public void removeActionListener(ActionListener listener)
+    {
+        removeFacesListener(listener);
+    }
+    
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/datascroller/HtmlDataScrollerTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,264 @@
+/*
+ * 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.component.html.ext;
+
+import java.io.Serializable;
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.date.HtmlInputDate.UserData;
+
+import javax.faces.component.UIInput;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class HtmlInputDate
+        extends UIInput implements UserRoleAware
+{
+
+    /**
+     * Overriden to support the force id, since the parent is not an extended component 
+     */
+    public String getClientId(FacesContext context)
+    {
+        String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+        if (clientId == null)
+        {
+            clientId = super.getClientId(context);
+        }
+
+        return clientId;
+    }
+        
+    public boolean isRendered(){
+        if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+        return super.isRendered();
+    }
+    
+    public UserData getUserData(Locale currentLocale){
+        return new UserData((Date) getValue(), currentLocale, getTimeZone(), isAmpm(), getType());
+    }    
+
+    public static class UserData implements Serializable {
+        private static final long serialVersionUID = -6507279524833267707L;
+        private String day;
+        private String month;
+        private String year;
+        private String hours;
+        private String minutes;
+        private String seconds;
+        private TimeZone timeZone = null;
+        private String ampm;
+        private boolean uses_ampm;
+        private String type;
+
+        public UserData(Date date, Locale currentLocale, String _timeZone, boolean uses_ampm, String type){
+            this.uses_ampm = uses_ampm;
+            this.type = type;
+
+            Calendar calendar = Calendar.getInstance(currentLocale);
+            if (_timeZone != null) {
+                timeZone = TimeZone.getTimeZone(_timeZone);
+                calendar.setTimeZone(timeZone);
+            }
+            
+            if(date == null)
+                return;
+          
+            calendar.setTime( date );
+            day = Integer.toString(calendar.get(Calendar.DAY_OF_MONTH));
+            month = Integer.toString(calendar.get(Calendar.MONTH)+1);
+            year = Integer.toString(calendar.get(Calendar.YEAR));
+            if (uses_ampm) {
+                int int_hours = calendar.get(Calendar.HOUR);
+                // ampm hours must be in range 0-11 to be handled right; we have to handle "12" specially
+                if (int_hours == 0) {
+                    int_hours = 12;
+                }
+                hours = Integer.toString(int_hours);
+                ampm = Integer.toString(calendar.get(Calendar.AM_PM));
+            } else {
+                hours = Integer.toString(calendar.get(Calendar.HOUR_OF_DAY));
+            }
+            minutes = Integer.toString(calendar.get(Calendar.MINUTE));
+            seconds = Integer.toString(calendar.get(Calendar.SECOND));
+        }
+
+        public Date parse() throws ParseException{
+            Date retDate = null;
+            Calendar tempCalendar=Calendar.getInstance();
+            tempCalendar.setLenient(Boolean.FALSE.booleanValue());
+            if (timeZone != null)
+                   tempCalendar.setTimeZone(timeZone);
+            try{
+                if(!isSubmitValid(uses_ampm, type)) {
+                    return null;
+                }
+                
+                if(! (type.equals( "time" ) || type.equals( "short_time" )) ) {
+                    tempCalendar.set(Calendar.DAY_OF_MONTH,Integer.parseInt(day));
+                    tempCalendar.set(Calendar.MONTH,Integer.parseInt(month)-1);
+                    tempCalendar.set(Calendar.YEAR,Integer.parseInt(year));
+                }
+
+                if(! type.equals( "date" )) {
+                    
+                    if (uses_ampm) {
+                        int int_hours = Integer.parseInt(hours);
+                        // ampm hours must be in range 0-11 to be handled right; we have to handle "12" specially
+                        if (int_hours == 12) {
+                            int_hours = 0;
+                        }
+                        tempCalendar.set(Calendar.HOUR,int_hours);
+                        tempCalendar.set(Calendar.AM_PM,Integer.parseInt(ampm));
+                    } else {
+                        tempCalendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(hours));
+                    }
+                    tempCalendar.set(Calendar.MINUTE,Integer.parseInt(minutes));
+                    
+                    if (seconds != null & (type.equals("full") || type.equals("time") || type.equals("short_time"))) {
+                        tempCalendar.set(Calendar.SECOND,Integer.parseInt(seconds));
+                    }
+                }
+                tempCalendar.set(Calendar.MILLISECOND, 0);
+                retDate = tempCalendar.getTime();
+            } catch (NumberFormatException e) {
+                throw new ParseException(e.getMessage(),0);
+            } catch (IllegalArgumentException e) {
+                throw new ParseException(e.getMessage(),0);
+            } 
+            return retDate;
+        }
+
+        private String formatedInt(String toFormat){
+            if( toFormat == null )
+                return null;
+
+            int i = -1;
+            try{
+                i = Integer.parseInt( toFormat );
+            }catch(NumberFormatException nfe){
+                return toFormat;
+            }
+            if( i >= 0 && i < 10 )
+                return "0"+i;
+            return Integer.toString(i);
+        }
+        
+        private boolean isDateSubmitted(boolean usesAmpm, String type) {
+            boolean isDateSubmitted = ! (StringUtils.isEmpty(getDay()) && ((getMonth() == null) || getMonth().equals("-1")) && StringUtils.isEmpty(getYear()));
+            if(usesAmpm)
+                isDateSubmitted = isDateSubmitted || isAmpmSubmitted();
+            return isDateSubmitted;
+        }
+        
+        private boolean isTimeSubmitted(boolean usesAmpm, String type) {
+            boolean isTimeSubmitted = ! (StringUtils.isEmpty(getHours()) && StringUtils.isEmpty(getMinutes()));
+            if(type.equals("time") || type.equals("full"))
+                isTimeSubmitted = isTimeSubmitted || ! StringUtils.isEmpty(getSeconds());
+            if(usesAmpm)
+                isTimeSubmitted = isTimeSubmitted || isAmpmSubmitted();
+            return isTimeSubmitted;
+        }
+        
+        private boolean isSubmitValid(boolean usesAmpm, String type) {
+            if(type.equals("date"))
+                return isDateSubmitted(usesAmpm, type);
+            else if(type.equals("time") || (type.equals("short_time")))
+                return isTimeSubmitted(usesAmpm, type);
+            else if(type.equals("full") || type.equals("both"))
+                return isDateSubmitted(usesAmpm, type) || isTimeSubmitted(usesAmpm, type);
+            else
+                return false;
+        }
+        
+        private boolean isAmpmSubmitted() {
+            if(getAmpm() == null)
+                return false;
+            else
+                return ! getAmpm().equals("-1");
+        }
+
+        public String getDay() {
+            return formatedInt( day );
+        }
+        public void setDay(String day) {
+            this.day = day;
+        }
+
+        public String getMonth() {
+            return month;
+        }
+        public void setMonth(String month) {
+            this.month = month;
+        }
+
+        public String getYear() {
+            return year;
+        }
+        public void setYear(String year) {
+            this.year = year;
+        }
+
+        public String getHours() {
+            return formatedInt( hours );
+        }
+        public void setHours(String hours) {
+            this.hours = hours;
+        }
+        public String getMinutes() {
+            return formatedInt( minutes );
+        }
+        public void setMinutes(String minutes) {
+            this.minutes = minutes;
+        }
+
+        public String getSeconds() {
+            return formatedInt( seconds );
+        }
+        public void setSeconds(String seconds) {
+            this.seconds = seconds;
+        }
+        
+        public String getAmpm() {
+            return ampm;
+        }
+        public void setAmpm(String ampm) {
+            this.ampm = ampm;
+        }
+        
+        public String getType() {
+            return type;
+        }
+        public void setType(String type) {
+            this.type = type;
+        }
+    }
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/date/HtmlInputDateTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java?rev=616601&view=auto
==============================================================================
--- myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java (added)
+++ myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java Tue Jan 29 18:58:48 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.component.html.ext;
+
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.custom.htmlTag.HtmlTag;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Leonardo Uribe (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class Div
+        extends HtmlTag
+{
+
+    /**///getValue
+    public Object getValue() {
+        return "div";
+      }
+        
+}

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/branches/1_2_0/core/src/main/java-templates/org/apache/myfaces/custom/div/DivTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL