| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| org.cb.cardboard.CardBoardUI |
|
|
| 1 | // START LICENSE |
|
| 2 | // JSet - a Java JSet card board game implementation |
|
| 3 | // Copyright (C) 2004 Jerome Lacoste |
|
| 4 | // |
|
| 5 | // This program is free software; you can redistribute it and/or modify |
|
| 6 | // it under the terms of the GNU General Public License as published by |
|
| 7 | // the Free Software Foundation; either version 2 of the License, or (at |
|
| 8 | // your option) any later version. |
|
| 9 | // |
|
| 10 | // This program is distributed in the hope that it will be useful, but |
|
| 11 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | // General Public License for more details. |
|
| 14 | // |
|
| 15 | // You should have received a copy of the GNU General Public License |
|
| 16 | // along with this program; if not, write to the Free Software |
|
| 17 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 18 | // END LICENSE |
|
| 19 | ||
| 20 | package org.cb.cardboard; |
|
| 21 | ||
| 22 | import javax.swing.plaf.ComponentUI; |
|
| 23 | import java.awt.Point; |
|
| 24 | import java.awt.Rectangle; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * The JCardBoard pluggable look and feel delegate. This interface adds |
|
| 28 | * methods that allow the JCardBoard component to map locations, e.g. mouse |
|
| 29 | * coordinates, to board cards and from card indices to the bounds of |
|
| 30 | * the card. |
|
| 31 | * |
|
| 32 | * @author jerome@coffeebreaks.org - last modified by $LastModifiedBy$ |
|
| 33 | * @version $Id: CardBoardUI.java 129 2004-04-15 05:00:43Z jerome $ |
|
| 34 | */ |
|
| 35 | 0 | public abstract class CardBoardUI extends ComponentUI |
| 36 | { |
|
| 37 | /** |
|
| 38 | * Convert a point in <code>JCardBord</code> coordinates to the closest index |
|
| 39 | * of the card at that location. To determine if the card actually |
|
| 40 | * contains the specified location use a combination of this method and |
|
| 41 | * <code>getCardBounds</code>. Returns -1 if the model is empty. |
|
| 42 | * |
|
| 43 | * @param board the board for which this instance delegates the look and feel |
|
| 44 | * @param location The JCardBoard relative coordinates of the card |
|
| 45 | * @return The index of the cell at location, or -1. |
|
| 46 | */ |
|
| 47 | public abstract int locationToIndex(final JCardBoard board, class="keyword">final Poclass="keyword">int location); |
|
| 48 | ||
| 49 | ||
| 50 | /** |
|
| 51 | * Returns the origin of the specified item in JCardBoard |
|
| 52 | * coordinates, null if index isn't valid. |
|
| 53 | * |
|
| 54 | * @param board the board for which this instance delegates the look and feel |
|
| 55 | * @param index The index of the JCardBoard cell. |
|
| 56 | * @return The origin of the index'th cell. |
|
| 57 | */ |
|
| 58 | public abstract Point indexToLocation(final JCardBoard board, class="keyword">final int index); |
|
| 59 | ||
| 60 | ||
| 61 | /** |
|
| 62 | * Returns the bounds of the specified item in JCardBoard |
|
| 63 | * coordinates, null if index isn't valid. |
|
| 64 | * |
|
| 65 | * @param board the board for which this instance delegates the look and feel |
|
| 66 | * @param index1 The index of the JCardBoard cell. |
|
| 67 | * @param index2 The index of the JCardBoard cell. |
|
| 68 | * @return The bounds of the index'th cell. |
|
| 69 | */ |
|
| 70 | public abstract Rectangle getCardBounds(final JCardBoard board, |
|
| 71 | final int index1, |
|
| 72 | final int index2); |
|
| 73 | ||
| 74 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |