Coverage Report - org.trails.component.PropertyEditor
 
Classes in this File Line Coverage Branch Coverage Complexity
PropertyEditor
100% 
N/A 
0
 
 1  
 /*
 2  
  * Copyright 2004 Chris Nelson
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 7  
  * Unless required by applicable law or agreed to in writing,
 8  
  * software distributed under the License is distributed on an "AS IS" BASIS,
 9  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 10  
  * See the License for the specific language governing permissions and limitations under the License.
 11  
  */
 12  
 package org.trails.component;
 13  
 
 14  
 import org.apache.tapestry.annotations.InjectObject;
 15  
 import org.apache.tapestry.components.Block;
 16  
 import org.apache.tapestry.form.IFormComponent;
 17  
 import org.apache.tapestry.util.ComponentAddress;
 18  
 import org.trails.descriptor.BlockFinder;
 19  
 import org.trails.descriptor.IPropertyDescriptor;
 20  
 import org.trails.page.IEditorBlockPage;
 21  
 
 22  
 /**
 23  
  * @author fus8882
 24  
  *         <p/>
 25  
  *         TODO To change the template for this generated type comment go to
 26  
  *         Window - Preferences - Java - Code Style - Code Templates
 27  
  */
 28  2
 public abstract class PropertyEditor extends TrailsComponent
 29  
 {
 30  
         public abstract IPropertyDescriptor getDescriptor();
 31  
 
 32  
         public abstract void setDescriptor(IPropertyDescriptor Descriptor);
 33  
 
 34  
         public abstract Object getModel();
 35  
 
 36  
         public abstract void setModel(Object model);
 37  
 
 38  
         @InjectObject("spring:editorService")
 39  
         public abstract BlockFinder getBlockFinder();
 40  
 
 41  
         public Block getBlock()
 42  
         {
 43  
 
 44  1
                 Block editorBlock = (Block)
 45  1
                         getEditorAddress().findComponent(getPage().getRequestCycle());
 46  
 
 47  1
                 ((IEditorBlockPage) editorBlock.getPage()).setModel(getModel());
 48  1
                 ((IEditorBlockPage) editorBlock.getPage()).setDescriptor(getDescriptor());
 49  1
                 ((IEditorBlockPage) editorBlock.getPage()).setEditPageName(getPage().getPageName());
 50  
 
 51  1
                 return editorBlock;
 52  
         }
 53  
 
 54  
         public ComponentAddress getEditorAddress()
 55  
         {
 56  
 
 57  3
                 return getBlockFinder().findBlockAddress(getDescriptor());
 58  
         }
 59  
 }