1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 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, final Point 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, 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 }