You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/01/28 23:52:00 UTC
svn commit: r904288 [2/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...
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/common/CarConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/common/CarConfigurator.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/common/CarConfigurator.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/common/CarConfigurator.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,373 @@
+/*
+ * 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.common;
+
+import org.apache.myfaces.examples.util.LocalizedSelectItem;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+import javax.faces.validator.ValidatorException;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author Thomas Spiegl (latest modification by $Author: paulsp $)
+ * @version $Revision: 520433 $ $Date: 2007-03-20 10:37:23 -0500 (mar, 20 mar 2007) $
+ */
+public class CarConfigurator
+ implements Serializable
+{
+
+ /**
+ * serial id for serialisation
+ */
+ private static final long serialVersionUID = 1L;
+ private static List _cars;
+ private static List _colors;
+ private static List _extrasList;
+ private static HashMap _priceList = new HashMap();
+ private static HashMap _priceFactorColors = new HashMap();
+ private static HashMap _priceListExtras = new HashMap();
+ static
+ {
+ _cars = new ArrayList();
+ _colors = new ArrayList();
+ _extrasList = new ArrayList();
+
+ _cars.add(new SelectItem("c1", "Audee X6", null));
+ _cars.add(new SelectItem("c2", "PMW 321u", null));
+ _cars.add(new SelectItem("c3", "Masta ZX7", null));
+ _cars.add(new SelectItem("c4", "Renolt ESP", null));
+ _cars.add(new SelectItem("c5", "WV Lumpo", null));
+ _cars.add(new SelectItem("c6", "James Blond Car", null));
+ _cars.add(new SelectItem("c7", "Neko Bus", null));
+
+ _colors.add(new LocalizedSelectItem(new Color("color_black"),"color_black"));
+ _colors.add(new LocalizedSelectItem(new Color("color_blue"),"color_blue"));
+ _colors.add(new LocalizedSelectItem(new Color("color_marine"),"color_marine"));
+ _colors.add(new LocalizedSelectItem(new Color("color_red"),"color_red"));
+
+ _extrasList.add(new LocalizedSelectItem("extra_aircond"));
+ _extrasList.add(new LocalizedSelectItem("extra_sideab"));
+ _extrasList.add(new LocalizedSelectItem("extra_mirrowheat"));
+ _extrasList.add(new LocalizedSelectItem("extra_leaderseat"));
+
+ _priceList.put("c1", new BigDecimal(30000));
+ _priceList.put("c2", new BigDecimal(32000));
+ _priceList.put("c3", new BigDecimal(20000));
+ _priceList.put("c4", new BigDecimal(25000));
+ _priceList.put("c5", new BigDecimal(10000));
+ _priceList.put("c6", new BigDecimal(100000000));
+ _priceList.put("c7", new BigDecimal(1000000000));
+
+ _priceFactorColors.put("color_black", new BigDecimal(1.15));
+ _priceFactorColors.put("color_blue", new BigDecimal(1.10));
+ _priceFactorColors.put("color_marine", new BigDecimal(1.05));
+ _priceFactorColors.put("color_red", new BigDecimal(1.0));
+
+ _priceListExtras.put("extra_aircond", new BigDecimal(510));
+ _priceListExtras.put("extra_sideab", new BigDecimal(1220));
+ _priceListExtras.put("extra_mirrowheat", new BigDecimal(1230));
+ _priceListExtras.put("extra_leaderseat", new BigDecimal(840));
+ }
+
+
+ private BigDecimal _price = new BigDecimal(0);
+ private String[] _extras;
+ private String _discount = "0";
+ private String _discount2 = "0";
+ private String _bandName;
+ private String _car;
+ private Color _color = new Color("color_blue");
+ private List _interiorColors = null;
+ private boolean _salesTax = false;
+ private Long _doors = new Long(4);
+
+ public CarConfigurator()
+ {
+ }
+
+
+ public Long getDoors()
+ {
+ return _doors;
+ }
+
+
+ public void setDoors(Long doors)
+ {
+ this._doors = doors;
+ }
+
+
+ public List getCars()
+ {
+ return _cars;
+ }
+
+ public List getColors()
+ {
+ return _colors;
+ }
+
+ public List getExtrasList()
+ {
+ return _extrasList;
+ }
+
+ public String getCar()
+ {
+ return _car;
+ }
+
+ public void setCar(String car)
+ {
+ _car = car;
+ }
+
+ public Color getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(Color color)
+ {
+ _color = color;
+ }
+
+ public List getInteriorColors()
+ {
+ return _interiorColors;
+ }
+
+ public void setInteriorColors(List interiorColors)
+ {
+ _interiorColors = interiorColors;
+ }
+
+ public BigDecimal getPrice()
+ {
+ return _price;
+ }
+
+ public void setPrice(BigDecimal price)
+ {
+ _price = price;
+ }
+
+ public String[] getExtras()
+ {
+ return _extras;
+ }
+
+ public void setExtras(String[] extras)
+ {
+ _extras = extras;
+ }
+
+ public String getDiscount()
+ {
+ return _discount;
+ }
+
+ public void setDiscount(String discount)
+ {
+ _discount = discount;
+ }
+
+ public String getDiscount2()
+ {
+ return _discount2;
+ }
+
+ public void setDiscount2(String discount2)
+ {
+ _discount2 = discount2;
+ }
+
+ public String getBandName()
+ {
+ return _bandName;
+ }
+
+ public void setBandName(String bandName)
+ {
+ _bandName = bandName;
+ }
+
+ public boolean isSalesTax()
+ {
+ return _salesTax;
+ }
+
+ public void setSalesTax(boolean salesTax)
+ {
+ _salesTax = salesTax;
+ }
+
+ public String calcPrice()
+ {
+ String car = getCar();
+ Color color = getColor();
+ if (car == null ||
+ color == null)
+ {
+ _price = new BigDecimal(0);
+ return "ok";
+ }
+
+ BigDecimal carprice = (BigDecimal)_priceList.get(car);
+ BigDecimal colorfactor = (BigDecimal)_priceFactorColors.get(color.getColor());
+ if (carprice == null ||
+ colorfactor == null)
+ {
+ _price = new BigDecimal(0);
+ return "ok";
+ }
+ _price = carprice.multiply(colorfactor);
+
+ String[] extras = getExtras();
+ if (extras != null)
+ {
+ for (int i = 0; i < extras.length; i++)
+ {
+ String extra = extras[i];
+ _price = _price.add((BigDecimal)_priceListExtras.get(extra));
+ }
+ }
+
+ if (_discount != null)
+ {
+ try
+ {
+ int i = Integer.parseInt(_discount);
+ switch (i)
+ {
+ case 0: break;
+ case 1: _price = _price.multiply(new BigDecimal(0.95)); break;
+ case 2: _price = _price.multiply(new BigDecimal(0.91)); break;
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ if (_discount2 != null)
+ {
+ try
+ {
+ int i = Integer.parseInt(_discount2);
+ switch (i)
+ {
+ case 1: _price = _price.multiply(new BigDecimal(0.85)); break;
+ case 2: _price = _price.multiply(new BigDecimal(0.80)); break;
+ case 3: _price = _price.multiply(new BigDecimal(0.6)); break;
+ }
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ if (_salesTax)
+ {
+ _price = _price.multiply(new BigDecimal(1.2));
+ }
+
+ return "ok";
+ }
+
+
+ public void validateCar(FacesContext context, UIComponent component, Object value) throws ValidatorException
+ {
+ if (value instanceof String && value.equals("c6"))
+ {
+ throw new ValidatorException(new FacesMessage("Are you kidding?", "You cannot buy a James Blond car!"));
+ }
+ }
+
+ public Converter getColorConverter()
+ {
+ return new ColorConverter();
+ }
+
+ public static class ColorConverter implements Converter
+ {
+
+ public Object getAsObject(FacesContext facesContext, UIComponent component, String string) throws ConverterException
+ {
+ if(string==null)
+ return null;
+
+ return new Color(string);
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent component, Object object) throws ConverterException
+ {
+ if(object instanceof Color)
+ {
+ return ((Color) object).getColor();
+ }
+
+ return null;
+ }
+ }
+
+ public static class Color implements Serializable
+ {
+ private String color;
+
+ public Color(String color)
+ {
+ this.color = color;
+ }
+
+ public String getColor()
+ {
+ return color;
+ }
+
+ public void setColor(String color)
+ {
+ this.color = color;
+ }
+
+ public boolean equals(Object cmp)
+ {
+ if(!(cmp instanceof Color))
+ return false;
+
+ String cmpColor = ((Color) cmp).getColor();
+
+ if(this.color == null && cmpColor!=null)
+ return false;
+
+ return this.color.equals(cmpColor);
+ }
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/crosstable/DataBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/crosstable/DataBean.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/crosstable/DataBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/crosstable/DataBean.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.crosstable;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+
+import org.apache.myfaces.examples.listexample.SimpleCountry;
+import org.apache.myfaces.examples.listexample.SimpleCountryList;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class DataBean extends SimpleCountryList
+{
+ private DataModel mColumns;
+ private DataModel mCountryDataModel;
+ private Map mValueMap = new HashMap();
+ private boolean mEditValues;
+ private String mColumnLabel;
+
+ /**
+ *
+ */
+ public DataBean()
+ {
+ super();
+ }
+
+ public boolean isEditValues()
+ {
+ return mEditValues;
+ }
+
+ public String editValues()
+ {
+ mEditValues = true;
+ return null;
+ }
+
+ public String saveValues()
+ {
+ mEditValues = false;
+ return null;
+ }
+
+ public String addColumn()
+ {
+ if (mColumnLabel != null)
+ {
+ List columns = (List) getColumnDataModel().getWrappedData();
+ columns.add(mColumnLabel);
+ }
+ return null;
+ }
+
+ public String removeColumn()
+ {
+ if (mColumns != null && mColumns.isRowAvailable())
+ {
+ Object column = mColumns.getRowData();
+ List columns = (List) getColumnDataModel().getWrappedData();
+ columns.remove(column);
+ }
+ return null;
+ }
+
+ public String getColumnLabel()
+ {
+ return mColumnLabel;
+ }
+
+ public void setColumnLabel(String label)
+ {
+ mColumnLabel = label;
+ }
+
+ public DataModel getCountryDataModel()
+ {
+ if (mCountryDataModel == null)
+ {
+ mCountryDataModel = new ListDataModel(getCountries());
+ }
+ return mCountryDataModel;
+ }
+
+ public DataModel getColumnDataModel()
+ {
+ if (mColumns == null)
+ {
+ String[] result = new String[] {"2002", "2003", "2004"};
+ mColumns = new ListDataModel(new ArrayList(Arrays.asList(result)));
+ }
+ return mColumns;
+ }
+
+ public String getColumnValue()
+ {
+ DataModel countryDataModel = getCountryDataModel();
+ if (countryDataModel.isRowAvailable())
+ {
+ SimpleCountry row = (SimpleCountry) countryDataModel.getRowData();
+ DataModel columnDataModel = getColumnDataModel();
+ if (columnDataModel.isRowAvailable())
+ {
+ Object column = columnDataModel.getRowData();
+ Object key = new RowColumnKey(new Long(row.getId()), column);
+ if (!mValueMap.containsKey(key))
+ {
+ // initialize with random value
+ String randomValue = String.valueOf((int) (Math.random() * 5000) + 5000);
+ mValueMap.put(key, randomValue);
+ }
+ return (String) mValueMap.get(key);
+ }
+ }
+ return null;
+ }
+
+ public void setColumnValue(String value)
+ {
+ DataModel countryDataModel = getCountryDataModel();
+ if (countryDataModel.isRowAvailable())
+ {
+ SimpleCountry row = (SimpleCountry) countryDataModel.getRowData();
+ DataModel columnDataModel = getColumnDataModel();
+ if (columnDataModel.isRowAvailable())
+ {
+ Object column = columnDataModel.getRowData();
+ Object key = new RowColumnKey(new Long(row.getId()), column);
+ mValueMap.put(key, value);
+ }
+ }
+ }
+
+ private class RowColumnKey
+ {
+ private final Object mRow;
+ private final Object mColumn;
+
+ /**
+ * @param row
+ * @param column
+ */
+ public RowColumnKey(Object row, Object column)
+ {
+ mRow = row;
+ mColumn = column;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj == null)
+ {
+ return false;
+ }
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof RowColumnKey)
+ {
+ RowColumnKey other = (RowColumnKey) obj;
+ return other.mRow.equals(mRow) && other.mColumn.equals(mColumn);
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (37 * 3 + mRow.hashCode()) * (37 * 3 + mColumn.hashCode());
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return mRow.toString() + "," + mColumn.toString();
+ }
+ }
+}
+
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/displayValueOnly/DVOFace.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/displayValueOnly/DVOFace.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/displayValueOnly/DVOFace.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/displayValueOnly/DVOFace.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.displayValueOnly;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: skitching $)
+ * @version $Revision: 673833 $ $Date: 2005-03-24 12:47:11 -0400 (Thu, 24 Mar 2005) $
+ */
+public class DVOFace implements Serializable
+{
+
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+
+ private boolean attribute = true;
+
+ private Map map = new HashMap(){
+
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+
+ public Object get(Object key){
+ Object held = super.get( key );
+ if( held != null )
+ return held;
+ if( key.toString().toLowerCase().indexOf("list")>0 )
+ return new ArrayList();
+
+ return null;
+ }
+ };
+
+ public boolean isAttribute() {
+ return attribute;
+ }
+ public void setAttribute(boolean attribute) {
+ this.attribute = attribute;
+ }
+ public Map getMap() {
+ return map;
+ }
+ public void setMap(Map map) {
+ this.map = map;
+ }
+}
\ No newline at end of file
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcActionListener.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcActionListener.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcActionListener.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,54 @@
+/*
+ * 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.example1;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class CalcActionListener
+ implements ActionListener
+{
+ public void processAction(ActionEvent event) throws AbortProcessingException
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent component = event.getComponent();
+
+ VariableResolver vr = facesContext.getApplication().getVariableResolver();
+ CalcForm form = (CalcForm)vr.resolveVariable(facesContext, "calcForm");
+ if (component.getId().equals("addButton") ||
+ component.getId().equals("href1"))
+ {
+ form.add();
+ }
+ else
+ {
+ form.subtract();
+ }
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/CalcForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.example1;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class CalcForm
+ implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private BigDecimal number1 = new BigDecimal(0d);
+ private BigDecimal number2 = new BigDecimal(0d);
+ private BigDecimal result = new BigDecimal(0d);
+
+ public void add()
+ {
+ result = number1.add(number2);
+ }
+
+ public void subtract()
+ {
+ result = number1.subtract(number2);
+ }
+
+ public BigDecimal getNumber1()
+ {
+ return number1;
+ }
+
+ public void setNumber1(BigDecimal number1)
+ {
+ this.number1 = number1;
+ }
+
+ public BigDecimal getNumber2()
+ {
+ return number2;
+ }
+
+ public void setNumber2(BigDecimal number2)
+ {
+ this.number2 = number2;
+ }
+
+ public BigDecimal getResult()
+ {
+ return result;
+ }
+
+ public void setResult(BigDecimal result)
+ {
+ this.result = result;
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseActionListener.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseActionListener.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseActionListener.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.example1;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class UCaseActionListener
+ implements ActionListener
+{
+ public void processAction(ActionEvent event) throws AbortProcessingException
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent component = event.getComponent();
+
+ VariableResolver vr = facesContext.getApplication().getVariableResolver();
+ UCaseForm form = (UCaseForm)vr.resolveVariable(facesContext, "ucaseForm");
+ if (component.getId().equals("ucaseButton"))
+ {
+ form.uppercase();
+ }
+ else
+ {
+ form.lowercase();
+ }
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/UCaseForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.example1;
+
+import java.io.Serializable;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class UCaseForm
+ implements Serializable
+{ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private String text = "";
+
+ public void uppercase()
+ {
+ text = text.toUpperCase();
+ }
+
+ public void lowercase()
+ {
+ text = text.toLowerCase();
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ /**
+ * Test method for method binding.
+ */
+ public String jumpHome()
+ {
+ System.out.println("JumpHome Action was called.");
+ return "jump_home";
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/ValidationController.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/ValidationController.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/ValidationController.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example1/ValidationController.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,155 @@
+/*
+ * 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.example1;
+
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.LongRangeValidator;
+import javax.faces.validator.Validator;
+
+/**
+ * DOCUMENT ME!
+ * @author Manfred Geiler
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class ValidationController
+{
+ public String enableValidation()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number1");
+ Validator[] validators = number1.getValidators();
+ if (validators == null || validators.length == 0)
+ {
+ number1.addValidator(new LongRangeValidator(10, 1));
+ }
+
+ UIInput number2 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
+ validators = number2.getValidators();
+ if (validators == null || validators.length == 0)
+ {
+ number2.addValidator(new LongRangeValidator(50, 20));
+ }
+
+ UIInput text = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
+ validators = text.getValidators();
+ if (validators == null || validators.length == 0)
+ {
+ text.addValidator(new LengthValidator(7, 3));
+ }
+
+ return "ok";
+ }
+
+ public String disableValidation()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number1");
+ Validator[] validators = number1.getValidators();
+ if (validators != null)
+ {
+ for (int i = 0; i < validators.length; i++)
+ {
+ Validator validator = validators[i];
+ number1.removeValidator(validator);
+ }
+ }
+
+ UIInput number2 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
+ validators = number2.getValidators();
+ if (validators != null)
+ {
+ for (int i = 0; i < validators.length; i++)
+ {
+ Validator validator = validators[i];
+ number2.removeValidator(validator);
+ }
+ }
+
+ UIInput text = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
+ validators = text.getValidators();
+ if (validators != null)
+ {
+ for (int i = 0; i < validators.length; i++)
+ {
+ Validator validator = validators[i];
+ text.removeValidator(validator);
+ }
+ }
+
+ return "ok";
+ }
+
+
+
+ public String getNumber1ValidationLabel()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number1");
+ Validator[] validators = number1.getValidators();
+ if (validators != null && validators.length > 0)
+ {
+ long min = ((LongRangeValidator)validators[0]).getMinimum();
+ long max = ((LongRangeValidator)validators[0]).getMaximum();
+ return " (" + min + "-" + max + ")";
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public String getNumber2ValidationLabel()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form1:number2");
+ Validator[] validators = number1.getValidators();
+ if (validators != null && validators.length > 0)
+ {
+ long min = ((LongRangeValidator)validators[0]).getMinimum();
+ long max = ((LongRangeValidator)validators[0]).getMaximum();
+ return " (" + min + "-" + max + ")";
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public String getTextValidationLabel()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIInput number1 = (UIInput)facesContext.getViewRoot().findComponent("form2:text");
+ Validator[] validators = number1.getValidators();
+ if (validators != null && validators.length > 0)
+ {
+ long min = ((LengthValidator)validators[0]).getMinimum();
+ long max = ((LengthValidator)validators[0]).getMaximum();
+ return " (" + min + "-" + max + " chars)";
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationController.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationController.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationController.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationController.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.example2;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.PhaseId;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class QuotationController
+ implements ActionListener
+{
+ public void processAction(ActionEvent event) throws AbortProcessingException
+ {
+ if (event.getPhaseId() == PhaseId.INVOKE_APPLICATION)
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ UIComponent component = event.getComponent();
+
+ VariableResolver vr = facesContext.getApplication().getVariableResolver();
+ QuotationForm form = (QuotationForm)vr.resolveVariable(facesContext, "q_form");
+ if (component.getId().equals("button1"))
+ {
+ form.quote();
+ }
+ else
+ {
+ form.unquote();
+ }
+ }
+
+ }
+
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.UPDATE_MODEL_VALUES;
+ }
+}
\ No newline at end of file
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationForm.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationForm.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationForm.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/example2/QuotationForm.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,140 @@
+/*
+ * 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.example2;
+
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl
+ */
+public class QuotationForm
+{
+ private String _text = "QuotationTest";
+ private String _quoteChar;
+ private String[] _selectManyValues;
+
+ private SelectItem[] _selectItems = null;
+ private List _selectManyItems = null;
+
+
+
+ public QuotationForm()
+ {
+ }
+
+
+ public String getText()
+ {
+ return _text;
+ }
+
+ public void setText(String text)
+ {
+ _text = text;
+ }
+
+ public String getQuoteChar()
+ {
+ return _quoteChar;
+ }
+
+ public void setQuoteChar(String value)
+ {
+ _quoteChar = value;
+ }
+
+ public SelectItem[] getSelectOneItems()
+ {
+ if (_selectItems == null)
+ {
+ _selectItems = new SelectItem[2];
+ _selectItems[0] = new SelectItem("*", "Asterisk");
+ _selectItems[1] = new SelectItem("+", "Plus");
+ }
+ return _selectItems;
+ }
+
+
+
+
+ public String[] getSelectManyValues()
+ {
+ return _selectManyValues;
+ }
+
+ public void setSelectManyValues(String[] value)
+ {
+ _selectManyValues = value;
+ }
+
+ public List getSelectManyItems()
+ {
+ if (_selectManyItems == null)
+ {
+ _selectManyItems = new ArrayList();
+ _selectManyItems.add(new SelectItem("\"", "Double"));
+ _selectManyItems.add(new SelectItem("'", "Single"));
+ _selectManyItems.add(new SelectItem("*", "Asterisk"));
+ _selectManyItems.add(new SelectItem("+", "Plus"));
+ _selectManyItems.add(new SelectItem("-", "Hyphen"));
+ }
+ return _selectManyItems;
+ }
+
+
+ public void quote()
+ {
+ if (_quoteChar != null)
+ {
+ _text = _quoteChar + _text + _quoteChar;
+ }
+ }
+
+ public void unquote()
+ {
+ if (_selectManyValues != null)
+ {
+ for (int i = 0; i < _selectManyValues.length; i++)
+ {
+ unquote(_selectManyValues[i]);
+ }
+ }
+ }
+
+ private void unquote(String quoteChar)
+ {
+ if (quoteChar != null && quoteChar.length() > 0)
+ {
+ if (_text.startsWith(quoteChar))
+ {
+ _text = _text.substring(1);
+ }
+
+ if (_text.endsWith(quoteChar))
+ {
+ _text = _text.substring(0, _text.length() - 1);
+ }
+ }
+ }
+
+}
+
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/ForceIdBean.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/ForceIdBean.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/ForceIdBean.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/ForceIdBean.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.forceid;
+
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:matzew@apache.org">Matthias Weßendorf</a>
+ */
+public class ForceIdBean {
+
+ private String valueOne, valueTwo;
+ private User users[];
+ private ArrayList choices = new ArrayList();
+ private String currentChoice;
+
+ public ForceIdBean(){
+ users = new User[2];
+ users[0] = new User("MyFaces","secrect");
+ users[1] = new User("Tomcat","secrect");
+
+ choices.add("foo");
+ choices.add("bar");
+ choices.add("buzz");
+ }
+
+ public String getValueOne() {
+ return valueOne;
+ }
+ public void setValueOne(String valueOne) {
+ this.valueOne = valueOne;
+ }
+ public String getValueTwo() {
+ return valueTwo;
+ }
+ public void setValueTwo(String valueTwo) {
+ this.valueTwo = valueTwo;
+ }
+ public User[] getUsers() {
+ return users;
+ }
+ public void setUsers(User[] users) {
+ this.users = users;
+ }
+
+ public ArrayList getChoices()
+ {
+ return choices;
+ }
+
+ public void setCurrentChoice(String currentChoice)
+ {
+ this.currentChoice = currentChoice;
+ }
+
+ public String getCurrentChoice()
+ {
+ return currentChoice;
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/User.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/User.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/User.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/forceid/User.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,60 @@
+/*
+ * 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.forceid;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * @author <a href="mailto:matzew@apache.org">Matthias Weßendorf</a>
+ */
+public class User {
+
+ public String username,password;
+ private static final Log log = LogFactory.getLog(User.class);
+
+ public User(){}
+
+ public User(String username,String password){
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public String getUsername() {
+ return username;
+ }
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String update(){
+ if(log.isDebugEnabled()){
+ log.debug("USERNAME: "+this.username);
+ log.debug("PASSWORD: "+this.password);
+ }
+ return ("go_forceId");
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/inputhtmlexample/EditorFace.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/inputhtmlexample/EditorFace.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/inputhtmlexample/EditorFace.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/inputhtmlexample/EditorFace.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,87 @@
+/*
+ * 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.inputhtmlexample;
+
+/**
+ * @author Sylvain Vieujot (latest modification by $Author: skitching $)
+ * @version $Revision: 673833 $ $Date: 2008-07-03 16:58:05 -0500 (jue, 03 jul 2008) $
+ */
+public class EditorFace {
+
+ private String text = "Default unformatted text.";
+
+ // Options
+ private boolean allowEditSource = true;
+ private boolean showPropertiesToolBox = false;
+ private boolean showLinksToolBox = false;
+ private boolean showImagesToolBox = false;
+ private boolean showTablesToolBox = false;
+ private boolean showCleanupExpressionsToolBox = false;
+ private boolean showDebugToolBox = false;
+
+ public String getText() {
+ return text;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public boolean isAllowEditSource() {
+ return allowEditSource;
+ }
+ public void setAllowEditSource(boolean allowEditSource) {
+ this.allowEditSource = allowEditSource;
+ }
+ public boolean isShowImagesToolBox() {
+ return showImagesToolBox;
+ }
+ public void setShowImagesToolBox(boolean showImagesToolBox) {
+ this.showImagesToolBox = showImagesToolBox;
+ }
+ public boolean isShowLinksToolBox() {
+ return showLinksToolBox;
+ }
+ public void setShowLinksToolBox(boolean showLinksToolBox) {
+ this.showLinksToolBox = showLinksToolBox;
+ }
+ public boolean isShowPropertiesToolBox() {
+ return showPropertiesToolBox;
+ }
+ public void setShowPropertiesToolBox(boolean showPropertiesToolBox) {
+ this.showPropertiesToolBox = showPropertiesToolBox;
+ }
+ public boolean isShowTablesToolBox(){
+ return showTablesToolBox;
+ }
+ public void setShowTablesToolBox(boolean showTablesToolBox){
+ this.showTablesToolBox = showTablesToolBox;
+ }
+ public boolean isShowCleanupExpressionsToolBox() {
+ return showCleanupExpressionsToolBox;
+ }
+ public void setShowCleanupExpressionsToolBox(boolean showCleanupExpressionsToolBox) {
+ this.showCleanupExpressionsToolBox = showCleanupExpressionsToolBox;
+ }
+ public boolean isShowDebugToolBox(){
+ return showDebugToolBox;
+ }
+ public void setShowDebugToolBox(boolean showDebugToolBox){
+ this.showDebugToolBox = showDebugToolBox;
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/jslistener/JsListenerModel.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/jslistener/JsListenerModel.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/jslistener/JsListenerModel.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/jslistener/JsListenerModel.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.myfaces.examples.jslistener;
+
+import javax.faces.model.SelectItem;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Martin Marinschek
+ */
+public class JsListenerModel
+{
+ private List options;
+ private List optionItems;
+
+ public List getOptions()
+ {
+ if(options == null)
+ {
+ initOptions();
+ }
+ return options;
+ }
+
+ public void setOptions(List options)
+ {
+ this.options = options;
+ }
+
+ public List getOptionItems()
+ {
+ if( optionItems == null ) {
+ initOptions();
+ }
+ return optionItems;
+ }
+
+ private void initOptions() {
+ options = new ArrayList();
+ options.add("o1");
+ options.add("o2");
+ options.add("o3");
+ options.add("o4");
+
+ optionItems = new ArrayList();
+ optionItems.add(new SelectItem("o1","Option 1"));
+ optionItems.add(new SelectItem("o2","Option 2"));
+ optionItems.add(new SelectItem("o3","Option 3"));
+ optionItems.add(new SelectItem("o4","Option 4"));
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ColumnHeader.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ColumnHeader.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ColumnHeader.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/ColumnHeader.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.examples.listexample;
+
+public class ColumnHeader
+
+{
+ public ColumnHeader()
+ {
+ }
+
+ private String _label;
+ private String _width;
+ private boolean _editable;
+
+ public ColumnHeader(String label, String width, boolean editable)
+ {
+ _label = label;
+ _width = width;
+ _editable = editable;
+ }
+
+ //=========================================================================
+ // Getters
+ //=========================================================================
+
+ public String getLabel()
+ {
+ return _label;
+ }
+
+ public String getWidth()
+ {
+ return _width;
+ }
+
+ public boolean isEditable()
+ {
+ return _editable;
+ }
+
+ //=========================================================================
+ // Getters
+ //=========================================================================
+
+ public void setLabel(String label)
+ {
+ _label = label;
+ }
+
+ public void setWidth(String width)
+ {
+ _width = width;
+ }
+
+ public void setEditable(boolean editable)
+ {
+ _editable = editable;
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerActionListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerActionListener.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerActionListener.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerActionListener.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.listexample;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+
+/**
+ * @author MBroekelmann
+ *
+ */
+public class DataScrollerActionListener implements ActionListener
+{
+
+ /**
+ * @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
+ */
+ public void processAction(ActionEvent actionEvent) throws AbortProcessingException
+ {
+ System.out.println("process dataScroller ActionEvent");
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/DataScrollerList.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.listexample;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.custom.datascroller.ScrollerActionEvent;
+
+/**
+ * DOCUMENT ME!
+ * @author Thomas Spiegl (latest modification by $Author: cjhoward $)
+ * @version $Revision: 796690 $ $Date: 2009-07-22 07:52:32 -0500 (mié, 22 jul 2009) $
+ */
+public class DataScrollerList
+{
+ private Integer rowCount = new Integer(10);
+
+ public Integer getRowCount() {
+ return rowCount;
+ }
+
+ public void setRowCount(Integer rowCount) {
+ this.rowCount = rowCount;
+ }
+
+ private List _list = new ArrayList();
+
+ public DataScrollerList()
+ {
+ for (int i = 1; i < 995; i++)
+ {
+ _list.add(new SimpleCar(i, "Car Type " + i, "blue"));
+ }
+ }
+
+ public List getList()
+ {
+ return _list;
+ }
+
+ public void scrollerAction(ActionEvent event)
+ {
+ ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
+ FacesContext.getCurrentInstance().getExternalContext().log(
+ "scrollerAction: facet: "
+ + scrollerEvent.getScrollerfacet()
+ + ", pageindex: "
+ + scrollerEvent.getPageIndex());
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/OpenDataList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/OpenDataList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/OpenDataList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/OpenDataList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,185 @@
+/*
+ * 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;
+
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+
+public class OpenDataList extends SortableList
+{
+ private DataModel data;
+ private DataModel columnHeaders;
+
+ private static final int SORT_ASCENDING = 1;
+ private static final int SORT_DESCENDING = -1;
+
+ public OpenDataList()
+ {
+ super(null);
+
+ // create header info
+ List headerList = new ArrayList();
+ headerList.add(new ColumnHeader("Index","100",false));
+ headerList.add(new ColumnHeader("Type","200",true));
+ headerList.add(new ColumnHeader("Model","300",true));
+ columnHeaders = new ListDataModel(headerList);
+
+ // create list of lists (data)
+ List rowList = new ArrayList();
+ for (int i = 100; i <= 999; i++)
+ {
+ List colList = new ArrayList();
+ colList.add(new Integer(i));
+ colList.add("Car Type " + i);
+ colList.add((i%2==0) ? "blue" : "green");
+ rowList.add(colList);
+ }
+ data = new ListDataModel(rowList);
+ }
+
+ //==========================================================================
+ // Getters
+ //==========================================================================
+
+ public DataModel getData()
+ {
+ sort(getSort(), isAscending());
+ return data;
+ }
+
+ void setData(DataModel datamodel)
+ {
+ System.out.println("preserved datamodel updated");
+ // just here to see if the datamodel is updated if preservedatamodel=true
+ }
+
+ public DataModel getColumnHeaders()
+ {
+ return columnHeaders;
+ }
+
+ //==========================================================================
+ // Public Methods
+ //==========================================================================
+
+ public Object getColumnValue()
+ {
+ Object columnValue = null;
+ if (data.isRowAvailable() && columnHeaders.isRowAvailable())
+ {
+ columnValue = ((List)data.getRowData()).get(columnHeaders.getRowIndex());
+ }
+ return columnValue;
+ }
+
+ public void setColumnValue(Object value)
+ {
+ if (data.isRowAvailable() && columnHeaders.isRowAvailable())
+ {
+ ((List)data.getRowData()).set(columnHeaders.getRowIndex(), value);
+ }
+ }
+
+ public String getColumnWidth()
+ {
+ String columnWidth = null;
+ if (data.isRowAvailable() && columnHeaders.isRowAvailable())
+ {
+ columnWidth = ((ColumnHeader)columnHeaders.getRowData()).getWidth();
+ }
+ return columnWidth;
+ }
+
+ public boolean isValueModifiable()
+ {
+ boolean valueModifiable = false;
+ if (data.isRowAvailable() && columnHeaders.isRowAvailable())
+ {
+ valueModifiable = ((ColumnHeader)columnHeaders.getRowData()).isEditable();
+ }
+ return valueModifiable;
+ }
+
+ //==========================================================================
+ // Protected Methods
+ //==========================================================================
+
+ protected boolean isDefaultAscending(String sortColumn)
+ {
+ return true;
+ }
+
+ protected void sort(final String column, final boolean ascending)
+ {
+ if (column != null)
+ {
+ int columnIndex = getColumnIndex(column);
+ int direction = (ascending) ? SORT_ASCENDING : SORT_DESCENDING;
+ sort(columnIndex, direction);
+ }
+ }
+
+ protected void sort(final int columnIndex, final int direction)
+ {
+ Comparator comparator = new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int result = 0;
+ Object column1 = ((List)o1).get(columnIndex);
+ Object column2 = ((List)o2).get(columnIndex);
+ if (column1 == null && column2 != null)
+ result = -1;
+ else if (column1 == null && column2 == null)
+ result = 0;
+ else if (column1 != null && column2 == null)
+ result = 1;
+ else
+ result = ((Comparable)column1).compareTo(column2) * direction;
+ return result;
+ }
+ };
+ Collections.sort((List)data.getWrappedData(), comparator);
+ }
+
+ //==========================================================================
+ // Private Methods
+ //==========================================================================
+
+ private int getColumnIndex(final String columnName)
+ {
+ int columnIndex = -1;
+ List headers = (List) columnHeaders.getWrappedData();
+ for (int i=0;i<headers.size() && columnIndex==-1;i++)
+ {
+ ColumnHeader header = (ColumnHeader) headers.get(i);
+ if (header.getLabel().equals(columnName))
+ {
+ columnIndex = i;
+ }
+ }
+ return columnIndex;
+ }
+
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/PagedSortableCarList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/PagedSortableCarList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/PagedSortableCarList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/PagedSortableCarList.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.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class PagedSortableCarList extends SortableList
+{
+ private List cars = new ArrayList();
+
+ private Map carMap = new HashMap();
+
+ public PagedSortableCarList()
+ {
+ super("type");
+ for (int i = 100; i < 900; i++)
+ {
+ Object car = new SimpleCar(i, "Car Type " + i, (i % 2 == 0) ? "blue" : "green");
+ cars.add(car);
+ carMap.put(new Integer(i), car);
+ }
+ }
+
+ public List getCars()
+ {
+ sort(getSort(), isAscending());
+ return cars;
+ }
+
+ public void setCars(List cars)
+ {
+ // update the cars from the provided list
+ for (Iterator iter = cars.iterator(); iter.hasNext();)
+ {
+ SimpleCar car = (SimpleCar) iter.next();
+ SimpleCar oldCar = (SimpleCar) carMap.get(new Integer(car.getId()));
+ oldCar.setType(car.getType());
+ oldCar.setColor(car.getColor());
+ }
+ }
+
+ 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/SimpleAutoSortableCarList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleAutoSortableCarList.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleAutoSortableCarList.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleAutoSortableCarList.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,80 @@
+/*
+ * 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.List;
+
+/**
+ * @author Catalin Kormos
+ */
+public class SimpleAutoSortableCarList
+{
+ private List _cars;
+ private String sortColumn = null;
+ private boolean sortAscending = true;
+
+ public SimpleAutoSortableCarList()
+ {
+ _cars = new ArrayList();
+
+ _cars.add(new SimpleCar(1, "car B", "blue"));
+ _cars.add(new SimpleCar(2, "car A", "red"));
+ _cars.add(new SimpleCar(3, "car D", "yellow"));
+ _cars.add(new SimpleCar(4, "car C", "green"));
+ _cars.add(new SimpleCar(5, "car E", "orange"));
+ _cars.add(new SimpleCar(6, "car J", "blue"));
+ _cars.add(new SimpleCar(7, "car I", "gray"));
+ _cars.add(new SimpleCar(8, "car M", "lightGray"));
+ _cars.add(new SimpleCar(9, "car N", "magenta"));
+ _cars.add(new SimpleCar(10, "car K", "unknown"));
+ _cars.add(new SimpleCar(11, "car L", "dark blue"));
+ }
+
+ public List getCars()
+ {
+ return _cars;
+ }
+
+ public void setCars(List cars)
+ {
+ this._cars = cars;
+ }
+
+ public String getSortColumn()
+ {
+ return sortColumn;
+ }
+
+ public void setSortColumn(String sortColumn)
+ {
+ this.sortColumn = sortColumn;
+ }
+
+ public boolean isSortAscending()
+ {
+ return sortAscending;
+ }
+
+ public void setSortAscending(boolean sortAscending)
+ {
+ this.sortAscending = sortAscending;
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCar.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCar.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCar.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCar.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: grantsmith $)
+ * @version $Revision: 472610 $ $Date: 2006-11-08 14:46:34 -0500 (mié, 08 nov 2006) $
+ */
+public class SimpleCar
+ implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private int _id;
+ private String _type;
+ private String _color;
+
+ public SimpleCar(int id, String type, String color)
+ {
+ _id = id;
+ _type = type;
+ _color = color;
+ }
+
+ public int getId()
+ {
+ return _id;
+ }
+
+ public void setId(int id)
+ {
+ _id = id;
+ }
+
+ public String getType()
+ {
+ return _type;
+ }
+
+ public void setType(String type)
+ {
+ _type = type;
+ }
+
+ public String getColor()
+ {
+ return _color;
+ }
+
+ public void setColor(String color)
+ {
+ _color = color;
+ }
+}
Added: myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCity.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCity.java?rev=904288&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCity.java (added)
+++ myfaces/tomahawk/trunk/examples/simple20/src/main/java/org/apache/myfaces/examples/listexample/SimpleCity.java Thu Jan 28 22:51:42 2010
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+/**
+ * @author MBroekelmann
+ *
+ */
+public class SimpleCity implements Serializable
+{
+ /**
+ * serial id for serialisation versioning
+ */
+ private static final long serialVersionUID = 1L;
+ private String mName;
+
+ private boolean selected;
+
+ public boolean isSelected() {
+ return selected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
+ public void unselect(){
+ setSelected(false);
+ }
+
+
+ /**
+ *
+ */
+ public SimpleCity(String name)
+ {
+ mName = name;
+ }
+
+ /**
+ *
+ */
+ public SimpleCity()
+ {
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName()
+ {
+ return mName;
+ }
+
+ /**
+ * @param name The name to set.
+ */
+ public void setName(String name)
+ {
+ mName = name;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ return getName();
+ }
+}