View Javadoc

1   /*
2    *  File: IStyleStrategy.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
10   */
11  package de.jaret.util.ui.table.renderer;
12  
13  import de.jaret.util.ui.table.model.IColumn;
14  import de.jaret.util.ui.table.model.IRow;
15  
16  /***
17   * Interface for a strategy that can be added to a cell style provider to determine styles on the fly based on the
18   * content of the element (such as coloring the background of even rows).
19   * 
20   * @author kliem
21   * @version $Id: IStyleStrategy.java 347 2007-04-07 15:01:10Z olk $
22   */
23  public interface IStyleStrategy {
24      /***
25       * This method is called before a cell style is delivered to the jaret table (by getCellStyle(row, col) in the cell
26       * style provider). It gets the cell style regulary determined by the provider and the default cell style. It can
27       * then replace that style according to the strategy. The strategy should not alter the incoming style since this
28       * alters all cells using that style.
29       * 
30       * @param row row
31       * @param column column
32       * @param incomingStyle the determined cell style
33       * @param defaultCellStyle the defalt cell style used by the provider
34       * @return cellstyle to be used by the table
35       */
36      ICellStyle getCellStyle(IRow row, IColumn column, ICellStyle incomingStyle, ICellStyle defaultCellStyle);
37  }