myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfreed...@apache.org
Subject svn commit: r950308 [2/13] - in /myfaces/portlet-bridge/core/trunk_2.0.x: ./ api/src/main/java/javax/portlet/faces/ api/src/main/java/javax/portlet/faces/component/ examples/ examples/blank/ examples/blank/src/main/webapp/WEB-INF/ examples/carstore/ ex...
Date Tue, 01 Jun 2010 23:35:49 GMT
Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarBean.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarBean.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarBean.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarBean.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,575 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UISelectItems;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.model.SelectItem;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.List;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * <p>This bean encapsulates a car model, including pricing and package
+ * choices.  The system allows the user to customize the properties of
+ * this bean with the help of the {@link CarCustomizer}.</p>
+ * <p/>
+ * <h3>Data Access</h3>
+ * <p/>
+ * <p>This is the only bean in the system that has complicated access to
+ * the persistent store of data.  In the present implementation, this
+ * persistent store is in <code>ResourceBundle</code> instances.</p>
+ * <p/>
+ * <p>There are three data source <code>ResourceBundle</code> files
+ * used:</p>
+ * <p/>
+ * <ol>
+ * <p/>
+ * <li><p><code>&lt;ModelName&gt;</code></p>
+ * <p/>
+ * <p>This contains the localized content for this model.  There
+ * is a variant of this file for each supported locale, for
+ * example, <code>Jalopy_de.properties</code></p>
+ * <p/>
+ * </li>
+ * <p/>
+ * <li><p><code>&lt;Common_properties&gt;</code></p>
+ * <p/>
+ * <p>This contains the localized content common to all
+ * models.</p>
+ * <p/>
+ * </li>
+ * <p/>
+ * <li><p><code>&lt;ModelName_options&gt;</code></p>
+ * <p/>
+ * <p>This contains the non-localized content for this model,
+ * including the non-localized options.  There is only one
+ * variant of this file for all locales for example,
+ * <code>Jalopy_options.properties</code></p>
+ * <p/>
+ * </li>
+ * <p/>
+ * </ol>
+ * <p/>
+ * <p>All files conform to the following convention:</p>
+ * <p/>
+ * <code><pre>
+ * key
+ * key_componentType
+ * key_valueType
+ * </pre></code>
+ * <p/>
+ * <p>Where <code>key</code> is the name of an attribute of this car.
+ * For example, <code>basePrice</code>, or <code>description</code>.
+ * <code>key_componentType</code> is the component type of the
+ * <code>UIComponent</code> subclass to be used to represent this
+ * attribute in the page, for example <code>SelectManyMenu</code>.
+ * <code>key_valueType</code> is the data type of the value of the
+ * <code>UIComponent</code>, for example <code>java.lang.Integer</code>.
+ * For all non-String valueTypes.</p>
+ * <p/>
+ * <p>When the bean is instantiated, we load both of the above
+ * properties files and iterate over the keys in each one.  For each
+ * key, we look at the <code>componentType</code> and ask the
+ * <code>Application</code> to create a component of that type.  We
+ * store that <code>UIComponent</code> instance in our
+ * <code>components</code> <code>Map</code> under the name
+ * <code>key</code>.  We look at the <code>valueType</code> for the
+ * <code>key</code>.  For non <code>java.lang.String</code> types, we
+ * ask the <code>Application</code> for a <code>Converter</code>
+ * instance for that class.  If found, we use it to convert the value
+ * for the <code>key</code> to the appropriate type and store that as
+ * the <code>value</code> of the <code>UIComponent</code> instance.</p>
+ */
+
+public class CarBean {
+
+    private static final Logger LOGGER = Logger.getLogger("carstore");
+
+    /**
+     * <p>The message identifier of the Message to be created if
+     * the conversion fails.  The message format string for this
+     * message may optionally include a <code>{0}</code>
+     * placeholder, which will be replaced by the object and value.</p>
+     */
+    public static final String CONVERTER_ERROR_MESSAGE_ID =
+          "carstore.Converter_Error";
+
+    //
+    // Relationship Instance Variables
+    //
+
+    /** Localized labels */
+
+    private ResourceBundle resources = null;
+
+    /** Price data */
+    private ResourceBundle priceData = null;
+
+    /**
+     * Keys: String attribute name, such as engine. Values: UIComponent
+     * for the attribute
+     */
+
+    private Map<String, UIComponent> components = null;
+
+    /**
+     * Keys: String attribute name, such as engine. Values: String value
+     * of the component named by key in our components Map.
+     */
+
+    private Map<String,Object> attributes = null;
+
+    // 
+    // Constructors
+    //
+
+    public CarBean() {
+        this.init(CarStore.DEFAULT_MODEL_PROPERTIES);
+    }
+
+
+    public CarBean(String bundleName) {
+        this.init(bundleName);
+    }
+
+
+    /**
+     * <p>Initialize our components <code>Map</code> as described in the
+     * class documentation.</p>
+     * <p/>
+     * <p>Create a wrapper <code>Map</code> around the components
+     * <code>Map</code> that exposes the String converted value of each
+     * component.</p>
+     * 
+     * @param bundleName the resource bundle name
+     */
+    private void init(String bundleName) {
+        FacesContext context = FacesContext.getCurrentInstance();       
+
+        components = new HashMap<String, UIComponent>();
+
+        // load the labels
+        resources =
+              ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+                                       ".bundles.Resources",
+                                       context.getViewRoot().getLocale());
+
+        // load the prices
+        priceData = ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+                                             ".bundles.OptionPrices");
+
+        // populate the locale-specific information
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Loading bundle: " + bundleName + ".");
+        }
+        ResourceBundle data = ResourceBundle.getBundle(bundleName,
+                                        context.getViewRoot().getLocale());
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Bundle " + bundleName +
+                        " loaded. Reading properties...");
+        }
+        initComponentsFromProperties(context, data);
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("done.");
+        }
+
+        // populate the non-locale-specific information common to all cars
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Loading bundle: Common_options.");
+        }
+        data = ResourceBundle.getBundle(CarStore.CARSTORE_PREFIX +
+                                        ".bundles.Common_options");
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Bundle Common_options loaded. Reading properties...");
+        }
+        initComponentsFromProperties(context, data);
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("done.");
+        }
+
+        // populate the non-locale-specific information specific to each car
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Loading bundle: " + bundleName + "_options.");
+        }
+        data = ResourceBundle.getBundle(bundleName + "_options");
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Bundle " + bundleName +
+                        "_options loaded. Reading properties...");
+        }
+        initComponentsFromProperties(context, data);
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("done.");
+        }
+
+        // create a read-only Map exposing the values of all of our
+        // components.
+        attributes =
+            new Map() {
+                public void clear() {
+                    CarBean.this.components.clear();
+                }
+
+
+                public boolean containsKey(Object key) {
+                    return CarBean.this.components.containsKey(key);
+                }
+
+
+                public boolean containsValue(Object value) {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public java.util.Set<Map.Entry<String,Object>> entrySet() {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public boolean equals(Object o) {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public Object get(Object key) {
+                    UIComponent component;
+                    Converter converter = null;
+                    Object result = null;
+                    if (null == key) {
+                        return null;
+                    }
+                    if (null != (component = 
+                        CarBean.this.components.get(key))) {
+                        // if this component can have a Converter
+                        if (component instanceof ValueHolder) {
+                            // try to get it
+                            converter = ((ValueHolder) component).
+                                getConverter();
+                            result = ((ValueHolder) component).getValue();
+                        }
+
+                        // if we do have a value
+                        if (null != result) {
+                            // and we do have a converter
+                            if (null != converter) {
+                                // convert the value to String
+                                result = converter.
+                                    getAsString(FacesContext.
+                                                getCurrentInstance(),
+                                                component, result);
+                            }
+                        }
+                    }
+                    return result;
+                }
+
+
+                public int hashCode() {
+                    return CarBean.this.components.hashCode();
+                }
+
+
+                public boolean isEmpty() {
+                    return CarBean.this.components.isEmpty();
+                }
+
+
+                public java.util.Set<String> keySet() {
+                    return CarBean.this.components.keySet();
+                }
+
+
+                public Object put(Object k, Object v) {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public void putAll(Map t) {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public Object remove(Object k) {
+                    throw new UnsupportedOperationException();
+                }
+
+
+                public int size() {
+                    return CarBean.this.components.size();
+                }
+
+
+                public Collection<Object> values() {
+                    ArrayList<Object> result = 
+                          new ArrayList<Object>(this.size());
+                    for (Object o : keySet()) {
+                        result.add(get(o));
+                    }
+                    return result;
+                }
+            };
+
+
+    }
+
+
+    /**
+     * <p>For each entry in data, create component and cause it to be
+     * populated with values.</p>
+     * @param context the <code>FacesContext</code> for the current request
+     * @param data a ResourceBundle
+     */
+    private void initComponentsFromProperties(FacesContext context,
+                                              ResourceBundle data) {
+
+        // populate the map
+        for (Enumeration<String> keys = data.getKeys(); keys.hasMoreElements();) {
+
+            String key = keys.nextElement();
+            if (key == null) {
+                continue;
+            }
+            // skip secondary keys.
+            if (key.contains("_")) {
+                continue;
+            }
+            String value = data.getString(key);
+            String componentType = data.getString(key + "_componentType");
+            String valueType = data.getString(key + "_valueType");
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.fine("populating map for " + key + "\n" +
+                            "\n\tvalue: " + value +
+                            "\n\tcomponentType: " + componentType +
+                            "\n\tvalueType: " + valueType);
+            }
+            // create the component for this componentType
+            UIComponent component =
+                  context.getApplication().createComponent(componentType);
+            populateComponentWithValue(context, component, componentType,
+                                       value, valueType);
+            components.put(key, component);
+        }
+    }
+
+
+    /**
+     * <p>populate the argument component with values, being sensitive
+     * to the possible multi-nature of the values, and to the type of
+     * the values.</p>
+     * @param context the <code>FacesContext</code> for the current request
+     * @param component the <code>UIComponent</code> to populate
+     * @param componentType the component type
+     * @param value the value
+     * @param valueType the value type
+     */
+    private void populateComponentWithValue(FacesContext context,
+                                            UIComponent component,
+                                            String componentType,
+                                            String value, 
+                                            String valueType) {
+        Application application = context.getApplication();
+        Converter converter = null;
+
+        // if we need a converter, and can have a converter
+        if (!"java.lang.String".equals(valueType) &&
+            component instanceof ValueHolder) {
+            // if so create it,
+            try {
+                converter =
+                      application.createConverter(CarStore.loadClass(valueType,
+                                                                     this));
+                // add it to our component,
+                ((ValueHolder) component).setConverter(converter);
+            } catch (ClassNotFoundException cne) {
+                FacesMessage errMsg = MessageFactory.getMessage(
+                      CONVERTER_ERROR_MESSAGE_ID,
+                      valueType);
+                throw new IllegalStateException(errMsg.getSummary());
+            }
+
+        }
+
+        // if this component is a SelectOne or SelectMany, take special action
+        if (isMultiValue(componentType)) {
+            // create a UISelectItems instance
+            UISelectItems items = new UISelectItems();
+            items.setValue(parseStringIntoArrayList(value, converter));
+            // add it to the component
+            component.getChildren().add(items);
+        } else {
+            // we have a single value
+            if (null != converter) {
+                component.getAttributes().put("value",
+                                              converter.getAsObject(context,
+                                                                    component,
+                                                                    value));
+            } else {
+                component.getAttributes().put("value", value);
+            }
+        }
+    }   
+
+    /**
+     * Determines if the component type is a SelectMany or SelectOne.
+     * @param componentType the component type
+     * @return true of the componentType starts with SelectMany or SelectOne
+     */
+    private boolean isMultiValue(String componentType) {
+        if (null == componentType) {
+            return false;
+        }
+        return (componentType.startsWith("javax.faces.SelectMany") ||
+                componentType.startsWith("javax.faces.SelectOne"));
+    }
+
+
+    /*
+     * Tokenizes the passed in String which is a comma separated string of
+     * option values that serve as keys into the main resources file.
+     * For example, optionStr could be "Disc,Drum", which corresponds to
+     * brake options available for the chosen car. This String is tokenized
+     * and used as key into the main resource file to get the localized option
+     * values and stored in the passed in ArrayList.
+     */
+
+    /**
+     * <p>Tokenizes the passed in String which is a comma separated string of
+     * option values that serve as keys into the main resources file.
+     * For example, optionStr could be "Disc,Drum", which corresponds to
+     * brake options available for the chosen car. This String is tokenized
+     * and used as key into the main resource file to get the localized option
+     * values and stored in the passed in ArrayList.</p>
+     *
+     * @param value a comma separated String of values
+     * @param converter currently ignored
+     * @return a <code>List</code> of <code>SelectItem</code> instances
+     *  parsed from <code>value</code>
+     */
+    public List<SelectItem> parseStringIntoArrayList(String value,
+                                         Converter converter) {
+
+        if (value == null) {
+            return null;
+        }
+
+        String[] splitOptions = value.split(",");
+        ArrayList<SelectItem> optionsList =
+              new ArrayList<SelectItem>((splitOptions.length) + 1);
+        for (String optionKey : splitOptions) {
+            String optionLabel;
+            try {
+                optionLabel = resources.getString(optionKey);
+            } catch (MissingResourceException e) {
+                // if we can't find a hit, the key is the label
+                optionLabel = optionKey;
+            }
+
+            if (null != converter) {
+                // PENDING deal with the converter case
+            } else {
+                optionsList.add(new SelectItem(optionKey, optionLabel));
+            }
+        }
+        return optionsList;
+    }
+
+
+    public String updatePricing() {
+        getCurrentPrice();
+        return null;
+    }
+
+
+    public Integer getCurrentPrice() {
+        // go through our options and try to get the prices
+        int sum = (Integer) ((ValueHolder) getComponents().get("basePrice")).
+              getValue();
+
+        for (Object o : getComponents().keySet()) {
+
+            String key = (String) o;
+            UIComponent component = (UIComponent) getComponents().get(key);
+            Object value = component.getAttributes().get("value");
+            if (null == value || (!(component instanceof UIInput))) {
+                continue;
+            }
+
+            // if the value is a String, see if we have priceData for it
+            if (value instanceof String) {
+                try {
+                    sum +=
+                          Integer.valueOf(priceData.getString((String) value));
+                } catch (NumberFormatException e) {
+                    // do nothing
+                }
+            }
+            // if the value is a Boolean, look up the price by name
+            else if (value instanceof Boolean &&
+                     (Boolean) value) {
+                try {
+                    sum +=
+                          Integer.valueOf(priceData.getString(key));
+                } catch (NumberFormatException e) {
+                    // do nothing
+                }
+            } else if (value instanceof Number) {
+                sum += ((Number) value).intValue();
+            }
+        }
+        Integer result = sum;
+        // store the new price into the component for currentPrice
+        ((ValueHolder) getComponents().get("currentPrice")).
+              setValue(result);
+        return result;
+    }
+
+
+    public Map getComponents() {
+        return components;
+    }
+
+
+    public Map<String,Object> getAttributes() {
+        return attributes;
+    }
+
+
+}

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarCustomizer.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarCustomizer.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarCustomizer.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarCustomizer.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,151 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+
+import java.util.Enumeration;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+/**
+ * <p>A helper class that customizes a CarBean for a set of options
+ * in a package.</p>
+ * <p/>
+ * <p>This class reads its settings from a Properties file</p>
+ */
+
+public class CarCustomizer {
+
+    private static final Logger LOGGER = Logger.getLogger("carstore");
+
+    //
+    // Relationship Instance Variables
+    //
+
+    private ResourceBundle bundle = null;
+
+
+    public CarCustomizer() {
+        this.init(CarStore.DEFAULT_PACKAGE_PROPERTIES);
+    }
+
+
+    public CarCustomizer(String bundleName) {
+        this.init(bundleName);
+    }
+
+
+    private void init(String bundleName) {
+
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Loading bundle: " + bundleName + ".");
+        }
+        bundle = ResourceBundle.getBundle(bundleName);
+    }
+
+
+    private String buttonStyle = null;
+
+
+    public String getButtonStyle() {
+        return buttonStyle;
+    }
+
+
+    public void setButtonStyle(String newButtonStyle) {
+        buttonStyle = newButtonStyle;
+    }
+
+
+    public void customizeCar(CarBean toCustomize) {
+
+        FacesContext context = FacesContext.getCurrentInstance();
+        String disabledStr;
+        String curSetting;
+        UIComponent component;
+        Converter converter;
+        Object valueToSet;
+
+        for (Enumeration keys = bundle.getKeys(); keys.hasMoreElements();) {
+
+            String key = (String) keys.nextElement();
+            // skip null and secondary keys.
+            if (key == null || -1 != key.indexOf('_')) {
+                continue;
+            }
+            // skip null values
+            if (null == (curSetting = bundle.getString(key))) {
+                continue;
+            }
+
+            // skip null components
+            if (null ==
+                (component =
+                      (UIComponent) toCustomize.getComponents().get(key))) {
+                continue;
+            }
+
+            // handle the disabled setting, if necessary
+            Boolean disabled = null;
+            try {
+                if (null !=
+                    (disabledStr = bundle.getString(key + "_disabled"))) {
+                    disabled = Boolean.valueOf(disabledStr);
+                }
+            } catch (Throwable e) {
+                // do nothing
+            }
+            if (null != disabled) {
+                component.getAttributes().put("disabled", disabled);
+            }
+
+            // set the value
+            // If the component can and does have a converter
+            if (component instanceof ValueHolder &&
+                (null != (converter =
+                      ((ValueHolder) component).getConverter()))) {
+                valueToSet = converter.getAsObject(context, component,
+                                                   curSetting);
+            } else {
+                valueToSet = curSetting;
+            }
+
+            if (component instanceof ValueHolder) {
+                ((ValueHolder) component).setValue(valueToSet);
+            }
+        }
+    }
+}
+	
+	
+	

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarStore.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarStore.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarStore.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CarStore.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,310 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sun.javaee.blueprints.components.ui.components.AreaSelectedEvent;
+
+/**
+ * <p>This is the main bean for the application.  It maintains a
+ * <code>Map</code> of {@link CarBean} instances, keyed by model name,
+ * and a <code>Map</code> of {@link CarCustomizer} instances, keyed by
+ * package name.  The <code>CarBean</code> instances in the model
+ * <code>Map</code> are accessed from several pages, as described
+ * below.</p>
+ * <p/>
+ * <p>Several pages in the application use this bean as the target of
+ * method reference and value reference expressions.</p>
+ * <p/>
+ * <ul>
+ * <p/>
+ * <li><p>The "chooseLocale" page uses <code>actionListener</code>
+ * attributes to point to the {@link #chooseLocaleFromMap} and {@link
+ * #chooseLocaleFromLink} methods.</p></li>
+ * <p/>
+ * <li><p>The "storeFront" page uses value binding expressions to pull
+ * information about four of the known car models in the store.</p></li>
+ * <p/>
+ * <li><p>The "carDetail" page uses value binding expressions to pull
+ * information about the currently chosen model.  It also uses the
+ * <code>action</code> attribute to convey the user's package
+ * choices.</p></li>
+ * <p/>
+ * <li><p>The "confirmChoices" page uses value binding expressions to
+ * pull the user's choices from the currently chosen model.</p></li>
+ * <p/>
+ * </ul>
+ */
+
+public class CarStore {
+
+    private static final Logger LOGGER = Logger.getLogger("carstore");
+
+    static final String CARSTORE_PREFIX = "carstore";
+
+    static final String DEFAULT_MODEL = "Jalopy";
+
+    static final String DEFAULT_PACKAGE = "Custom";
+
+    static final String DEFAULT_MODEL_PROPERTIES = CARSTORE_PREFIX +
+                                                   ".bundles." + DEFAULT_MODEL;
+
+    static final String DEFAULT_PACKAGE_PROPERTIES = CARSTORE_PREFIX
+                                                     +
+                                                     ".bundles."
+                                                     + DEFAULT_PACKAGE;
+
+    // 
+    // Relationship Instance Variables
+    // 
+
+    /**
+     * <p>The locales to be selected for each hotspot, keyed by the
+     * alternate text for that area.</p>
+     */
+    private Map<String, Locale> locales = null;
+
+    /** <p>The currently selected car model.</p> */
+
+    private String currentModelName = DEFAULT_MODEL;
+
+    /**
+     * <p>The car models we offer.</p>
+     * <p/>
+     * <p>Keys: Strings that happen to correspond to the name of the
+     * packages.</p>
+     * <p/>
+     * <p>Values: CarBean instances</p>
+     */
+    private Map<String, CarBean> carModels = null;
+
+    /**
+     * <p>Keys: Strings that happen to correspond to the name of the
+     * Properties file for the car (without the package prefix).</p>
+     * <p/>
+     * <p>Values: CarBeanCustomizer instances</p>
+     */
+
+    private Map<String, CarCustomizer> carCustomizers = null;
+
+
+    public CarStore() {
+        if (LOGGER.isLoggable(Level.FINE)) {
+            LOGGER.fine("Creating main CarStore bean");
+            LOGGER.fine("Populating locale map");
+        }
+        locales = new HashMap<String, Locale>(4);
+        locales.put("NAmerica", Locale.ENGLISH);
+        locales.put("SAmerica", new Locale("es", "es"));
+        locales.put("Germany", Locale.GERMAN);
+        locales.put("France", Locale.FRENCH);
+    }
+
+    // 
+    // ActionListener handlers
+    //
+
+    public void chooseLocaleFromMap(ActionEvent actionEvent) {
+        AreaSelectedEvent event = (AreaSelectedEvent) actionEvent;
+        String current = event.getMapComponent().getCurrent();
+        FacesContext context = FacesContext.getCurrentInstance();
+        context.getViewRoot().setLocale(locales.get(current));
+        resetMaps();
+    }
+
+
+    public void chooseLocaleFromLink(ActionEvent event) {
+        String current = event.getComponent().getId();
+        FacesContext context = FacesContext.getCurrentInstance();
+        context.getViewRoot().setLocale(locales.get(current));
+        resetMaps();
+    }
+
+
+    private void resetMaps() {
+        if (null != carModels) {
+            carModels.clear();
+            carModels = null;
+        }
+        if (null != carCustomizers) {
+            carCustomizers.clear();
+            carCustomizers = null;
+        }
+    }
+
+
+    public void choosePackage(ActionEvent event) {
+        String packageName = event.getComponent().getId();
+        choosePackage(packageName);
+    }
+
+
+    public void choosePackage(String packageName) {
+        CarCustomizer packageCustomizer = carCustomizers.get(packageName);
+        packageCustomizer.customizeCar(getCurrentModel());
+        getCurrentModel().getCurrentPrice();
+
+        // HERE IS WHERE WE UPDATE THE BUTTON STYLE!
+
+        // go through all the available packages and set the button
+        // style accordingly.
+        for (String curName : carCustomizers.keySet()) {
+            packageCustomizer = carCustomizers.get(curName);
+            if (curName.equals(packageName)) {
+                packageCustomizer.setButtonStyle("package-selected");
+            } else {
+                packageCustomizer.setButtonStyle("package-unselected");
+            }
+        }
+    }
+
+    // 
+    // action handlers
+    // 
+
+    public String storeFrontJalopyPressed() {
+        setCurrentModelName("Jalopy");
+        return "carDetail";
+    }
+
+
+    public String storeFrontRoadsterPressed() {
+        setCurrentModelName("Roadster");
+        return "carDetail";
+    }
+
+
+    public String storeFrontLuxuryPressed() {
+        setCurrentModelName("Luxury");
+        return "carDetail";
+    }
+
+
+    public String storeFrontSUVPressed() {
+        setCurrentModelName("SUV");
+        return "carDetail";
+    }
+
+
+    public String buyCurrentCar() {
+        getCurrentModel().getCurrentPrice();
+        return "confirmChoices";
+    }
+
+    //
+    // Accessors
+    // 
+
+    public CarBean getCurrentModel() {
+        return carModels.get(getCurrentModelName());
+    }
+
+
+    public Map getModels() {
+        if (null == carModels) {
+            carModels = new HashMap<String, CarBean>(4);
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.fine("Populating carModel map");
+            }
+            carModels.put(DEFAULT_MODEL,
+                          new CarBean(DEFAULT_MODEL_PROPERTIES));
+            carModels.put("Roadster",
+                          new CarBean(CARSTORE_PREFIX + ".bundles.Roadster"));
+            carModels.put("Luxury", new CarBean(CARSTORE_PREFIX +
+                                                ".bundles.Luxury"));
+            carModels.put("SUV", new CarBean(CARSTORE_PREFIX +
+                                             ".bundles.SUV"));
+        }
+
+        return carModels;
+    }
+
+
+    public Map getCustomizers() {
+        getModels();
+        if (null == carCustomizers) {
+            carCustomizers = new HashMap<String, CarCustomizer>(4);
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.fine("Populating carCustomizers map");
+            }
+            carCustomizers.put("Custom", new CarCustomizer(CARSTORE_PREFIX +
+                                                           ".bundles.Custom"));
+            carCustomizers.put("Standard",
+                               new CarCustomizer(CARSTORE_PREFIX +
+                                                 ".bundles.Standard"));
+            carCustomizers.put("Performance",
+                               new CarCustomizer(CARSTORE_PREFIX +
+                                                 ".bundles.Performance"));
+            carCustomizers.put("Deluxe",
+                               new CarCustomizer(CARSTORE_PREFIX +
+                                                 ".bundles.Deluxe"));
+            choosePackage("Custom");
+        }
+        return carCustomizers;
+    }
+
+    //
+    // private methods
+    // 
+
+    private String getCurrentModelName() {
+        return currentModelName;
+    }
+
+
+    private void setCurrentModelName(String newName) {
+        currentModelName = newName;
+    }
+
+    // package private util methods
+
+    static Class loadClass(String name,
+                           Object fallbackClass) throws ClassNotFoundException {
+        ClassLoader loader = getCurrentLoader(fallbackClass);
+        return loader.loadClass(name);
+    }
+
+
+    static ClassLoader getCurrentLoader(Object fallbackClass) {
+        ClassLoader loader =
+              Thread.currentThread().getContextClassLoader();
+        if (loader == null) {
+            loader = fallbackClass.getClass().getClassLoader();
+        }
+        return loader;
+    }
+
+
+}

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CreditCardConverter.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CreditCardConverter.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CreditCardConverter.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CreditCardConverter.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,138 @@
+/*
+ * $Id: CreditCardConverter.java,v 1.3 2006/03/09 01:17:29 rlubke Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+
+/**
+ * CreditCardConverter Class accepts a Credit Card Number of type String
+ * and strips blanks and <oode>"-"</code> if any from it. It also formats the
+ * CreditCardNumber such a blank space separates every four characters.
+ * Blanks and <oode>"-"</code> characters are the expected demiliters
+ * that could be used as part of a CreditCardNumber.
+ */
+public class CreditCardConverter implements Converter {
+
+    /**
+     * <p>The message identifier of the Message to be created if
+     * the conversion fails.  The message format string for this
+     * message may optionally include a <code>{0}</code> and
+     * <code>{1}</code> placeholders, which
+     * will be replaced by the object and value.</p>
+     */
+    public static final String CONVERSION_ERROR_MESSAGE_ID =
+          "carstore.Conversion_Error";
+    
+
+    /**
+     * <p>Parses the credit card number and strips any whitespace or 
+     * <code>"-"</code> characters from it.</p>
+     * @param context the <code>FacesContext</code> of the current request
+     * @param component the component associated with the value
+     * @param newValue the new value
+     * @return the credit card number less any whitespace or <code>"-"<code>
+     *  characters
+     * @throws ConverterException if the value cannot be converted
+     */
+    public Object getAsObject(FacesContext context, 
+                              UIComponent component,
+                              String newValue) throws ConverterException {
+
+        if (newValue == null) {
+            return newValue;
+        }
+        // Since this is only a String to String conversion, this conversion 
+        // does not throw ConverterException.
+        String convertedValue = newValue.trim();
+        if (((convertedValue.indexOf('-')) != -1) ||
+            ((convertedValue.indexOf(' ')) != -1)) {
+            char[] input = convertedValue.toCharArray();
+            StringBuilder buffer = new StringBuilder(50);
+            for (char anInput : input) {
+                buffer.append(anInput);
+            }
+            convertedValue = buffer.toString();
+        }
+        // System.out.println("Converted value " + convertedValue);
+        return convertedValue;
+    }
+   
+    /**
+     * <p>Formats the value by inserting space after every four characters
+     * for better readability if they don't already exist. In the process
+     * converts any <code>"-"</code> characters into blanks for consistency.</p>
+     * @param context the <code>FacesContext</code> of the current request
+     * @param component the component associated with the value
+     * @param value the value to convert
+     * @return a formatted credit card number
+     * @throws ConverterException if the value cannot be converted
+     */
+    public String getAsString(FacesContext context, UIComponent component,
+                              Object value) throws ConverterException {
+
+        if (value == null) {
+            return null;
+        }
+        // value must be of the type that can be cast to a String.
+        String inputVal = null;
+        try {
+            inputVal = (String) value;
+        } catch (ClassCastException ce) {
+            FacesMessage errMsg = MessageFactory.getMessage(
+                  CONVERSION_ERROR_MESSAGE_ID,
+                  value,
+                  inputVal);
+            throw new ConverterException(errMsg.getSummary());
+        }
+
+        // insert spaces after every four characters for better    
+        // readability if it doesn't already exist.   
+        char[] input = inputVal.toCharArray();
+        StringBuilder buffer = new StringBuilder(50);
+        for (int i = 0; i < input.length; ++i) {
+            if ((i % 4) == 0 && i != 0) {
+                if (input[i] != ' ' || input[i] != '-') {
+                    buffer.append(' ');
+                    // if there any "-"'s convert them to blanks.
+                } else if (input[i] == '-') {
+                    buffer.append(' ');
+                }
+            }
+            buffer.append(input[i]);
+        }
+        // System.out.println("Formatted value " + convertedValue);
+        return buffer.toString();
+    }
+}

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CustomerBean.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CustomerBean.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CustomerBean.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/CustomerBean.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,185 @@
+/*
+ * $Id: CustomerBean.java,v 1.3 2006/03/09 01:17:29 rlubke Exp $
+ */
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.ResourceBundle;
+
+public class CustomerBean {
+
+
+    private String firstName = null;
+    private String middleInitial = null;
+    private String lastName = null;
+    private String mailingAddress = null;
+    private String city = null;
+    private String state = null;
+    private String zip = null;
+    private String month = null;
+    private String year = null;
+
+
+    public CustomerBean() {
+        super();
+    }
+
+
+    protected Collection<SelectItem> titleOptions = null;
+
+
+    public Collection getTitleOptions() {
+        titleOptions = new ArrayList<SelectItem>(3);
+        ResourceBundle rb = ResourceBundle.getBundle(
+              "carstore.bundles.Resources",
+              (FacesContext.getCurrentInstance().getViewRoot().getLocale()));
+        String titleStr = (String) rb.getObject("mrLabel");
+        titleOptions.add(new SelectItem(titleStr, titleStr,
+                                        titleStr));
+        titleStr = (String) rb.getObject("mrsLabel");
+        titleOptions.add(new SelectItem(titleStr, titleStr,
+                                        titleStr));
+        titleStr = (String) rb.getObject("msLabel");
+        titleOptions.add(new SelectItem(titleStr, titleStr,
+                                        titleStr));
+
+        return titleOptions;
+    }
+
+
+    public void setTitleOptions(Collection<SelectItem> newOptions) {
+        titleOptions = new ArrayList<SelectItem>(newOptions);
+    }
+
+
+    String title = null;
+
+
+    public void setCurrentTitle(String newTitle) {
+        title = newTitle;
+    }
+
+
+    public String getCurrentTitle() {
+        return title;
+    }
+
+
+    public void setFirstName(String first) {
+        firstName = first;
+    }
+
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+
+    public void setMiddleInitial(String mI) {
+        middleInitial = mI;
+    }
+
+
+    public String getMiddleInitial() {
+        return middleInitial;
+    }
+
+
+    public void setLastName(String last) {
+        lastName = last;
+    }
+
+
+    public String getLastName() {
+        return lastName;
+    }
+
+
+    public void setMailingAddress(String mA) {
+        mailingAddress = mA;
+    }
+
+
+    public String getMailingAddress() {
+        return mailingAddress;
+    }
+
+
+    public void setCity(String cty) {
+        city = cty;
+    }
+
+
+    public String getCity() {
+        return city;
+    }
+
+
+    public void setState(String sT) {
+        state = sT;
+    }
+
+
+    public String getState() {
+        return state;
+    }
+
+
+    public void setZip(String zipCode) {
+        zip = zipCode;
+    }
+
+
+    public String getZip() {
+        return zip;
+    }
+
+
+    public void setMonth(String mth) {
+        month = mth;
+    }
+
+
+    public String getMonth() {
+        return month;
+    }
+
+
+    public void setYear(String yr) {
+        year = yr;
+    }
+
+
+    public String getYear() {
+        return year;
+    }
+}

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FirstNameChanged.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FirstNameChanged.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FirstNameChanged.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FirstNameChanged.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,52 @@
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+
+package carstore;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.PhaseId;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+
+public class FirstNameChanged implements ValueChangeListener {
+
+    public void processValueChange(ValueChangeEvent event)
+          throws AbortProcessingException {
+        if (null != event.getNewValue()) {
+            FacesContext.getCurrentInstance().getExternalContext()
+                  .getSessionMap()
+                  .put("firstName", event.getNewValue());
+        }
+    }
+
+
+    public PhaseId getPhaseId() {
+        return PhaseId.ANY_PHASE;
+    }
+
+}
+    

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidator.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidator.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidator.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidator.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,274 @@
+/*
+ * $Id: FormatValidator.java,v 1.3 2006/03/09 01:17:29 rlubke Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+import javax.el.ValueExpression;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import java.util.ArrayList;
+
+
+/**
+ * <p><strong>FormatValidator</strong> is a Validator that checks
+ * the validity of String representation of the value of the
+ * associated component against a list of specified patterns.</p>
+ * <ul>
+ * <li>Call getValue() to retrieve the current value of the component.
+ * If it is <code>null</code>, exit immediately.  (If null values
+ * should not be allowed, a RequiredValidator can be configured
+ * to check for this case.)</li>
+ * <li><code>formatPattern</code> is a <code>|</code> separated string
+ * of allowed patterns. </li>
+ * <li> This validator uses the following rules to match a value against a
+ * pattern.
+ * <li> if the matching pattern has a "A", then corresponding character
+ * in input value should be a letter.
+ * <li> if the matching pattern has a "9", then corresponding character
+ * in input value should be a number.
+ * <li> if the matching pattern has a "#", then corresponding character
+ * in input value should be a number or  a letter.
+ * <li> Any other character must match literally.
+ * </ul> </ul>
+ * <p/>
+ * Validators have to be Serializable, so you can't maintain a reference to
+ * a java.sql.Connection or javax.sql.DataSource inside this class in case
+ * you need to hook upto the database or some other back end resource.
+ * One approach would be to use JNDI-based data source lookups or do
+ * this verification in the business tier.
+ */
+
+public class FormatValidator implements Validator, StateHolder {
+
+    // ----------------------------------------------------- Manifest Constants
+
+    /**
+     * <p>The message identifier of the Message to be created if
+     * the validation fails.  The message format string for this
+     * message may optionally include a <code>{0}</code> placeholder, which
+     * will be replaced by list of format patterns.</p>
+     */
+    public static final String FORMAT_INVALID_MESSAGE_ID =
+          "carstore.Format_Invalid";
+
+    private ArrayList<String> formatPatternsList;
+
+
+    //
+    // Constructors and Initializers    
+    //
+    public FormatValidator() {
+        super();
+    }
+
+    // 
+    // General Methods
+    //
+    /**
+     * <code>|</code> separated String of format patterns
+     * that this validator must match against.
+     */
+    private ValueExpression formatPatterns = null;
+
+
+    /* <p>Return the format patterns that the validator supports. */
+
+    /**
+     * @return the configured format patterns
+     */
+    public ValueExpression getFormatPatterns() {
+
+        return (this.formatPatterns);
+
+    }
+
+
+    /**
+     * <p>Set the format patterns that the validator support..</p>
+     *
+     * @param formatPatterns <code>|</code> separated String of format patterns
+     *                       that this validator must match against.
+     */
+    public void setFormatPatterns(ValueExpression formatPatterns) {
+
+        this.formatPatterns = formatPatterns;
+        parseFormatPatterns();
+    }
+
+
+    /**
+     * Parses the <code>formatPatterns</code> into validPatterns
+     * <code>ArrayList</code>. The delimiter must be "|".
+     */
+    public void parseFormatPatterns() {
+        String evalPatterns = (String)
+              formatPatterns
+                    .getValue(FacesContext.getCurrentInstance().getELContext());
+        if (evalPatterns == null || evalPatterns.length() == 0) {
+            return;
+        }
+        String[] patterns = evalPatterns.split("\\|");
+        if (formatPatternsList != null) {
+            return;
+        } else {
+            formatPatternsList = new ArrayList<String>(patterns.length);
+        }
+        for (String pattern : patterns) {
+            formatPatternsList.add(pattern);
+        }
+    }
+
+
+    //
+    // Methods from Validator
+    //
+    public void validate(FacesContext context, UIComponent component,
+                         Object toValidate) {
+        boolean valid = false;
+        String value;
+        if ((context == null) || (component == null)) {
+            throw new NullPointerException();
+        }
+        if (!(component instanceof UIOutput)) {
+            return;
+        }
+
+        if (null == formatPatternsList || null == toValidate) {
+            return;
+        }
+
+        value = toValidate.toString();
+        // validate the value against the list of valid patterns.
+        for (String aFormatPatternsList : formatPatternsList) {
+            valid = isFormatValid((aFormatPatternsList), value);
+            if (valid) {
+                break;
+            }
+        }
+        if (!valid) {
+            FacesMessage errMsg = MessageFactory.getMessage(context,
+                                                            FORMAT_INVALID_MESSAGE_ID,
+                                                            formatPatterns);
+            throw new ValidatorException(errMsg);
+        }
+    }
+
+
+    /* Returns true if the value matches one of the valid patterns. */
+
+    /**
+     * <p>Returns true if the value matches one of the valid patterns.</p>
+     * @param pattern the 'control' pattern
+     * @param value the value to match
+     * @return true if the value matches the pattern
+     */
+    protected boolean isFormatValid(String pattern, String value) {
+        boolean valid = true;
+        // if there is no pattern to match then value is valid
+        if (pattern == null || pattern.length() == 0) {
+            return true;
+        }
+        // if the value is null or a zero length string return false.
+        if (value == null || value.length() == 0) {
+            return false;
+        }
+        // if the length of the value is not equal to the length of the
+        // pattern string then the value is not valid.
+        if (value.length() != pattern.length()) {
+            return false;
+        }
+        value = value.trim();
+        // rules for matching. 
+        // 1. if the matching pattern has a "A", then corresponding character
+        // in the value should a letter.
+        // 2. if the matching pattern has a "9", then corresponding character
+        // in the value should a number
+        // 3. if the matching pattern has a "#", then corresponding character
+        // in the value should a number or a letter
+        // 4.. any other character must match literally.
+        char[] input = value.toCharArray();
+        char[] fmtpattern = pattern.toCharArray();
+        for (int i = 0; i < fmtpattern.length; ++i) {
+            if (fmtpattern[i] == 'A') {
+                if (!(Character.isLetter(input[i]))) {
+                    valid = false;
+                }
+            } else if (fmtpattern[i] == '9') {
+                if (!(Character.isDigit(input[i]))) {
+                    valid = false;
+                }
+            } else if (fmtpattern[i] == '#') {
+                if ((!(Character.isDigit(input[i]))) &&
+                    (!(Character.isLetter(input[i])))) {
+                    valid = false;
+                }
+            } else {
+                if (!(fmtpattern[i] == input[i])) {
+                    valid = false;
+                }
+            }
+        }
+        return valid;
+
+    }
+
+
+    public Object saveState(FacesContext context) {
+        Object values[] = new Object[2];
+        values[0] = formatPatterns;
+        values[1] = formatPatternsList;
+        return (values);
+    }
+
+
+    public void restoreState(FacesContext context, Object state) {
+        Object values[] = (Object[]) state;
+        formatPatterns = (ValueExpression) values[0];
+        formatPatternsList = (ArrayList<String>) values[1];
+    }
+
+
+    private boolean transientValue = false;
+
+
+    public boolean isTransient() {
+        return (this.transientValue);
+    }
+
+
+    public void setTransient(boolean transientValue) {
+        this.transientValue = transientValue;
+    }
+}

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidatorTag.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidatorTag.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidatorTag.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/FormatValidatorTag.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,74 @@
+/*
+ * $Id: FormatValidatorTag.java,v 1.3 2006/03/09 01:17:30 rlubke Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.webapp.ValidatorELTag;
+import javax.servlet.jsp.JspException;
+
+/**
+ * FormatValidatorTag is the tag handler class for FormatValidator tag,
+ * <code>format_validator</code>.
+ */
+
+public class FormatValidatorTag extends ValidatorELTag {
+
+    private static final String VALIDATOR_ID = "FormatValidator";
+    protected ValueExpression formatPatterns = null;
+
+
+    public FormatValidatorTag() {
+        super();
+    }
+
+
+    public ValueExpression getFormatPatterns() {
+        return formatPatterns;
+    }
+
+
+    public void setFormatPatterns(ValueExpression formatPatterns) {
+        this.formatPatterns = formatPatterns;
+    }
+
+    protected Validator createValidator() throws JspException {
+        FormatValidator result =
+              (FormatValidator) FacesContext.getCurrentInstance()
+                    .getApplication()
+                    .createValidator(VALIDATOR_ID);
+
+        result.setFormatPatterns(formatPatterns);
+        return result;
+    }
+
+} // end of class FormatValidatorTag

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/MessageFactory.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/MessageFactory.java?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/MessageFactory.java (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/MessageFactory.java Tue Jun  1 23:35:42 2010
@@ -0,0 +1,210 @@
+/*
+ * $Id: MessageFactory.java,v 1.3 2006/03/09 01:17:30 rlubke Exp $
+ */
+
+/*
+ * The contents of this file are subject to the terms
+ * of the Common Development and Distribution License
+ * (the License). You may not use this file except in
+ * compliance with the License.
+ * 
+ * You can obtain a copy of the License at
+ * https://javaserverfaces.dev.java.net/CDDL.html or
+ * legal/CDDLv1.0.txt. 
+ * See the License for the specific language governing
+ * permission and limitations under the License.
+ * 
+ * When distributing Covered Code, include this CDDL
+ * Header Notice in each file and include the License file
+ * at legal/CDDLv1.0.txt.    
+ * If applicable, add the following below the CDDL Header,
+ * with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ * 
+ * [Name of File] [ver.__] [Date]
+ * 
+ * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+ */
+
+package carstore;
+
+import javax.faces.application.Application;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * <p>supported filters: <code>package</code> and
+ * <code>protection</code>.</p>
+ */
+
+public class MessageFactory {
+
+    private static final Object[] EMPTY_ARGS = new Object[0];
+
+
+    private MessageFactory() {
+    }
+
+
+    public static String substituteParams(Locale locale,
+                                          String msgtext,
+                                          Object... params) {
+        String localizedStr = null;
+
+        if (params == null || msgtext == null) {
+            return msgtext;
+        }
+        StringBuffer b = new StringBuffer(100);
+        MessageFormat mf = new MessageFormat(msgtext);
+        if (locale != null) {
+            mf.setLocale(locale);
+            b.append(mf.format(params));
+            localizedStr = b.toString();
+        }
+        return localizedStr;
+    }    
+
+    /**
+     * <p>This version of getMessage() is used by Sun's JSF implementation
+     * for localizing implementation specific messages
+     * @param messageId the message ID
+     * @param params substitution params
+     * @return a localized <code>FacesMessage</code>
+     */
+    public static FacesMessage getMessage(String messageId, Object... params) {
+        Locale locale;
+        FacesContext context = FacesContext.getCurrentInstance();
+        // context.getViewRoot() may not have been initialized at this point.
+        if (context != null && context.getViewRoot() != null) {
+            locale = context.getViewRoot().getLocale();
+            if (locale == null) {
+                locale = Locale.getDefault();
+            }
+        } else {
+            locale = Locale.getDefault();
+        }
+
+        return getMessage(locale, messageId, params);
+    }
+
+
+    public static FacesMessage getMessage(Locale locale,
+                                          String messageId,
+                                          Object... params) {
+        String summary = null;
+        String detail = null;
+        String bundleName;
+        ResourceBundle bundle = null;
+
+        // see if we have a user-provided bundle
+        if (null != (bundleName = getApplication().getMessageBundle())) {
+            if (null !=
+                (bundle =
+                      ResourceBundle.getBundle(bundleName, locale,
+                                               getCurrentLoader(bundleName)))) {
+                // see if we have a hit
+                try {
+                    summary = bundle.getString(messageId);
+                } catch (MissingResourceException e) {
+                    // log message
+                }
+            }
+        }
+
+        // we couldn't find a summary in the user-provided bundle
+        if (null == summary) {
+            // see if we have a summary in the app provided bundle
+            bundle = ResourceBundle.getBundle(FacesMessage.FACES_MESSAGES,
+                                              locale,
+                                              getCurrentLoader(bundleName));
+            if (null == bundle) {
+                throw new NullPointerException();
+            }
+            // see if we have a hit
+            try {
+                summary = bundle.getString(messageId);
+            } catch (MissingResourceException e) {
+                // log message
+            }
+        }
+
+        // we couldn't find a summary anywhere!  Return null
+        if (null == summary) {
+            return null;
+        }
+
+        // At this point, we have a summary and a bundle.
+        if (null == summary || null == bundle) {
+            throw new NullPointerException();
+        }
+        summary = substituteParams(locale, summary, params);
+
+        try {
+            detail = substituteParams(locale,
+                                      bundle.getString(messageId + "_detail"),
+                                      params);
+        } catch (MissingResourceException e) {
+            // log message
+        }
+
+        return (new FacesMessage(summary, detail));
+    }
+
+
+    //
+    // Methods from MessageFactory
+    // 
+    public static FacesMessage getMessage(FacesContext context,
+                                          String messageId) {
+        return getMessage(context, messageId, EMPTY_ARGS);
+    }
+
+
+    public static FacesMessage getMessage(FacesContext context,
+                                          String messageId,
+                                          Object... params) {
+        if (context == null || messageId == null) {
+            throw new NullPointerException(
+                  "One or more parameters could be null");
+        }
+        Locale locale;
+        // viewRoot may not have been initialized at this point.
+        if (context.getViewRoot() != null) {
+            locale = context.getViewRoot().getLocale();
+        } else {
+            locale = Locale.getDefault();
+        }
+        if (null == locale) {
+            throw new NullPointerException();
+        }
+        FacesMessage message = getMessage(locale, messageId, params);
+        if (message != null) {
+            return message;
+        }
+        locale = Locale.getDefault();
+        return (getMessage(locale, messageId, params));
+    }
+
+
+    protected static Application getApplication() {
+        return (FacesContext.getCurrentInstance().getApplication());
+    }
+
+
+    protected static ClassLoader getCurrentLoader(Object fallbackClass) {
+        ClassLoader loader =
+              Thread.currentThread().getContextClassLoader();
+        if (loader == null) {
+            loader = fallbackClass.getClass().getClassLoader();
+        }
+        return loader;
+    }
+
+
+} // end of class MessageFactory

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Common_options.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Common_options.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Common_options.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Common_options.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,48 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the non-localized set of options common to all cars
+
+sunroof=false
+sunroof_componentType=javax.faces.SelectBoolean
+sunroof_valueType=java.lang.Boolean
+cruisecontrol=false
+cruisecontrol_componentType=javax.faces.SelectBoolean
+cruisecontrol_valueType=java.lang.Boolean
+keylessentry=false
+keylessentry_componentType=javax.faces.SelectBoolean
+keylessentry_valueType=java.lang.Boolean
+securitySystem=false
+securitySystem_componentType=javax.faces.SelectBoolean
+securitySystem_valueType=java.lang.Boolean
+skiRack=false
+skiRack_componentType=javax.faces.SelectBoolean
+skiRack_valueType=java.lang.Boolean
+towPackage=false
+towPackage_componentType=javax.faces.SelectBoolean
+towPackage_valueType=java.lang.Boolean
+gps=false
+gps_componentType=javax.faces.SelectBoolean
+gps_valueType=java.lang.Boolean

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Custom.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Custom.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Custom.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Custom.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,45 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+sunroof=false
+sunroof_disabled=false
+cruisecontrol=false
+cruisecontrol_disabled=false
+keylessentry=false
+keylessentry_disabled=false
+securitySystem=false
+securitySystem_disabled=false
+skirack=false
+skirack_disabled=false
+towPackage=false
+towPackage_disabled=false
+gps=false
+gps_disabled=false
+
+engine=V4
+brake=Disc
+suspension=Regular
+speaker=4
+audio=Standard
+transmission=Manual

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Deluxe.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Deluxe.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Deluxe.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Deluxe.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,45 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+sunroof=true
+sunroof_disabled=false
+cruisecontrol=true
+cruisecontrol_disabled=false
+keylessentry=true
+keylessentry_disabled=false
+securitySystem=true
+securitySystem_disabled=false
+skirack=true
+skirack_disabled=false
+towPackage=true
+towPackage_disabled=false
+gps=true
+gps_disabled=false
+
+engine=V8
+brake=Drum
+suspension=Regular
+speaker=6
+audio=Premium
+transmission=Auto

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,33 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the localized content for the Jalopy 
+
+title=Duke's Stripped-Down Jalopy
+title_componentType=javax.faces.Output
+title_valueType=java.lang.String
+description=If you're the type who doesn't care what anyone thinks, this is the car for you. Strictly for point-a-to-point-b types.
+description_componentType=javax.faces.Output
+description_valueType=java.lang.String

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_de.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_de.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_de.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_de.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,33 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the localized content for the Jalopy 
+
+title=Dukes alte Kiste
+title_componentType=javax.faces.Output
+title_valueType=java.lang.String
+description=Wenn Sie der Typ von Mensch sind, den es nicht k\u00fcmmert, was jeder denkt, dann ist dies genau der richtige Wagen f\u00fcr Sie! Gedacht f\u00fcr Punkt-A-Nach-Punkt-B Typen. 
+description_componentType=javax.faces.Output
+description_valueType=java.lang.String

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_es.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_es.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_es.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_es.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,33 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the localized content for the Jalopy 
+
+title=El cacharro de Duke
+title_componentType=javax.faces.Output
+title_valueType=java.lang.String
+description=Este es el carro para ti si tu eres el tipo de persona de que no le importa lo que otros opinion de ti.
+description_componentType=javax.faces.Output
+description_valueType=java.lang.String

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_fr.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_fr.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_fr.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_fr.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,33 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the localized content for the Jalopy 
+
+title=La coccinelle de Duke
+title_componentType=javax.faces.Output
+title_valueType=java.lang.String
+description=Si l'opinion des autres ne vous d\u00e9range pas, c'est l'automobile qu'il vous faut.  Id\u00e9al pous vous permettre d'aller du point A au point B.
+description_componentType=javax.faces.Output
+description_valueType=java.lang.String

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_options.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_options.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_options.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Jalopy_options.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,58 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the non-localized set of options for the Jalopy
+
+basePrice=10750
+basePrice_componentType=javax.faces.Output
+basePrice_valueType=java.lang.Integer
+currentPrice=10750
+currentPrice_componentType=javax.faces.Output
+currentPrice_valueType=java.lang.Integer
+brake=Disc,Drum
+brake_componentType=javax.faces.SelectOne
+brake_valueType=java.lang.String
+suspension=Performance,Regular
+suspension_componentType=javax.faces.SelectOne
+suspension_valueType=java.lang.String
+audio=Standard,Premium
+audio_componentType=javax.faces.SelectOne
+audio_valueType=java.lang.String
+transmission=Auto,Manual
+transmission_componentType=javax.faces.SelectOne
+transmission_valueType=java.lang.String
+image=/images/200x168_Jalopy.jpg
+image_componentType=javax.faces.Graphic
+image_valueType=java.lang.String
+imageSmall=/images/150x126_Jalopy.jpg
+imageSmall_componentType=javax.faces.Graphic
+imageSmall_valueType=java.lang.String
+engine=V4,V6
+engine_componentType=javax.faces.SelectOne
+engine_valueType=java.lang.String
+speaker=4,6
+speaker_componentType=javax.faces.SelectOne
+speaker_valueType=java.lang.String
+

Added: myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Luxury.properties
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Luxury.properties?rev=950308&view=auto
==============================================================================
--- myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Luxury.properties (added)
+++ myfaces/portlet-bridge/core/trunk_2.0.x/examples/carstore/src/main/java/carstore/bundles/Luxury.properties Tue Jun  1 23:35:42 2010
@@ -0,0 +1,34 @@
+#
+# The contents of this file are subject to the terms
+# of the Common Development and Distribution License
+# (the License). You may not use this file except in
+# compliance with the License.
+# 
+# You can obtain a copy of the License at
+# https://javaserverfaces.dev.java.net/CDDL.html or
+# legal/CDDLv1.0.txt. 
+# See the License for the specific language governing
+# permission and limitations under the License.
+# 
+# When distributing Covered Code, include this CDDL
+# Header Notice in each file and include the License file
+# at legal/CDDLv1.0.txt.    
+# If applicable, add the following below the CDDL Header,
+# with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+# 
+# [Name of File] [ver.__] [Date]
+# 
+# Copyright 2005 Sun Microsystems Inc. All Rights Reserved
+#
+
+# this file contains the localized content for the Luxury
+
+
+title=Duke's Vulgar Luxury Car
+title_componentType=javax.faces.Output
+title_valueType=java.lang.String
+description=Those Joneses next door have everything, don't they? Well, show them that you're the one pulling in the big bucks by driving up in this loaded chassis.
+description_componentType=javax.faces.Output
+description_valueType=java.lang.String



Mime
View raw message