myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1766800 - in /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago: facelets/ internal/component/
Date Thu, 27 Oct 2016 10:00:11 GMT
Author: lofwyr
Date: Thu Oct 27 10:00:11 2016
New Revision: 1766800

URL: http://svn.apache.org/viewvc?rev=1766800&view=rev
Log:
TOBAGO-1614 - Removing interfaces: OnComponentCreated and OnComponentPopulated

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIProgress.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

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java?rev=1766800&r1=1766799&r2=1766800&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
Thu Oct 27 10:00:11 2016
@@ -20,8 +20,6 @@
 package org.apache.myfaces.tobago.facelets;
 
 import org.apache.myfaces.tobago.component.InputSuggest;
-import org.apache.myfaces.tobago.component.OnComponentCreated;
-import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.event.SheetStateChangeSource;
@@ -39,7 +37,6 @@ import javax.faces.view.facelets.Compone
 import javax.faces.view.facelets.FaceletContext;
 import javax.faces.view.facelets.MetaRuleset;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -75,52 +72,36 @@ public class TobagoComponentHandler exte
   }
 
   @Override
-  public void onComponentCreated(final FaceletContext context, final UIComponent component,
final UIComponent parent) {
-    if (component instanceof OnComponentCreated
-        && component.getAttributes().get(OnComponentCreated.MARKER) == null) {
-      component.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
-      ((OnComponentCreated) component).onComponentCreated(context.getFacesContext(), parent);
-    }
-  }
-
-  @Override
   public void onComponentPopulated(
       final FaceletContext context, final UIComponent component, final UIComponent parent)
{
-    if (component instanceof OnComponentPopulated
-        && component.getAttributes().get(OnComponentPopulated.MARKER) == null) {
-      component.getAttributes().put(OnComponentPopulated.MARKER, Boolean.TRUE);
-      ((OnComponentPopulated) component).onComponentPopulated(context.getFacesContext(),
parent);
-    }
+
     // TODO call only if component was created
     if (component instanceof EditableValueHolder) {
       addDefaultValidators(context.getFacesContext(), (EditableValueHolder) component);
     }
   }
 
-  public static void addDefaultValidators(final FacesContext context, final EditableValueHolder
component) {
+  private void addDefaultValidators(final FacesContext context, final EditableValueHolder
component) {
     final TobagoConfigImpl tobagoConfig = (TobagoConfigImpl) TobagoConfig.getInstance(context);
-    final Map validatorInfoMap = tobagoConfig.getDefaultValidatorInfo();
+    final Map<String, String> validatorInfoMap = tobagoConfig.getDefaultValidatorInfo();
     if (validatorInfoMap.isEmpty()) {
       return;
     }
     final Validator[] validators = component.getValidators();
     if (validators.length > 0) {
-      final Set classNames = new HashSet();
+      final Set<String> classNames = new HashSet<String>();
       // collect classNames of validators
-      for (int i = 0; i < validators.length; i++) {
-        classNames.add(validators[i].getClass().getName());
+      for (Validator validator : validators) {
+        classNames.add(validator.getClass().getName());
       }
-      final Iterator it = validatorInfoMap.entrySet().iterator();
-      while (it.hasNext()) {
-        final Map.Entry entry = (Map.Entry) it.next();
+      for (Map.Entry<String, String> entry : validatorInfoMap.entrySet()) {
         if (!classNames.contains(entry.getValue())) {
           component.addValidator(context.getApplication().createValidator((String) entry.getKey()));
         }
       }
     } else {
-      final Iterator it = validatorInfoMap.keySet().iterator();
-      while (it.hasNext()) {
-        component.addValidator(context.getApplication().createValidator((String) it.next()));
+      for (String next : validatorInfoMap.keySet()) {
+        component.addValidator(context.getApplication().createValidator(next));
       }
     }
   }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java?rev=1766800&r1=1766799&r2=1766800&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommand.java
Thu Oct 27 10:00:11 2016
@@ -19,7 +19,6 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.SupportsAccessKey;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.event.CollapsibleActionListener;
@@ -34,15 +33,20 @@ import javax.faces.component.UIComponent
 import javax.faces.component.UIInput;
 import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.context.FacesContext;
+import javax.faces.event.ComponentSystemEvent;
+import javax.faces.event.ComponentSystemEventListener;
 import javax.faces.event.FacesEvent;
+import javax.faces.event.ListenerFor;
 import javax.faces.event.PhaseId;
+import javax.faces.event.PostAddToViewEvent;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
+@ListenerFor(systemEventClass = PostAddToViewEvent.class)
 public abstract class AbstractUICommand extends UICommand
-    implements SupportsAccessKey, OnComponentPopulated, Visual, ClientBehaviorHolder {
+    implements SupportsAccessKey, Visual, ClientBehaviorHolder, ComponentSystemEventListener
{
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUICommand.class);
 
@@ -57,11 +61,14 @@ public abstract class AbstractUICommand
   private Boolean parentOfCommands;
 
   @Override
-  public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent)
{
+  public void processEvent(ComponentSystemEvent event) {
+    super.processEvent(event);
 
-    final List<AbstractUIOperation> list = ComponentUtils.findDescendantList(this,
AbstractUIOperation.class);
-    for (AbstractUIOperation operation : list) {
-      addActionListener(new CollapsibleActionListener(operation.getFor()));
+    if (event instanceof PostAddToViewEvent) {
+      final List<AbstractUIOperation> list = ComponentUtils.findDescendantList(this,
AbstractUIOperation.class);
+      for (AbstractUIOperation operation : list) {
+        addActionListener(new CollapsibleActionListener(operation.getFor()));
+      }
     }
   }
 
@@ -176,6 +183,4 @@ public abstract class AbstractUICommand
   public abstract String getTip();
 
   public abstract String getConfirmation();
-
-//  public abstract Integer getTabIndex();
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java?rev=1766800&r1=1766799&r2=1766800&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPanelBase.java
Thu Oct 27 10:00:11 2016
@@ -19,7 +19,6 @@
 
 package org.apache.myfaces.tobago.internal.component;
 
-import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.internal.layout.LayoutUtils;
 
@@ -27,8 +26,7 @@ import javax.faces.component.UIComponent
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 
-public abstract class AbstractUIPanelBase extends javax.faces.component.UIPanel
-    implements OnComponentPopulated, Visual {
+public abstract class AbstractUIPanelBase extends javax.faces.component.UIPanel implements
Visual {
 
   @Override
   public void encodeBegin(final FacesContext facesContext) throws IOException {
@@ -63,9 +61,5 @@ public abstract class AbstractUIPanelBas
     super.encodeEnd(facesContext);
   }
 
-  @Override
-  public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent)
{
-  }
-
   public abstract java.lang.String getTip();
 }

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIProgress.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIProgress.java?rev=1766800&r1=1766799&r2=1766800&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIProgress.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIProgress.java
Thu Oct 27 10:00:11 2016
@@ -50,6 +50,8 @@ public abstract class AbstractUIProgress
   @Override
   public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
 
+    super.processEvent(event);
+
     if (event instanceof PreRenderComponentEvent) {
       Object model = getValue();
       if (model instanceof BoundedRangeModel) {

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=1766800&r1=1766799&r2=1766800&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
Thu Oct 27 10:00:11 2016
@@ -20,7 +20,6 @@
 package org.apache.myfaces.tobago.internal.component;
 
 import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.Sorter;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.event.PageActionEvent;
@@ -65,7 +64,7 @@ import java.util.List;
 
 @ListenerFor(systemEventClass = PreRenderComponentEvent.class)
 public abstract class AbstractUISheet extends AbstractUIData
-    implements SheetStateChangeSource2, SortActionSource2, OnComponentPopulated, ClientBehaviorHolder,
Visual,
+    implements SheetStateChangeSource2, SortActionSource2, ClientBehaviorHolder, Visual,
                ComponentSystemEventListener {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUISheet.class);
@@ -132,6 +131,8 @@ public abstract class AbstractUISheet ex
   @Override
   public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
 
+    super.processEvent(event);
+
     if (event instanceof PreRenderComponentEvent) {
       final String columns = getColumns();
       if (columns != null) {
@@ -554,10 +555,6 @@ public abstract class AbstractUISheet ex
   }
 
   @Override
-  public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent)
{
-  }
-
-  @Override
   public boolean isRendersRowContainer() {
     return true;
   }

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=1766800&r1=1766799&r2=1766800&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
Thu Oct 27 10:00:11 2016
@@ -22,7 +22,6 @@ package org.apache.myfaces.tobago.intern
 import org.apache.myfaces.tobago.compat.FacesUtilsEL;
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
-import org.apache.myfaces.tobago.component.OnComponentPopulated;
 import org.apache.myfaces.tobago.component.UITab;
 import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.event.TabChangeEvent;
@@ -50,7 +49,7 @@ import java.util.Collections;
 import java.util.List;
 
 public abstract class AbstractUITabGroup extends AbstractUIPanelBase
-    implements TabChangeSource2, ActionSource2, OnComponentPopulated, ClientBehaviorHolder,
Visual {
+    implements TabChangeSource2, ActionSource2, ClientBehaviorHolder, Visual {
 
   private static final Logger LOG = LoggerFactory.getLogger(AbstractUITabGroup.class);
 
@@ -294,11 +293,6 @@ public abstract class AbstractUITabGroup
   }
 
   @Override
-  public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent)
{
-    super.onComponentPopulated(facesContext, parent);
-  }
-
-  @Override
   public String getDefaultEventName() {
     return "reload";
   }



Mime
View raw message