myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r904288 [3/13] - in /myfaces/tomahawk/trunk/examples/simple20: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/myfaces/ src/main/java/org/apache/myfaces/examples/ src/main/java/org/apac...
Date Thu, 28 Jan 2010 22:52:00 GMT
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountry.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountry.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountry.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountry.java Thu Jan 28 22:51:42 2010
@@ -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.examples.listexample;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.html.HtmlDataTable;
+import javax.faces.event.ActionEvent;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: skitching $)
+ * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (jue, 03 jul 2008) $
+ */
+public class SimpleCountry implements Serializable
+{
+    /**
+     * serial id for serialisation versioning
+     */
+    private static final long serialVersionUID = 1L;
+    private long _id;
+    private String _name;
+    private String _isoCode;
+    private BigDecimal _size;
+    private boolean _remove = false;
+    private List _cities;
+    private String mSortCitiesColumn;
+    private boolean mIsSortCitiesAscending;
+    
+    public SimpleCountry(long id, String name, String isoCode, BigDecimal size, SimpleCity[] cities)
+    {
+        _id = id;
+        _name = name;
+        _isoCode = isoCode;
+        _size = size;
+
+        if (cities != null)
+            _cities = new ArrayList(Arrays.asList(cities));
+        else
+            _cities = new ArrayList();
+    }
+
+    public long getId()
+    {
+        return _id;
+    }
+
+    public String getName()
+    {
+        return _name;
+    }
+
+    public String getIsoCode()
+    {
+        return _isoCode;
+    }
+
+    public BigDecimal getSize()
+    {
+        return _size;
+    }
+
+    public List getCities()
+    {
+        if (mSortCitiesColumn != null)
+        {
+            Collections.sort(_cities, new Comparator()
+            {
+                public int compare(Object arg0, Object arg1)
+                {
+                    SimpleCity lhs;
+                    SimpleCity rhs;
+                    if (isSortCitiesAscending())
+                    {
+                        lhs = (SimpleCity) arg0;
+                        rhs = (SimpleCity) arg1;
+                    }
+                    else
+                    {
+                        rhs = (SimpleCity) arg0;
+                        lhs = (SimpleCity) arg1;
+                    }
+                    String lhsName = lhs.getName();
+                    String rhsName = rhs.getName();
+                    if (lhsName != null)
+                    {
+                        if(rhsName != null)
+                        {
+                            return lhsName.compareToIgnoreCase(rhsName);
+                        }
+                        return -1;
+                    }
+                    else if (rhsName != null)
+                    {
+                        return 1;
+                    }
+                    return 0;
+                }
+            });
+        }
+        return _cities;
+    }
+
+    public void setId(long id)
+    {
+        _id = id;
+    }
+
+    public void setIsoCode(String isoCode)
+    {
+        _isoCode = isoCode;
+    }
+
+    public void setName(String name)
+    {
+        _name = name;
+    }
+
+    public void setSize(BigDecimal size)
+    {
+        _size = size;
+    }
+
+    public boolean isRemove()
+    {
+        return _remove;
+    }
+
+    public void setRemove(boolean remove)
+    {
+        _remove = remove;
+    }
+
+    public String addCity()
+    {
+        getCities().add(new SimpleCity());
+        return null;
+    }
+
+    public void deleteCity(ActionEvent ev)
+    {
+        UIData datatable = findParentHtmlDataTable(ev.getComponent());
+        getCities().remove(datatable.getRowIndex() + datatable.getFirst());
+    }
+
+    public void setSortCitiesColumn(String columnName)
+    {
+        mSortCitiesColumn = columnName;
+    }
+
+    /**
+     * @return Returns the sortCitiesColumn.
+     */
+    public String getSortCitiesColumn()
+    {
+        return mSortCitiesColumn;
+    }
+
+    public boolean isSortCitiesAscending()
+    {
+        return mIsSortCitiesAscending;
+    }
+
+    /**
+     * @param isSortCitiesAscending The isSortCitiesAscending to set.
+     */
+    public void setSortCitiesAscending(boolean isSortCitiesAscending)
+    {
+        mIsSortCitiesAscending = isSortCitiesAscending;
+    }
+
+    /**
+     * @param component
+     * @return
+     */
+    private HtmlDataTable findParentHtmlDataTable(UIComponent component)
+    {
+        if (component == null)
+        {
+            return null;
+        }
+        if (component instanceof HtmlDataTable)
+        {
+            return (HtmlDataTable) component;
+        }
+        return findParentHtmlDataTable(component.getParent());
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,129 @@
+/*
+ * 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.examples.listexample;
+
+import javax.faces.context.FacesContext;
+
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler (latest modification by $Author: skitching $)
+ * @author Thomas Spiegl
+ * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (jue, 03 jul 2008) $
+ */
+public class SimpleCountryForm
+{
+    private boolean renderHeader = true;
+    private boolean renderFooter = true;
+    
+    private long _id;
+    private String _name;
+    private String _isoCode;
+
+    public long getId()
+    {
+        return _id;
+    }
+
+    public void setId(long id)
+    {
+        _id = id;
+        if (_id > 0)
+        {
+            SimpleCountry simpleCountry = getList().getSimpleCountry(_id);
+            if (simpleCountry == null)
+            {
+                return;
+            }
+            _name = simpleCountry.getName();
+            _isoCode = simpleCountry.getIsoCode();
+        }
+    }
+
+    public void setIsoCode(String isoCode)
+    {
+        _isoCode = isoCode;
+    }
+
+    public String getIsoCode()
+    {
+        return _isoCode;
+    }
+
+    public String getName()
+    {
+        return _name;
+    }
+
+    public void setName(String name)
+    {
+        _name = name;
+    }
+
+    private SimpleCountry getSimpleCountry()
+    {
+        return new SimpleCountry(_id, _name, _isoCode, null, null);
+    }
+
+    public boolean isRenderFooter()
+    {
+        return renderFooter;
+    }
+
+    public void setRenderFooter(boolean renderFooter)
+    {
+        this.renderFooter = renderFooter;
+    }
+
+    public boolean isRenderHeader()
+    {
+        return renderHeader;
+    }
+
+    public void setRenderHeader(boolean renderHeader)
+    {
+        this.renderHeader = renderHeader;
+    }
+
+    public String save()
+    {
+        getList().saveSimpleCountry(getSimpleCountry());
+        return "ok_next";
+    }
+
+    public String delete()
+    {
+        getList().deleteSimpleCountry(getSimpleCountry());
+        return "ok_next";
+    }
+
+    public String apply()
+    {
+        getList().saveSimpleCountry(getSimpleCountry());
+        return "ok";
+    }
+
+    private SimpleCountryList getList()
+    {
+        Object obj = FacesContext.getCurrentInstance().getApplication().getVariableResolver()
+            .resolveVariable(FacesContext.getCurrentInstance(), "countryList");
+        return (SimpleCountryList) obj;
+
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCountryList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,184 @@
+/*
+ * 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.examples.listexample;
+
+import org.apache.myfaces.component.html.ext.HtmlDataTable;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: skitching $)
+ * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (jue, 03 jul 2008) $
+ */
+public class SimpleCountryList
+{
+    private List _countries = new ArrayList();
+    static
+    {
+    }
+
+    SimpleCountry getSimpleCountry(long id)
+    {
+        for (int i = 0; i < _countries.size(); i++)
+        {
+            SimpleCountry country = (SimpleCountry)_countries.get(i);
+            if (country.getId() == id)
+            {
+                return country;
+            }
+        }
+        return null;
+    }
+
+    long getNewSimpleCountryId()
+    {
+        long maxId = 0;
+        for (int i = 0; i < _countries.size(); i++)
+        {
+            SimpleCountry country = (SimpleCountry)_countries.get(i);
+            if (country.getId() > maxId)
+            {
+                maxId = country.getId();
+            }
+        }
+        return maxId + 1;
+    }
+
+    void saveSimpleCountry(SimpleCountry simpleCountry)
+    {
+        if (simpleCountry.getId() == 0)
+        {
+            simpleCountry.setId(getNewSimpleCountryId());
+        }
+        boolean found = false;
+        for (int i = 0; i < _countries.size(); i++)
+        {
+            SimpleCountry country = (SimpleCountry)_countries.get(i);
+            if (country.getId() == simpleCountry.getId())
+            {
+                _countries.set(i, simpleCountry);
+                found = true;
+            }
+        }
+        if (!found)
+        {
+            _countries.add(simpleCountry);
+        }
+    }
+
+    void deleteSimpleCountry(SimpleCountry simpleCountry)
+    {
+        for (int i = 0; i < _countries.size(); i++)
+        {
+            SimpleCountry country = (SimpleCountry)_countries.get(i);
+            if (country.getId() == simpleCountry.getId())
+            {
+                _countries.remove(i);
+            }
+        }
+    }
+
+    public SimpleCountryList()
+    {
+        _countries.add(new SimpleCountry(1, "AUSTRIA", "AT", new BigDecimal(123L), createCities(new String[]{"Wien","Graz","Linz","Salzburg"})));
+        _countries.add(new SimpleCountry(2, "AZERBAIJAN", "AZ", new BigDecimal(535L), createCities(new String[]{"Baku","Sumgait","Qabala","Agdam"})));
+        _countries.add(new SimpleCountry(3, "BAHAMAS", "BS", new BigDecimal(1345623L), createCities(new String[]{"Nassau","Alice Town","Church Grove","West End"})));
+        _countries.add(new SimpleCountry(4, "BAHRAIN", "BH", new BigDecimal(346L), createCities(new String[]{"Bahrain"})));
+        _countries.add(new SimpleCountry(5, "BANGLADESH", "BD", new BigDecimal(456L), createCities(new String[]{"Chittagong","Chandpur","Bogra","Feni"})));
+        _countries.add(new SimpleCountry(6, "BARBADOS", "BB", new BigDecimal(45645L), createCities(new String[]{"Grantley Adams"})));
+    }
+
+    /**
+     * @param names
+     * @return
+     */
+    private SimpleCity[] createCities(String[] names)
+    {
+        SimpleCity[] result = new SimpleCity[names.length];
+        for (int i = 0; i < result.length; i++)
+        {
+            result[i] = new SimpleCity(names[i]);
+        }
+        return result;
+    }
+
+    public List getCountries()
+    {
+        return _countries;
+    }
+    
+    public Map getCountryMap()
+    {
+        Map map = new HashMap();
+
+        List li = getCountries();
+
+        for (int i = 0; i < li.size(); i++)
+        {
+            SimpleCountry simpleCountry = (SimpleCountry) li.get(i);
+            map.put(simpleCountry.getIsoCode(),simpleCountry.getName());
+        }
+
+        return map;
+    }
+    
+    public void setCountries(List countries)
+    {
+        _countries = countries;
+    }
+
+    public String addCountry()
+    {
+        List list = getCountries();
+        list.add(new SimpleCountry(list.size() + 1, "", "", new BigDecimal(0), createCities(new String[] {})));
+        return "ok";
+    }
+
+    public void deleteCountry(ActionEvent ev)
+    {
+        UIData datatable = findParentHtmlDataTable(ev.getComponent());
+        getCountries().remove(datatable.getRowIndex() + datatable.getFirst());
+    }
+
+    /**
+     * @param component
+     * @return
+     */
+    private HtmlDataTable findParentHtmlDataTable(UIComponent component)
+    {
+        if (component == null)
+        {
+            return null;
+        }
+        if (component instanceof HtmlDataTable)
+        {
+            return (HtmlDataTable) component;
+        }
+        return findParentHtmlDataTable(component.getParent());
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleDemo.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleDemo.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleDemo.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleDemo.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,75 @@
+/*
+ * 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.examples.listexample;
+
+import java.io.Serializable;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: werpu $)
+ * @version $Revision: 371731 $ $Date: 2006-01-24 01:18:44 +0100 (Di, 24 Jan 2006) $
+ */
+public class SimpleDemo
+        implements Serializable
+{
+    /**
+     * serial id for serialisation versioning
+     */
+    private static final long serialVersionUID = 1L;
+    private int _id;
+    private String _value1;
+    private String _value2;
+
+    public SimpleDemo(int id, String type, String color)
+    {
+        _id = id;
+        _value1 = type;
+        _value2 = color;
+    }
+
+    public int getId()
+    {
+        return _id;
+    }
+
+    public void setId(int id)
+    {
+        _id = id;
+    }
+
+    public String getValue1()
+    {
+        return _value1;
+    }
+
+    public void setValue1(String value1)
+    {
+        _value1 = value1;
+    }
+
+    public String getValue2()
+    {
+        return _value2;
+    }
+
+    public void setValue2(String value2)
+    {
+        _value2 = value2;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleGroupByList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleGroupByList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleGroupByList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleGroupByList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.examples.listexample;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class SimpleGroupByList
+{
+    private List _demoList = new ArrayList();
+
+    private Map _demoListMap = new HashMap();
+
+    public SimpleGroupByList()
+    {
+        for (int i = 0; i < 12; i++)
+        {
+            Object demo = new SimpleDemo(i, (i < 3 )? "Group 1":(i < 6 ) ? "Group 2": (i < 9)?"Group 3":"Group 4", "Item "+i);
+            _demoList.add(demo);
+            _demoListMap.put(new Integer(i), demo);
+        }
+    }
+
+    public List getDemoList()
+    {
+        return _demoList;
+    }
+
+    public void setDemoList(List demo)
+    {
+        _demoList = demo;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleSortableCarList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleSortableCarList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleSortableCarList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleSortableCarList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,83 @@
+/*
+ * 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.examples.listexample;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class SimpleSortableCarList extends SortableList
+{
+    private List _cars;
+
+    public SimpleSortableCarList()
+    {
+        super("type");
+
+        _cars = new ArrayList();
+        _cars.add(new SimpleCar(1, "car A", "red"));
+        _cars.add(new SimpleCar(1, "car B", "blue"));
+        _cars.add(new SimpleCar(1, "car C", "green"));
+        _cars.add(new SimpleCar(1, "car D", "yellow"));
+        _cars.add(new SimpleCar(1, "car E", "orange"));
+    }
+
+    public List getCars()
+    {
+        sort(getSort(), isAscending());
+        return _cars;
+    }
+
+    protected boolean isDefaultAscending(String sortColumn)
+    {
+        return true;
+    }
+
+    protected void sort(final String column, final boolean ascending)
+    {
+        Comparator comparator = new Comparator()
+        {
+            public int compare(Object o1, Object o2)
+            {
+                SimpleCar c1 = (SimpleCar)o1;
+                SimpleCar c2 = (SimpleCar)o2;
+                if (column == null)
+                {
+                    return 0;
+                }
+                if (column.equals("type"))
+                {
+                    return ascending ? c1.getType().compareTo(c2.getType()) : c2.getType().compareTo(c1.getType());
+                }
+                else if (column.equals("color"))
+                {
+                    return ascending ? c1.getColor().compareTo(c2.getColor()) : c2.getColor().compareTo(c1.getColor());
+                }
+                else return 0;
+            }
+        };
+        Collections.sort(_cars, comparator);
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SortableList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SortableList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SortableList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SortableList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,91 @@
+/*
+ * 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.examples.listexample;
+
+
+
+/**
+ * Convenient base class for sortable lists.
+ * @author Thomas Spiegl (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public abstract class SortableList
+{
+    private String _sort;
+    private boolean _ascending;
+
+    protected SortableList(String defaultSortColumn)
+    {
+        _sort = defaultSortColumn;
+        _ascending = isDefaultAscending(defaultSortColumn);
+    }
+
+    /**
+     * Sort the list.
+     */
+    protected abstract void sort(String column, boolean ascending);
+
+    /**
+     * Is the default sort direction for the given column "ascending" ?
+     */
+    protected abstract boolean isDefaultAscending(String sortColumn);
+
+
+    public void sort(String sortColumn)
+    {
+        if (sortColumn == null)
+        {
+            throw new IllegalArgumentException("Argument sortColumn must not be null.");
+        }
+
+        if (_sort.equals(sortColumn))
+        {
+            //current sort equals new sortColumn -> reverse sort order
+            _ascending = !_ascending;
+        }
+        else
+        {
+            //sort new column in default direction
+            _sort = sortColumn;
+            _ascending = isDefaultAscending(_sort);
+        }
+
+        sort(_sort, _ascending);
+    }
+
+    public String getSort()
+    {
+        return _sort;
+    }
+
+    public void setSort(String sort)
+    {
+        _sort = sort;
+    }
+
+    public boolean isAscending()
+    {
+        return _ascending;
+    }
+
+    public void setAscending(boolean ascending)
+    {
+        _ascending = ascending;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeItem.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeItem.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeItem.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeItem.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,123 @@
+/*
+ * 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.examples.listexample;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * Bean class holding a tree item.
+ * </p>
+ * 
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ * */
+public class TreeItem implements Serializable
+{
+    /**
+     * serial id for serialisation versioning
+     */
+    private static final long serialVersionUID = 1L;
+
+    private int id;
+
+    private String name;
+
+    private String isoCode;
+
+    private String description;
+
+    
+    /**
+     * @param id The id.
+     * @param name The name.
+     * @param isoCode The isoCode.
+     * @param description The description.
+     */
+    public TreeItem(int id, String name, String isoCode, String description)
+    {
+        this.id = id;
+        this.name = name;
+        this.isoCode = isoCode;
+        this.description = description;
+    }
+
+    /**
+     * @return Returns the description.
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+
+    /**
+     * @param description The description to set.
+     */
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    /**
+     * @return Returns the id.
+     */
+    public int getId()
+    {
+        return id;
+    }
+
+    /**
+     * @param id The id to set.
+     */
+    public void setId(int id)
+    {
+        this.id = id;
+    }
+
+    /**
+     * @return Returns the isoCode.
+     */
+    public String getIsoCode()
+    {
+        return isoCode;
+    }
+
+    /**
+     * @param isoCode The isoCode to set.
+     */
+    public void setIsoCode(String isoCode)
+    {
+        this.isoCode = isoCode;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeTable.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeTable.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/TreeTable.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,98 @@
+/*
+ * 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.examples.listexample;
+
+import java.io.Serializable;
+
+import org.apache.myfaces.custom.tree.DefaultMutableTreeNode;
+import org.apache.myfaces.custom.tree.model.DefaultTreeModel;
+
+/**
+ * <p>
+ * Bean holding the tree hierarchy.
+ * </p>
+ * 
+ * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
+ */
+public class TreeTable implements Serializable
+{
+    /**
+     * serial id for serialisation versioning
+     */
+    private static final long serialVersionUID = 1L;
+    
+    private DefaultTreeModel  treeModel;
+
+    /**
+     * @param treeModel The treeModel.
+     */
+    public TreeTable(DefaultTreeModel treeModel)
+    {
+        this.treeModel = treeModel;
+    }
+
+    /**
+     * <p>
+     * Default constructor.
+     * </p>
+     */
+    public TreeTable()
+    {
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeItem(1, "XY", "9001", "XY 9001"));
+        DefaultMutableTreeNode a = new DefaultMutableTreeNode(new TreeItem(2, "A", "9001", "A 9001"));
+        root.insert(a);
+        DefaultMutableTreeNode b = new DefaultMutableTreeNode(new TreeItem(3, "B", "9001", "B 9001"));
+        root.insert(b);
+        DefaultMutableTreeNode c = new DefaultMutableTreeNode(new TreeItem(4, "C", "9001", "C 9001"));
+        root.insert(c);
+
+        DefaultMutableTreeNode node = new DefaultMutableTreeNode(new TreeItem(5, "a1", "9002", "a1 9002"));
+        a.insert(node);
+        node = new DefaultMutableTreeNode(new TreeItem(6, "a2", "9002", "a2 9002"));
+        a.insert(node);
+        node = new DefaultMutableTreeNode(new TreeItem(7, "a3", "9002", "a3 9002"));
+        a.insert(node);
+        node = new DefaultMutableTreeNode(new TreeItem(8, "b", "9002", "b 9002"));
+        b.insert(node);
+
+        a = node;
+        node = new DefaultMutableTreeNode(new TreeItem(9, "x1", "9003", "x1 9003"));
+        a.insert(node);
+        node = new DefaultMutableTreeNode(new TreeItem(9, "x2", "9003", "x2 9003"));
+        a.insert(node);
+
+        this.treeModel = new DefaultTreeModel(root);
+    }
+
+    /**
+     * @return Returns the treeModel.
+     */
+    public DefaultTreeModel getTreeModel()
+    {
+        return treeModel;
+    }
+
+    /**
+     * @param treeModel The treeModel to set.
+     */
+    public void setTreeModel(DefaultTreeModel treeModel)
+    {
+        this.treeModel = treeModel;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/AutoScrollBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/AutoScrollBean.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/AutoScrollBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/AutoScrollBean.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.examples.misc;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Bean to demonstrate the org.apache.myfaces.AUTO_SCROLL init parameter behaviour
+ *
+ * @author Bruno Aranda (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class AutoScrollBean
+{
+
+    private List numbers;
+
+    public AutoScrollBean()
+    {
+        this.numbers = new ArrayList(100);
+
+        for (int i=0; i<100; i++)
+        {
+            numbers.add(String.valueOf(i));
+        }
+    }
+
+    public List getNumbers()
+    {
+        return numbers;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/FileUploadForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/FileUploadForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/FileUploadForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/FileUploadForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,71 @@
+/*
+ * 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.examples.misc;
+
+import java.io.IOException;
+
+import org.apache.myfaces.custom.fileupload.UploadedFile;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class FileUploadForm
+{
+    private UploadedFile _upFile;
+    private String _name = "";
+
+    public UploadedFile getUpFile()
+    {
+        return _upFile;
+    }
+
+    public void setUpFile(UploadedFile upFile)
+    {
+        _upFile = upFile;
+    }
+
+    public String getName()
+    {
+        return _name;
+    }
+
+    public void setName(String name)
+    {
+        _name = name;
+    }
+
+    public String upload() throws IOException
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        facesContext.getExternalContext().getApplicationMap().put("fileupload_bytes", _upFile.getBytes());
+        facesContext.getExternalContext().getApplicationMap().put("fileupload_type", _upFile.getContentType());
+        facesContext.getExternalContext().getApplicationMap().put("fileupload_name", _upFile.getName());
+        return "ok";
+    }
+
+    public boolean isUploaded()
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        return facesContext.getExternalContext().getApplicationMap().get("fileupload_bytes")!=null;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/GlobalOptions.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/GlobalOptions.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/GlobalOptions.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/GlobalOptions.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,50 @@
+/*
+ * 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.examples.misc;
+
+/**
+ * Global (dynamically changeable) options for examples application.
+ * @author Manfred Geiler (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class GlobalOptions
+{
+    private String _pageLayout;
+
+    public String getPageLayout()
+    {
+        return _pageLayout;
+    }
+
+    public void setPageLayout(String pageLayout)
+    {
+        _pageLayout = pageLayout;
+    }
+
+
+    public String getNumericAsString() {
+        return "23";
+    }
+
+    
+    public long getNumeric() {
+        return 23L;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/Language.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/Language.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/Language.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/Language.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.misc;
+
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2005-03-24 12:47:11 -0400 (Thu, 24 Mar 2005) $
+ */
+public class Language
+{
+    private String code = null;
+
+    public String getCode() {
+        return code;
+    }
+    public void setCode(String code) {
+        this.code = code;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/NavigationMenu.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,133 @@
+/*
+ * 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.examples.misc;
+
+import org.apache.myfaces.custom.navmenu.NavigationMenuItem;
+import org.apache.myfaces.custom.navmenu.jscookmenu.HtmlCommandJSCookMenu;
+import org.apache.myfaces.custom.navmenu.htmlnavmenu.HtmlCommandNavigationItem;
+import org.apache.myfaces.examples.util.GuiUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.faces.event.ActionEvent;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Thomas Spiegl (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class NavigationMenu {
+    private static final Log log = LogFactory.getLog(NavigationMenu.class);
+
+    public NavigationMenuItem[] getInfoItems() {
+        String label = GuiUtil.getMessageResource("nav_Info", null);
+        NavigationMenuItem[] menu = new NavigationMenuItem[1];
+
+        menu[0] = new NavigationMenuItem(label, null, null, true);
+
+        NavigationMenuItem[] items = new NavigationMenuItem[2];
+        menu[0].setNavigationMenuItems(items);
+
+        label = GuiUtil.getMessageResource("nav_Contact", null);
+        items[0] = new NavigationMenuItem(label, "go_contact", "images/help.gif", false);
+
+        label = GuiUtil.getMessageResource("nav_Copyright", null);
+        items[1] = new NavigationMenuItem(label, "go_copyright", "images/help.gif", false);
+
+        return menu;
+    }
+
+    public List getJSCookMenuNavigationItems() {
+        List menu = new ArrayList();
+        menu.add(getMenuNaviagtionItem("Home", "go_home"));
+        return menu;
+    }
+
+    public List getPanelNavigationItems() {
+        List menu = new ArrayList();
+        // Products
+        NavigationMenuItem products = getMenuNaviagtionItem("#{example_messages['panelnav_products']}", null);
+        menu.add(products);
+        products.add(getMenuNaviagtionItem("#{example_messages['panelnav_serach']}", "#{navigationMenu.getAction2}"));
+        products.add(getMenuNaviagtionItem("#{example_messages['panelnav_serach_acc']}", "#{navigationMenu.getAction2}"));
+        NavigationMenuItem item = getMenuNaviagtionItem("#{example_messages['panelnav_search_adv']}", "#{navigationMenu.getAction2}");
+        item.setActive(true);
+        item.setOpen(true);
+        item.setTarget("_blank");
+        products.add(item);
+        // Shop
+        menu.add(getMenuNaviagtionItem("#{example_messages['panelnav_shop']}", "#{navigationMenu.getAction2}"));
+        // Corporate Info
+        NavigationMenuItem corporateInfo = getMenuNaviagtionItem("#{example_messages['panelnav_corporate']}", null);
+        menu.add(corporateInfo);
+        corporateInfo.add(getMenuNaviagtionItem("#{example_messages['panelnav_news']}", "#{navigationMenu.getAction2}"));
+        item = getMenuNaviagtionItem("#{example_messages['panelnav_investor']}", "#{navigationMenu.getAction3}");
+        //item.setIcon("images/arrow-first.gif");
+        item.setDisabled(true);
+        corporateInfo.add(item);
+        // Contact
+        menu.add(getMenuNaviagtionItem("#{example_messages['panelnav_contact']}", "#{navigationMenu.getAction2}"));
+        // External Link
+        item = getMenuNaviagtionItem("#{example_messages['panelnav_contact']}", null);
+        item.setExternalLink("#{example_messages['external_link']}");
+        item.setTarget("_blank");
+        menu.add(item);
+        return menu;
+    }
+
+    private static NavigationMenuItem getMenuNaviagtionItem(String label, String action) {
+        NavigationMenuItem item = new NavigationMenuItem(label, action);
+        item.setActionListener("#{navigationMenu.actionListener}");
+        item.setValue(label);
+        return item;
+    }
+
+    public String getAction1() {
+        return "go_panelnavigation_1";
+    }
+
+    public String actionListener(ActionEvent event) {
+        if (event.getComponent() instanceof HtmlCommandNavigationItem) {
+            log.info("ActionListener: " + ((HtmlCommandNavigationItem) event.getComponent()).getValue());
+            return getAction1();
+        }
+        else {
+            String outcome = (String) ((HtmlCommandJSCookMenu) event.getComponent()).getValue();
+            log.info("ActionListener: " + outcome);
+            return outcome;
+        }
+    }
+
+    public String getAction2() {
+        return "go_panelnavigation_2";
+    }
+
+    public String getAction3() {
+        return "go_panelnavigation_3";
+    }
+
+    public String goHome() {
+        return "go_home";
+    }
+
+    public boolean getDisabled() {
+        return true;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsController.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsController.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsController.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsController.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.examples.misc;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class OptionsController
+{
+    public String changeLocale()
+    {
+        FacesContext facesContext = FacesContext.getCurrentInstance();
+        VariableResolver vr = facesContext.getApplication().getVariableResolver();
+        OptionsForm form = (OptionsForm)vr.resolveVariable(facesContext, "optionsForm");
+        facesContext.getViewRoot().setLocale(form.getLocale());
+        return "ok";
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/OptionsForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,85 @@
+/*
+ * 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.examples.misc;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import java.util.AbstractList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler (latest modification by $Author: skitching $)
+ * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (jue, 03 jul 2008) $
+ */
+public class OptionsForm
+{
+    private static final Locale SPANISH = new Locale("es", "","");
+    private static final Locale CATALAN = new Locale("ca", "","");
+
+    private static final List AVAILABLE_LOCALES
+        = Arrays.asList(new Locale[] {Locale.ENGLISH,
+                                      Locale.CHINESE,
+                                      Locale.GERMAN,
+                                      Locale.JAPANESE,
+                                      Locale.FRENCH,
+                                      SPANISH,
+                                      CATALAN});
+
+    private Locale _locale = null;
+
+    public String getLanguage()
+    {
+        return _locale != null
+                ? _locale.getLanguage()
+                : FacesContext.getCurrentInstance().getViewRoot().getLocale().getLanguage();
+    }
+
+    public void setLanguage(String language)
+    {
+        _locale = new Locale(language);
+    }
+
+    public Locale getLocale()
+    {
+        return _locale;
+    }
+
+    public List getAvailableLanguages()
+    {
+        return new AbstractList()
+        {
+            public Object get(int index)
+            {
+                Locale locale = (Locale)AVAILABLE_LOCALES.get(index);
+                String language = locale.getDisplayLanguage(locale);
+                return new SelectItem(locale.getLanguage(), language, language);
+            }
+
+            public int size()
+            {
+                return AVAILABLE_LOCALES.size();
+            }
+        };
+    }
+
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TabbedPaneBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TabbedPaneBean.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TabbedPaneBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TabbedPaneBean.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.examples.misc;
+
+import java.io.Serializable;
+
+/**
+ * @author Manfred Geiler (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class TabbedPaneBean implements Serializable
+{
+    //private static final Log log = LogFactory.getLog(TabbedPaneBean.class);
+
+    /**
+     * serial id for serialisation versioning
+     */
+    private static final long serialVersionUID = 1L;
+    
+    private boolean           _tab1Visible     = true;
+    private boolean           _tab2Visible     = true;
+    private boolean           _tab3Visible     = true;
+
+    public boolean isTab1Visible()
+    {
+        return _tab1Visible;
+    }
+
+    public void setTab1Visible(boolean tab1Visible)
+    {
+        _tab1Visible = tab1Visible;
+    }
+
+    public boolean isTab2Visible()
+    {
+        return _tab2Visible;
+    }
+
+    public void setTab2Visible(boolean tab2Visible)
+    {
+        _tab2Visible = tab2Visible;
+    }
+
+    public boolean isTab3Visible()
+    {
+        return _tab3Visible;
+    }
+
+    public void setTab3Visible(boolean tab3Visible)
+    {
+        _tab3Visible = tab3Visible;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBox.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBox.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBox.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBox.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,47 @@
+/*
+ * 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.examples.misc;
+
+import java.io.Serializable;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class TestCheckBox implements Serializable
+{
+    private boolean checked;
+    private String text;
+
+ 
+    public boolean isChecked() {
+        return checked;
+    }
+    public void setChecked(boolean checked) {
+        this.checked = checked;
+    }
+    
+    
+    public String getText() {
+        return text;
+    }
+    public void setText(String text) {
+        this.text = text;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBoxList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBoxList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBoxList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestCheckBoxList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.examples.misc;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class TestCheckBoxList
+{
+    private List testCheckBoxes;
+    
+    public TestCheckBoxList(){
+        testCheckBoxes = new ArrayList(3);
+        
+        for(int i=0 ; i<3 ; i++)
+            testCheckBoxes.add( new TestCheckBox() );
+    }
+
+    public List getTestCheckBoxes() {
+        return testCheckBoxes;
+    }
+    public void setTestCheckBoxes(List testCheckBoxes) {
+        this.testCheckBoxes = testCheckBoxes;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestRadioButton.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestRadioButton.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestRadioButton.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/misc/TestRadioButton.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.examples.misc;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class TestRadioButton
+{
+    private String choice;
+
+    public String getChoice() {
+        return choice;
+    }
+    public void setChoice(String choice) {
+        this.choice = choice;
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/picklist/PicklistBean.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,73 @@
+/*
+ * 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.examples.picklist;
+
+import java.util.ArrayList;
+
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+public class PicklistBean
+{
+    private ArrayList testList = new ArrayList();
+
+    private String selectedInfo;
+
+    public PicklistBean()
+    {
+        testList.add(new SelectItem("option4", "another option 4"));
+        testList.add(new SelectItem("option5", "another option 5"));
+        testList.add(new SelectItem("option6", "another option 6"));
+    }
+
+    public void selectionChanged(ValueChangeEvent evt)
+    {
+        String[] selectedValues = (String[]) evt.getNewValue();
+
+        if (selectedValues.length == 0)
+        {
+            selectedInfo = "No selected values";
+        }
+        else
+        {
+
+            StringBuffer sb = new StringBuffer("Selected values: ");
+
+            for (int i = 0; i < selectedValues.length; i++)
+            {
+                if (i > 0)
+                    sb.append(", ");
+                sb.append(selectedValues[i]);
+            }
+
+            selectedInfo = sb.toString();
+        }
+    }
+
+    public ArrayList getTestList()
+    {
+        return testList;
+    }
+
+    public String getSelectedInfo()
+    {
+        return selectedInfo;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/AddEntryHandler.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,135 @@
+/*
+ * 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.examples.schedule;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.myfaces.custom.schedule.model.DefaultScheduleEntry;
+import org.apache.myfaces.custom.schedule.model.ScheduleModel;
+
+/**
+ * Handler class for manually adding an entry to the example schedule model.
+ * 
+ * @author Jurgen Lust (latest modification by $Author$)
+ * @version $Revision$
+ */
+public class AddEntryHandler implements Serializable
+{
+    private static final long serialVersionUID = -4253400845605088699L;
+
+    private Date from;
+
+    private Date until;
+
+    private String title;
+
+    private String location;
+
+    private String comments;
+
+    private ScheduleModel model;
+
+    public String getComments()
+    {
+        return comments;
+    }
+
+    public void setComments(String comments)
+    {
+        this.comments = comments;
+    }
+
+    public Date getFrom()
+    {
+        return from;
+    }
+
+    public void setFrom(Date from)
+    {
+        this.from = from;
+    }
+
+    public String getLocation()
+    {
+        return location;
+    }
+
+    public void setLocation(String location)
+    {
+        this.location = location;
+    }
+
+    public ScheduleModel getModel()
+    {
+        return model;
+    }
+
+    public void setModel(ScheduleModel model)
+    {
+        this.model = model;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+
+    public Date getUntil()
+    {
+        return until;
+    }
+
+    public void setUntil(Date until)
+    {
+        this.until = until;
+    }
+
+    public String add()
+    {
+        if (!from.before(until))
+        {
+            FacesContext.getCurrentInstance().addMessage(
+                    null,
+                    new FacesMessage(FacesMessage.SEVERITY_ERROR,
+                            "start time must be before end time", null));
+            return "failure";
+        }
+        DefaultScheduleEntry entry = new DefaultScheduleEntry();
+        entry.setId(RandomStringUtils.randomNumeric(32));
+        entry.setStartTime(from);
+        entry.setEndTime(until);
+        entry.setTitle(title);
+        entry.setSubtitle(location);
+        entry.setDescription(comments);
+        model.addEntry(entry);
+        model.refresh();
+        return "success";
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/BindingScheduleExampleHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/BindingScheduleExampleHandler.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/BindingScheduleExampleHandler.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/BindingScheduleExampleHandler.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,97 @@
+/*
+ * 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.examples.schedule;
+
+import java.io.Serializable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.custom.schedule.HtmlSchedule;
+import org.apache.myfaces.custom.schedule.ScheduleMouseEvent;
+
+/**
+ * Handler class for demonstrating the schedule mouse events.
+ * 
+ * @author Jurgen Lust (latest modification by $Author$)
+ * @version $Revision$
+ */
+public class BindingScheduleExampleHandler extends ScheduleExampleHandler
+        implements Serializable
+{
+    private static final long serialVersionUID = 763734566918182549L;
+    private static final Log log = LogFactory
+            .getLog(BindingScheduleExampleHandler.class);
+    private HtmlSchedule schedule;
+    private String mouseActionText;
+
+    public String getMouseActionText()
+    {
+        return mouseActionText;
+    }
+
+    public HtmlSchedule getSchedule()
+    {
+        return schedule;
+    }
+
+    public void setSchedule(HtmlSchedule schedule)
+    {
+        this.schedule = schedule;
+    }
+
+    public String getLastClickedDate()
+    {
+        if (getSchedule() == null
+                || getSchedule().getLastClickedDateAndTime() == null)
+            return "no date/time clicked";
+        return getSchedule().getLastClickedDateAndTime().toString();
+    }
+
+    public String scheduleAction()
+    {
+        log.info("The schedule was clicked");
+        log.info("selected entry: " + schedule.getModel().getSelectedEntry());
+        return "success";
+    }
+
+    public void scheduleClicked(ScheduleMouseEvent event)
+    {
+        log.info("scheduleClicked!!!" + event.getEventType());
+        StringBuffer buffer = new StringBuffer();
+        switch (event.getEventType())
+        {
+        case ScheduleMouseEvent.SCHEDULE_BODY_CLICKED:
+            buffer.append("schedule body was clicked: ");
+            buffer.append(event.getClickedTime());
+            break;
+        case ScheduleMouseEvent.SCHEDULE_HEADER_CLICKED:
+            buffer.append("schedule header was clicked: ");
+            buffer.append(event.getClickedDate());
+            break;
+        case ScheduleMouseEvent.SCHEDULE_ENTRY_CLICKED:
+            buffer.append("schedule entry was clicked.");
+            
+            break;
+        default:
+            buffer.append("no schedule mouse events registered");
+        }
+        mouseActionText = buffer.toString();
+    }
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/RandomColorScheduleEntryRenderer.java Thu Jan 28 22:51:42 2010
@@ -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.examples.schedule;
+
+import java.util.HashMap;
+import java.util.Random;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.custom.schedule.DefaultScheduleEntryRenderer;
+import org.apache.myfaces.custom.schedule.HtmlSchedule;
+import org.apache.myfaces.custom.schedule.model.ScheduleEntry;
+
+/**
+ * An example ScheduleEntryRenderer that assigns a random color to each
+ * entry.
+ * 
+ * @author Jurgen Lust (latest modification by $Author$)
+ * @version $Revision$
+ */
+public class RandomColorScheduleEntryRenderer extends
+        DefaultScheduleEntryRenderer
+{
+    private static final long serialVersionUID = -4594648204963119057L;
+    private HashMap colors = new HashMap();
+
+    public String getColor(FacesContext context, HtmlSchedule schedule,
+            ScheduleEntry entry, boolean selected)
+    {
+        if (colors.containsKey(entry.getId()))
+            return (String) colors.get(entry.getId());
+        StringBuffer color = new StringBuffer();
+        Random random = new Random();
+        color.append("rgb(");
+        color.append(random.nextInt(255));
+        color.append(",");
+        color.append(random.nextInt(255));
+        color.append(",");
+        color.append(random.nextInt(255));
+        color.append(")");
+        String colorString = color.toString();
+        colors.put(entry.getId(), colorString);
+        return colorString;
+    }
+
+}

Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/schedule/ScheduleExampleHandler.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,156 @@
+/*
+ * 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.examples.schedule;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import javax.faces.event.ActionEvent;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.myfaces.custom.schedule.model.DefaultScheduleEntry;
+import org.apache.myfaces.custom.schedule.model.ScheduleModel;
+import org.apache.myfaces.custom.schedule.model.SimpleScheduleModel;
+
+/**
+ * Handler class for the schedule example 
+ * 
+ * @author Jurgen Lust (latest modification by $Author$)
+ * @version $Revision$
+ */
+public class ScheduleExampleHandler implements Serializable
+{
+    private static final long serialVersionUID = -8815771399735333108L;
+
+    private ScheduleModel model;
+
+    public ScheduleModel getModel()
+    {
+        return model;
+    }
+
+    public void setModel(ScheduleModel model)
+    {
+        this.model = model;
+    }
+
+    public void deleteSelectedEntry(ActionEvent event)
+    {
+        if (model == null)
+            return;
+        model.removeSelectedEntry();
+    }
+
+    public void addSampleHoliday(ActionEvent event)
+    {
+        if (model instanceof SimpleScheduleModel)
+        {
+            SimpleScheduleModel ssm = (SimpleScheduleModel) model;
+            Calendar calendar = GregorianCalendar.getInstance();
+            calendar.setTime(ssm.getSelectedDate());
+            calendar.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
+            ssm.setHoliday(calendar.getTime(), "Poeperkesdag");
+            ssm.refresh();
+        }
+    }
+
+    public void addSampleEntries(ActionEvent event)
+    {
+        if (model == null)
+            return;
+        Calendar calendar = GregorianCalendar.getInstance();
+        calendar.setTime(model.getSelectedDate());
+        calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
+        calendar.set(Calendar.HOUR_OF_DAY, 14);
+        DefaultScheduleEntry entry1 = new DefaultScheduleEntry();
+        // every entry in a schedule must have a unique id
+        entry1.setId(RandomStringUtils.randomNumeric(32));
+        entry1.setStartTime(calendar.getTime());
+        calendar.add(Calendar.MINUTE, 45);
+        entry1.setEndTime(calendar.getTime());
+        entry1.setTitle("Test MyFaces schedule component");
+        entry1.setSubtitle("my office");
+        entry1
+                .setDescription("We need to get this thing out of the sandbox ASAP");
+        model.addEntry(entry1);
+        DefaultScheduleEntry entry2 = new DefaultScheduleEntry();
+        entry2.setId(RandomStringUtils.randomNumeric(32));
+        // entry2 overlaps entry1
+        calendar.add(Calendar.MINUTE, -20);
+        entry2.setStartTime(calendar.getTime());
+        calendar.add(Calendar.HOUR, 2);
+        entry2.setEndTime(calendar.getTime());
+        entry2.setTitle("Show schedule component to boss");
+        entry2.setSubtitle("my office");
+        entry2.setDescription("Convince him to get time to thoroughly test it");
+        model.addEntry(entry2);
+        DefaultScheduleEntry entry3 = new DefaultScheduleEntry();
+        entry3.setId(RandomStringUtils.randomNumeric(32));
+        calendar.add(Calendar.DATE, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 9);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        entry3.setStartTime(calendar.getTime());
+        calendar.set(Calendar.HOUR_OF_DAY, 17);
+        entry3.setEndTime(calendar.getTime());
+        entry3.setTitle("Thoroughly test schedule component");
+        model.addEntry(entry3);
+        DefaultScheduleEntry entry4 = new DefaultScheduleEntry();
+        entry4.setId(RandomStringUtils.randomNumeric(32));
+        calendar.add(Calendar.MONTH, -1);
+        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+        calendar.set(Calendar.HOUR_OF_DAY, 11);
+        entry4.setStartTime(calendar.getTime());
+        calendar.set(Calendar.HOUR_OF_DAY, 14);
+        entry4.setEndTime(calendar.getTime());
+        entry4.setTitle("Long lunch");
+        model.addEntry(entry4);
+        DefaultScheduleEntry entry5 = new DefaultScheduleEntry();
+        entry5.setId(RandomStringUtils.randomNumeric(32));
+        calendar.add(Calendar.MONTH, 2);
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 1);
+        entry5.setStartTime(calendar.getTime());
+        calendar.set(Calendar.HOUR_OF_DAY, 5);
+        entry5.setEndTime(calendar.getTime());
+        entry5.setTitle("Fishing trip");
+        model.addEntry(entry5);
+        //Let's add a zero length entry...
+        DefaultScheduleEntry entry6 = new DefaultScheduleEntry();
+        calendar.setTime(model.getSelectedDate());
+        calendar.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
+        calendar.set(Calendar.HOUR_OF_DAY, 16);
+        entry6.setId(RandomStringUtils.randomNumeric(32));
+        entry6.setStartTime(calendar.getTime());
+        entry6.setEndTime(calendar.getTime());
+        entry6.setTitle("Zero length entry");
+        entry6.setDescription("Is only rendered when the 'renderZeroLengthEntries' attribute is 'true'");
+        model.addEntry(entry6);
+        //And also an allday event
+        DefaultScheduleEntry entry7 = new DefaultScheduleEntry();
+        entry7.setId(RandomStringUtils.randomNumeric(32));
+        entry7.setTitle("All day event");
+        entry7.setSubtitle("This event renders as an all-day event");
+        entry7.setAllDay(true);
+        model.addEntry(entry7);
+        model.refresh();
+    }
+}



Mime
View raw message