You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by ma...@apache.org on 2007/03/07 14:44:48 UTC

svn commit: r515587 [3/19] - in /incubator/adffaces/branches/matzew-core-1.0.0-incubation: ./ examples/ examples/trinidad-demo/ examples/trinidad-demo/src/ examples/trinidad-demo/src/conf/ examples/trinidad-demo/src/main/ examples/trinidad-demo/src/mai...

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,263 @@
+/*
+ *  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.trinidaddemo;
+
+import java.lang.reflect.Array;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+public class ListTestBean implements java.io.Serializable
+{
+  public void valueChanged(ValueChangeEvent vce)
+  {
+    String oldValue = _toString(vce.getOldValue());
+    Object newValue = _toString(vce.getNewValue());
+    FacesContext context = FacesContext.getCurrentInstance();
+    String message =
+      "Value changed from " + oldValue + " to " + newValue;
+    context.addMessage(vce.getComponent().getClientId(context),
+                       new FacesMessage(message));
+  }
+
+  public Integer getSingleInt()
+  {
+    return _int;
+  }
+
+  public void setSingleInt(Integer val)
+  {
+    _int = val;
+  }
+
+  public int[] getIntArray()
+  {
+    return _intArray;
+  }
+
+  public void setIntArray(int[] val)
+  {
+    _intArray = val;
+  }
+
+  public String getSingleString()
+  {
+    return _string;
+  }
+
+  public void setSingleString(String val)
+  {
+    _string = val;
+  }
+
+  public String[] getStringArray()
+  {
+    return _stringArray;
+  }
+
+  public void setStringArray(String[] val)
+  {
+    _stringArray = val;
+  }
+
+  public List<Object> getObjectList()
+  {
+    return _objectList;
+  }
+
+  public void setObjectList(List<Object> val)
+  {
+    _objectList = val;
+  }
+
+  public List<String> getStringList()
+  {
+    return _stringList;
+  }
+
+  public void setSelectedSelectItems(List<?> val)
+  {
+    _selectedSelectItems = val;
+  }
+
+  public List<?> getSelectedSelectItems()
+  {
+    return _selectedSelectItems;
+  }
+  
+  public void setSelectedCars(List<?> selectedCars)
+  {
+    _selectedCars = selectedCars;
+  }
+
+  public List<?> getSelectedCars()
+  {
+    return _selectedCars;
+  }
+    
+  public void setSelectedCars2(List<?> selectedCars)
+  {
+    _selectedCars2 = selectedCars;
+  }
+
+  public List<?> getSelectedCars2()
+  {
+    return _selectedCars2;
+  }
+
+  public List<SelectItem> getMakes()
+  {
+    return _MAKE_ITEMS;
+  }
+  
+  public SelectItem getFirstSelectItemString()
+  {
+    return _FIRST_CAR;
+  }
+  
+  public SelectItem getSecondSelectItemString()
+  {
+    return _SECOND_CAR;
+  }
+  
+  public SelectItem getThirdSelectItemString()
+  {
+    return _THIRD_CAR;
+  }  
+  
+  public SelectItem getFirstSelectItemCar()
+  {
+    return _FIRST_SELECT_ITEM_CAR;
+  }
+  
+  public SelectItem getSecondSelectItemCar()
+  {
+    return _SECOND_SELECT_ITEM_CAR;
+  }
+  
+  public SelectItem getThirdSelectItemCar()
+  {
+    return _THIRD_SELECT_ITEM_CAR;
+  }  
+  
+  static private String _toString(Object o)
+  {
+    if (o == null)
+      return "null";
+
+    if (o instanceof List)
+    {
+      String s = "List[";
+      for (int i = 0; i < ((List) o).size(); i++)
+      {
+        if (i != 0)
+          s += ",";
+
+        s += _toString(((List) o).get(i));
+      }
+
+      return s + "]";
+    }
+    else if (o.getClass().isArray())
+    {
+      String s = "Array[";
+      int size = Array.getLength(o);
+      for (int i = 0; i < size; i++)
+      {
+        if (i != 0)
+          s += ",";
+
+        s += _toString(Array.get(o, i));
+      }
+
+      return s + "]";
+    }
+
+    if (o instanceof Car)
+      return "\"" + ((Car)o).getName() + "\"";
+      
+    if (o instanceof String)
+      return "\"" + o.toString() + "\"";
+
+    return o.toString();
+  }
+
+  // this is used to test a Car Object instead of a String in SelectItem
+  // when we use this, we also need to set "useIndexValue" attribute to true.
+  static public class Car  implements java.io.Serializable
+  {
+    public Car(){}
+    
+    public Car (String name)
+    {
+      _name = name;
+    }
+    public String getName()
+    {
+      return _name;
+    }
+    private String _name;
+  } 
+  
+  static private final List<SelectItem> _MAKE_ITEMS = new ArrayList<SelectItem>();
+  
+  static private final SelectItem _FIRST_CAR = 
+    new SelectItem("cordera", "Cordera Ltd.");
+  static private final SelectItem _SECOND_CAR = 
+    new SelectItem("automno", "Autumno Inc.");
+  static private final SelectItem _THIRD_CAR  = 
+    new SelectItem("grabowski", "Grabowski Motors");
+
+  static private final SelectItem _FIRST_SELECT_ITEM_CAR = 
+    new SelectItem(new Car("cordera"), "Cordera Ltd.");
+  static private final SelectItem _SECOND_SELECT_ITEM_CAR = 
+    new SelectItem(new Car("automno"), "Autumno Inc.");
+  static private final SelectItem _THIRD_SELECT_ITEM_CAR  = 
+    new SelectItem(new Car("grabowski"), "Grabowski Motors"); 
+
+
+  static
+  {
+    // test a Car Object instead of a String in SelectItem.
+    // If you do not have a converter, 
+    // make sure to use "useIndexValue='true'" in selectOne/selectMany
+    // component.
+    _MAKE_ITEMS.add(_FIRST_SELECT_ITEM_CAR);
+    _MAKE_ITEMS.add(_SECOND_SELECT_ITEM_CAR);
+    _MAKE_ITEMS.add(_THIRD_SELECT_ITEM_CAR);
+  }   
+  
+  private List<?> _selectedCars;
+  private List<?> _selectedCars2;
+  private List<?> _selectedSelectItems;
+    
+  private Integer _int = 1;
+  private int[] _intArray;
+
+  private String _string;
+  private String[] _stringArray;
+
+  private List<String> _stringList;
+  private List<Object> _objectList;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ListTestBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,173 @@
+/*
+ *  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.trinidaddemo;
+
+import java.text.SimpleDateFormat;
+
+import java.util.Date;
+
+public class PartialDemoStatusBean implements java.io.Serializable
+{
+  public PartialDemoStatusBean()
+  {
+    reset();
+  }
+
+  public boolean getChecked()
+  {
+    return Boolean.TRUE.equals(_checkBoxState);
+  }
+
+  public int getCheckBoxUpdateCount()
+  {
+    return _checkBoxUpdateCount;
+  }
+
+  public String getCheckBoxStateText()
+  {
+    if (_checkBoxState == null)
+      return _DEFAULT_CHECK_STATE;
+
+    if (Boolean.TRUE.equals(_checkBoxState))
+      return _CHECKED_STATE;
+
+    return _NOT_CHECKED_STATE;
+  }
+
+  public String getChoiceInt()
+  {
+    if (_choiceInt == null)
+      return "1";
+    return _choiceInt.toString();
+  }
+
+  public String getChoiceText()
+  {
+    if (_choiceInt == null)
+      return _DEFAULT_CHOICE_TEXT;
+
+    return "value #" + _choiceInt;
+  }
+
+  public String getLinkUpdate()
+  {
+    return _linkUpdate;
+  }
+
+  public String getRadioStateText()
+  {
+    return _radioState;
+  }
+
+  public String getTextStateText()
+  {
+    if (_DEFAULT_TEXT_VALUE.equals(_textValue))
+      return _DEFAULT_TEXT_STATE;
+    return _textValue;
+  }
+
+  public String getTextValue()
+  {
+    return _textValue;
+  }
+
+  public void setChecked(boolean checked)
+  {
+    _checkBoxState = (checked ? Boolean.TRUE : Boolean.FALSE);
+  }
+
+  public void setChecked(Boolean checked)
+  {
+    _checkBoxState = checked;
+  }
+
+  public void setChoiceText(String txt)
+  {
+    // does nothing
+  }
+
+  public void setChoiceInt(String ci)
+  {
+    _choiceInt = new Integer(ci);
+  }
+
+  public void setLinkUpdate()
+  {
+    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
+    _linkUpdate = sdf.format(new Date());
+  }
+
+  public void setRadioStateText(String t)
+  {
+    _radioState = t;
+  }
+
+  void setSelectBooleanState(String value)
+  {
+    _radioState = "selectBoolean set, " + value;
+  }
+
+  void setSelectOneState(String value)
+  {
+    _radioState = "selectOne set, item " + value;
+  }
+
+  public void setTextValue(String t)
+  {
+    _textValue = t;
+  }
+
+  public void resetCheckBox()
+  {
+    _checkBoxUpdateCount = 0;
+    _checkBoxState = null;
+  }
+
+  public void incrementCheckBoxUpdateCount()
+  {
+    _checkBoxUpdateCount++;
+  }
+
+  public void reset()
+  {
+    resetCheckBox();
+    _choiceInt = null;
+    _linkUpdate = _DEFAULT_LINK_UPDATE;
+    _radioState = _DEFAULT_RADIO_STATE;
+    _textValue = _DEFAULT_TEXT_VALUE;
+  }
+
+  private int     _checkBoxUpdateCount;
+  // This is kept as a Boolean so we can reset to the default value.
+  private Boolean _checkBoxState;
+  private Integer _choiceInt;
+  private String  _linkUpdate;
+  private String  _radioState;
+  private String  _textValue;
+
+  private static String _NOTHING              = "nothing yet.";
+  private static String _DEFAULT_CHECK_STATE  = "updates this text.";
+  private static String _CHECKED_STATE        = "is checked.";
+  private static String _NOT_CHECKED_STATE    = "is not checked.";
+  private static String _DEFAULT_CHOICE_TEXT  = _NOTHING;
+  private static String _DEFAULT_LINK_UPDATE  = "never.";
+  private static String _DEFAULT_RADIO_STATE  = "no selection yet.";
+  private static String _DEFAULT_TEXT_STATE   = _NOTHING;
+  private static String _DEFAULT_TEXT_VALUE   = "Change this text";
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoStatusBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidaddemo;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+
+import org.apache.myfaces.trinidad.component.UIXOutput;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+public class PartialDemoUtilBean
+{
+  public void action(ActionEvent action)
+  {
+    // Just update the string which says when the last update was.
+    _status.setLinkUpdate();
+  }
+
+  // This is called for the resetButton
+  public void reset(ActionEvent action)
+  {
+    _status.reset();
+    _resetList();
+  }
+
+  public void valueChanged(ValueChangeEvent vce)
+  {
+    Object newValue = vce.getNewValue();
+    UIComponent component = vce.getComponent();
+
+    String rendererType = component.getRendererType();
+
+    // For these first components the listeners have registered themselves
+    // by setting the partialTriggers attribute. So we just update the model.
+    if (rendererType.equals("org.apache.myfaces.trinidad.Checkbox"))
+    {
+      _status.setChecked((Boolean) newValue);
+      _status.incrementCheckBoxUpdateCount();
+    }
+    else if (rendererType.equals("org.apache.myfaces.trinidad.Radio"))
+    {
+      if (Boolean.TRUE.equals(newValue))
+      {
+        String text = (String) component.getAttributes().get("text");
+        _status.setSelectBooleanState(text);
+      }
+      else if (newValue instanceof String)
+        _status.setSelectOneState((String) newValue);
+    }
+    else if (rendererType.equals("org.apache.myfaces.trinidad.Text"))
+    {
+      if (newValue instanceof String)
+        _status.setTextValue((String) newValue);
+    }
+    else if (rendererType.equals("org.apache.myfaces.trinidad.Choice"))
+    {
+      if (newValue instanceof String)
+        _status.setChoiceInt((String) newValue);
+    }
+
+    // This component illustrates a method of dynamically adding a
+    // partialTarget (i.e. without setting the partialTriggers attribute). It
+    // updates a component binding and adds the updated component directly to
+    // the list of partial targets.
+    else if (rendererType.equals("org.apache.myfaces.trinidad.Listbox"))
+    {
+      _listUpdate.setValue(component.getAttributes().get("value"));
+      _addTarget(_listUpdate);
+    }
+  }
+
+  public UIXOutput getListUpdate()
+  {
+    return _listUpdate;
+  }
+
+  public void setListUpdate(UIXOutput listUpdate)
+  {
+    _listUpdate = listUpdate;
+  }
+
+  public PartialDemoStatusBean getStatus()
+  {
+    return _status;
+  }
+
+  public void setStatus(PartialDemoStatusBean status)
+  {
+    _status = status;
+  }
+
+  private void _resetList()
+  {
+    _listUpdate.setValue("nothing yet.");
+    _addTarget(_listUpdate);
+  }
+
+  private void _addTarget(UIComponent target)
+  {
+    RequestContext adfContext = RequestContext.getCurrentInstance();
+    adfContext.addPartialTarget(target);
+  }
+
+  private PartialDemoStatusBean _status;
+  private UIXOutput _listUpdate;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PartialDemoUtilBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidaddemo;
+
+import javax.faces.event.ActionEvent;
+import org.apache.myfaces.trinidad.event.PollEvent;
+
+/**
+ * Bean for poll component demos.
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ */
+
+public class PollBean implements java.io.Serializable
+{
+  public PollBean()
+  {
+    _POLL_COUNT = 0;
+  }
+  
+  public void onPoll(PollEvent event)
+  {
+    ++_POLL_COUNT;
+  }
+  
+  public int getPollCount()
+  {
+    return _POLL_COUNT;
+  }
+  
+  public void resetPoll(ActionEvent event)
+  {
+    _POLL_COUNT = 0;
+  }
+  
+  private static int _POLL_COUNT;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PollBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,57 @@
+/*
+ *  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.trinidaddemo;
+
+import java.util.Collections;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+/**
+ * A proxy class to ask the e-mail demo for preferences information,
+ * but only when we're inside the e-mail demo!
+ */
+public class PreferencesProxy
+{
+  public Object getProxy()
+  {
+    // If we're in the e-mail demo, use its preferences
+    FacesContext context = FacesContext.getCurrentInstance();
+    if ((context.getViewRoot() != null) &&
+        (context.getViewRoot().getViewId().indexOf("/email/") >= 0))
+    {
+      ValueBinding vb =
+        context.getApplication().createValueBinding("#{email.preferences}");
+      return vb.getValue(context);
+    }
+    // If we are showing the SkinDemo page, get the skinFamily from the 
+    // sessionScope.
+    else if ((context.getViewRoot() != null) &&
+        (context.getViewRoot().getViewId().indexOf("SkinDemo") >= 0))
+    {
+      ValueBinding vb =
+        context.getApplication().createValueBinding("#{sessionScope}");
+      return vb.getValue(context);     
+    }
+    // Otherwise, go to an empty map (blank preferences)
+    else
+      return Collections.EMPTY_MAP;
+
+  }
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/PreferencesProxy.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,121 @@
+/*
+ *  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.trinidaddemo;
+
+import java.io.Serializable;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.trinidad.model.BoundedRangeModel;
+import org.apache.myfaces.trinidad.model.DefaultBoundedRangeModel;
+
+/**
+ * Bean for progress component demos.
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ */
+public class ProgressBean implements Serializable
+{
+  public BoundedRangeModel getProgressModel()
+  {
+    if (null == __model)
+    {
+      prepare();
+    }
+    return __model;
+  }
+  
+  public void cancelProcess(ActionEvent event)
+  {
+    endProcess();
+  }
+  
+  protected void prepare()
+  {
+    __model = new DefaultBoundedRangeModel(-1, 125);
+    //pu: simulate asynchronous model updates on a different thread
+    __processThread = new ProcessThread(500, 0);
+    __processThread.start();
+  }
+  
+  protected void endProcess()
+  {
+    __processThread = null;
+    __model = null;
+  }
+  
+  protected class ProcessThread extends Thread implements Serializable
+  {
+    /**
+     * @param updateIntervalFactor - controls the speed of the thread
+     * @param updateValueFactor - The value by which the 'value' from the 
+     *    model should be incremented for every cycle. Randomizes the increment
+     *    if updateValueFactor supplied is '0'.
+     */
+    ProcessThread(long updateIntervalFactor, long updateValueFactor)
+    {
+      _updateIntervalFactor = updateIntervalFactor;
+      _updateValueFactor = updateValueFactor;
+    }
+    
+    @Override
+    public void run()
+    {
+      try
+      {
+        //pu: Be in indeterminate mode for some time to start with
+        sleep(3000);
+        //pu: Take care to get out if we are the discarded thread upon endProcess()
+        while ( (__processThread == Thread.currentThread()) &&
+                (__model != null) &&
+                (__model.getValue() < __model.getMaximum()) 
+              )
+        {
+          long sleepFactor = Math.round(Math.random()*10);
+          long updatedValue = __model.getValue() + 
+            ((_updateValueFactor == 0) ? sleepFactor:_updateValueFactor);
+          long maximum = __model.getMaximum();
+          if (updatedValue > maximum)
+          {
+            updatedValue = maximum;
+          }
+          __model.setValue(updatedValue);
+          sleep(sleepFactor * _updateIntervalFactor);
+        }
+      }
+      catch (InterruptedException ie)
+      {
+        _LOG.log(Level.WARNING, "Background task thread interrupted", ie);
+      }
+      __model = null;
+    }
+    private long _updateIntervalFactor;
+    private long _updateValueFactor;
+  }
+  
+  protected volatile DefaultBoundedRangeModel __model;
+  protected volatile ProcessThread __processThread;
+
+  static private final Logger _LOG = Logger.getLogger(
+    ProgressBean.class.getName());
+
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,95 @@
+/*
+ *  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.trinidaddemo;
+
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.event.PollEvent;
+import org.apache.myfaces.trinidad.model.DefaultBoundedRangeModel;
+
+/**
+ * Bean for progress steps demos.
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ */
+public class ProgressStepsBean extends ProgressBean 
+{
+  public List<String> getProgressSteps()
+  {
+    return _PROGRESS_STEPS;
+  }
+  
+  public void onPoll(PollEvent event)
+  {
+    if ( __model != null && (__model.getMaximum() <= __model.getValue()) )
+    {
+      //pu: This means the background task is complete.
+      //  End the task and navigate off to a different page.
+      endProcess();
+      try
+      {
+        ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
+        ec.redirect("../components/progressEnd.jspx?taskStatus=completed");
+      }
+      catch(IOException ioe)
+      {
+        _LOG.log(Level.WARNING, "Could not redirect", ioe);
+      }
+      catch (RuntimeException re)
+      {
+        _LOG.log(Level.SEVERE, "Could not redirect", re);
+        throw re;
+      }
+    }
+  }
+  
+  @Override
+  protected void prepare()
+  {
+    __model = new DefaultBoundedRangeModel(-1, 6);
+    //pu: simulate asynchronous model updates on a different thread
+    __processThread = new ProcessThread(1500, 1);
+    __processThread.start();
+  }
+  
+  static private List<String> _PROGRESS_STEPS;
+  
+  static private final Logger _LOG = Logger.getLogger(
+    ProgressStepsBean.class.getName());
+  
+  static
+  {
+    _PROGRESS_STEPS = new ArrayList<String>();
+    _PROGRESS_STEPS.add("Checking for latest version");
+    _PROGRESS_STEPS.add("Checking available disk space");
+    _PROGRESS_STEPS.add("Copying files");
+    _PROGRESS_STEPS.add("Analyzing dependencies");
+    _PROGRESS_STEPS.add("Install in progress");
+    _PROGRESS_STEPS.add("Building icons and shortcuts");
+  }
+
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ProgressStepsBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,84 @@
+/*
+ *  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.trinidaddemo;
+
+import java.util.List;
+import javax.faces.component.UIComponent;
+import javax.faces.event.ActionEvent;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputText;
+
+public class ReorderTest
+{
+  public void setPanel(UIComponent panel)
+  {
+    _panel = panel;
+  }
+
+  public UIComponent getPanel()
+  {
+    return _panel;
+  }
+
+  @SuppressWarnings("unchecked")
+  public void add(ActionEvent event)
+  {
+    List<UIComponent> children = _panel.getChildren();
+    CoreOutputText output = new CoreOutputText();
+    output.setValue("Item " + (children.size() + 1));
+    children.add(0, output);
+  }
+
+  @SuppressWarnings("unchecked")
+  public void remove(ActionEvent event)
+  {
+    List<UIComponent> children = _panel.getChildren();
+    children.remove(children.size() - 1);
+  }
+
+  @SuppressWarnings("unchecked")
+  public void removeFirst(ActionEvent event)
+  {
+    List<UIComponent> children = _panel.getChildren();
+    children.remove(0);
+  }
+
+  @SuppressWarnings("unchecked")
+  public void rotate(ActionEvent event)
+  {
+    List<UIComponent> children = _panel.getChildren();
+    UIComponent o = children.get(0);
+    children.remove(0);
+    children.add(o);
+  }
+
+  public void removeSeparator(ActionEvent event)
+  {
+    _panel.getFacets().remove("separator");
+  }
+
+  @SuppressWarnings("unchecked")
+  public void setSeparator(ActionEvent event)
+  {
+    CoreOutputText output = new CoreOutputText();
+    output.setValue("New Separator");
+    _panel.getFacets().put("separator", output);
+  }
+  
+  private UIComponent _panel;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ReorderTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidaddemo;
+
+import javax.faces.model.SelectItem;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class SelectItemTestBean
+{
+  public SelectItemTestBean()
+  {
+    _oneItem = new SelectItem("foo", "Foo", "Description of foo", false);
+
+    _itemList = new ArrayList<SelectItem>();
+    _itemList.add(new SelectItem("foo", "Foo", "Description of foo", false));
+    _itemList.add(new SelectItem("bar", "Bar", "Description of bar", false));
+    _itemList.add(new SelectItem("baz", "Baz", "Description of baz", false));
+
+    _itemArray = new SelectItem[3];
+    _itemArray[0] = new SelectItem("foo", "Foo", "Description of foo", false);
+    _itemArray[1] = new SelectItem("bar", "Bar", "Description of bar", false);
+    _itemArray[2] = new SelectItem("baz", "Baz", "Description of baz", false);
+
+    _itemMap = new HashMap<String, String>();
+    _itemMap.put("Foo", "foo");
+    _itemMap.put("Bar", "bar");
+    _itemMap.put("Baz", "baz");
+  }
+
+  public SelectItem getOneItem()
+  {
+    return _oneItem;
+  }
+
+  public ArrayList<SelectItem> getItemList()
+  {
+    return _itemList;
+  }
+
+  public HashMap<String, String> getItemMap()
+  {
+    return _itemMap;
+  }
+
+  public SelectItem[] getItemArray()
+  {
+    return _itemArray;
+  }
+
+  private SelectItem              _oneItem;
+  private ArrayList<SelectItem>   _itemList;
+  private HashMap<String, String> _itemMap;
+  private SelectItem[]            _itemArray;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SelectItemTestBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,86 @@
+/*
+ *  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.trinidaddemo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import org.apache.myfaces.trinidad.component.UIXCollection;
+import org.apache.myfaces.trinidad.component.UIXTree;
+import org.apache.myfaces.trinidad.component.UIXTable;
+import org.apache.myfaces.trinidad.model.RowKeySet;
+
+public class TableBean
+{
+  @SuppressWarnings("unchecked")
+  public TableBean()
+  {
+    _selection = Collections.EMPTY_LIST;
+  }
+  
+  public UIComponent getTable()
+  {
+    return _table;
+  }
+
+  public void setTable(UIComponent hgrid)
+  {
+    _table = hgrid;
+  }
+
+  @SuppressWarnings("unchecked")
+  public void performReport(ActionEvent action)
+  {
+    UIXCollection table = (UIXCollection) _table;
+    final RowKeySet state;
+    if (table instanceof UIXTable)
+      state = ((UIXTable) table).getSelectedRowKeys();
+    else
+      state = ((UIXTree) table).getSelectedRowKeys();
+    Iterator<Object> selection = state.iterator();
+    Object oldKey = table.getRowKey();
+    _selection = new ArrayList<Object>();
+    while (selection.hasNext())
+    {
+      table.setRowKey(selection.next());
+      _selection.add(table.getRowData());
+    }
+    table.setRowKey(oldKey);
+    FacesContext context = FacesContext.getCurrentInstance();
+    FacesMessage message =
+      new FacesMessage("Report Performed","Report was performed on "+
+                       _selection.size()+" records");
+    context.addMessage(null, message);
+  }
+
+  public List<Object> getReportItems()
+  {
+    return _selection;
+  }
+
+  private UIComponent _table = null;
+  private List<Object> _selection;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TableBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidaddemo;
+
+import org.apache.myfaces.trinidad.event.DisclosureEvent;
+
+public class ToggleBean implements java.io.Serializable
+{
+  public void onDisclosure(DisclosureEvent event)
+  {
+    _totalCount++;
+  }
+
+  public int getTotalCount()
+  {
+    return _totalCount;
+  }
+
+  private int _totalCount;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ToggleBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,108 @@
+/*
+ *  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.trinidaddemo;
+
+import java.beans.IntrospectionException;
+import java.util.List;
+import org.apache.myfaces.trinidad.model.ChildPropertyTreeModel;
+import org.apache.myfaces.trinidad.model.TreeModel;
+
+/**
+ * This class facilitates the construction of a ChildPropertyTreeModel instance
+ * via managed-beans. ChildPropertyTreeModel does not have a no-arg constructor.
+ * This class does, and so can be instantiated as a managed-bean.
+ * Two properties need to be set: "childProperty" and "instance"
+ */
+public class TreeModelAdapter implements java.io.Serializable
+{
+  public TreeModelAdapter()
+  {
+  }
+
+  private String _propertyName = null;
+  private Object _instance = null;
+  private transient TreeModel _model = null;
+
+  public TreeModel getModel() throws IntrospectionException
+  {
+    if (_model == null)
+    {
+      _model = new ChildPropertyTreeModel(getInstance(), getChildProperty());
+    }
+    return _model;
+  }
+
+  public String getChildProperty()
+  {
+    return _propertyName;
+  }
+
+  /**
+   * Sets the property to use to get at child lists
+   * @param propertyName
+   */
+  public void setChildProperty(String propertyName)
+  {
+    _propertyName = propertyName;
+    _model = null;
+  }
+
+  public Object getInstance()
+  {
+    return _instance;
+  }
+
+  /**
+   * Sets the root list for this tree.
+   * @param instance must be something that can be converted into a List
+   */
+  public void setInstance(Object instance)
+  {
+    _instance = instance;
+    _model = null;
+  }
+  
+  /**
+   * Sets the root list for this tree.
+   * This is needed for passing a List when using the managed bean list  
+   * creation facility, which requires the parameter type is List.
+   * @param instance the list of root nodes
+   */
+  public void setListInstance(List<Object> instance)
+  {
+    setInstance(instance);
+  }  
+  
+  /**
+   * This should only be called if setListInstance was called.
+   * 
+   * This method shouldn't be needed according to 
+   * faces spec 1.1 rev 1, see 5.3.1.3
+   * However without this we get the following error in websphere:
+   *                java.beans.IntrospectionException: No method 
+   *                            "getListInstance" with 0 arg(s) of 
+   *                            matching types in websphere
+   */
+  @SuppressWarnings("unchecked")
+  public List<Object> getListInstance()
+  {
+    return (List<Object>)getInstance();
+  }
+  
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeModelAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,86 @@
+/*
+ *  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.trinidaddemo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * A basic implementation of TreeNode that exposes the extra magic
+ * keys that will be requested by the tree renderer.
+ * <p>
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author Adam Winer
+ */
+public class TreeNodeImpl implements Serializable
+{
+  public String getText()
+  {
+    return _text;
+  }
+
+  public void setText(String text)
+  {
+    _text = text;
+  }
+
+
+  public String getIcon()
+  {
+    return _icon;
+  }
+
+  public void setIcon(String icon)
+  {
+    _icon = icon;
+  }
+
+  public String getDestination()
+  {
+    return _destination;
+  }
+
+
+  public void setDestination(String destination)
+  {
+    _destination = destination;
+  }
+
+  public void setChildren(List<TreeNodeImpl> nodes)
+  {
+    // Clone on the way in.
+    _nodes = new ArrayList<TreeNodeImpl>(nodes);
+  }
+
+  public List<TreeNodeImpl> getChildren()
+  {
+    if (_nodes == null)
+      return null;
+
+    return Collections.unmodifiableList(_nodes);
+  }
+
+
+  private String _text = null;
+  private String _destination = null;
+  private String _icon = null;
+  private List<TreeNodeImpl> _nodes;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/TreeNodeImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,131 @@
+/*
+ *  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.trinidaddemo;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelPage;
+
+import org.apache.myfaces.trinidad.model.UploadedFile;
+
+public class UIBean
+{
+  public UIBean()
+  {
+  }
+
+  public CorePanelPage getPanelPage()
+  {
+    return _panelPage;
+  }
+
+  public UIBeanState getState()
+  {
+    return _state;
+  }
+
+  public void setState(UIBeanState state)
+  {
+    _state = state;
+  }
+
+  public void setPanelPage(CorePanelPage panelPage)
+  {
+    _panelPage = panelPage;
+  }
+
+  public void fileUploaded(ValueChangeEvent event)
+  {
+    UploadedFile file = (UploadedFile) event.getNewValue();
+    if (file != null)
+    {
+      FacesContext context = FacesContext.getCurrentInstance();
+      FacesMessage message = new FacesMessage(
+         "Uploaded file " + file.getFilename() +
+         " (" + file.getLength() + " bytes)");
+      context.addMessage(event.getComponent().getClientId(context), message);
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  public void testFailover()
+  {
+    FacesContext context = FacesContext.getCurrentInstance();
+    Map<String, Object> session = 
+      context.getExternalContext().getSessionMap();
+    
+    Map.Entry<String, Object> writing = null;
+    try
+    {
+      ObjectOutputStream oos =
+        new ObjectOutputStream(new ByteArrayOutputStream(2 << 16));
+      Iterator<Map.Entry<String, Object>> entries = session.entrySet().iterator();
+      while (entries.hasNext())
+      {
+        writing = entries.next();
+        oos.writeObject(writing.getValue());
+        context.addMessage(null,
+                           new FacesMessage("Successfully serialized " + writing.getValue() + " [at " + writing.getKey() + "]"));
+      }
+    }
+    catch (IOException ioe)
+    {
+      context.addMessage(null,
+           new FacesMessage(FacesMessage.SEVERITY_ERROR,
+                            "Failed while outputting object " + writing.getValue()  +
+                            " [at " + writing.getKey() + "]",
+                            ioe.getMessage()));
+    }
+  }
+
+  //
+  // For testing purposes, here's a series of methods that can
+  // be EL-addressed that blow up.  These exceptions should
+  // be displayed somewhere (preferably in a logged error
+  // message), not swallowed.
+  //
+
+  public String actionThatFails()
+  {
+    throw new IllegalStateException("Calling this action is a bad move");
+  }
+
+  public void listenerThatFails(ValueChangeEvent event)
+  {
+    throw new IllegalStateException("Using this listener is a bad move");
+  }
+
+  public String getFailedProperty()
+  {
+    throw new IllegalStateException("Getting this property is a bad move");
+  }
+
+
+  private CorePanelPage _panelPage;
+  private UIBeanState _state;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,38 @@
+/*
+ *  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.trinidaddemo;
+
+public class UIBeanState implements java.io.Serializable
+{
+  public UIBeanState()
+  {
+  }
+
+  public boolean isTitleSet()
+  {
+    return _isTitleSet;
+  }
+
+  public void setTitleSet(boolean set)
+  {
+    _isTitleSet = set;
+  }
+
+  private boolean _isTitleSet;
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/UIBeanState.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,405 @@
+/*
+ *  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.trinidaddemo.change;
+
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.myfaces.trinidad.change.AddChildComponentChange;
+import org.apache.myfaces.trinidad.change.AddChildDocumentChange;
+import org.apache.myfaces.trinidad.change.SetFacetChildComponentChange;
+import org.apache.myfaces.trinidad.change.AttributeComponentChange;
+import org.apache.myfaces.trinidad.change.ChangeManager;
+import org.apache.myfaces.trinidad.change.ComponentChange;
+import org.apache.myfaces.trinidad.change.DocumentChange;
+import org.apache.myfaces.trinidad.change.RemoveChildComponentChange;
+import org.apache.myfaces.trinidad.change.RemoveFacetComponentChange;
+import org.apache.myfaces.trinidad.change.ReorderChildrenComponentChange;
+import org.apache.myfaces.trinidad.component.core.nav.CoreCommandButton;
+
+import org.apache.myfaces.trinidad.component.core.output.CoreImage;
+import org.apache.myfaces.trinidad.component.core.output.CoreOutputFormatted;
+import org.apache.myfaces.trinidad.context.RequestContext;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+import org.xml.sax.SAXException;
+import java.io.ByteArrayInputStream;
+
+/**
+ * Managed bean for Change persistence demos.
+ * @version $Name:  $ ($Revision$) $Date$
+ */
+public class ChangeBean 
+{
+  /**
+   * Picks up an image randomly from a list and changes it on the image.
+   */
+  @SuppressWarnings("unchecked")
+  public void modifyObjectImage(ActionEvent event)
+  {
+    UIComponent uic = event.getComponent().findComponent("oi1");
+    String source = "/components/images/" + _images[_getRandIndex()];
+    uic.getAttributes().put("source", source);
+    _addAttributeChange(uic, "source", source);
+  }
+  
+  /**
+   * Picks up a string randomly from a list and changes the text attribute value
+   *  of the panelBox.
+   */
+  @SuppressWarnings("unchecked")
+  public void modifyPanelBox(ActionEvent event)
+  {
+    UIComponent uic = event.getComponent().findComponent("pb1");
+    String text = _texts[_getRandIndex()];
+    uic.getAttributes().put("text", text);
+    _addAttributeChange(uic, "text", text);
+  }
+
+  /**
+   * Modifies the sortable property of the column.
+   */
+  @SuppressWarnings("unchecked")
+  public void modifyColumn(ActionEvent event)
+  {
+    //=-=pu: 'uic1' gets null, while 'uic' gets valid component, maybe a bug ?.
+    //UIComponent uic1 = event.getComponent().findComponent("c1");
+    UIComponent uic2 = event.getComponent().findComponent("t1");
+    UIComponent uic = uic2.findComponent("c1");
+    
+    Object sortableAttrib = uic.getAttributes().get("sortable");
+    Boolean isSortable = 
+      (sortableAttrib == null)? Boolean.TRUE:(Boolean)sortableAttrib;
+    Boolean newSortableValue = 
+      Boolean.TRUE.equals(isSortable)? Boolean.FALSE:Boolean.TRUE;
+    uic.getAttributes().put("sortable", newSortableValue);
+    _addAttributeChange(uic, "sortable", newSortableValue);
+  }
+
+  /**
+   * Picks up a string randomly from a list and changes the label attribute 
+   *  value of the inputText.
+   */
+  @SuppressWarnings("unchecked")
+  public void modifyInputText(ActionEvent event)
+  {
+    UIComponent uic = event.getComponent().findComponent("it1");
+    String label = _labels[_getRandIndex()];
+    uic.getAttributes().put("label", label);
+    _addAttributeChange(uic, "label", label);
+  }
+
+  /**
+   * Appends an image child to the panelGroup in the underlying JSP document
+   */
+  public void appendChildToDocument(ActionEvent event)
+  {
+    UIComponent eventSource = event.getComponent();
+    UIComponent uic = eventSource.findComponent("pg1");
+    
+    // only allow the image to be added once
+    if (_findChildById(uic,"oi3") != null)
+      return;
+      
+    FacesContext fc = FacesContext.getCurrentInstance();
+
+    DocumentFragment imageFragment = _createDocumentFragment(_IMAGE_MARK_UP);
+    
+    if (imageFragment != null)
+    {
+      DocumentChange change = new AddChildDocumentChange(imageFragment);
+      
+      ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+      
+      apm.addDocumentChange(fc, uic, change);
+    }
+  }
+
+  /**
+   * Appends an image child to the panelGroup.
+   */
+  @SuppressWarnings("unchecked")
+  public void appendChild(ActionEvent event)
+  {
+    UIComponent eventSource = event.getComponent();
+    UIComponent uic = eventSource.findComponent("pg1");
+    if (_findChildById(uic,"oi2") != null)
+      return;
+    FacesContext fc = FacesContext.getCurrentInstance();
+    
+    CoreImage newChild = 
+      (CoreImage) fc.getApplication().createComponent(
+        "org.apache.myfaces.trinidad.CoreImage");
+    newChild.setId("oi2");
+    newChild.setInlineStyle("height: 100px, width: 120px");
+    newChild.setSource(
+      "http://homepage.mac.com/awiner/.Pictures/WindyHill/PaleSwallowtail.jpg");  
+    uic.getChildren().add(newChild);
+
+    ComponentChange aca = new AddChildComponentChange(newChild);
+
+    ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+    apm.addComponentChange(fc, uic, aca);
+  }
+
+  /**
+   * Adds a 'brandingAppContextual' facet  to the panelGroup.
+   */
+  @SuppressWarnings("unchecked")
+  public void addFacet(ActionEvent event)
+  {
+    UIComponent eventSource = event.getComponent();
+    UIComponent uic = eventSource.findComponent("pp1");
+    FacesContext fc = FacesContext.getCurrentInstance();
+    CoreOutputFormatted newFacetComponent = 
+      (CoreOutputFormatted) fc.getApplication().createComponent(
+        "org.apache.myfaces.trinidad.CoreOutputFormatted");
+    newFacetComponent.setStyleUsage("inContextBranding" );
+    newFacetComponent.setValue(
+      "Customer Company - Menlo Park");
+    uic.getFacets().put("brandingAppContextual", newFacetComponent);
+
+    ComponentChange afa = new SetFacetChildComponentChange("brandingAppContextual", newFacetComponent);
+
+    ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+    apm.addComponentChange(fc, uic, afa);
+  }
+
+  /**
+   * Reverses the order of children of the panelGroup.
+   */
+  @SuppressWarnings("unchecked")
+  public void reorderChildren(ActionEvent event)
+  {
+    UIComponent uic = event.getComponent().findComponent("pg1");
+    int numChildren = uic.getChildCount();
+    if (numChildren == 0)
+      return;
+    List<UIComponent> children = uic.getChildren();
+    Collections.reverse(children);
+    List<String> reorderedChildIdList = new ArrayList<String>();
+    for(UIComponent child : children)
+    {
+      reorderedChildIdList.add(child.getId());
+    }
+    
+    ComponentChange ra = new ReorderChildrenComponentChange(reorderedChildIdList);
+
+    FacesContext fc = FacesContext.getCurrentInstance();
+    ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+    apm.addComponentChange(fc, uic, ra);
+  }
+
+  /**
+   * Removes a pair of children, based on some characteristic of the
+   *  event source.
+   */
+  public void removeChildren(ActionEvent event)
+  {
+    UIComponent eventSource = event.getComponent();
+    UIComponent uic = eventSource.findComponent("pg1");
+    int numChildren = uic.getChildCount();
+    if (numChildren == 0)
+      return;
+    String eventSourceId = eventSource.getId();    
+    if (eventSourceId.equals("cb2"))
+    {
+      _removeChild(uic, "sic1");
+      _removeChild(uic, "cc1");
+    }
+    else if (eventSourceId.equals("cb3"))
+    {
+      _removeChild(uic, "cd1");
+      _removeChild(uic, "sid1");
+    }
+  }
+
+  /**
+   * Removes one or more facets, based on some characteristic of the
+   *  event source.
+   */
+  @SuppressWarnings("unchecked")
+  public void removeFacets(ActionEvent event)
+  {
+    CoreCommandButton eventSource = (CoreCommandButton) event.getComponent();
+    //pu: Anything until ":" in the button text represents the facet name/s
+    String facetNameFromButtonText = (eventSource.getText().split(":"))[0];
+    //pu: In case of the button that removes multiple facets, this is again 
+    //  delimited by "_"
+    String removableFacetNames[] = facetNameFromButtonText.split("_");
+    
+    //pu: Get the CorePanelPage components that has all the removable facets
+    UIComponent uic = eventSource.findComponent("pp1");
+    Map<String, UIComponent> facets = uic.getFacets();
+    if (facets.keySet().size() == 0)
+      return;
+
+    for (int i=0; i<removableFacetNames.length; i++)
+    {
+      if (facets.get(removableFacetNames[i]) != null)
+      {
+        facets.remove(removableFacetNames[i]);
+        ComponentChange rfa = new RemoveFacetComponentChange(removableFacetNames[i]);
+        FacesContext fc = FacesContext.getCurrentInstance();
+        ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+        apm.addComponentChange(fc, uic, rfa);
+      }
+    }
+  }
+
+  /**
+   * Creates a DocumentFragment containing the parsed content
+   * @param markUp JSP Document markup
+   * @return DocumentFragment containing the parsed content
+   */
+  private static DocumentFragment _createDocumentFragment(
+    String markUp)
+  {
+    // prepend XML declaration
+    markUp = "<?xml version = '1.0' encoding = 'ISO-8859-1'?>" + markUp;
+
+    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    factory.setNamespaceAware(true);
+    factory.setValidating(false);
+
+    DocumentBuilder builder;
+    
+    try
+    {
+      builder = factory.newDocumentBuilder();
+    }
+    catch (ParserConfigurationException pce)
+    {
+      _LOG.log(Level.WARNING, "Unable to get XML Parser:", pce);
+      
+      return null;
+    }
+    
+    try
+    {
+      // use a version explicitly with ISO-8859-1 instead
+      byte[] markupBytes = markUp.getBytes();
+      Document newDoc = builder.parse(new ByteArrayInputStream(markupBytes));
+    
+      DocumentFragment fragment = newDoc.createDocumentFragment();
+      
+      // add the document's root element to the fragment
+      fragment.appendChild(newDoc.getDocumentElement());
+      
+      return fragment;
+    }
+    catch (SAXException se)
+    {      
+      _LOG.log(Level.WARNING, "Unable to parse markup:" + markUp, se);
+      
+      return null;
+    }
+    catch (IOException ioe)
+    {
+      _LOG.log(Level.WARNING, "IO Problem with markup:" + markUp, ioe);
+
+      return null;
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  private static void _removeChild(UIComponent uic, String removableChildId)
+  {
+    UIComponent removableChild = _findChildById(uic, removableChildId);
+    if (removableChild != null)
+    {
+      List<UIComponent> children = uic.getChildren();
+      children.remove(removableChild);
+      ComponentChange rca = new RemoveChildComponentChange(removableChildId);
+      FacesContext fc = FacesContext.getCurrentInstance();
+      ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+      apm.addComponentChange(fc, uic, rca);
+    }
+  }
+  
+  @SuppressWarnings("unchecked")
+  private static UIComponent _findChildById(UIComponent uic, String id)
+  {
+    int numChildren = uic.getChildCount();
+    if (numChildren == 0)
+      return null;
+    List<UIComponent> children = uic.getChildren();
+    UIComponent child = null;
+    for (int i=0; i<numChildren; i++)
+    {
+      child = children.get(i);
+      if (id.equals(child.getId()))
+        return child;
+    }
+    return null;
+  }
+
+  private static void _addAttributeChange(
+    UIComponent uic, 
+    String attribName, 
+    Object attribValue
+    )
+  {
+    FacesContext fc = FacesContext.getCurrentInstance();
+    ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
+    ComponentChange aa = new AttributeComponentChange(attribName, attribValue);
+    apm.addComponentChange(fc, uic, aa);
+  }
+  
+  private static int _getRandIndex()
+  {
+    return (int) (Math.random()*10)/2;
+  }
+  
+  private static final String _images[] = 
+    {"cobrand.gif","corporateBrand.gif","largeAd.gif","mediumAd.gif","new.gif"};
+  private static final String _labels[] = 
+    {"Label One","Label Two","Label Three","Label Four","Label Five"};
+  private static final String _texts[] = 
+    {"PanelBoxText One",
+     "PanelBoxText Two",
+     "PanelBoxText Three",
+     "PanelBoxText Four",
+     "PanelBoxText Five"};
+
+  // markup to use for image added to document
+  private static final String _IMAGE_MARK_UP = 
+   "<tr:Image id='oi3' inlineStyle='height: 100px; width: 120px;' " +
+   "source='http://homepage.mac.com/awiner/.Pictures/WindyHill/PaleSwallowtail.jpg' " +
+   "xmlns:af='http://myfaces.apache.org/adf/faces/EA17'/>";
+
+  static private final Logger _LOG = Logger.getLogger(ChangeBean.class.getName());
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/change/ChangeBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java?view=auto&rev=515587
==============================================================================
--- incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java (added)
+++ incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java Wed Mar  7 06:44:35 2007
@@ -0,0 +1,59 @@
+/*
+ *  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.trinidaddemo.composite;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+
+public class CompositeTest
+{
+  public CompositeTest()
+  {
+  }
+
+  public UIComponent getDateInput()
+  {
+    return _dateInput;
+  }
+
+  public void setDateInput(UIComponent dateInput)
+  {
+    _dateInput = dateInput;
+  }
+
+  private UIComponent _dateInput = new ForceRendererType();
+
+  /**
+   * Turns out there's no easy way to simply replace the renderer
+   * for a control like UIInput;  UIComponentTag will call setRendererType()
+   * after consulting the "binding" attribute, overriding anything
+   * done in either the getter or setter.  So, here's a subclass
+   * that forces the renderer type to a constant.  The alternative
+   * is writing a custom JSP tag to do the same, but then you
+   * have to re-invent the wheel as far as the input tag goes.
+   */
+  static public class ForceRendererType extends UIInput
+  {
+    @Override
+    public String getRendererType()
+    {
+      return "org.apache.myfaces.trinidaddemo.DateField";
+    }
+  }
+}

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-core-1.0.0-incubation/examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/composite/CompositeTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL