001    /*
002     * Created on Apr 14, 2008
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
005     * the License. You may obtain a copy of the License at
006     *
007     * http://www.apache.org/licenses/LICENSE-2.0
008     *
009     * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
010     * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
011     * specific language governing permissions and limitations under the License.
012     *
013     * Copyright @2008-2010 the original author or authors.
014     */
015    package org.fest.swing.cell;
016    
017    import java.awt.Color;
018    import java.awt.Font;
019    
020    import javax.swing.JTable;
021    
022    import org.fest.swing.annotation.RunsInCurrentThread;
023    
024    /**
025     * Understands reading the internal value of a cell in a <code>{@link JTable}</code> as expected in a test.
026     * <p>
027     * <b>Note:</b> methods in this interface are <b>not</b> guaranteed to be executed in the event dispatch thread (EDT.)
028     * Clients are responsible for invoking them in the EDT.
029     * </p>
030     *
031     * @author Alex Ruiz
032     */
033    @RunsInCurrentThread
034    public interface JTableCellReader {
035    
036      /**
037       * Returns the internal value of a cell in a <code>{@link JTable}</code> as expected in a test.
038       * <p>
039       * <b>Note:</b> Implementations of this method <b>may not</b> guaranteed to be executed in the event dispatch thread
040       * (EDT.) Clients are responsible for invoking this method in the EDT.
041       * </p>
042       * @param table the given <code>JTable</code>.
043       * @param row the row index of the cell.
044       * @param column the column index of the cell.
045       * @return the internal value of a cell in a <code>JTable</code> as expected in a test.
046       */
047      String valueAt(JTable table, int row, int column);
048    
049      /**
050       * Returns the font of the cell renderer for the given table cell.
051       * <p>
052       * <b>Note:</b> Implementations of this method <b>may not</b> guaranteed to be executed in the event dispatch thread
053       * (EDT.) Clients are responsible for invoking this method in the EDT.
054       * </p>
055       * @param table the given <code>JTable</code>.
056       * @param row the row index of the cell.
057       * @param column the column index of the cell.
058       * @return the font of the cell renderer for the given table cell.
059       */
060      Font fontAt(JTable table, int row, int column);
061    
062      /**
063       * Returns the background color of the cell renderer for the given table cell.
064       * <p>
065       * <b>Note:</b> Implementations of this method <b>may not</b> guaranteed to be executed in the event dispatch thread
066       * (EDT.) Clients are responsible for invoking this method in the EDT.
067       * </p>
068       * @param table the given <code>JTable</code>.
069       * @param row the row index of the cell.
070       * @param column the column index of the cell.
071       * @return the background color of the cell renderer for the given table cell.
072       */
073      Color backgroundAt(JTable table, int row, int column);
074    
075      /**
076       * Returns the foreground color of the cell renderer for the given table cell.
077       * <p>
078       * <b>Note:</b> Implementations of this method <b>may not</b> guaranteed to be executed in the event dispatch thread
079       * (EDT.) Clients are responsible for invoking this method in the EDT.
080       * </p>
081       * @param table the given <code>JTable</code>.
082       * @param row the row index of the cell.
083       * @param column the column index of the cell.
084       * @return the foreground color of the cell renderer for the given table cell.
085       */
086      Color foregroundAt(JTable table, int row, int column);
087    }