Coverage Report - org.apache.tapestry5.internal.services.AjaxPageNameComponentEventResultProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
AjaxPageNameComponentEventResultProcessor
100%
8/8
N/A
0
 
 1  
 //  Copyright 2008, 2009 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.internal.services;
 16  
 
 17  
 import org.apache.tapestry5.Link;
 18  
 import org.apache.tapestry5.services.Ajax;
 19  
 import org.apache.tapestry5.services.ComponentEventResultProcessor;
 20  
 
 21  
 import java.io.IOException;
 22  
 
 23  
 /**
 24  
  * A {@link org.apache.tapestry5.services.ComponentEventResultProcessor}, used for Ajax requests, for a String value
 25  
  * that is interpreted as a logical page name.
 26  
  *
 27  
  * @see org.apache.tapestry5.internal.services.PageNameComponentEventResultProcessor
 28  
  */
 29  2
 public class AjaxPageNameComponentEventResultProcessor implements ComponentEventResultProcessor<String>
 30  
 {
 31  
     private final ComponentEventResultProcessor masterProcessor;
 32  
 
 33  
     private final LinkSource linkSource;
 34  
 
 35  
     public AjaxPageNameComponentEventResultProcessor(@Ajax ComponentEventResultProcessor masterProcessor,
 36  
                                                      LinkSource linkSource)
 37  2
     {
 38  2
         this.masterProcessor = masterProcessor;
 39  2
         this.linkSource = linkSource;
 40  2
     }
 41  
 
 42  
     /**
 43  
      * Obtains a page render {@link org.apache.tapestry5.Link} for the named, then builds a JSON reponse for the
 44  
      * client.
 45  
      *
 46  
      * @param value page name
 47  
      * @throws IOException
 48  
      */
 49  
     public void processResultValue(String value) throws IOException
 50  
     {
 51  2
         Link link = linkSource.createPageRenderLink(value, false);
 52  
 
 53  2
         masterProcessor.processResultValue(link);
 54  2
     }
 55  
 }