Coverage report

  %line %branch
org.apache.commons.jelly.tags.swing.TableModelTag
0% 
0% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 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
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.jelly.tags.swing;
 17  
 
 18  
 import javax.swing.JTable;
 19  
 
 20  
 import org.apache.commons.jelly.JellyTagException;
 21  
 import org.apache.commons.jelly.tags.core.UseBeanTag;
 22  
 import org.apache.commons.jelly.tags.swing.model.ExpressionTableModel;
 23  
 
 24  
 /**
 25  
  * Creates a default TableModel using nested tableColumn tags.
 26  
  *
 27  
  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 28  
  * @version $Revision: 155420 $
 29  
  */
 30  0
 public class TableModelTag extends UseBeanTag {
 31  
 
 32  
     public ExpressionTableModel getTableModel() {
 33  0
         return (ExpressionTableModel) getBean();
 34  
     }
 35  
 
 36  
 
 37  
     // Implementation methods
 38  
     //-------------------------------------------------------------------------
 39  
     protected void processBean(String var, Object bean) throws JellyTagException {
 40  0
         super.processBean(var, bean);
 41  
 
 42  0
         ComponentTag tag = (ComponentTag) findAncestorWithClass( ComponentTag.class );
 43  0
         if ( tag == null ) {
 44  0
             throw new JellyTagException( "This tag must be nested within a JellySwing <table> tag" );
 45  
         }
 46  0
         ExpressionTableModel model = getTableModel();
 47  0
         model.setContext(context);
 48  
 
 49  0
         Object component = tag.getComponent();
 50  0
         if (component instanceof JTable) {
 51  0
             JTable table = (JTable) component;
 52  0
             table.setModel(model);
 53  
         }
 54  
         else {
 55  0
             throw new JellyTagException( "This tag must be nested within a JellySwing <table> tag" );
 56  
         }
 57  0
     }
 58  
 
 59  
     protected Class getDefaultClass() {
 60  0
         return ExpressionTableModel.class;
 61  
     }
 62  
 }
 63  
 

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.