org.cb.cardboard
Class CardBoardUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended byorg.cb.cardboard.CardBoardUI

public abstract class CardBoardUI
extends javax.swing.plaf.ComponentUI

The JCardBoard pluggable look and feel delegate. This interface adds methods that allow the JCardBoard component to map locations, e.g. mouse coordinates, to board cards and from card indices to the bounds of the card.

Version:
$Id: CardBoardUI.java 129 2004-04-15 05:00:43Z jerome $
Author:
jerome@coffeebreaks.org - last modified by $LastModifiedBy$

Constructor Summary
CardBoardUI()
           
 
Method Summary
abstract  java.awt.Rectangle getCardBounds(JCardBoard board, int index1, int index2)
          Returns the bounds of the specified item in JCardBoard coordinates, null if index isn't valid.
abstract  java.awt.Point indexToLocation(JCardBoard board, int index)
          Returns the origin of the specified item in JCardBoard coordinates, null if index isn't valid.
abstract  int locationToIndex(JCardBoard board, java.awt.Point location)
          Convert a point in JCardBord coordinates to the closest index of the card at that location.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardBoardUI

public CardBoardUI()
Method Detail

locationToIndex

public abstract int locationToIndex(JCardBoard board,
                                    java.awt.Point location)
Convert a point in JCardBord coordinates to the closest index of the card at that location. To determine if the card actually contains the specified location use a combination of this method and getCardBounds. Returns -1 if the model is empty.

Parameters:
board - the board for which this instance delegates the look and feel
location - The JCardBoard relative coordinates of the card
Returns:
The index of the cell at location, or -1.

indexToLocation

public abstract java.awt.Point indexToLocation(JCardBoard board,
                                               int index)
Returns the origin of the specified item in JCardBoard coordinates, null if index isn't valid.

Parameters:
board - the board for which this instance delegates the look and feel
index - The index of the JCardBoard cell.
Returns:
The origin of the index'th cell.

getCardBounds

public abstract java.awt.Rectangle getCardBounds(JCardBoard board,
                                                 int index1,
                                                 int index2)
Returns the bounds of the specified item in JCardBoard coordinates, null if index isn't valid.

Parameters:
board - the board for which this instance delegates the look and feel
index1 - The index of the JCardBoard cell.
index2 - The index of the JCardBoard cell.
Returns:
The bounds of the index'th cell.


Copyright © 2004 CoffeeBreaks. All Rights Reserved.