incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r425557 [2/2] - in /incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad: ./ component/
Date Tue, 25 Jul 2006 23:28:21 GMT
Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.ActionSource;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * Base class for progress components
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXProgressTemplate
+                extends UIXComponentBase
+                implements ActionSource
+{
+  public void queueEvent(FacesEvent e)
+  {
+    if (e.getSource() == this && e instanceof ActionEvent)
+    {
+      if (isImmediate())
+        e.setPhaseId(PhaseId.ANY_PHASE);
+      else
+        e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+    }
+
+    super.queueEvent(e);
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    super.broadcast(event);
+
+    // Notify the specified action listener method (if any),
+    // and the default action listener
+    if (event instanceof ActionEvent)
+    {
+      FacesContext context = getFacesContext();
+      MethodBinding mb = getActionListener();
+      if (mb != null)
+        mb.invoke(context, new Object[] { event });
+
+      ActionListener defaultActionListener =
+        context.getApplication().getActionListener();
+      if (defaultActionListener != null)
+      {
+        defaultActionListener.processAction((ActionEvent) event);
+      }
+    }
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXProgressTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,130 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.ActionSource;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.context.AdfFacesContext;
+import org.apache.myfaces.trinidad.event.LaunchEvent;
+import org.apache.myfaces.trinidad.event.ReturnEvent;
+
+
+/**
+ * Base class for selectInput components.
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXSelectInputTemplate extends UIXEditableValue
+                                      implements ActionSource
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public MethodBinding getActionListener();
+/**/  abstract public MethodBinding getReturnListener();
+
+  /**
+   * <p>Intercept <code>queueEvent</code> and mark the phaseId for any
+   * ActionEvents to be <code>PhaseId.APPLY_REQUEST_VALUES</code>.
+   */
+  public void queueEvent(FacesEvent e)
+  {
+    if (e instanceof ActionEvent)
+    {
+      // Always deliver ActionEvents immediately?
+      //  if (isImmediate())
+      {
+        e.setPhaseId(PhaseId.ANY_PHASE);
+      }
+      /*
+      else
+      {
+        e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+        }*/
+    }
+
+    super.queueEvent(e);
+  }
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    if (event instanceof ActionEvent)
+    {
+      AdfFacesContext afContext = AdfFacesContext.getCurrentInstance();
+      afContext.getDialogService().setCurrentLaunchSource(this);
+
+      try
+      {
+        // Perform standard superclass processing
+        super.broadcast(event);
+
+        // Notify the specified action listener method (if any),
+        // and the default action listener
+        __broadcast(event, getActionListener());
+
+        FacesContext context = getFacesContext();
+        ActionListener defaultActionListener =
+          context.getApplication().getActionListener();
+        if (defaultActionListener != null)
+        {
+          defaultActionListener.processAction((ActionEvent) event);
+        }
+      }
+      finally
+      {
+        afContext.getDialogService().setCurrentLaunchSource(null);
+      }
+    }
+    else if (event instanceof LaunchEvent)
+    {
+      // =-=AEW Support launch listeners on SelectInput?
+      // super.broadcast(event);
+      //
+      // __broadcast(event, getLaunchListener());
+      ((LaunchEvent) event).launchDialog(true);
+    }
+    else if (event instanceof ReturnEvent)
+    {
+      super.broadcast(event);
+
+      __broadcast(event, getReturnListener());
+      Object returnValue = ((ReturnEvent) event).getReturnValue();
+      if (returnValue != null)
+      {
+        setSubmittedValue(returnValue);
+      }
+
+      // =-=AEW: always jump to render response???  Seems the safest
+      // option, because we don't want to immediately update a model
+      // or really perform any validation.
+      getFacesContext().renderResponse();
+    }
+    else
+    {
+      super.broadcast(event);
+    }
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectInputTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,172 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.lang.reflect.Array;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.logging.ADFLogger;
+
+abstract public class UIXSelectManyTemplate extends UIXEditableValue
+{
+
+
+  static public final String REQUIRED_MESSAGE_ID =
+    "org.apache.myfaces.trinidad.UIXSelectMany.REQUIRED";
+  static public final String UNSUPPORTED_MODEL_TYPE_MESSAGE_ID =
+    "org.apache.myfaces.trinidad.UIXSelectMany.UNSUPPORTED_MODEL_TYPE";
+
+
+  /**
+   * Compares two values, disregarding the order of the elements.
+   * @todo walk through UIXSelectItem values to determine that new
+   *       values are permitted
+   */
+  protected void validateValue(FacesContext context, Object newValue)
+  {
+    super.validateValue(context, newValue);
+  }
+
+  protected boolean isEmpty(Object value)
+  {
+    if (value == null)
+      return true;
+
+    if (value instanceof Collection)
+      return ((Collection) value).isEmpty();
+
+    if (value.getClass().isArray())
+      return Array.getLength(value) == 0;
+
+    return false;
+  }
+
+
+  protected String getRequiredMessageKey()
+  {
+    return REQUIRED_MESSAGE_ID;
+  }
+
+  /**
+   *
+   * @todo improve efficiency
+   * @return true if the values are different
+   */
+  protected boolean compareValues(Object previous, Object value)
+  {
+    int prevSize = __getSize(previous);
+    int newSize = __getSize(value);
+
+    // If the sizes are different, no need to bother with further work
+    if (prevSize != newSize)
+      return true;
+
+    // If the sizes are the same, and they're empty, we're also done.
+    if (prevSize == 0)
+      return false;
+
+    List prevList = __toList(previous);
+    List newList = __toList(value);
+    return _destructiveCompareOutOfOrderLists(prevList, newList);
+  }
+
+  //
+  // Return the size of each list
+  //
+  static int __getSize(Object o)
+  {
+    if (o == null)
+      return 0;
+
+    if (o instanceof Collection)
+      return ((Collection) o).size();
+
+    if (o.getClass().isArray())
+      return Array.getLength(o);
+
+    if (_LOG.isFine())
+      _LOG.fine("Type " + o.getClass() +
+                " is not a supported List model type");
+    return 0;
+  }
+
+  //
+  // Compare two Lists in an order-independent fashion, possibly
+  // mutating one or the other list.
+  //
+  static private boolean _destructiveCompareOutOfOrderLists(
+    List one,
+    List two)
+  {
+    int size = one.size();
+
+    // Assert the two sizes are the same, since we should
+    // have eliminated that possibility earlier
+    assert(one.size() == two.size());
+
+    for (int i = 0; i < size; i++)
+    {
+      Object o = one.get(i);
+      int indexOf = two.indexOf(o);
+      if (indexOf < 0)
+        return true;
+
+      two.remove(indexOf);
+    }
+
+    return false;
+  }
+
+  //
+  // Convert an Object to a mutable, copied List;  copied
+  // because our compare routine is destructive.
+  //
+  static List __toList(Object o)
+  {
+    if (o == null)
+      return null;
+
+    ArrayList listCopy = new ArrayList();
+    if (o instanceof Collection)
+    {
+      listCopy.addAll((Collection) o);
+    }
+    // Use java.lang.reflect.Array, etc. to support primitive Object arrays
+    else if (o.getClass().isArray())
+    {
+      int length = Array.getLength(o);
+      listCopy.ensureCapacity(length);
+      for (int i = 0; i < length; i++)
+      {
+        listCopy.add(Array.get(o, i));
+      }
+    }
+    else
+    {
+      // Already logged in __getSize(), so let it slide here
+      ;
+    }
+
+    return listCopy;
+  }
+
+  static private final ADFLogger _LOG = ADFLogger.createADFLogger(UIXSelectMany.class);
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectManyTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.context.FacesContext;
+
+abstract public class UIXSelectOneTemplate extends UIXEditableValue
+{
+
+  static public final String REQUIRED_MESSAGE_ID =
+    "org.apache.myfaces.trinidad.UIXSelectOne.REQUIRED";
+
+  /**
+   * @todo walk through UIXSelectItem values to determine that the new
+   *       value is permitted
+   */
+  public void validateValue(FacesContext context, Object newValue)
+  {
+    super.validateValue(context, newValue);
+  }
+  
+
+  protected String getRequiredMessageKey()
+  {
+    return REQUIRED_MESSAGE_ID;
+  }    
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOneTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.util.List;
+
+abstract public class UIXSelectOrderTemplate extends UIXSelectMany
+{
+  /**
+   * Compares two values, paying attention to the order of the elements.
+   * @todo improve efficiency
+   * @return true if the values are different
+   */
+  protected boolean compareValues(Object previous, Object value)
+  {
+    int prevSize = __getSize(previous);
+    int newSize = __getSize(value);
+
+    // If the sizes are different, no need to bother with further work
+    if (prevSize != newSize)
+      return true;
+
+    // If the sizes are the same, and they're empty, we're also done.
+    if (prevSize == 0)
+      return false;
+
+    List prevList = (previous instanceof List)
+                      ? (List) previous : __toList(previous);
+    List newList = (value instanceof List)
+                      ? (List) value : __toList(value);
+
+    // Since List has explicit rules about how equals() works, we
+    // can just use that method.
+    return !prevList.equals(newList);
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectOrderTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,193 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.io.IOException;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import org.apache.myfaces.trinidad.event.RangeChangeEvent;
+import org.apache.myfaces.trinidad.event.RangeChangeListener;
+import org.apache.myfaces.trinidad.model.CollectionModel;
+import org.apache.myfaces.trinidad.model.ModelUtils;
+
+
+/**
+ * Base class for SelectRange
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+public abstract class UIXSelectRangeTemplate extends UIXComponentBase
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public MethodBinding getRangeChangeListener();
+/**/  abstract public void setFirst(int first);
+/**/  abstract public boolean isImmediate();
+/**/  abstract public Object getValue();
+
+
+  public void encodeBegin(FacesContext context) throws IOException
+  {
+    _flushCachedDataModel();
+    super.encodeBegin(context);
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    // Notify the specified RangeChanged listener method (if any)
+    if (event instanceof RangeChangeEvent)
+    {
+      RangeChangeEvent gtEvent = (RangeChangeEvent)event;
+      // update first when the event is delivered
+      setFirst(gtEvent.getNewStart());
+
+      __broadcast(event, getRangeChangeListener());
+    }
+
+    // Perform standard superclass processing
+    super.broadcast(event);
+  }
+  /**
+   * * We don't want to update model if we have validation errors
+   * on the page, so if not immediate, queue the event in
+   * INVOKE_APPLICATION phase.
+   */
+  public void queueEvent(FacesEvent e)
+  {
+    if ((e instanceof RangeChangeEvent) && (e.getSource() == this))
+    {
+      if (isImmediate())
+      {
+        e.setPhaseId(PhaseId.ANY_PHASE);
+      }
+      else
+      {
+        e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+      }
+    }
+
+    super.queueEvent(e);
+  }
+
+  /**
+   * Makes a row current.
+   * @see CollectionModel#setRowIndex
+   * @param rowIndex the zero-based row-index of the row that should be made
+   * current. Use -1 to clear the current row.
+   */
+  public final void setRowIndex(int rowIndex)
+  {
+    _getDataModel().setRowIndex(rowIndex);
+  }
+
+  /**
+   * @see CollectionModel#getRowIndex
+   * @return the zero-based row-index of the current row, or -1
+   *  if now row is current.
+   */
+  public final int getRowIndex()
+  {
+    return _getDataModel().getRowIndex();
+  }
+
+  /**
+   * Gets the total number of rows in this table.
+   * @see CollectionModel#getRowCount
+   * @return -1 if the total number is not known.
+   */
+  public final int getRowCount()
+  {
+    return _getDataModel().getRowCount();
+  }
+
+  /**
+  * Checks to see if the current row is available. This is useful when the
+  * total number of rows is not known.
+  * @see CollectionModel#isRowAvailable
+  * @return true iff the current row is available.
+  */
+   public final boolean isRowAvailable()
+   {
+     return _getDataModel().isRowAvailable();
+   }
+
+  /**
+  * Checks to see if the given row is available. This is useful when the
+  * total number of rows is not known.
+  * @see CollectionModel#isRowAvailable(int)
+  * @param rowIndex identifies the row to check
+  * @return true iff the current row is available.
+  */
+   public final boolean isRowAvailable(int rowIndex)
+   {
+     return _getDataModel().isRowAvailable(rowIndex);
+   }
+
+  /**
+   * Gets the data for the current row.
+   * @see CollectionModel#getRowData
+   * @return null if the current row is unavailable
+   */
+  public final Object getRowData()
+  {
+    CollectionModel model = _getDataModel();
+    // we need to call isRowAvailable() here because the 1.0 sun RI was
+    // throwing exceptions when getRowData() was called with rowIndex=-1
+    return model.isRowAvailable() ? model.getRowData() : null;
+  }
+
+  /**
+   * Gets the data for the current row.
+   * @param rowIndex identifies the row to get data from
+   * @see CollectionModel#getRowData(int)
+   * @return null if the current row is unavailable
+   */
+  public final Object getRowData(int rowIndex)
+  {
+    CollectionModel model = _getDataModel();
+    // we need to call isRowAvailable() here because the 1.0 sun RI was
+    // throwing exceptions when getRowData() was called with rowIndex=-1
+    return model.isRowAvailable(rowIndex) ? model.getRowData(rowIndex) : null;
+  }
+
+  private CollectionModel _getDataModel()
+  {
+    if (_dataModel == null)
+    {
+      Object value = getValue();
+
+      _dataModel = ModelUtils.toCollectionModel(value);
+
+    }
+
+    return _dataModel;
+  }
+
+  //
+  // Flush the cached data model, if needed
+  //
+  private void _flushCachedDataModel()
+  {
+
+     _dataModel = null;
+
+  }
+
+  private transient CollectionModel   _dataModel = null;
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSelectRangeTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.event.DisclosureEvent;
+
+/**
+ * Base class for ShowDetail component.
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXShowDetailTemplate extends UIXComponentBase
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public boolean isDisclosed();
+/**/  abstract public void setDisclosed(boolean setDisclosed);
+/**/  abstract public boolean isImmediate();
+/**/  abstract public MethodBinding getDisclosureListener();
+
+  public void processDecodes(FacesContext context)
+  {
+    // If we're not disclosed, only process ourselves
+    if (!isDisclosed())
+    {
+      if (isRendered())
+        decode(context);
+    }
+    else
+      super.processDecodes(context);
+  }
+
+  public void processValidators(FacesContext context)
+  {
+    if (isDisclosed())
+      super.processValidators(context);
+  }
+
+  public void processUpdates(FacesContext context)
+  {
+    if (isDisclosed())
+      super.processUpdates(context);
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    // Perform standard superclass processing
+    super.broadcast(event);
+
+    if (event instanceof DisclosureEvent)
+    {
+      // Expand or collapse this showDetail
+      boolean isDisclosed = ((DisclosureEvent) event).isExpanded();
+      setDisclosed(isDisclosed);
+      //pu: Implicitly record a Change for 'disclosed' attribute
+      addAttributeChange("disclosed",
+                         isDisclosed ? Boolean.TRUE : Boolean.FALSE);
+      if (isImmediate())
+        getFacesContext().renderResponse();
+
+      // Notify the specified disclosure listener method (if any)
+      __broadcast(event, getDisclosureListener());
+    }
+  }
+
+  /**
+   * @todo Should a non-immediate ShowDetail fire after UPDATE_MODEL_VALUES,
+   * or INVOKE_APPLICATION?  Or should we only support non-immediate
+   * ShowDetails?
+   */
+  public void queueEvent(FacesEvent e)
+  {
+    if ((e instanceof DisclosureEvent) && (e.getSource() == this))
+    {
+      if (isImmediate())
+      {
+        e.setPhaseId(PhaseId.ANY_PHASE);
+      }
+      else
+      {
+        e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+      }
+    }
+
+    super.queueEvent(e);
+  }
+
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.myfaces.trinidad.component;
+
+import java.util.List;
+
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.event.DisclosureEvent;
+
+/**
+ * Base class for ShowOne component.
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXShowOneTemplate extends UIXComponentBase
+{
+  public void queueEvent(FacesEvent e)
+  {
+    //  Care only if it is a DisclosureEvent, and only if its source is one of
+    //  its immediate children, for... one could bubble up from one of its grand
+    //  children that could be a ShowDetail.
+    if ( (e instanceof DisclosureEvent) &&
+         (this == e.getComponent().getParent()) )
+    {
+      //  Care only if the incoming event was from the to-be-disclosed
+      //  showDetailItem
+      if (((DisclosureEvent) e).isExpanded())
+      {
+        List children = getChildren();
+        int childCount = children.size();
+        UIXShowDetail toBeUnDisclosedChild = null;
+        for (int i=0; i<childCount; i++)
+        {
+          toBeUnDisclosedChild =  (UIXShowDetail) children.get(i);
+          if (toBeUnDisclosedChild.isDisclosed())
+            break;
+        }
+        //  Override the phaseId that would be already set on this event
+        //  (coming off of the to-be-disclosed showDetailItem), because the
+        //  phase-id should actually be determined by the 'immediate' attribute
+        //  on the to-be-undisclosed showDetailItem
+        if (toBeUnDisclosedChild.isImmediate())
+        {
+          e.setPhaseId(PhaseId.ANY_PHASE);
+        }
+        else
+        {
+          e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+        }
+        //  Now queue the event for the to-be-undisclosed showDetailItem
+        //  Note that this is always delivered earlier than the one that is
+        //  already queued for to-be-disclosed showDetailItem.
+        (new DisclosureEvent(toBeUnDisclosedChild, false)).queue();
+      }
+    }
+    super.queueEvent(e);
+  }
+
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowOneTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,183 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.ActionSource;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * Base class for singleStep components
+ *
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ * @todo =-=jmw should the text attribute be on the
+ * base component?
+ */
+abstract public class UIXSingleStepTemplate
+                extends UIXComponentBase
+                implements ActionSource
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public MethodBinding getPreviousActionListener();
+/**/  abstract public MethodBinding getNextActionListener();
+/**/  abstract public MethodBinding getPreviousAction();
+/**/  abstract public MethodBinding getNextAction();
+/**/  abstract public void setPreviousActionListener(MethodBinding listener);
+/**/  abstract public void setNextActionListener(MethodBinding listener);
+/**/  abstract public void setPreviousAction(MethodBinding action);
+/**/  abstract public void setNextAction(MethodBinding action);
+
+
+  public void queueEvent(FacesEvent e)
+  {
+    if (e.getSource() == this)
+    {
+      if (getActionType() == PREVIOUS_ACTION_TYPE)
+        e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+      else
+        e.setPhaseId(PhaseId.INVOKE_APPLICATION);
+    }
+
+    super.queueEvent(e);
+  }
+
+  /**
+   * @todo Store as transient PropertyKey
+   */
+  public Object getActionType()
+  {
+    return _actionType;
+  }
+
+
+  public void setActionType(Object actionType)
+  {
+    _actionType = actionType;
+  }
+
+  /**
+    * @todo if I have default listeners, then should
+    * remove (then restore) default Listeners before saving state -
+    * this note copied from form.submitButtonBase.saveState....
+   */
+  public Object saveState(FacesContext context)
+  {
+    return super.saveState(context);
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    // Perform standard superclass processing
+    super.broadcast(event);
+
+
+    FacesContext context = getFacesContext();
+
+    // Notify the specified listener method (if any)
+    if (event instanceof ActionEvent)
+    {
+      if (getActionType() == PREVIOUS_ACTION_TYPE)
+      {
+        __broadcast(event, getPreviousActionListener());
+      }
+      else
+      {
+        __broadcast(event, getNextActionListener());
+      }
+
+      ActionListener defaultActionListener =
+                             context.getApplication().getActionListener();
+
+      if (defaultActionListener != null)
+        defaultActionListener.processAction((ActionEvent) event);
+    }
+  }
+
+  public MethodBinding getAction()
+  {
+    if ( getActionType() == PREVIOUS_ACTION_TYPE)
+      return getPreviousAction();
+
+    return getNextAction();
+  }
+
+  /**
+   * @todo Either make this throw an exception, or make it
+   *   execute on both back and next.
+   */
+  public void setAction(MethodBinding action)
+  {
+    if ( getActionType() == PREVIOUS_ACTION_TYPE)
+      setPreviousAction(action);
+    else
+      setNextAction(action);
+  }
+
+  public MethodBinding getActionListener()
+  {
+    if ( getActionType() == PREVIOUS_ACTION_TYPE)
+      return getPreviousActionListener();
+
+    return getNextActionListener();
+  }
+
+  /**
+   * @todo Either make this throw an exception, or make it
+   *   execute on both back and next.
+   */
+  public void setActionListener(MethodBinding listener)
+  {
+    if ( getActionType() == PREVIOUS_ACTION_TYPE)
+      setPreviousActionListener(listener);
+    else
+      setNextActionListener(listener);
+  }
+
+  /**
+   * returns true if the actionType is PREVIOUS_ACTION_TYPE
+   */
+  public boolean isImmediate()
+  {
+    return  (getActionType() == PREVIOUS_ACTION_TYPE);
+  }
+  /**
+   * no-op.
+   * For UIXSingleStep components, even though it implements ActionSource,
+   * we do no have an immediate attribute.
+   * By default, if actionType is PREVIOUS_ACTION_TYPE,
+   * we set the phase to PhaseId.APPLY_REQUEST_VALUES, else we set the
+   * phase to PhaseId.INVOKE_APPLICATION.
+   */
+  public void setImmediate(boolean immediate)
+  {
+    // do nothing
+  }
+
+  private Object _actionType = NEXT_ACTION_TYPE;
+
+  public static final Object NEXT_ACTION_TYPE = new Object();
+  public static final Object PREVIOUS_ACTION_TYPE = new Object();
+  // Someday we might add a cancel button?
+  // public static final Object CANCEL_ACTION_TYPE = new Object();
+
+
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSingleStepTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,86 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.NamingContainer;
+import javax.faces.context.FacesContext;
+
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+/**
+ * Base class for Subform component.
+ * <p>
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXSubformTemplate extends UIXComponentBase
+                                        implements NamingContainer
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public boolean isSubmitted();
+/**/  abstract public void setSubmitted(boolean submitted);
+/**/  abstract public boolean isDefault();
+
+  public void queueEvent(FacesEvent event)
+  {
+    // If the event is being queued for anything *after* APPLY_REQUEST_VALUES,
+    // then this subform is active.
+    if (PhaseId.APPLY_REQUEST_VALUES.compareTo(event.getPhaseId()) < 0)
+    {
+      _storeSomethingSubmitted(FacesContext.getCurrentInstance());
+      setSubmitted(true);
+    }
+
+    super.queueEvent(event);
+  }
+
+  public void processDecodes(FacesContext context)
+  {
+    setSubmitted(false);
+    super.processDecodes(context);
+  }
+
+  public void processValidators(FacesContext context)
+  {
+    if (!isSubmitted() && isDefault() && !_isSomethingSubmitted(context))
+      setSubmitted(true);
+
+    if (isSubmitted())
+      super.processValidators(context);
+  }
+
+  public void processUpdates(FacesContext context)
+  {
+    if (isSubmitted())
+      super.processUpdates(context);
+  }
+
+  static private void _storeSomethingSubmitted(FacesContext context)
+  {
+    context.getExternalContext().getRequestMap().put(_SOMETHING_SUBMITTED,
+                                                     Boolean.TRUE);
+  }
+
+  static private boolean _isSomethingSubmitted(FacesContext context)
+  {
+    return Boolean.TRUE.equals(context.getExternalContext().
+                               getRequestMap().get(_SOMETHING_SUBMITTED));
+  }
+
+  static private final String _SOMETHING_SUBMITTED =
+    "org.apache.myfaces.trinidad.component.UIXSubformSubmitted";
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSubformTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,109 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+
+/**
+ * Base class for the switcher componnet.
+ * <p>
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXSwitcherTemplate extends UIXComponentBase
+{
+/**/ // Abstract methods implemented by code gen
+/**/  abstract public String getFacetName();
+/**/  abstract public String getDefaultFacet();
+
+  /**
+   * Only decode the currently active facet.
+   */
+  public void processDecodes(FacesContext context)
+  {
+    UIComponent facet = _getFacet();
+    if (facet != null)
+      facet.processDecodes(context);
+  }
+
+  /**
+   * Only process validations on the currently active facet.
+   */
+  public void processValidators(FacesContext context)
+  {
+    UIComponent facet = _getFacet();
+    if (facet != null)
+      facet.processValidators(context);
+  }
+
+
+  /**
+   * Only process updates on the currently active facet.
+   */
+  public void processUpdates(FacesContext context)
+  {
+    UIComponent facet = _getFacet();
+    if (facet != null)
+      facet.processUpdates(context);
+  }
+
+
+  /**
+   * Only render the currently active facet.
+   */
+  public void encodeChildren(FacesContext context)
+    throws IOException
+  {
+    UIComponent facet = _getFacet();
+    if (facet != null)
+      __encodeRecursive(context, facet);
+  }
+
+
+  /**
+   * Override to return true.
+   */
+  public boolean getRendersChildren()
+  {
+    return true;
+  }
+
+  private UIComponent _getFacet()
+  {
+    if (!isRendered())
+      return null;
+
+    String facetName = getFacetName();
+    if (facetName != null)
+    {
+      UIComponent facet = getFacet(facetName);
+      if (facet != null)
+        return facet;
+    }
+
+    String defaultFacet = getDefaultFacet();
+    if (defaultFacet != null)
+      return getFacet(defaultFacet);
+
+    return null;
+  }
+
+}
+

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXSwitcherTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,357 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
+import org.apache.myfaces.trinidad.event.RangeChangeEvent;
+import org.apache.myfaces.trinidad.event.SelectionEvent;
+import org.apache.myfaces.trinidad.event.SortEvent;
+import org.apache.myfaces.trinidad.model.CollectionModel;
+import org.apache.myfaces.trinidad.model.RowKeySet;
+import org.apache.myfaces.trinidad.model.RowKeySetImpl;
+
+/**
+ * Base class for the Table component. The behaviour supported by this base class
+ * include record navigation, sorting, selection and detail-disclosure.
+ * <p>
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXTableTemplate extends UIXIteratorTemplate
+  implements CollectionComponent
+{
+
+  public void setSortCriteria(List criteria)
+  {
+    _sortCriteria = criteria;
+    super.setSortCriteria(criteria);
+  }
+
+  /**
+   * Sets the phaseID of UI events depending on the "immediate" property.
+   */
+  public void queueEvent(FacesEvent event)
+  {
+    TableUtils.__handleQueueEvent(this, event);
+    super.queueEvent(event);
+  }
+
+  /**
+   * Delivers an event to the appropriate listeners.
+   * @param event
+   * @throws javax.faces.event.AbortProcessingException
+   */
+  public void broadcast(FacesEvent event)
+    throws AbortProcessingException
+  {
+    // the order of processing is
+    // 1. do any default action handling
+    // 2. invoke any actionListener method binding
+    // 3. call all the registered ActionListener instances.
+
+    // Deliver to the default RangeChangeListener
+    if (event instanceof RangeChangeEvent)
+    {
+      RangeChangeEvent rEvent = (RangeChangeEvent) event;
+      int first = rEvent.getNewStart();
+      setFirst(first);
+      //pu: Implicitly record a Change for 'first' attribute
+      addAttributeChange("first", new Integer(first));
+      
+      if ((first == 0) && (rEvent.getNewEnd() == getRowCount()))
+      {
+        setShowAll(true);
+        //pu: Implicitly record a Change for 'showAll' attribute
+        addAttributeChange("showAll", Boolean.TRUE);
+      }
+      else if (isShowAll())
+      {
+        setShowAll(false);
+        //pu: Implicitly record a Change for 'showAll' attribute
+        addAttributeChange("showAll", Boolean.FALSE);
+      }
+
+      __broadcast(event, getRangeChangeListener());
+    }
+    else if (event instanceof RowDisclosureEvent)
+    {
+      RowDisclosureEvent eEvent = (RowDisclosureEvent) event;
+      RowKeySet set = getDisclosedRowKeys();
+      set.addAll(eEvent.getAddedSet());
+      set.removeAll(eEvent.getRemovedSet());
+      __broadcast(event, getRowDisclosureListener());
+    }
+    else if (event instanceof SortEvent)
+    {
+      SortEvent sEvent = (SortEvent) event;
+      setSortCriteria(sEvent.getSortCriteria());
+      __broadcast(event, getSortListener());
+    }
+    else if (event instanceof SelectionEvent)
+    {
+      //pu: Implicitly record a Change for 'selectionState' attribute
+      addAttributeChange("selectedRowKeys",
+                         getSelectedRowKeys());
+      __broadcast(event, getSelectionListener());
+    }
+
+    super.broadcast(event);
+  }
+
+
+/**/  abstract public void setDisclosedRowKeys(RowKeySet state);
+/**/  abstract public RowKeySet getDisclosedRowKeys();
+/**/  public abstract RowKeySet getSelectedRowKeys();
+/**/  public abstract void setSelectedRowKeys(RowKeySet model);
+/**/  abstract public void setFirst(int first);
+/**/  abstract public void setShowAll(boolean showAll);
+/**/  abstract public boolean isShowAll();
+/**/  abstract public UIComponent getDetailStamp();
+/**/  public abstract MethodBinding getRangeChangeListener();
+/**/  public abstract MethodBinding getSortListener();
+/**/  public abstract MethodBinding getRowDisclosureListener();
+/**/  public abstract MethodBinding getSelectionListener();
+/**/  public abstract boolean isImmediate();
+
+  public Object saveState(FacesContext context)
+  {
+    Object o = super.saveState(context);
+    if ((o == null) &&
+        ((_sortCriteria == null) || _sortCriteria.isEmpty()))
+      return null;
+
+    return new Object[]{o, _sortCriteria};
+  }
+
+  public void restoreState(FacesContext context, Object state)
+  {
+    Object[] array = (Object[]) state;
+    super.restoreState(context, array[0]);
+
+
+    // Get the sort criteria - but *don't* call setSortCriteria()
+    // here;  doing so would require getting the collection model,
+    // and that may invoke client code that isn't quite in a state
+    // to be invoked, in part because component "binding"s have not been
+    // evaluated yet.
+    List criteria = (List) array[1];
+    _sortCriteria = criteria;
+  }
+
+  
+  /**
+   * Gets the data for the first selected row.
+   * This is useful when using EL to get at column data for the selected
+   * row when using a tableSelectOne.
+   * @return null if there is nothing selected in the table.
+   */
+  public Object getSelectedRowData() 
+  {
+    RowKeySet state = getSelectedRowKeys();
+    Iterator keys = state.iterator();
+    if (keys.hasNext()) 
+    {
+      Object key = keys.next();
+      CollectionModel model = getCollectionModel();
+      Object old = model.getRowKey();
+      try
+      {
+        model.setRowKey(key);
+        return model.getRowData();
+      }
+      finally
+      {
+        model.setRowKey(old);
+      }
+    }
+    return null;
+  }
+
+  protected final void processFacetsAndChildren(
+    FacesContext context,
+    PhaseId phaseId)
+  {
+    // process all the facets of this table just once
+    // (except for the "detailStamp" facet which must be processed once
+    // per row):
+    TableUtils.__processFacets(context, this, this, phaseId,
+      UIXTable.DETAIL_STAMP_FACET);
+
+    // process all the facets of this table's column children:
+    TableUtils.__processColumnFacets(context, this, this, phaseId);
+
+    // process all the children and the detailStamp as many times as necessary
+    _processStamps(context, phaseId);
+  }
+
+  /**
+   * Gets the stamps. This returns the children of this component plus
+   * the detail stamp (if any).
+   * @todo cache the result.
+   */
+  protected final List getStamps()
+  {
+    List children = super.getStamps();
+    UIComponent detail = getDetailStamp();
+    if (detail != null)
+    {
+      List stamps = new ArrayList(children.size() + 1);
+      stamps.addAll(children);
+      stamps.add(detail);
+      return stamps;
+    }
+    return children;
+  }
+
+  /**
+   * Saves the state for the given stamp.
+   * This method avoids changing the state of facets on columns.
+   */
+  protected final Object saveStampState(FacesContext context, UIComponent stamp)
+  {
+    if (stamp instanceof UIXColumn)
+    {
+      // if it is a column, we don't want the facets processed.
+      // Only the children:
+      return StampState.saveChildStampState(context, stamp, this);
+    }
+    else
+      return super.saveStampState(context, stamp);
+  }
+
+  /**
+   * Restores the state for the given stamp.
+   * This method avoids changing the state of facets on columns.
+   */
+  protected final void restoreStampState(FacesContext context, UIComponent stamp,
+                                         Object stampState)
+  {
+    if (stamp instanceof UIXColumn)
+    {
+      // if it is a column, we don't want the facets processed.
+      // Only the children:
+      StampState.restoreChildStampState(context, stamp, this, stampState);
+    }
+    else
+      super.restoreStampState(context, stamp, stampState);
+  }
+
+  protected final CollectionModel createCollectionModel(
+    CollectionModel current,
+    Object value)
+  {
+    CollectionModel model = super.createCollectionModel(current, value); 
+
+    getSelectedRowKeys().setCollectionModel(model);
+    getDisclosedRowKeys().setCollectionModel(model);
+
+    // If we were perviously sorted, restore the sort order:
+    if (_sortCriteria != null)
+    {
+      model.setSortCriteria(_sortCriteria);
+    }
+
+    return model;
+  }
+
+  /**
+   * Gets the internal state of this component.
+   */
+  Object __getMyStampState()
+  {
+    Object[] state = new Object[6];
+    state[0] = _sortCriteria;
+    state[1] = super.__getMyStampState();
+    state[2] = new Integer(getFirst());
+    state[3] = Boolean.valueOf(isShowAll());
+    state[4] = getSelectedRowKeys();
+    state[5] = getDisclosedRowKeys();
+    return state;
+  }
+  
+  /**
+   * Sets the internal state of this component.
+   * @param stampState the internal state is obtained from this object.
+   */
+  void __setMyStampState(Object stampState)
+  {
+    Object[] state = (Object[]) stampState;
+    _sortCriteria = (List) state[0];
+    super.__setMyStampState(state[1]);
+    setFirst(((Integer) state[2]).intValue());
+    setShowAll(Boolean.TRUE == state[3]);
+    setSelectedRowKeys((RowKeySet) state[4]);
+    setDisclosedRowKeys((RowKeySet) state[5]);
+  }
+
+  private void _processStamps(
+    FacesContext context,
+    PhaseId phaseId)
+  {
+    // Process all the children
+    CollectionModel tableData = getCollectionModel();
+    if (tableData.getRowCount() != 0)
+    {
+      int startIndex = getFirst();
+      int endIndex = isShowAll() ? getRowCount()-1 : TableUtils.getLast(this);
+
+      UIComponent detail = getDetailStamp();
+      RowKeySet disclosureState =
+        (detail == null) ? null : getDisclosedRowKeys();
+
+      for (int i = startIndex; i <= endIndex; i++)
+      {
+        setRowIndex(i);
+        TableUtils.__processStampedChildren(context, this, phaseId);
+
+        if ((disclosureState != null) && disclosureState.isContained())
+        {
+          assert getRowIndex() == i;
+          processComponent(context, detail, phaseId);
+        }
+      }
+
+      setRowIndex(-1);
+    }
+  }
+
+
+  void __init()
+  {
+    super.__init();
+    if (getSelectedRowKeys() == null)
+      setSelectedRowKeys(new RowKeySetImpl());
+    if (getDisclosedRowKeys() == null)
+      setDisclosedRowKeys(new RowKeySetImpl());
+    // if "first" is valueBound, we can't deal with it changing 
+    // during the lifecycle. So stash it as a local value.
+    // see bug 4537121:
+    setFirst(getFirst());
+  }
+
+  transient private List _sortCriteria = null;
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,325 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.event.FocusEvent;
+import org.apache.myfaces.trinidad.event.RangeChangeEvent;
+import org.apache.myfaces.trinidad.event.RangeChangeListener;
+import org.apache.myfaces.trinidad.event.SelectionEvent;
+import org.apache.myfaces.trinidad.model.RowKeySet;
+import org.apache.myfaces.trinidad.model.TreeModel;
+
+/**
+ * Base class for TreeTable component. The behaviours implemented by the
+ * TreeTable include expanding/collapsing subtrees and focusing into subtrees.
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ * @todo document new default value for formSubmitted
+ */
+abstract public class UIXTreeTableTemplate extends UIXTree
+{
+/**/  public abstract int[] getRowsByDepth();
+/**/  abstract public MethodBinding getRangeChangeListener();
+
+  /**
+   * Gets the maximum number of rows to show.
+   * This changes depending on the depth of the current row in the tree
+   * hierarchy.
+   * The rows per depth is obtained from
+   * {@link #getRowsByDepth}.
+   * @return 0 if all rows must be shown at this level.
+   */
+  public final int getRows()
+  {
+    int depth = getTreeModel().getDepth();
+    assert depth >= 0;
+
+    // the root element is selected when depth is zero:
+    if (depth==0)
+      return 1; // the treeTable only shows the first root node.
+
+    int[] rows = getRowsByDepth();
+    if ((rows == null) || (rows.length == 0))
+      return 0;
+
+    depth--;
+
+    // in a treeTable, the the first "rows" property affects how many
+    // children of the root element to show.
+    return (depth >= rows.length) ? rows[rows.length - 1] : rows[depth];
+  }
+
+  /**
+   * Gets the range start index for the current collection.
+   * The current collection is the children of the parent of the
+   * current rowData. ie: the current collection is the collection of
+   * siblings of the current rowData.
+   * @return zero based index of the row that must be displayed first.
+   * @see #getRowData()
+   */
+  public final int getFirst()
+  {
+    // "first" does not change per path. It changes per parent path.
+    // this is because "first", "rows" and "rowCount" applies to the container
+    // element and not the current element:
+    Object container = _getContainerPath();
+    Integer first = (Integer) _firstMap.get(container);
+    return (first != null) ? first.intValue() : 0;
+  }
+
+  /**
+   * Sets the range start index for the current collection.
+   * The current collection is the children of the parent of the
+   * current rowData. ie: the current collection is the collection of
+   * siblings of the current rowData.
+   * @param index zero based index of the row that must be displayed first.
+   * @see #getRowData()
+   */
+  public void setFirst(int index)
+  {
+    // "first" does not change per path. It changes per parent path.
+    // this is because "first", "rows" and "rowCount" applies to the container
+    // element and not the current element:
+    Object container = _getContainerPath();
+    if (_firstMap == Collections.EMPTY_MAP)
+      _firstMap = new HashMap(3);
+
+    if (index <= 0)
+      _firstMap.remove(container);
+    else
+      _firstMap.put(container, new Integer(index));
+  }
+
+  /**
+   * Adds a RangeChangeListener.
+   */
+  public void addRangeChangeListener(RangeChangeListener listener)
+  {
+    addFacesListener(listener);
+  }
+
+  /**
+   * Removes a RangeChangeListener.
+   */
+  public void removeRangeChangeListener(RangeChangeListener listener)
+  {
+    removeFacesListener(listener);
+  }
+
+
+  /**
+   * Retrieves all RangeChangeListeners
+   */
+  public RangeChangeListener[] getRangeChangeListeners()
+  {
+    return (RangeChangeListener[]) getFacesListeners(RangeChangeListener.class);
+  }
+
+  public Object saveState(FacesContext context)
+  {
+    Object[] array = new Object[2];
+    array[0] = super.saveState(context);
+    array[1] = (_firstMap.isEmpty()) ? null : _firstMap;
+
+    if (array[0] == null && array[1] == null)
+      return null;
+
+    return array;
+  }
+
+  public void restoreState(FacesContext context, Object state)
+  {
+    Object[] array = (Object[]) state;
+    super.restoreState(context, array[0]);
+    _firstMap = (Map) array[1];
+    if (_firstMap == null)
+      _firstMap = Collections.EMPTY_MAP;
+  }
+
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  {
+    // Notify the specified disclosure listener method (if any)
+    if (event instanceof FocusEvent)
+    {
+      setFocusRowKey(getRowKey());
+      //pu: Implicitly record a Change for 'focusPath' attribute
+      addAttributeChange("focusPath",
+                         getFocusRowKey());
+      // it is nice to expand the focused item:
+      getDisclosedRowKeys().add();
+
+      __broadcast(event, getFocusListener());
+    }
+    else if (event instanceof RangeChangeEvent)
+    {
+      RangeChangeEvent rce = (RangeChangeEvent) event;
+      setFirst(rce.getNewStart());
+      //pu: Implicitly record a Change for 'first' attribute
+      //=-=pu: This ain't getting restored. Check with Arj or file a bug.
+      addAttributeChange("first",
+                         new Integer(rce.getNewStart()));
+      __broadcast(event, getRangeChangeListener());
+    }
+
+    // Perform standard superclass processing
+    super.broadcast(event);
+  }
+
+
+  /**
+   * Gets the stamps. This returns the children of this component plus
+   * the nodeStamp stamp (if any).
+   * @todo cache the result.
+   */
+  protected final List getStamps()
+  {
+    List children = getChildren();
+    UIComponent nodeStamp = getNodeStamp();
+    if (nodeStamp != null)
+    {
+      List stamps = new ArrayList(children.size() + 1);
+      stamps.addAll(children);
+      stamps.add(nodeStamp);
+      return stamps;
+    }
+    return children;
+  }
+
+  /**
+   * Restores the state for the given stamp.
+   * This method avoids changing the state of facets on columns.
+   */
+  protected final void restoreStampState(FacesContext context, UIComponent stamp,
+                                         Object stampState)
+  {
+    if (stamp instanceof UIXColumn)
+    {
+      // if it is a column, we don't want the facets processed.
+      // Only the children:
+      StampState.restoreChildStampState(context, stamp, this, stampState);
+    }
+    else
+      super.restoreStampState(context, stamp, stampState);
+  }
+
+  /**
+   * Saves the state for the given stamp.
+   * This method avoids changing the state of facets on columns.
+   */
+  protected final Object saveStampState(FacesContext context, UIComponent stamp)
+  {
+    if (stamp instanceof UIXColumn)
+    {
+      // if it is a column, we don't want the facets processed.
+      // Only the children:
+      return StampState.saveChildStampState(context, stamp, this);
+    }
+    else
+      return super.saveStampState(context, stamp);
+  }
+
+  protected final void processFacetsAndChildren(
+    FacesContext context,
+    PhaseId phaseId)
+  {
+    // process all the facets of this hgrid just once
+    // (except for the "nodeStamp" facet which must be processed once
+    // per row):
+    TableUtils.__processFacets(context, this, this, phaseId,
+      UIXTreeTable.NODE_STAMP_FACET);
+
+    UIComponent nodeStamp = getNodeStamp();
+    // process any facets of the nodeStamp column:
+    TableUtils.__processFacets(context, this, nodeStamp, phaseId, null);
+
+    // process all the facets of this table's column children:
+    TableUtils.__processColumnFacets(context, this, this, phaseId);
+
+    // recursively process any grandchild columns of the nodeStamp column:
+    TableUtils.__processColumnFacets(context, this, nodeStamp, phaseId);
+
+    Object oldPath = getRowKey();
+    try
+    {
+      Object path = getFocusRowKey();
+      if (path == null)
+      {
+        // no data in this TreeTable
+        return;
+      }
+
+      setRowKey(path);
+      TableUtils.__processStampedChildren(context, this, phaseId);
+      processComponent(context, nodeStamp, phaseId); // bug 4688568
+      RowKeySet state = getDisclosedRowKeys();
+      if (state.isContained())
+      {
+        enterContainer();
+        HierarchyUtils.__iterateOverTree(context,
+                                         phaseId,
+                                         this,
+                                         state,
+                                         true);
+      }
+    }
+    finally
+    {
+      setRowKey(oldPath);
+    }
+  }
+
+  void __init()
+  {
+    super.__init();
+    Object path = getFocusRowKey();
+    if (path == null)
+    {
+      TreeModel model = getTreeModel();
+      Object oldKey = model.getRowKey();
+      model.setRowKey(null);
+      model.setRowIndex(0);
+      if (model.isRowAvailable())
+      {
+        setFocusRowKey(model.getRowKey());
+      }
+      model.setRowKey(oldKey);
+    }
+  }
+
+  /**
+   * Gets the path of the parent
+   */
+  private Object _getContainerPath()
+  {
+    Object parentKey = getTreeModel().getContainerRowKey();
+    return parentKey;
+  }
+
+  private Map _firstMap = Collections.EMPTY_MAP;
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTableTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,121 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+import java.io.IOException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+import org.apache.myfaces.trinidad.model.CollectionModel;
+import org.apache.myfaces.trinidad.model.ModelUtils;
+import org.apache.myfaces.trinidad.model.RowKeySet;
+import org.apache.myfaces.trinidad.model.RowKeySetTreeImpl;
+import org.apache.myfaces.trinidad.model.TreeModel;
+import org.apache.myfaces.trinidad.event.SelectionEvent;
+
+/**
+ * Base class for Tree component.
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXTreeTemplate extends UIXHierarchy
+{
+/**/  public abstract RowKeySet getDisclosedRowKeys();
+/**/  public abstract void setDisclosedRowKeys(RowKeySet keys);
+/**/  public abstract RowKeySet getSelectedRowKeys();
+/**/  public abstract void setSelectedRowKeys(RowKeySet keys);
+/**/  public abstract MethodBinding getRowDisclosureListener();
+/**/  public abstract UIComponent getNodeStamp();
+  
+  /**
+   * Sets the phaseID of UI events depending on the "immediate" property.
+   */
+  public void queueEvent(FacesEvent event)
+  {
+    TableUtils.__handleQueueEvent(this, event);
+    super.queueEvent(event);
+  }
+
+  /**
+   * Delivers an event.
+   * @param event
+   * @throws javax.faces.event.AbortProcessingException
+   */
+  public void broadcast(FacesEvent event) throws AbortProcessingException
+  { 
+    if (event instanceof SelectionEvent)
+    {
+      //pu: Implicitly record a Change for 'selectionState' attribute
+      //=-=pu: This ain't getting restored. Check with Arj or file a bug.
+      addAttributeChange("selectedRowKeys",
+                         getSelectedRowKeys());
+      __broadcast(event, getSelectionListener());
+    }
+
+    HierarchyUtils.__handleBroadcast(this, 
+                                      event, 
+                                      getDisclosedRowKeys(), 
+                                      getRowDisclosureListener());
+    super.broadcast(event);
+  }
+ 
+
+  public CollectionModel createCollectionModel(CollectionModel current, Object value)
+  {
+    
+    TreeModel model = ModelUtils.toTreeModel(value);
+    model.setRowKey(null);    
+    getDisclosedRowKeys().setCollectionModel(model);
+    getSelectedRowKeys().setCollectionModel(model);
+    return model;
+  }
+
+ 
+  
+  protected void processFacetsAndChildren(
+    FacesContext context,
+    PhaseId phaseId)
+  {
+    // this component has no facets that need to be processed once.
+    // instead process the "nodeStamp" facet as many times as necessary:
+    Object oldPath = getRowKey();
+    setRowKey(null);
+    HierarchyUtils.__iterateOverTree(context, 
+                                      phaseId, 
+                                      this, 
+				      getDisclosedRowKeys(),
+                                      true);
+    setRowKey(oldPath);
+  }
+
+ 
+  void __encodeBegin(FacesContext context) throws IOException
+  {
+    HierarchyUtils.__handleEncodeBegin(this, getDisclosedRowKeys());
+    super.__encodeBegin(context);
+  }
+
+  void __init()
+  {
+    super.__init();
+    if (getDisclosedRowKeys() == null)
+      setDisclosedRowKeys(new RowKeySetTreeImpl());
+    if (getSelectedRowKeys() == null)
+      setSelectedRowKeys(new RowKeySetTreeImpl());
+  }
+}

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java?rev=425557&view=auto
==============================================================================
--- incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java (added)
+++ incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java Tue Jul 25 16:28:19 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.ValueHolder;
+
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+
+/**
+ * Base class for components that have a value.
+ * <p>
+ * @version $Name:  $ ($Revision$) $Date$
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXValueTemplate extends UIXComponentBase
+  implements ValueHolder
+{
+  /**
+   * Return the locally stored value, ignoring any ValueBinding
+   * set for "value".
+   */
+  public Object getLocalValue()
+  {
+    PropertyKey key = UIXValue.VALUE_KEY;
+    return getFacesBean().getLocalProperty(key);
+  }
+}
+

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/adffaces/branches/matzew-repackaging-trinidad/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXValueTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL



Mime
View raw message