You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by cj...@apache.org on 2009/07/16 16:50:45 UTC

svn commit: r794700 - in /myfaces/core/trunk/api/src/main/java/javax/faces: component/ view/facelets/

Author: cjhoward
Date: Thu Jul 16 14:50:44 2009
New Revision: 794700

URL: http://svn.apache.org/viewvc?rev=794700&view=rev
Log:
MYFACES-2286 - javax.faces.view.facelets TODOs and UIViewRoot TODOs

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/BehaviorHandler.java
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ConverterHandler.java
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java
    myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/component/UIViewRoot.java Thu Jul 16 14:50:44 2009
@@ -100,13 +100,17 @@
     private Map<String, Object> _viewScope;
 
     private transient Lifecycle _lifecycle = null;
-
+    
+    private HashMap<Class<? extends SystemEvent>, List<SystemEventListener>> _systemEventListeners;
+    
     /**
      * Construct an instance of the UIViewRoot.
      */
     public UIViewRoot()
     {
         setRendererType(null);
+        
+        _systemEventListeners = new HashMap<Class<? extends SystemEvent>, List<SystemEventListener>>();
     }
 
     /**
@@ -1121,20 +1125,43 @@
     
     public List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent)
     {
-        //TODO: Implement this method
-        return null;
+        checkNull (systemEvent, "systemEvent");
+        
+        return _systemEventListeners.get (systemEvent);
     }
     
     public void subscribeToViewEvent(Class<? extends SystemEvent> systemEvent,
             SystemEventListener listener)
     {
-        //TODO: Implement this method
+        List<SystemEventListener> listeners;
+        
+        checkNull (systemEvent, "systemEvent");
+        checkNull (listener, "listener");
+        
+        listeners = _systemEventListeners.get (systemEvent);
+        
+        if (listeners == null) {
+            listeners = new ArrayList<SystemEventListener>();
+            
+            _systemEventListeners.put (systemEvent, listeners);
+        }
+        
+        listeners.add (listener);
     }
     
     public void unsubscribeFromViewEvent(Class<? extends SystemEvent> systemEvent,
             SystemEventListener listener)
     {
-        //TODO: Implement this method
+        List<SystemEventListener> listeners;
+        
+        checkNull (systemEvent, "systemEvent");
+        checkNull (listener, "listener");
+        
+        listeners = _systemEventListeners.get (systemEvent);
+        
+        if (listeners != null) {
+            listeners.remove (listener);
+        }
     }
 
     /**

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/BehaviorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/BehaviorHandler.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/BehaviorHandler.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/BehaviorHandler.java Thu Jul 16 14:50:44 2009
@@ -1,61 +1,72 @@
-/*
- * 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 javax.faces.view.facelets;
-
-import javax.faces.view.BehaviorHolderAttachedObjectHandler;
-
-/**
- * @author Simon Lessard (latest modification by $Author: slessard $)
- * @version $Revision: 696523 $ $Date: 2009-03-15 17:28:58 -0400 (mer., 17 sept. 2008) $
- *
- * @since 2.0
- */
-public class BehaviorHandler extends FaceletsAttachedObjectHandler implements BehaviorHolderAttachedObjectHandler
-{
-    /**
-     * @param config
-     */
-    public BehaviorHandler(TagConfig config)
-    {
-        super(config);
-        // TODO IMPLEMENT API
-    }
-    
-    public String getBehaviorId()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-    
-    public TagAttribute getEvent()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected TagHandlerDelegate getTagHandlerHelper()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-}
+/*
+ * 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 javax.faces.view.facelets;
+
+import javax.faces.view.BehaviorHolderAttachedObjectHandler;
+
+/**
+ * @author Simon Lessard (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2009-03-15 17:28:58 -0400 (mer., 17 sept. 2008) $
+ *
+ * @since 2.0
+ */
+public class BehaviorHandler extends FaceletsAttachedObjectHandler implements BehaviorHolderAttachedObjectHandler
+{
+    private String behaviorId;
+    private TagAttribute event;
+    
+    /**
+     * @param config
+     */
+    public BehaviorHandler(BehaviorConfig config)
+    {
+        super(config);
+        
+        behaviorId = config.getBehaviorId();
+        event = getAttribute ("event");
+    }
+    
+    public String getBehaviorId()
+    {
+        return behaviorId;
+    }
+    
+    public TagAttribute getEvent()
+    {
+        return event;
+    }
+
+    public String getEventName ()
+    {
+        if (event == null) {
+            return null;
+        }
+        
+        return event.getValue();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected TagHandlerDelegate getTagHandlerHelper()
+    {
+        return delegateFactory.createBehaviorHandlerDelegate (this);
+    }
+}

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java Thu Jul 16 14:50:44 2009
@@ -1,67 +1,74 @@
-/*
- * 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 javax.faces.view.facelets;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.facelets.FaceletContext;
-
-/**
- * Implementation of the tag logic used in the JSF specification. This is your golden hammer for wiring UIComponents to
- * Facelets.
- * 
- * @author Jacob Hookom
- * @version $Id: ComponentHandler.java,v 1.19 2008/07/13 19:01:47 rlubke Exp $
- */
-public class ComponentHandler extends DelegatingMetaTagHandler
-{
-    public ComponentHandler(ComponentConfig config)
-    {
-        super(config);
-
-        // TODO IMPLEMENT API
-    }
-
-    public ComponentConfig getComponentConfig()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-
-    public static final boolean isNew(UIComponent component)
-    {
-        // TODO IMPLEMENT API
-        return true;
-    }
-
-    public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent)
-    {
-        // TODO IMPLEMENT API
-    }
-
-    public void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
-    {
-        // TODO IMPLEMENT API
-    }
-
-    protected TagHandlerDelegate getTagHandlerHelper()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-}
+/*
+ * 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 javax.faces.view.facelets;
+
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+
+/**
+ * Implementation of the tag logic used in the JSF specification. This is your golden hammer for wiring UIComponents to
+ * Facelets.
+ * 
+ * @author Jacob Hookom
+ * @version $Id: ComponentHandler.java,v 1.19 2008/07/13 19:01:47 rlubke Exp $
+ */
+public class ComponentHandler extends DelegatingMetaTagHandler
+{
+    private ComponentConfig config;
+    private TagHandlerDelegate helper;
+    
+    public ComponentHandler(ComponentConfig config)
+    {
+        super(config);
+        
+        this.config = config;
+        
+        // Spec seems to indicate that the helper is created here, as opposed to other Handler
+        // instances, where it's presumably a new instance for every getter call.
+        
+        this.helper = delegateFactory.createComponentHandlerDelegate (this);
+    }
+
+    public ComponentConfig getComponentConfig()
+    {
+        return config;
+    }
+
+    public static final boolean isNew(UIComponent component)
+    {
+        // TODO: only partially done... how do we determine that the component is "new to the tree"?
+        
+        return (component != null);
+    }
+
+    public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent)
+    {
+        // no-op.
+    }
+
+    public void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
+    {
+        // no-op.
+    }
+
+    protected TagHandlerDelegate getTagHandlerHelper()
+    {
+        return helper;
+    }
+}

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ConverterHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ConverterHandler.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ConverterHandler.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ConverterHandler.java Thu Jul 16 14:50:44 2009
@@ -1,55 +1,55 @@
-/*
- * 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 javax.faces.view.facelets;
-
-import javax.faces.view.ValueHolderAttachedObjectHandler;
-
-/**
- * Handles setting a Converter instance on a ValueHolder. Will wire all attributes set to the Converter instance
- * created/fetched. Uses the "binding" attribute for grabbing instances to apply attributes to. <p/> Will only
- * set/create Converter is the passed UIComponent's parent is null, signifying that it wasn't restored from an existing
- * tree.
- * 
- * @see javax.faces.webapp.ConverterELTag
- * @see javax.faces.convert.Converter
- * @see javax.faces.component.ValueHolder
- * @author Jacob Hookom
- * @version $Id: ConvertHandler.java,v 1.4 2008/07/13 19:01:46 rlubke Exp $
- */
-public class ConverterHandler extends FaceletsAttachedObjectHandler implements ValueHolderAttachedObjectHandler
-{
-    public ConverterHandler(ConverterConfig config)
-    {
-        super(config);
-        
-        // TODO IMPLEMENT API
-    }
-    
-    public String getConverterId()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-    
-    protected TagHandlerDelegate getTagHandlerHelper()
-    {
-        // TODO IMPLEMENT API
-        return null;
-    }
-}
+/*
+ * 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 javax.faces.view.facelets;
+
+import javax.faces.view.ValueHolderAttachedObjectHandler;
+
+/**
+ * Handles setting a Converter instance on a ValueHolder. Will wire all attributes set to the Converter instance
+ * created/fetched. Uses the "binding" attribute for grabbing instances to apply attributes to. <p/> Will only
+ * set/create Converter is the passed UIComponent's parent is null, signifying that it wasn't restored from an existing
+ * tree.
+ * 
+ * @see javax.faces.webapp.ConverterELTag
+ * @see javax.faces.convert.Converter
+ * @see javax.faces.component.ValueHolder
+ * @author Jacob Hookom
+ * @version $Id: ConvertHandler.java,v 1.4 2008/07/13 19:01:46 rlubke Exp $
+ */
+public class ConverterHandler extends FaceletsAttachedObjectHandler implements ValueHolderAttachedObjectHandler
+{
+    private String converterId;
+    
+    public ConverterHandler(ConverterConfig config)
+    {
+        super(config);
+        
+        converterId = config.getConverterId();
+    }
+    
+    public String getConverterId (FaceletContext ctx)
+    {
+        return converterId;
+    }
+    
+    protected TagHandlerDelegate getTagHandlerHelper()
+    {
+        return delegateFactory.createConverterHandlerDelegate (this);
+    }
+}

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java Thu Jul 16 14:50:44 2009
@@ -1,101 +1,108 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package javax.faces.view.facelets;
-
-import java.io.IOException;
-
-import javax.faces.component.UIComponent;
-import javax.faces.view.facelets.FaceletContext;
-
-/**
- * @author Simon Lessard (latest modification by $Author: slessard $)
- * @version $Revision: 696523 $ $Date: 2009-03-15 17:11:43 -0400 (mer., 17 sept. 2008) $
- * 
- * @since 2.0
- */
-public abstract class DelegatingMetaTagHandler extends MetaTagHandler
-{
-    protected TagHandlerDelegateFactory helperFactory;
-
-    public DelegatingMetaTagHandler(TagConfig config)
-    {
-        super(config);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void apply(FaceletContext ctx, UIComponent parent) throws IOException
-    {
-        getTagHandlerHelper().apply(ctx, parent);
-    }
-
-    public void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException
-    {
-        // TODO: IMPLEMENT HERE
-    }
-
-    public TagAttribute getBinding()
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-
-    public Tag getTag()
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-
-    public TagAttribute getTagAttribute(String localName)
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-
-    public String getTagId()
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-
-    public boolean isDisabled(FaceletContext ctx)
-    {
-        // TODO: IMPLEMENT HERE
-        return false;
-    }
-
-    public void setAttributes(FaceletContext ctx, Object instance)
-    {
-        // TODO: IMPLEMENT HERE
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected MetaRuleset createMetaRuleset(Class<?> type)
-    {
-        return getTagHandlerHelper().createMetaRuleset(type);
-    }
-
-    protected abstract TagHandlerDelegate getTagHandlerHelper();
-
-}
+/*
+ * 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 javax.faces.view.facelets;
+
+import java.io.IOException;
+
+import javax.faces.FactoryFinder;
+import javax.faces.component.UIComponent;
+import javax.faces.view.facelets.FaceletContext;
+
+/**
+ * @author Simon Lessard (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2009-03-15 17:11:43 -0400 (mer., 17 sept. 2008) $
+ * 
+ * @since 2.0
+ */
+public abstract class DelegatingMetaTagHandler extends MetaTagHandler
+{
+    protected TagHandlerDelegateFactory delegateFactory;
+    private TagAttribute binding;
+    private TagAttribute disabled;
+    
+    public DelegatingMetaTagHandler(TagConfig config)
+    {
+        super(config);
+        
+        delegateFactory = (TagHandlerDelegateFactory)
+            FactoryFinder.getFactory (FactoryFinder.TAG_HANDLER_DELEGATE_FACTORY);
+        binding = getAttribute ("binding");
+        disabled = getAttribute ("disabled");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void apply(FaceletContext ctx, UIComponent parent) throws IOException
+    {
+        getTagHandlerHelper().apply(ctx, parent);
+    }
+
+    public void applyNextHandler(FaceletContext ctx, UIComponent c) throws IOException
+    {
+        nextHandler.apply (ctx, c);
+    }
+
+    public TagAttribute getBinding()
+    {
+        return binding;
+    }
+
+    public Tag getTag()
+    {
+        return tag;
+    }
+
+    public TagAttribute getTagAttribute(String localName)
+    {
+        return super.getAttribute (localName);
+    }
+
+    public String getTagId()
+    {
+        return tagId;
+    }
+
+    public boolean isDisabled(FaceletContext ctx)
+    {
+        if (disabled == null) {
+            return false;
+        }
+        
+        return disabled.getBoolean (ctx);
+    }
+
+    public void setAttributes(FaceletContext ctx, Object instance)
+    {
+        super.setAttributes (ctx, instance);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected MetaRuleset createMetaRuleset(Class<?> type)
+    {
+        return getTagHandlerHelper().createMetaRuleset(type);
+    }
+
+    protected abstract TagHandlerDelegate getTagHandlerHelper();
+
+}

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java?rev=794700&r1=794699&r2=794700&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java Thu Jul 16 14:50:44 2009
@@ -1,53 +1,58 @@
-/*
- * 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 javax.faces.view.facelets;
-
-import javax.faces.view.EditableValueHolderAttachedObjectHandler;
-import javax.faces.view.facelets.FaceletContext;
-
-/**
- * Handles setting a Validator instance on a EditableValueHolder. Will wire all attributes set to the Validator instance
- * created/fetched. Uses the "binding" attribute for grabbing instances to apply attributes to. <p/> Will only
- * set/create Validator is the passed UIComponent's parent is null, signifying that it wasn't restored from an existing
- * tree.
- * 
- * @author Jacob Hookom
- * @version $Id: ValidateHandler.java,v 1.4 2008/07/13 19:01:46 rlubke Exp $
- */
-public class ValidatorHandler extends FaceletsAttachedObjectHandler implements EditableValueHolderAttachedObjectHandler
-{
-    public ValidatorHandler(ValidatorConfig config)
-    {
-        super(config);
-
-        // TODO: IMPLEMENT HERE
-    }
-
-    public String getValidatorId(FaceletContext ctx)
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-
-    protected TagHandlerDelegate getTagHandlerHelper()
-    {
-        // TODO: IMPLEMENT HERE
-        return null;
-    }
-}
+/*
+ * 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 javax.faces.view.facelets;
+
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.FaceletContext;
+
+/**
+ * Handles setting a Validator instance on a EditableValueHolder. Will wire all attributes set to the Validator instance
+ * created/fetched. Uses the "binding" attribute for grabbing instances to apply attributes to. <p/> Will only
+ * set/create Validator is the passed UIComponent's parent is null, signifying that it wasn't restored from an existing
+ * tree.
+ * 
+ * @author Jacob Hookom
+ * @version $Id: ValidateHandler.java,v 1.4 2008/07/13 19:01:46 rlubke Exp $
+ */
+public class ValidatorHandler extends FaceletsAttachedObjectHandler implements EditableValueHolderAttachedObjectHandler
+{
+    private ValidatorConfig config;
+    
+    public ValidatorHandler(ValidatorConfig config)
+    {
+        super(config);
+        
+        this.config = config;
+    }
+    
+    public ValidatorConfig getValidatorConfig ()
+    {
+        return this.config;
+    }
+    
+    public String getValidatorId(FaceletContext ctx)
+    {
+        return config.getValidatorId();
+    }
+
+    protected TagHandlerDelegate getTagHandlerHelper()
+    {
+        return delegateFactory.createValidatorHandlerDelegate (this);
+    }
+}