myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r427657 [19/42] - in /myfaces: core/trunk/api/src/main/java/javax/faces/component/ core/trunk/api/src/test/java/javax/faces/ core/trunk/api/src/test/java/javax/faces/application/ core/trunk/api/src/test/java/javax/faces/component/ core/trun...
Date Tue, 01 Aug 2006 17:44:01 GMT
Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleEntryComparator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java Tue Aug  1 10:43:28 2006
@@ -1,432 +1,432 @@
-/*
- * Copyright 2004 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.schedule.util;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-
-/**
- * <p>
- * Some utility methods
- * </p>
- *
- * @author Jurgen Lust (latest modification by $Author: jlust $)
- * @author Kito Mann (some methods taken from the source code of his book 'JavaServer Faces in Action', which is also released under the Apache License
- * @author Bruno Aranda (adaptation of Jurgen's code to myfaces)
- * @version $Revision: 387334 $
- */
-public class ScheduleUtil
-{
-    //~ Class Variables --------------------------------------------------------
-    private final static SimpleDateFormat DATE_ID_FORMATTER = new SimpleDateFormat("yyyyMMdd");
-    
-    //~ Constructors -----------------------------------------------------------
-    /**
-     * This class should not be instantiated, it only contains static methods
-     */
-    private ScheduleUtil() {
-        super();
-    }
-    
-    //~ Methods ----------------------------------------------------------------
-
-    /**
-     * <p>
-     * Check if the value of a UIComponent is a value or method binding
-     * expression.
-     * </p>
-     *
-     * @param value the value to check
-     *
-     * @return whether the value is a binding expression
-     */
-    public static boolean isBindingExpression(Object value)
-    {
-        boolean returnboolean =
-            ((value != null) && value instanceof String &&
-            ((String) value).startsWith("#{") &&
-            ((String) value).endsWith("}"));
-
-        return returnboolean;
-    }
-
-    /**
-     * <p>
-     * Get the boolean value of a UIComponent, even if it is a value
-     * binding expression.
-     * </p>
-     *
-     * @param component the component
-     * @param property the property
-     * @param key the key of the value binding
-     * @param defaultValue the default value
-     *
-     * @return the boolean value
-     */
-    public static boolean getBooleanProperty(
-        UIComponent component,
-        Boolean property,
-        String key,
-        boolean defaultValue
-    )
-    {
-        if (property != null) {
-            return property.booleanValue();
-        } else {
-            ValueBinding binding =
-                (ValueBinding) component.getValueBinding(key);
-
-            if (binding != null) {
-                Boolean value =
-                    (Boolean) binding.getValue(
-                        FacesContext.getCurrentInstance()
-                    );
-
-                if (value != null) {
-                    return value.booleanValue();
-                }
-            }
-        }
-
-        return defaultValue;
-    }
-
-    /**
-     * <p>
-     * Get the boolean value of an attribute
-     * </p>
-     *
-     * @param attributeValue the attribute value
-     * @param valueIfNull the default value
-     *
-     * @return the boolean value
-     */
-    public static boolean getBooleanValue(
-        Object attributeValue,
-        boolean valueIfNull
-    )
-    {
-        if (attributeValue == null) {
-            return valueIfNull;
-        }
-
-        if (attributeValue instanceof String) {
-            return ((String) attributeValue).equalsIgnoreCase("true");
-        } else {
-            return ((Boolean) attributeValue).booleanValue();
-        }
-    }
-
-    /**
-     * <p>
-     * Get the float value of a UIComponent, even if it is a value
-     * binding expression.
-     * </p>
-     *
-     * @param component the component
-     * @param property the property
-     * @param key the key of the value binding
-     * @param defaultValue the default value
-     *
-     * @return the float value
-     */
-    public static float getFloatProperty(
-        UIComponent component,
-        Float property,
-        String key,
-        float defaultValue
-    )
-    {
-        if (property != null) {
-            return property.floatValue();
-        } else {
-            ValueBinding binding =
-                (ValueBinding) component.getValueBinding(key);
-
-            if (binding != null) {
-                Float value =
-                    (Float) binding.getValue(FacesContext.getCurrentInstance());
-
-                if (value != null) {
-                    return value.floatValue();
-                }
-            }
-        }
-
-        return defaultValue;
-    }
-
-    /**
-     * <p>
-     * Get the hashcode for the truncated date
-     * </p>
-     *
-     * @param date the date
-     *
-     * @return the hashCode of the truncated date
-     */
-    public static int getHashCodeForDay(Date date)
-    {
-    	Calendar calendar = Calendar.getInstance();
-    	calendar.setTime(date);
-    	
-    	return new Integer(calendar.get(Calendar.ERA)).hashCode() ^ 
-    		new Integer(calendar.get(Calendar.YEAR)).hashCode() ^
-    		new Integer(calendar.get(Calendar.DAY_OF_YEAR)).hashCode();
-    }
-
-    /**
-     * <p>
-     * Get the int value of a UIComponent, even if it is a value
-     * binding expression.
-     * </p>
-     *
-     * @param component the component
-     * @param property the property
-     * @param key the key of the value binding
-     * @param defaultValue the default value
-     *
-     * @return the int value
-     */
-    public static int getIntegerProperty(
-        UIComponent component,
-        Integer property,
-        String key,
-        int defaultValue
-    )
-    {
-        if (property != null) {
-            return property.intValue();
-        } else {
-            ValueBinding binding =
-                (ValueBinding) component.getValueBinding(key);
-
-            if (binding != null) {
-                Integer value =
-                    (Integer) binding.getValue(
-                        FacesContext.getCurrentInstance()
-                    );
-
-                if (value != null) {
-                    return value.intValue();
-                }
-            }
-        }
-
-        return defaultValue;
-    }
-
-    /**
-     * <p>
-     * Get the object value of a UIComponent, even if it is a value
-     * binding expression.
-     * </p>
-     *
-     * @param component the component
-     * @param property the property
-     * @param key the key of the value binding
-     * @param defaultValue the default value
-     *
-     * @return the object value
-     */
-    public static Object getObjectProperty(
-        UIComponent component,
-        Object property,
-        String key,
-        Object defaultValue
-    )
-    {
-        if (property != null) {
-            return property;
-        } else {
-            ValueBinding binding =
-                (ValueBinding) component.getValueBinding(key);
-
-            if (binding != null) {
-                return binding.getValue(FacesContext.getCurrentInstance());
-            }
-        }
-
-        return defaultValue;
-    }
-
-    /**
-     * <p>
-     * Check if the 2 dates are in the same day.
-     * </p>
-     *
-     * @param date1 the first date
-     * @param date2 the second date
-     *
-     * @return whether the dates are in the same day
-     */
-    public static boolean isSameDay(
-        Date date1,
-        Date date2
-    )
-    {
-        if ((date1 == null) || (date2 == null)) {
-            return false;
-        }
-        
-        Calendar calendar1 = Calendar.getInstance();
-        calendar1.setTime(date1);
-        
-        Calendar calendar2 = Calendar.getInstance();
-        calendar2.setTime(date2);
-        
-        return (calendar1.get(Calendar.ERA) == calendar2.get(Calendar.ERA) &&
-        		calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
-        		calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR));
-    }
-
-    /**
-     * <p>
-     * Get the String value of a UIComponent, even if it is a value
-     * binding expression.
-     * </p>
-     *
-     * @param component the component
-     * @param property the property
-     * @param key the key of the value binding
-     * @param defaultValue the default value
-     *
-     * @return the String value
-     */
-    public static String getStringProperty(
-        UIComponent component,
-        String property,
-        String key,
-        String defaultValue
-    )
-    {
-        if (property != null) {
-            return property;
-        } else {
-            ValueBinding binding =
-                (ValueBinding) component.getValueBinding(key);
-
-            if (binding != null) {
-                return (String) binding.getValue(
-                    FacesContext.getCurrentInstance()
-                );
-            }
-        }
-
-        return defaultValue;
-    }
-
-    /**
-     * <p>
-     * Check if the value of the given component can be modified
-     * </p>
-     *
-     * @param component the component
-     *
-     * @return whether the value can be modified
-     */
-    public static boolean canModifyValue(UIComponent component)
-    {
-        boolean returnboolean =
-            (component.isRendered() &&
-            !getBooleanValue(component.getAttributes().get("readonly"), false) &&
-            !getBooleanValue(component.getAttributes().get("disabled"), false));
-
-        return returnboolean;
-    }
-
-    /**
-     * <p>
-     * Compare 2 dates after truncating them.
-     * </p>
-     *
-     * @param date1 the first date
-     * @param date2 the second date
-     *
-     * @return the comparison
-     */
-    public static int compareDays(
-        Date date1,
-        Date date2
-    )
-    {
-        if (date1 == null) {
-            return -1;
-        }
-
-        if (date2 == null) {
-            return 1;
-        }
-        
-        return truncate(date1).compareTo(truncate(date2));
-    }
-    
-    /**
-     * truncate the given Date to 00:00:00 that same day
-     * 
-     * @param date the date that should be truncated
-     * @return the truncated date
-     */
-    public static Date truncate(Date date) {
-        if (date == null) return null;
-        Calendar cal = GregorianCalendar.getInstance();
-        cal.setTime(date);
-        cal.set(Calendar.HOUR_OF_DAY, 0);
-        cal.set(Calendar.MINUTE, 0);
-        cal.set(Calendar.SECOND, 0);
-        cal.set(Calendar.MILLISECOND, 0);
-        return cal.getTime();
-    }
-    
-    /**
-     * get a String identifying this date
-     * 
-     * @param date the date
-     * @return the identifier for this date
-     */
-    public static String getDateId(Date date) {
-        if (date == null) return "NULL";
-        return DATE_ID_FORMATTER.format(date);
-    }
-    
-    /**
-     * get a date from the given date ID
-     * 
-     * @param id the date ID
-     * @return the date
-     */
-    public static Date getDateFromId(String id) {
-        if (id == null || id.length() == 0 || "null".equals(id)) return null;
-        try
-        {
-            return DATE_ID_FORMATTER.parse(id);
-        }
-        catch (ParseException e)
-        {
-            return null;
-        }
-    }
-}
-//The End
+/*
+ * Copyright 2004 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.schedule.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+
+/**
+ * <p>
+ * Some utility methods
+ * </p>
+ *
+ * @author Jurgen Lust (latest modification by $Author: jlust $)
+ * @author Kito Mann (some methods taken from the source code of his book 'JavaServer Faces in Action', which is also released under the Apache License
+ * @author Bruno Aranda (adaptation of Jurgen's code to myfaces)
+ * @version $Revision: 387334 $
+ */
+public class ScheduleUtil
+{
+    //~ Class Variables --------------------------------------------------------
+    private final static SimpleDateFormat DATE_ID_FORMATTER = new SimpleDateFormat("yyyyMMdd");
+    
+    //~ Constructors -----------------------------------------------------------
+    /**
+     * This class should not be instantiated, it only contains static methods
+     */
+    private ScheduleUtil() {
+        super();
+    }
+    
+    //~ Methods ----------------------------------------------------------------
+
+    /**
+     * <p>
+     * Check if the value of a UIComponent is a value or method binding
+     * expression.
+     * </p>
+     *
+     * @param value the value to check
+     *
+     * @return whether the value is a binding expression
+     */
+    public static boolean isBindingExpression(Object value)
+    {
+        boolean returnboolean =
+            ((value != null) && value instanceof String &&
+            ((String) value).startsWith("#{") &&
+            ((String) value).endsWith("}"));
+
+        return returnboolean;
+    }
+
+    /**
+     * <p>
+     * Get the boolean value of a UIComponent, even if it is a value
+     * binding expression.
+     * </p>
+     *
+     * @param component the component
+     * @param property the property
+     * @param key the key of the value binding
+     * @param defaultValue the default value
+     *
+     * @return the boolean value
+     */
+    public static boolean getBooleanProperty(
+        UIComponent component,
+        Boolean property,
+        String key,
+        boolean defaultValue
+    )
+    {
+        if (property != null) {
+            return property.booleanValue();
+        } else {
+            ValueBinding binding =
+                (ValueBinding) component.getValueBinding(key);
+
+            if (binding != null) {
+                Boolean value =
+                    (Boolean) binding.getValue(
+                        FacesContext.getCurrentInstance()
+                    );
+
+                if (value != null) {
+                    return value.booleanValue();
+                }
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * <p>
+     * Get the boolean value of an attribute
+     * </p>
+     *
+     * @param attributeValue the attribute value
+     * @param valueIfNull the default value
+     *
+     * @return the boolean value
+     */
+    public static boolean getBooleanValue(
+        Object attributeValue,
+        boolean valueIfNull
+    )
+    {
+        if (attributeValue == null) {
+            return valueIfNull;
+        }
+
+        if (attributeValue instanceof String) {
+            return ((String) attributeValue).equalsIgnoreCase("true");
+        } else {
+            return ((Boolean) attributeValue).booleanValue();
+        }
+    }
+
+    /**
+     * <p>
+     * Get the float value of a UIComponent, even if it is a value
+     * binding expression.
+     * </p>
+     *
+     * @param component the component
+     * @param property the property
+     * @param key the key of the value binding
+     * @param defaultValue the default value
+     *
+     * @return the float value
+     */
+    public static float getFloatProperty(
+        UIComponent component,
+        Float property,
+        String key,
+        float defaultValue
+    )
+    {
+        if (property != null) {
+            return property.floatValue();
+        } else {
+            ValueBinding binding =
+                (ValueBinding) component.getValueBinding(key);
+
+            if (binding != null) {
+                Float value =
+                    (Float) binding.getValue(FacesContext.getCurrentInstance());
+
+                if (value != null) {
+                    return value.floatValue();
+                }
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * <p>
+     * Get the hashcode for the truncated date
+     * </p>
+     *
+     * @param date the date
+     *
+     * @return the hashCode of the truncated date
+     */
+    public static int getHashCodeForDay(Date date)
+    {
+    	Calendar calendar = Calendar.getInstance();
+    	calendar.setTime(date);
+    	
+    	return new Integer(calendar.get(Calendar.ERA)).hashCode() ^ 
+    		new Integer(calendar.get(Calendar.YEAR)).hashCode() ^
+    		new Integer(calendar.get(Calendar.DAY_OF_YEAR)).hashCode();
+    }
+
+    /**
+     * <p>
+     * Get the int value of a UIComponent, even if it is a value
+     * binding expression.
+     * </p>
+     *
+     * @param component the component
+     * @param property the property
+     * @param key the key of the value binding
+     * @param defaultValue the default value
+     *
+     * @return the int value
+     */
+    public static int getIntegerProperty(
+        UIComponent component,
+        Integer property,
+        String key,
+        int defaultValue
+    )
+    {
+        if (property != null) {
+            return property.intValue();
+        } else {
+            ValueBinding binding =
+                (ValueBinding) component.getValueBinding(key);
+
+            if (binding != null) {
+                Integer value =
+                    (Integer) binding.getValue(
+                        FacesContext.getCurrentInstance()
+                    );
+
+                if (value != null) {
+                    return value.intValue();
+                }
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * <p>
+     * Get the object value of a UIComponent, even if it is a value
+     * binding expression.
+     * </p>
+     *
+     * @param component the component
+     * @param property the property
+     * @param key the key of the value binding
+     * @param defaultValue the default value
+     *
+     * @return the object value
+     */
+    public static Object getObjectProperty(
+        UIComponent component,
+        Object property,
+        String key,
+        Object defaultValue
+    )
+    {
+        if (property != null) {
+            return property;
+        } else {
+            ValueBinding binding =
+                (ValueBinding) component.getValueBinding(key);
+
+            if (binding != null) {
+                return binding.getValue(FacesContext.getCurrentInstance());
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * <p>
+     * Check if the 2 dates are in the same day.
+     * </p>
+     *
+     * @param date1 the first date
+     * @param date2 the second date
+     *
+     * @return whether the dates are in the same day
+     */
+    public static boolean isSameDay(
+        Date date1,
+        Date date2
+    )
+    {
+        if ((date1 == null) || (date2 == null)) {
+            return false;
+        }
+        
+        Calendar calendar1 = Calendar.getInstance();
+        calendar1.setTime(date1);
+        
+        Calendar calendar2 = Calendar.getInstance();
+        calendar2.setTime(date2);
+        
+        return (calendar1.get(Calendar.ERA) == calendar2.get(Calendar.ERA) &&
+        		calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR) &&
+        		calendar1.get(Calendar.DAY_OF_YEAR) == calendar2.get(Calendar.DAY_OF_YEAR));
+    }
+
+    /**
+     * <p>
+     * Get the String value of a UIComponent, even if it is a value
+     * binding expression.
+     * </p>
+     *
+     * @param component the component
+     * @param property the property
+     * @param key the key of the value binding
+     * @param defaultValue the default value
+     *
+     * @return the String value
+     */
+    public static String getStringProperty(
+        UIComponent component,
+        String property,
+        String key,
+        String defaultValue
+    )
+    {
+        if (property != null) {
+            return property;
+        } else {
+            ValueBinding binding =
+                (ValueBinding) component.getValueBinding(key);
+
+            if (binding != null) {
+                return (String) binding.getValue(
+                    FacesContext.getCurrentInstance()
+                );
+            }
+        }
+
+        return defaultValue;
+    }
+
+    /**
+     * <p>
+     * Check if the value of the given component can be modified
+     * </p>
+     *
+     * @param component the component
+     *
+     * @return whether the value can be modified
+     */
+    public static boolean canModifyValue(UIComponent component)
+    {
+        boolean returnboolean =
+            (component.isRendered() &&
+            !getBooleanValue(component.getAttributes().get("readonly"), false) &&
+            !getBooleanValue(component.getAttributes().get("disabled"), false));
+
+        return returnboolean;
+    }
+
+    /**
+     * <p>
+     * Compare 2 dates after truncating them.
+     * </p>
+     *
+     * @param date1 the first date
+     * @param date2 the second date
+     *
+     * @return the comparison
+     */
+    public static int compareDays(
+        Date date1,
+        Date date2
+    )
+    {
+        if (date1 == null) {
+            return -1;
+        }
+
+        if (date2 == null) {
+            return 1;
+        }
+        
+        return truncate(date1).compareTo(truncate(date2));
+    }
+    
+    /**
+     * truncate the given Date to 00:00:00 that same day
+     * 
+     * @param date the date that should be truncated
+     * @return the truncated date
+     */
+    public static Date truncate(Date date) {
+        if (date == null) return null;
+        Calendar cal = GregorianCalendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal.getTime();
+    }
+    
+    /**
+     * get a String identifying this date
+     * 
+     * @param date the date
+     * @return the identifier for this date
+     */
+    public static String getDateId(Date date) {
+        if (date == null) return "NULL";
+        return DATE_ID_FORMATTER.format(date);
+    }
+    
+    /**
+     * get a date from the given date ID
+     * 
+     * @param id the date ID
+     * @return the date
+     */
+    public static Date getDateFromId(String id) {
+        if (id == null || id.length() == 0 || "null".equals(id)) return null;
+        try
+        {
+            return DATE_ID_FORMATTER.parse(id);
+        }
+        catch (ParseException e)
+        {
+            return null;
+        }
+    }
+}
+//The End

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/schedule/util/ScheduleUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/ToggleExpandedEvent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java Tue Aug  1 10:43:28 2006
@@ -1,151 +1,151 @@
-/*
- * Copyright 2004 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.tree2;
-
-import java.util.StringTokenizer;
-import java.util.ArrayList;
-
-/**
- * Model class for the tree component.  It provides random access to nodes in a tree
- * made up of instances of the {@link TreeNode} class.
- *
- * @author Sean Schofield
- * @author Hans Bergsten (Some code taken from an example in his O'Reilly JavaServer Faces book. Copied with permission)
- * @version $Revision: 168205 $ $Date: 2005-05-04 18:59:21 -0400 (Wed, 04 May 2005) $
- */
-public class TreeModelBase implements TreeModel
-{
-
-    private static final long serialVersionUID = 3969414475396945742L;
-//  private static final Log log = LogFactory.getLog(TreeModelBase.class);
-
-    private TreeNode root;
-    private TreeState treeState = new TreeStateBase();
-
-
-    /**
-     * Constructor
-     * @param root The root TreeNode
-     */
-    public TreeModelBase(TreeNode root)
-    {
-        this.root = root;
-    }
-
-    // see interface
-    public TreeState getTreeState()
-    {
-        return treeState;
-    }
-
-    // see interface
-    public void setTreeState(TreeState treeState)
-    {
-        this.treeState = treeState;
-    }
-
-
-
-    /**
-     * Gets an array of String containing the ID's of all of the {@link TreeNode}s in the path to
-     * the specified node.  The path information will be an array of <code>String</code> objects
-     * representing node ID's. The array will starting with the ID of the root node and end with
-     * the ID of the specified node.
-     *
-     * @param nodeId The id of the node for whom the path information is needed.
-     * @return String[]
-     */
-    public String[] getPathInformation(String nodeId)
-    {
-        if (nodeId == null)
-        {
-            throw new IllegalArgumentException("Cannot determine parents for a null node.");
-        }
-
-        ArrayList pathList = new ArrayList();
-        pathList.add(nodeId);
-
-        while (nodeId.lastIndexOf(SEPARATOR) != -1)
-        {
-            nodeId = nodeId.substring(0, nodeId.lastIndexOf(SEPARATOR));
-            pathList.add(nodeId);
-        }
-
-        String[] pathInfo = new String[pathList.size()];
-
-        for (int i=0; i < pathInfo.length; i++)
-        {
-            pathInfo[i] = (String)pathList.get(pathInfo.length - i - 1);
-        }
-
-        return pathInfo;
-    }
-
-    /**
-     * Indicates whether or not the specified {@link TreeNode} is the last child in the <code>List</code>
-     * of children.  If the node id provided corresponds to the root node, this returns <code>true</code>.
-     *
-     * @param nodeId The ID of the node to check
-     * @return boolean
-     */
-    public boolean isLastChild(String nodeId)
-    {
-        if (nodeId.lastIndexOf(SEPARATOR) == -1)
-        {
-            // root node considered to be the last child
-            return true;
-        }
-
-        //first get the id of the parent
-        String parentId = nodeId.substring(0, nodeId.lastIndexOf(SEPARATOR));
-        String childString = nodeId.substring(nodeId.lastIndexOf(SEPARATOR) + 1);
-        int childId = Integer.parseInt(childString);
-        TreeNode parentNode = getNodeById(parentId);
-
-        return  childId + 1== parentNode.getChildCount();
-    }
-
-    public TreeNode getNodeById(String nodeId)
-    {
-    	if (nodeId == null)
-    		return null;
-
-        TreeNode node = null;
-        StringTokenizer st = new StringTokenizer(nodeId, SEPARATOR);
-
-        while (st.hasMoreTokens())
-        {
-            int nodeIndex = Integer.parseInt(st.nextToken());
-            if(node == null)
-            {
-                node = root;
-            }
-            else
-            {
-                // don't worry about invalid index, that exception will be caught later and dealt with
-                node = (TreeNode)node.getChildren().get(nodeIndex);
-            }
-        }
-
-        return node;
-    }
-
-    // see interface
-    public TreeWalker getTreeWalker()
-    {
-        return new TreeWalkerBase();
-    }
-}
+/*
+ * Copyright 2004 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.tree2;
+
+import java.util.StringTokenizer;
+import java.util.ArrayList;
+
+/**
+ * Model class for the tree component.  It provides random access to nodes in a tree
+ * made up of instances of the {@link TreeNode} class.
+ *
+ * @author Sean Schofield
+ * @author Hans Bergsten (Some code taken from an example in his O'Reilly JavaServer Faces book. Copied with permission)
+ * @version $Revision: 168205 $ $Date: 2005-05-04 18:59:21 -0400 (Wed, 04 May 2005) $
+ */
+public class TreeModelBase implements TreeModel
+{
+
+    private static final long serialVersionUID = 3969414475396945742L;
+//  private static final Log log = LogFactory.getLog(TreeModelBase.class);
+
+    private TreeNode root;
+    private TreeState treeState = new TreeStateBase();
+
+
+    /**
+     * Constructor
+     * @param root The root TreeNode
+     */
+    public TreeModelBase(TreeNode root)
+    {
+        this.root = root;
+    }
+
+    // see interface
+    public TreeState getTreeState()
+    {
+        return treeState;
+    }
+
+    // see interface
+    public void setTreeState(TreeState treeState)
+    {
+        this.treeState = treeState;
+    }
+
+
+
+    /**
+     * Gets an array of String containing the ID's of all of the {@link TreeNode}s in the path to
+     * the specified node.  The path information will be an array of <code>String</code> objects
+     * representing node ID's. The array will starting with the ID of the root node and end with
+     * the ID of the specified node.
+     *
+     * @param nodeId The id of the node for whom the path information is needed.
+     * @return String[]
+     */
+    public String[] getPathInformation(String nodeId)
+    {
+        if (nodeId == null)
+        {
+            throw new IllegalArgumentException("Cannot determine parents for a null node.");
+        }
+
+        ArrayList pathList = new ArrayList();
+        pathList.add(nodeId);
+
+        while (nodeId.lastIndexOf(SEPARATOR) != -1)
+        {
+            nodeId = nodeId.substring(0, nodeId.lastIndexOf(SEPARATOR));
+            pathList.add(nodeId);
+        }
+
+        String[] pathInfo = new String[pathList.size()];
+
+        for (int i=0; i < pathInfo.length; i++)
+        {
+            pathInfo[i] = (String)pathList.get(pathInfo.length - i - 1);
+        }
+
+        return pathInfo;
+    }
+
+    /**
+     * Indicates whether or not the specified {@link TreeNode} is the last child in the <code>List</code>
+     * of children.  If the node id provided corresponds to the root node, this returns <code>true</code>.
+     *
+     * @param nodeId The ID of the node to check
+     * @return boolean
+     */
+    public boolean isLastChild(String nodeId)
+    {
+        if (nodeId.lastIndexOf(SEPARATOR) == -1)
+        {
+            // root node considered to be the last child
+            return true;
+        }
+
+        //first get the id of the parent
+        String parentId = nodeId.substring(0, nodeId.lastIndexOf(SEPARATOR));
+        String childString = nodeId.substring(nodeId.lastIndexOf(SEPARATOR) + 1);
+        int childId = Integer.parseInt(childString);
+        TreeNode parentNode = getNodeById(parentId);
+
+        return  childId + 1== parentNode.getChildCount();
+    }
+
+    public TreeNode getNodeById(String nodeId)
+    {
+    	if (nodeId == null)
+    		return null;
+
+        TreeNode node = null;
+        StringTokenizer st = new StringTokenizer(nodeId, SEPARATOR);
+
+        while (st.hasMoreTokens())
+        {
+            int nodeIndex = Integer.parseInt(st.nextToken());
+            if(node == null)
+            {
+                node = root;
+            }
+            else
+            {
+                // don't worry about invalid index, that exception will be caught later and dealt with
+                node = (TreeNode)node.getChildren().get(nodeIndex);
+            }
+        }
+
+        return node;
+    }
+
+    // see interface
+    public TreeWalker getTreeWalker()
+    {
+        return new TreeWalkerBase();
+    }
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeModelBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeNodeChecked.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeState.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeState.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeState.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeState.java Tue Aug  1 10:43:28 2006
@@ -1,77 +1,77 @@
-/*
- * Copyright 2004-2006 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.tree2;
-
-import java.io.Serializable;
-
-public interface TreeState extends Serializable
-{
-
-    /**
-     * Indicates whether or not the specified {@link TreeNode} is expanded.
-     *
-     * @param nodeId The id of the node in question.
-     * @return If the node is expanded.
-     */
-    public boolean isNodeExpanded(String nodeId);
-
-    /**
-     * Toggle the expanded state of the specified {@link TreeNode}.
-     * @param nodeId The id of the node whose expanded state should be toggled.
-     */
-    public void toggleExpanded(String nodeId);
-
-    /**
-     * Expand the complete path specified.  If any node in the path is already expanded,
-     * that node should be left as it is.
-     *
-     * @param nodePath The path to be expanded.
-     */
-    public void expandPath(String[] nodePath);
-
-    /**
-     * Collapse the complete path specified.  If any node in the path is already collapsed,
-     * that node should be left as it is.
-     *
-     * @param nodePath The path to be collapsed.
-     */
-    public void collapsePath(String[] nodePath);
-
-    /**
-     * Getter for transient property.
-     * @return boolean
-     */
-    public boolean isTransient();
-
-    /**
-     * Setter for transient property
-     * @param trans boolean
-     */
-    public void setTransient(boolean trans);
-
-    /**
-     * Sets the id of the currently selected node
-     * @param nodeId The id of the currently selected node
-     */
-    public void setSelected(String nodeId);
-
-    /**
-     * Indicates whether or not the specified node is selected.
-     * @param nodeId String
-     * @return boolean
-     */
-    public boolean isSelected(String nodeId);
-}
+/*
+ * Copyright 2004-2006 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.tree2;
+
+import java.io.Serializable;
+
+public interface TreeState extends Serializable
+{
+
+    /**
+     * Indicates whether or not the specified {@link TreeNode} is expanded.
+     *
+     * @param nodeId The id of the node in question.
+     * @return If the node is expanded.
+     */
+    public boolean isNodeExpanded(String nodeId);
+
+    /**
+     * Toggle the expanded state of the specified {@link TreeNode}.
+     * @param nodeId The id of the node whose expanded state should be toggled.
+     */
+    public void toggleExpanded(String nodeId);
+
+    /**
+     * Expand the complete path specified.  If any node in the path is already expanded,
+     * that node should be left as it is.
+     *
+     * @param nodePath The path to be expanded.
+     */
+    public void expandPath(String[] nodePath);
+
+    /**
+     * Collapse the complete path specified.  If any node in the path is already collapsed,
+     * that node should be left as it is.
+     *
+     * @param nodePath The path to be collapsed.
+     */
+    public void collapsePath(String[] nodePath);
+
+    /**
+     * Getter for transient property.
+     * @return boolean
+     */
+    public boolean isTransient();
+
+    /**
+     * Setter for transient property
+     * @param trans boolean
+     */
+    public void setTransient(boolean trans);
+
+    /**
+     * Sets the id of the currently selected node
+     * @param nodeId The id of the currently selected node
+     */
+    public void setSelected(String nodeId);
+
+    /**
+     * Indicates whether or not the specified node is selected.
+     * @param nodeId String
+     * @return boolean
+     */
+    public boolean isSelected(String nodeId);
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeStateBase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeStateBase.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeStateBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeStateBase.java Tue Aug  1 10:43:28 2006
@@ -1,88 +1,88 @@
-/*
- * Copyright 2004-2006 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.tree2;
-
-import java.util.HashSet;
-
-public class TreeStateBase implements TreeState
-{
-
-    private static final long serialVersionUID = -6767283932185878071L;
-    private HashSet _expandedNodes = new HashSet();
-    private boolean _transient = false;
-    private String _selected;
-
-    // see interface
-    public boolean isNodeExpanded(String nodeId)
-    {
-        return (_expandedNodes.contains(nodeId) /*&& !getNode().isLeaf()*/);
-    }
-
-    // see interface
-    public void toggleExpanded(String nodeId)
-    {
-        if (_expandedNodes.contains(nodeId))
-        {
-            _expandedNodes.remove(nodeId);
-        }
-        else
-        {
-            _expandedNodes.add(nodeId);
-        }
-    }
-
-    // see interface
-    public boolean isTransient()
-    {
-        return _transient;
-    }
-
-    // see interface
-    public void setTransient(boolean trans)
-    {
-        _transient = trans;
-    }
-
-    // see interface
-    public void expandPath(String[] nodePath)
-    {
-        for (int i=0; i < nodePath.length; i++)
-        {
-            String nodeId = nodePath[i];
-            _expandedNodes.add(nodeId);
-        }
-    }
-
-    // see interface
-    public void collapsePath(String[] nodePath)
-    {
-        for (int i=0; i < nodePath.length; i++)
-        {
-            String nodeId = nodePath[i];
-            _expandedNodes.remove(nodeId);
-        }
-    }
-
-    public void setSelected(String nodeId)
-    {
-        _selected = nodeId;
-    }
-
-    public boolean isSelected(String nodeId)
-    {
-        return nodeId.equals(_selected);
-    }
-}
+/*
+ * Copyright 2004-2006 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.tree2;
+
+import java.util.HashSet;
+
+public class TreeStateBase implements TreeState
+{
+
+    private static final long serialVersionUID = -6767283932185878071L;
+    private HashSet _expandedNodes = new HashSet();
+    private boolean _transient = false;
+    private String _selected;
+
+    // see interface
+    public boolean isNodeExpanded(String nodeId)
+    {
+        return (_expandedNodes.contains(nodeId) /*&& !getNode().isLeaf()*/);
+    }
+
+    // see interface
+    public void toggleExpanded(String nodeId)
+    {
+        if (_expandedNodes.contains(nodeId))
+        {
+            _expandedNodes.remove(nodeId);
+        }
+        else
+        {
+            _expandedNodes.add(nodeId);
+        }
+    }
+
+    // see interface
+    public boolean isTransient()
+    {
+        return _transient;
+    }
+
+    // see interface
+    public void setTransient(boolean trans)
+    {
+        _transient = trans;
+    }
+
+    // see interface
+    public void expandPath(String[] nodePath)
+    {
+        for (int i=0; i < nodePath.length; i++)
+        {
+            String nodeId = nodePath[i];
+            _expandedNodes.add(nodeId);
+        }
+    }
+
+    // see interface
+    public void collapsePath(String[] nodePath)
+    {
+        for (int i=0; i < nodePath.length; i++)
+        {
+            String nodeId = nodePath[i];
+            _expandedNodes.remove(nodeId);
+        }
+    }
+
+    public void setSelected(String nodeId)
+    {
+        _selected = nodeId;
+    }
+
+    public boolean isSelected(String nodeId)
+    {
+        return nodeId.equals(_selected);
+    }
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeStateBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java Tue Aug  1 10:43:28 2006
@@ -1,61 +1,61 @@
-/*
- * Copyright 2006 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.tree2;
-
-public interface TreeWalker
-{
-    /**
-     * Getter for the check state property.  Indicates whether or not the TreeWalker
-     * should navigate over nodes that are not currently expanded.
-     *
-     * @return boolean
-     */
-    public boolean isCheckState();
-
-    /**
-     * Setter for the check state property.  Indicates whether or not the TreeWalker
-     * should navigate over nodes that are not currently expanded.
-     *
-     * @param checkState boolean
-     */
-    public void setCheckState(boolean checkState);
-
-    /**
-     * Walk the tree and set the current node to the next node.
-     * @return boolean whether or not there was another node to walk
-     */
-    public boolean next();
-
-    /**
-     * Returns the id of the root node.
-     * @return String
-     */
-    public String getRootNodeId();
-
-    /**
-     * This method allows the renderer to pass a reference to the tree object.  With this
-     * reference the TreeWalker can set the current node as its walking the tree.
-     *
-     * @param treeData UITreeData
-     */
-    public void setTree(UITreeData treeData);
-
-    /**
-     * Reset the walker so the tree can be walked again starting from the root.
-     */
-    public void reset();
-}
+/*
+ * Copyright 2006 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.tree2;
+
+public interface TreeWalker
+{
+    /**
+     * Getter for the check state property.  Indicates whether or not the TreeWalker
+     * should navigate over nodes that are not currently expanded.
+     *
+     * @return boolean
+     */
+    public boolean isCheckState();
+
+    /**
+     * Setter for the check state property.  Indicates whether or not the TreeWalker
+     * should navigate over nodes that are not currently expanded.
+     *
+     * @param checkState boolean
+     */
+    public void setCheckState(boolean checkState);
+
+    /**
+     * Walk the tree and set the current node to the next node.
+     * @return boolean whether or not there was another node to walk
+     */
+    public boolean next();
+
+    /**
+     * Returns the id of the root node.
+     * @return String
+     */
+    public String getRootNodeId();
+
+    /**
+     * This method allows the renderer to pass a reference to the tree object.  With this
+     * reference the TreeWalker can set the current node as its walking the tree.
+     *
+     * @param treeData UITreeData
+     */
+    public void setTree(UITreeData treeData);
+
+    /**
+     * Reset the walker so the tree can be walked again starting from the root.
+     */
+    public void reset();
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java Tue Aug  1 10:43:28 2006
@@ -1,158 +1,158 @@
-/*
- * Copyright 2006 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.tree2;
-
-import org.apache.commons.lang.StringUtils;
-import java.util.Stack;
-import java.util.List;
-
-/**
- * A base implementation of the {@link TreeWalker} interface.  Uses a simple node naming
- * scheme of "0" for the root node, "0:0" for the first child, "0:1" for the second child, etc.
- */
-public class TreeWalkerBase implements TreeWalker
-{
-    private String ROOT_NODE_ID = "0";
-    private String TREE_NODE_SEPARATOR = ":";
-
-    private UITreeData tree;
-    private Stack nodeStack = new Stack();
-    private Stack idStack = new Stack();
-    private boolean checkState = true;
-    private boolean startedWalking = false;
-
-    // see interface
-    public void setTree(UITreeData tree)
-    {
-        this.tree = tree;
-    }
-
-    // see interface
-    public boolean isCheckState()
-    {
-        return checkState;
-    }
-
-    // see interface
-    public void setCheckState(boolean checkState)
-    {
-        this.checkState = checkState;
-    }
-
-    // see interface
-    public boolean next()
-    {
-        if (!startedWalking)
-        {
-            // the first next() call just needs to set the root node and push it onto the stack
-            idStack.push(ROOT_NODE_ID);
-            tree.setNodeId(ROOT_NODE_ID);
-            nodeStack.push(tree.getNode());
-
-            startedWalking = true;
-            return true;
-        }
-
-        if (nodeStack.isEmpty())
-        {
-            return false;
-        }
-
-        TreeNode prevNode = (TreeNode)nodeStack.peek();
-        String prevNodeId = (String)idStack.peek();
-
-        if (prevNode.isLeaf())
-        {
-            nodeStack.pop();
-            idStack.pop();
-
-            return next();
-        }
-        else
-        {
-            TreeNode nextNode = null;
-            String nextNodeId = null;
-
-            if (prevNodeId.equals(tree.getNodeId()))
-            {
-                /**
-                 * We know there is at least one child b/c otherwise we would have popped the node after
-                 * checking isLeaf.  Basically we need to keep drilling down until we reach the deepest
-                 * node that is available for "walking."  Then we'll return to the parent and render its
-                 * siblings and walk back up the tree.
-                 */
-                nextNodeId = prevNodeId + TREE_NODE_SEPARATOR + "0";
-
-                // don't render any children if the node is not expanded
-                if (checkState)
-                {
-                    if (!tree.getDataModel().getTreeState().isNodeExpanded(prevNodeId))
-                    {
-                        nodeStack.pop();
-                        idStack.pop();
-
-                        return next();
-                    }
-                }
-            }
-            else
-            {
-                // get the parent node
-                String currentNodeId = tree.getNodeId();
-                String parentNodeId = StringUtils.substringBeforeLast(currentNodeId, TREE_NODE_SEPARATOR);
-                tree.setNodeId(parentNodeId);
-                TreeNode parentNode = tree.getNode();
-
-                int siblingCount = Integer.parseInt(currentNodeId.substring(parentNodeId.length()+1));
-                siblingCount++;
-
-                if (siblingCount == parentNode.getChildCount())
-                {
-                    // no more siblings
-                    nodeStack.pop();
-                    idStack.pop();
-
-                    return next();
-                }
-
-                nextNodeId = parentNodeId + TREE_NODE_SEPARATOR + siblingCount;
-            }
-
-            tree.setNodeId(nextNodeId);
-            nextNode = tree.getNode();
-
-            nodeStack.push(nextNode);
-            idStack.push(nextNodeId);
-
-            return true;
-        }
-    }
-
-    // see interface
-    public String getRootNodeId()
-    {
-        return ROOT_NODE_ID;
-    }
-
-    // see interface
-    public void reset()
-    {
-        nodeStack.empty();
-        idStack.empty();
-        startedWalking = false;
-    }
-}
+/*
+ * Copyright 2006 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.tree2;
+
+import org.apache.commons.lang.StringUtils;
+import java.util.Stack;
+import java.util.List;
+
+/**
+ * A base implementation of the {@link TreeWalker} interface.  Uses a simple node naming
+ * scheme of "0" for the root node, "0:0" for the first child, "0:1" for the second child, etc.
+ */
+public class TreeWalkerBase implements TreeWalker
+{
+    private String ROOT_NODE_ID = "0";
+    private String TREE_NODE_SEPARATOR = ":";
+
+    private UITreeData tree;
+    private Stack nodeStack = new Stack();
+    private Stack idStack = new Stack();
+    private boolean checkState = true;
+    private boolean startedWalking = false;
+
+    // see interface
+    public void setTree(UITreeData tree)
+    {
+        this.tree = tree;
+    }
+
+    // see interface
+    public boolean isCheckState()
+    {
+        return checkState;
+    }
+
+    // see interface
+    public void setCheckState(boolean checkState)
+    {
+        this.checkState = checkState;
+    }
+
+    // see interface
+    public boolean next()
+    {
+        if (!startedWalking)
+        {
+            // the first next() call just needs to set the root node and push it onto the stack
+            idStack.push(ROOT_NODE_ID);
+            tree.setNodeId(ROOT_NODE_ID);
+            nodeStack.push(tree.getNode());
+
+            startedWalking = true;
+            return true;
+        }
+
+        if (nodeStack.isEmpty())
+        {
+            return false;
+        }
+
+        TreeNode prevNode = (TreeNode)nodeStack.peek();
+        String prevNodeId = (String)idStack.peek();
+
+        if (prevNode.isLeaf())
+        {
+            nodeStack.pop();
+            idStack.pop();
+
+            return next();
+        }
+        else
+        {
+            TreeNode nextNode = null;
+            String nextNodeId = null;
+
+            if (prevNodeId.equals(tree.getNodeId()))
+            {
+                /**
+                 * We know there is at least one child b/c otherwise we would have popped the node after
+                 * checking isLeaf.  Basically we need to keep drilling down until we reach the deepest
+                 * node that is available for "walking."  Then we'll return to the parent and render its
+                 * siblings and walk back up the tree.
+                 */
+                nextNodeId = prevNodeId + TREE_NODE_SEPARATOR + "0";
+
+                // don't render any children if the node is not expanded
+                if (checkState)
+                {
+                    if (!tree.getDataModel().getTreeState().isNodeExpanded(prevNodeId))
+                    {
+                        nodeStack.pop();
+                        idStack.pop();
+
+                        return next();
+                    }
+                }
+            }
+            else
+            {
+                // get the parent node
+                String currentNodeId = tree.getNodeId();
+                String parentNodeId = StringUtils.substringBeforeLast(currentNodeId, TREE_NODE_SEPARATOR);
+                tree.setNodeId(parentNodeId);
+                TreeNode parentNode = tree.getNode();
+
+                int siblingCount = Integer.parseInt(currentNodeId.substring(parentNodeId.length()+1));
+                siblingCount++;
+
+                if (siblingCount == parentNode.getChildCount())
+                {
+                    // no more siblings
+                    nodeStack.pop();
+                    idStack.pop();
+
+                    return next();
+                }
+
+                nextNodeId = parentNodeId + TREE_NODE_SEPARATOR + siblingCount;
+            }
+
+            tree.setNodeId(nextNodeId);
+            nextNode = tree.getNode();
+
+            nodeStack.push(nextNode);
+            idStack.push(nextNodeId);
+
+            return true;
+        }
+    }
+
+    // see interface
+    public String getRootNodeId()
+    {
+        return ROOT_NODE_ID;
+    }
+
+    // see interface
+    public void reset()
+    {
+        nodeStack.empty();
+        idStack.empty();
+        startedWalking = false;
+    }
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/TreeWalkerBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRenderer.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRenderer.java Tue Aug  1 10:43:28 2006
@@ -1,29 +1,29 @@
-/*
- * Copyright 2004 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.renderkit.html.ext;
-
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase;
-
-/**
- * X-CHECKED: tlddoc h:panelGrid 1.0 final
- *
- * @author Martin Marinschek (latest modification by $Author: grantsmith $)
- * @version $Revision: 169655 $ $Date: 2005-05-11 18:45:06 +0200 (Wed, 11 May 2005) $
- */
-public class HtmlGridRenderer
-    extends HtmlGridRendererBase
-{
-}
+/*
+ * Copyright 2004 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.renderkit.html.ext;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGridRendererBase;
+
+/**
+ * X-CHECKED: tlddoc h:panelGrid 1.0 final
+ *
+ * @author Martin Marinschek (latest modification by $Author: grantsmith $)
+ * @version $Revision: 169655 $ $Date: 2005-05-11 18:45:06 +0200 (Wed, 11 May 2005) $
+ */
+public class HtmlGridRenderer
+    extends HtmlGridRendererBase
+{
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGridRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java Tue Aug  1 10:43:28 2006
@@ -1,28 +1,28 @@
-/*
- * Copyright 2004 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.renderkit.html.ext;
-
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGroupRendererBase;
-
-
-/**
- * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
- * @version $Revision: 167446 $ $Date: 2004-12-23 13:03:09Z $
- */
-public class HtmlGroupRenderer
-    extends HtmlGroupRendererBase
-{
-}
+/*
+ * Copyright 2004 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.renderkit.html.ext;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlGroupRendererBase;
+
+
+/**
+ * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
+ * @version $Revision: 167446 $ $Date: 2004-12-23 13:03:09Z $
+ */
+public class HtmlGroupRenderer
+    extends HtmlGroupRendererBase
+{
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRenderer.java?rev=427657&r1=427656&r2=427657&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRenderer.java Tue Aug  1 10:43:28 2006
@@ -1,32 +1,32 @@
-/*
- * Copyright 2004 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.renderkit.html.ext;
-
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlImageRendererBase;
-
-
-/**
- * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
- * @author Bruno Aranda
- * @version $Revision: 167446 $ $Date: 2004-12-23 13:03:09Z $
- */
-public class HtmlImageRenderer
-    extends HtmlImageRendererBase
-{
-	
-	
-	
-}
+/*
+ * Copyright 2004 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.renderkit.html.ext;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlImageRendererBase;
+
+
+/**
+ * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
+ * @author Bruno Aranda
+ * @version $Revision: 167446 $ $Date: 2004-12-23 13:03:09Z $
+ */
+public class HtmlImageRenderer
+    extends HtmlImageRendererBase
+{
+	
+	
+	
+}

Propchange: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlImageRenderer.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message