heineman.klondike
Class WastePileController

java.lang.Object
  |
  +--SolitaireReleasedAdapter
        |
        +--heineman.klondike.WastePileController

public class WastePileController
extends SolitaireReleasedAdapter

Controls all actions regarding the WastePile.

In an earlier version of this controller, the CardView object returned by the PileView object was converted into a ColumnView to make it easier to process Release requests throughout the system. Unfortunately, this negated the usefulness of returnWidget because this method for a PileView only accepted CardView objects. This leads the the following controller design principle: Never change the type of the object extracted from a Widget because then NO OTHER CONTROLLER will be able to use returnWidget.

Thus, the alternative we must choose is to have all other controllers check the type of the dragging object, and if it is a CardView, then it is understood to be coming from the wastePile; these controllers will be slightly more complicated, but the logic can easily be localized, and returnWidget is not affected.

See Also:
Serialized Form

Field Summary
protected  PileView src
          The specific WastePileView being controlled.
protected  Klondike theGame
          The Klondike Game.
 
Constructor Summary
WastePileController(Klondike theGame, PileView waste)
          WastePileController constructor comment.
 
Method Summary
 void mouseClicked(java.awt.event.MouseEvent me)
          Try to play the faceup card directly to the foundation.
 void mousePressed(java.awt.event.MouseEvent me)
          Coordinate reaction to the beginning of a Drag Event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theGame

protected Klondike theGame
The Klondike Game.


src

protected PileView src
The specific WastePileView being controlled.

Constructor Detail

WastePileController

public WastePileController(Klondike theGame,
                           PileView waste)
WastePileController constructor comment.

Method Detail

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
Try to play the faceup card directly to the foundation.

Parameters:
me - java.awt.event.MouseEvent

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
Coordinate reaction to the beginning of a Drag Event.

Parameters:
me - java.awt.event.MouseEvent