View Javadoc

1   /*
2    * Copyright 2004 Jeff Johnston
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.extremecomponents.table.model;
17  
18  import java.util.List;
19  
20  import org.apache.commons.beanutils.MethodUtils;
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.extremecomponents.table.bean.Column;
24  import org.extremecomponents.table.cell.Cell;
25  import org.extremecomponents.util.ExceptionUtils;
26  
27  
28  /***
29   * @author jeff johnston
30   */
31  public class ProcessDefaultColumn implements ProcessColumn
32  {
33  	private static Log logger = LogFactory.getLog(ProcessDefaultColumn.class);
34  
35  	public void beforeFirstRow(TableModel model, String method, List body){}
36  	public void afterLastRow(TableModel model, String method, List body){}
37  
38  	public String process(TableModel model, Column column, Cell cell, String method)
39  	{
40  		try
41  		{
42  			return (String)MethodUtils.invokeMethod(cell, method, null); 
43  		}
44  		catch (Exception e)
45  		{
46  			System.out.println(ExceptionUtils.formatStackTrace(e));
47  			logger.debug("Could not invoke the cell method.", e);
48  		}
49  		
50  		return null;
51  	}
52  }