myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1523702 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/compat/ tobago-core/src/main/java/org/apache/myfaces/tobago/event/ tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/ tobago-core/src/main/j...
Date Mon, 16 Sep 2013 15:25:40 GMT
Author: lofwyr
Date: Mon Sep 16 15:25:40 2013
New Revision: 1523702

URL: http://svn.apache.org/r1523702
Log:
TOBAGO-1228: Setting JSF 2.0 as default version for Tobago
  - updating event handling
  - using MethodExpression instead of MethodBinding

Added:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource2.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource2.java
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SheetStateChangeSourceRule.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SortActionSourceRule.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeSourceRule.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/actionlistener/SimpleTabChangeListener.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtils.java
Mon Sep 16 15:25:40 2013
@@ -34,6 +34,10 @@ import javax.faces.event.FacesEvent;
 import java.util.Comparator;
 import java.util.Map;
 
+/**
+ * @deprecated since 2.0.0
+ */
+@Deprecated
 @SuppressWarnings("deprecation")
 public class FacesUtils {
 
@@ -55,6 +59,10 @@ public class FacesUtils {
     return FacesInvokeOnComponent12.invokeOnComponent(context, component, clientId, callback);
   }
 
+  /**
+   * @deprecated since 2.0.0
+   */
+  @Deprecated
   public static void invokeMethodBinding(FacesContext facesContext, MethodBinding methodBinding,
FacesEvent event) {
     if (methodBinding != null && event != null) {
       try {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/compat/FacesUtilsEL.java
Mon Sep 16 15:25:40 2013
@@ -52,6 +52,9 @@ public class FacesUtilsEL {
   private FacesUtilsEL() {
   }
 
+  /**
+   * @deprecated since 2.0.0
+   */
   public static boolean invokeOnComponent(
       FacesContext context, UIComponent component, String clientId, ContextCallback callback)
{
     String thisClientId = component.getClientId(context);
@@ -196,7 +199,7 @@ public class FacesUtilsEL {
     if (validator instanceof MethodExpression) {
       editableValueHolder.addValidator(new MethodExpressionValidator((MethodExpression) validator));
     } else {
-      LOG.error("Unknown instance for validator: " + (validator != null ? validator.getClass().getName()
: validator));
+      LOG.error("Unknown instance for validator: " + (validator != null ? validator.getClass().getName()
: "<null>"));
     }
   }
 
@@ -216,6 +219,9 @@ public class FacesUtilsEL {
     component.setValueExpression(name, (ValueExpression) valueBindingOrExpression);
   }
 
+  /**
+   * @deprecated since 2.0.0
+   */
   public static void addBindingOrExpressionTabChangeListener(
       TabChangeSource source, String type, Object bindingOrExpression) {
     if (bindingOrExpression instanceof ValueExpression) {

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource2.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource2.java?rev=1523702&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource2.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeSource2.java
Mon Sep 16 15:25:40 2013
@@ -0,0 +1,29 @@
+/*
+ * 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.tobago.event;
+
+import javax.el.MethodExpression;
+
+public interface SheetStateChangeSource2 extends SheetStateChangeSource {
+
+  MethodExpression getStateChangeListenerExpression();
+
+  void setStateChangeListenerExpression(MethodExpression actionListener);
+}

Added: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource2.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource2.java?rev=1523702&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource2.java
(added)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/event/TabChangeSource2.java
Mon Sep 16 15:25:40 2013
@@ -0,0 +1,30 @@
+/*
+ * 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.tobago.event;
+
+import javax.el.MethodExpression;
+
+public interface TabChangeSource2 extends TabChangeSource {
+
+  MethodExpression getTabChangeListenerExpression();
+
+  void setTabChangeListenerExpression(MethodExpression actionListener);
+
+}

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SheetStateChangeSourceRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SheetStateChangeSourceRule.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SheetStateChangeSourceRule.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SheetStateChangeSourceRule.java
Mon Sep 16 15:25:40 2013
@@ -19,10 +19,8 @@
 
 package org.apache.myfaces.tobago.facelets;
 
-import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
 import org.apache.myfaces.tobago.event.SheetStateChangeSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.myfaces.tobago.event.SheetStateChangeSource2;
 
 import javax.faces.event.ActionEvent;
 import javax.faces.view.facelets.FaceletContext;
@@ -33,8 +31,6 @@ import javax.faces.view.facelets.TagAttr
 
 public class SheetStateChangeSourceRule extends MetaRule {
 
-  private static final Logger LOG = LoggerFactory.getLogger(SheetStateChangeSourceRule.class);
-
   static final Class[] ACTION_LISTENER = new Class[]{ActionEvent.class};
 
   public static final SheetStateChangeSourceRule INSTANCE = new SheetStateChangeSourceRule();
@@ -57,12 +53,8 @@ public class SheetStateChangeSourceRule 
     }
 
     public void applyMetadata(FaceletContext ctx, Object instance) {
-LOG.error("TODO: implementation for JSF 1.2 / JSF 2.0");
-      ((SheetStateChangeSource) instance)
-// XXX
-          .setStateChangeListener(new MethodExpressionToMethodBinding(attribute
-              .getMethodExpression(ctx, null,
-                  SheetStateChangeSourceRule.ACTION_LISTENER)));
+      ((SheetStateChangeSource2) instance).setStateChangeListenerExpression(
+          attribute.getMethodExpression(ctx, null, SheetStateChangeSourceRule.ACTION_LISTENER));
     }
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SortActionSourceRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SortActionSourceRule.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SortActionSourceRule.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/SortActionSourceRule.java
Mon Sep 16 15:25:40 2013
@@ -19,10 +19,8 @@
 
 package org.apache.myfaces.tobago.facelets;
 
-import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
 import org.apache.myfaces.tobago.event.SortActionSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.myfaces.tobago.event.SortActionSource2;
 
 import javax.faces.event.ActionEvent;
 import javax.faces.view.facelets.FaceletContext;
@@ -33,8 +31,6 @@ import javax.faces.view.facelets.TagAttr
 
 public class SortActionSourceRule extends MetaRule {
 
-  private static final Logger LOG = LoggerFactory.getLogger(SortActionSourceRule.class);
-
   static final Class[] ACTION_LISTENER = new Class[]{ActionEvent.class};
 
   public static final SortActionSourceRule INSTANCE = new SortActionSourceRule();
@@ -58,9 +54,8 @@ public class SortActionSourceRule extend
     }
 
     public void applyMetadata(FaceletContext ctx, Object instance) {
-      LOG.error("TODO: implementation for JSF 1.2 / JSF 2.0");
-      ((SortActionSource) instance).setSortActionListener(new MethodExpressionToMethodBinding(attribute
-          .getMethodExpression(ctx, null, SortActionSourceRule.ACTION_LISTENER)));
+      ((SortActionSource2) instance).setSortActionListenerExpression(
+          attribute.getMethodExpression(ctx, null, SortActionSourceRule.ACTION_LISTENER));
     }
   }
 

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeListenerHandler.java
Mon Sep 16 15:25:40 2013
@@ -20,7 +20,7 @@
 package org.apache.myfaces.tobago.facelets;
 
 import org.apache.myfaces.tobago.event.TabChangeListener;
-import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.event.TabChangeSource2;
 import org.apache.myfaces.tobago.event.ValueExpressionTabChangeListener;
 
 import javax.el.ELException;
@@ -62,10 +62,10 @@ public class TabChangeListenerHandler ex
 
   public void apply(FaceletContext faceletContext, UIComponent parent)
       throws IOException, FacesException, ELException {
-    if (parent instanceof TabChangeSource) {
+    if (parent instanceof TabChangeSource2) {
       // only process if parent was just created
       if (parent.getParent() == null) {
-        TabChangeSource changeSource = (TabChangeSource) parent;
+        TabChangeSource2 changeSource = (TabChangeSource2) parent;
         TabChangeListener listener = null;
         ValueExpression valueExpression = null;
         if (binding != null) {

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeSourceRule.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeSourceRule.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeSourceRule.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TabChangeSourceRule.java
Mon Sep 16 15:25:40 2013
@@ -19,9 +19,8 @@
 
 package org.apache.myfaces.tobago.facelets;
 
-import org.apache.myfaces.tobago.component.MethodExpressionToMethodBinding;
 import org.apache.myfaces.tobago.event.TabChangeEvent;
-import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.event.TabChangeSource2;
 
 import javax.faces.view.facelets.FaceletContext;
 import javax.faces.view.facelets.MetaRule;
@@ -33,9 +32,8 @@ public class TabChangeSourceRule extends
   static final Class[] ACTION_LISTENER = new Class[]{TabChangeEvent.class};
   public static final TabChangeSourceRule INSTANCE = new TabChangeSourceRule();
 
-  public Metadata applyRule(String name, TagAttribute attribute,
-      MetadataTarget metadataTarget) {
-    if (metadataTarget.isTargetInstanceOf(TabChangeSource.class)) {
+  public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget metadataTarget)
{
+    if (metadataTarget.isTargetInstanceOf(TabChangeSource2.class)) {
       if ("tabChangeListener".equals(name)) {
         return new TabChangeListenerMapper(attribute);
       }
@@ -52,9 +50,8 @@ public class TabChangeSourceRule extends
     }
 
     public void applyMetadata(FaceletContext ctx, Object instance) {
-      ((TabChangeSource) instance).setTabChangeListener(
-          new MethodExpressionToMethodBinding(
-              attribute.getMethodExpression(ctx, null, TabChangeSourceRule.ACTION_LISTENER)));
+      ((TabChangeSource2) instance).setTabChangeListenerExpression(
+          attribute.getMethodExpression(ctx, null, TabChangeSourceRule.ACTION_LISTENER));
     }
   }
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
Mon Sep 16 15:25:40 2013
@@ -19,7 +19,6 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import org.apache.myfaces.tobago.compat.FacesUtils;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.ColumnEvent;
 import org.apache.myfaces.tobago.component.ComponentTypes;
@@ -31,9 +30,9 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.event.PageActionEvent;
 import org.apache.myfaces.tobago.event.SheetStateChangeEvent;
 import org.apache.myfaces.tobago.event.SheetStateChangeListener;
-import org.apache.myfaces.tobago.event.SheetStateChangeSource;
+import org.apache.myfaces.tobago.event.SheetStateChangeSource2;
 import org.apache.myfaces.tobago.event.SortActionEvent;
-import org.apache.myfaces.tobago.event.SortActionSource;
+import org.apache.myfaces.tobago.event.SortActionSource2;
 import org.apache.myfaces.tobago.internal.layout.Grid;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.layout.LayoutContainer;
@@ -49,12 +48,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.el.ELContext;
+import javax.el.MethodExpression;
 import javax.el.ValueExpression;
 import javax.faces.component.UIColumn;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UINamingContainer;
 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;
@@ -65,7 +64,7 @@ import java.util.List;
 import java.util.Map;
 
 public abstract class AbstractUISheet extends AbstractUIData
-    implements SheetStateChangeSource, SortActionSource, OnComponentPopulated,
+    implements SheetStateChangeSource2, SortActionSource2, OnComponentPopulated,
     LayoutContainer, LayoutComponent, SupportsRenderedPartially {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUISheet.class);
@@ -427,19 +426,21 @@ public abstract class AbstractUISheet ex
   public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
     super.broadcast(facesEvent);
     if (facesEvent instanceof SheetStateChangeEvent) {
-      FacesUtils.invokeMethodBinding(getFacesContext(), getStateChangeListener(), facesEvent);
+      final MethodExpression listener = getStateChangeListenerExpression();
+      listener.invoke(getFacesContext().getELContext(), new Object[]{facesEvent});
     } else if (facesEvent instanceof PageActionEvent) {
       if (facesEvent.getComponent() == this) {
-        FacesUtils.invokeMethodBinding(
-            getFacesContext(), getStateChangeListener(), new SheetStateChangeEvent(this));
+        final MethodExpression listener = getStateChangeListenerExpression();
+        listener.invoke(getFacesContext().getELContext(), new Object[]{facesEvent});
+
         performPaging((PageActionEvent) facesEvent);
       }
     } else if (facesEvent instanceof SortActionEvent) {
-      MethodBinding methodBinding = getSortActionListener();
-      if (methodBinding!= null) {
+      MethodExpression expression = getSortActionListenerExpression();
+      if (expression!= null) {
         // TODO should be first invokeMethodBinding and the update state
         getSheetState(getFacesContext()).updateSortState((SortActionEvent) facesEvent);
-        FacesUtils.invokeMethodBinding(getFacesContext(), methodBinding, facesEvent);
+        expression.invoke(getFacesContext().getELContext(), new Object[]{facesEvent});
       } else {
         getSheetState(getFacesContext()).updateSortState((SortActionEvent) facesEvent);
         new Sorter().perform((SortActionEvent) facesEvent);

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUITabGroup.java
Mon Sep 16 15:25:40 2013
@@ -19,7 +19,6 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import org.apache.myfaces.tobago.compat.FacesUtils;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.ComponentTypes;
 import org.apache.myfaces.tobago.component.Facets;
@@ -28,7 +27,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.SupportsRenderedPartially;
 import org.apache.myfaces.tobago.event.TabChangeEvent;
 import org.apache.myfaces.tobago.event.TabChangeListener;
-import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.event.TabChangeSource2;
 import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
 import org.apache.myfaces.tobago.layout.LayoutComponent;
 import org.apache.myfaces.tobago.layout.LayoutContainer;
@@ -37,24 +36,20 @@ import org.apache.myfaces.tobago.util.Cr
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.el.MethodExpression;
 import javax.el.ValueExpression;
-import javax.faces.component.ActionSource;
+import javax.faces.component.ActionSource2;
 import javax.faces.component.UIComponent;
 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 java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 public abstract class AbstractUITabGroup extends AbstractUIPanelBase
-    implements TabChangeSource, ActionSource, LayoutContainer, LayoutComponent, OnComponentPopulated,
+    implements TabChangeSource2, ActionSource2, LayoutContainer, LayoutComponent, OnComponentPopulated,
     SupportsRenderedPartially {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUITabGroup.class);
@@ -65,9 +60,6 @@ public abstract class AbstractUITabGroup
   public static final String SWITCH_TYPE_RELOAD_PAGE = "reloadPage";
   public static final String SWITCH_TYPE_RELOAD_TAB = "reloadTab";
 
-  private javax.el.MethodExpression actionExpression;
-  private javax.faces.el.MethodBinding actionListener;
-
   @Override
   public void encodeBegin(FacesContext facesContext) throws IOException {
 
@@ -148,7 +140,7 @@ public abstract class AbstractUITabGroup
       }
       AbstractUIPanelBase renderedTab = getRenderedTab();
       renderedTab.processDecodes(context);
-      for (UIComponent facet : (Collection<UIComponent>) getFacets().values()) {
+      for (UIComponent facet : getFacets().values()) {
         facet.processDecodes(context);
       }
       try {
@@ -173,7 +165,7 @@ public abstract class AbstractUITabGroup
       }
       AbstractUIPanelBase renderedTab = getRenderedTab();
       renderedTab.processValidators(context);
-      for (UIComponent facet : (Collection<UIComponent>) getFacets().values()) {
+      for (UIComponent facet : getFacets().values()) {
         facet.processValidators(context);
       }
     } else {
@@ -192,7 +184,7 @@ public abstract class AbstractUITabGroup
       }
       AbstractUIPanelBase renderedTab = getRenderedTab();
       renderedTab.processUpdates(context);
-      for (UIComponent facet : (Collection<UIComponent>) getFacets().values()) {
+      for (UIComponent facet : getFacets().values()) {
         facet.processUpdates(context);
       }
 
@@ -204,16 +196,27 @@ public abstract class AbstractUITabGroup
   public void broadcast(FacesEvent facesEvent) throws AbortProcessingException {
     super.broadcast(facesEvent);
     if (facesEvent instanceof TabChangeEvent && facesEvent.getComponent() == this)
{
-      FacesUtils.invokeMethodBinding(getFacesContext(), getTabChangeListener(), facesEvent);
+      final TabChangeEvent event = (TabChangeEvent) facesEvent;
+
+// switched off, because this is already called in super.broadcast()
+//      final TabChangeListener[] tabChangeListeners = getTabChangeListeners();
+//      for (TabChangeListener listener : tabChangeListeners) {
+//        listener.processTabChange(event);
+//      }
+//
+//      final ActionListener[] actionListeners = getActionListeners();
+//      for (ActionListener listener : actionListeners) {
+//        listener.processAction(event);
+//      }
 
-      FacesUtils.invokeMethodBinding(getFacesContext(), getActionListener(), facesEvent);
+      // XXX is this needed?
       if (!isSwitchTypeClient()) {
         ActionListener defaultActionListener = getFacesContext().getApplication().getActionListener();
         if (defaultActionListener != null) {
-          defaultActionListener.processAction((ActionEvent) facesEvent);
+          defaultActionListener.processAction(event);
         }
       }
-      Integer index = ((TabChangeEvent) facesEvent).getNewTabIndex();
+      Integer index = event.getNewTabIndex();
       ValueExpression expression = getValueExpression(Attributes.SELECTED_INDEX);
       if (expression != null) {
         expression.setValue(getFacesContext().getELContext(), index);
@@ -225,7 +228,7 @@ public abstract class AbstractUITabGroup
 
   public void addTabChangeListener(TabChangeListener listener) {
     if (LOG.isWarnEnabled() && isSwitchTypeClient()) {
-      LOG.warn("Adding TabChangeListener to Client side Tabgroup!");
+      LOG.warn("Adding TabChangeListener to client side TabGroup!");
     }
     addFacesListener(listener);
   }
@@ -305,7 +308,7 @@ public abstract class AbstractUITabGroup
           facesContext, ComponentTypes.TAB_GROUP_LAYOUT, RendererTypes.TAB_GROUP_LAYOUT,
parent));
     }
   }
-  
+
   public LayoutManager getLayoutManager() {
     return (LayoutManager) getFacet(Facets.LAYOUT);
   }
@@ -318,19 +321,4 @@ public abstract class AbstractUITabGroup
     return isRendered();
   }
 
-  public void restoreState(FacesContext context, Object componentState) {
-    Object[] values = (Object[]) componentState;
-    super.restoreState(context, values[0]);
-    actionListener = (MethodBinding) restoreAttachedState(context, values[1]);
-    actionExpression = (MethodExpression) restoreAttachedState(context, values[2]);
-  }
-
-  public Object saveState(FacesContext context) {
-    Object[] values = new Object[3];
-    values[0] = super.saveState(context);
-    values[1] = saveAttachedState(context, actionListener);
-    values[2] = saveAttachedState(context, actionExpression);
-    return values;
-  }
-
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/TabChangeListenerTag.java
Mon Sep 16 15:25:40 2013
@@ -20,11 +20,11 @@
 package org.apache.myfaces.tobago.internal.taglib.component;
 
 import org.apache.myfaces.tobago.apt.annotation.BodyContent;
+import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
 import org.apache.myfaces.tobago.apt.annotation.Tag;
 import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.SimpleTag;
 import org.apache.myfaces.tobago.event.TabChangeListener;
-import org.apache.myfaces.tobago.event.TabChangeSource;
+import org.apache.myfaces.tobago.event.TabChangeSource2;
 import org.apache.myfaces.tobago.event.ValueExpressionTabChangeListener;
 
 import javax.el.ELContext;
@@ -95,11 +95,11 @@ public abstract class TabChangeListenerT
       // TODO Message resource i18n
       throw new JspException("Component Instance is null");
     }
-    if (!(component instanceof TabChangeSource)) {
+    if (!(component instanceof TabChangeSource2)) {
       // TODO Message resource i18n
-      throw new JspException("Component " + component.getClass().getName() + " is not instanceof
TabChangeSource");
+      throw new JspException("Component " + component.getClass().getName() + " is not instanceof
TabChangeSource2");
     }
-    TabChangeSource changeSource = (TabChangeSource) component;
+    TabChangeSource2 changeSource = (TabChangeSource2) component;
     final ELContext elContext = FacesContext.getCurrentInstance().getELContext();
 
     TabChangeListener handler = null;

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
Mon Sep 16 15:25:40 2013
@@ -549,7 +549,7 @@ public class TobagoDemoController implem
   }
 
   public void stateChangeListener(ActionEvent e) {
-    LOG.error("SheetState has Changed: " + e);
+    LOG.info("SheetState has Changed: " + e);
 
   }
 

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/actionlistener/SimpleTabChangeListener.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/actionlistener/SimpleTabChangeListener.java?rev=1523702&r1=1523701&r2=1523702&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/actionlistener/SimpleTabChangeListener.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/actionlistener/SimpleTabChangeListener.java
Mon Sep 16 15:25:40 2013
@@ -33,8 +33,9 @@ public class SimpleTabChangeListener imp
   }
 
   public void processTabChange(TabChangeEvent tabChangeEvent) {
-    LOG.info("TabState has Changed: from tabIndex '" + tabChangeEvent.getOldTabIndex()
-        + "' to tabIndex '" + tabChangeEvent.getNewTabIndex() + "' id='" + System.identityHashCode(this)
+ "'");
+    LOG.info("TabState has changed: from tabIndex '" + tabChangeEvent.getOldTabIndex()
+        + "' to tabIndex '" + tabChangeEvent.getNewTabIndex()
+        + "' id='" + tabChangeEvent.getComponent().getClientId() + "'");
 
   }
 }



Mime
View raw message