codeblockutil
Class StackCard

java.lang.Object
  extended by codeblockutil.StackCard
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

 class StackCard
extends java.lang.Object
implements java.beans.PropertyChangeListener

A StackCard is used by explorers to interface between a CSwing Canvas and a CSwing explorer. An explorer explores Canvases. This is the foundation onto which the factory UI is built. However, an Explorer and a Canvas are two very different objects. One is a high-level CSwing UI that manages the display of internal components and controls the position and visibility of internal components. The other (that is, the Canvas) is a low-level CSwing component that has no control over itself (or at least it shouldn't). An mediator is required to link the two objects together. We solve this interface problem by employing a mediator between an Explorer and a Canvas. That's where a StackCard comes in. A StackCard (whose visibility should be limited within the package) takes commands from it's parent Explorer and directs it's Canvas to follow the commands. In the opposite direction, a drawer also takes in user-generated actions and informs the parent explorer of what had just happed, so that the parent explorer can decide what to do with it.


Constructor Summary
StackCard(Canvas canvas)
          Constructs new StackCard with a parent Explorer
StackCard(Canvas canvas, StackExplorer explorer)
          Constucts a new StackCard with an explorer
 
Method Summary
(package private)  void animate()
           
(package private)  java.awt.Rectangle getDestination()
           
(package private)  javax.swing.JComponent getJComponent()
           
(package private)  java.awt.Rectangle getOrigin()
           
(package private)  void goToDestination()
          move to destination
(package private)  void goToOrigin()
          move to Origin
(package private)  boolean isDirectedToDestination()
          True iff directed to DESTINATION
 void propertyChange(java.beans.PropertyChangeEvent e)
           
(package private)  void reformDrawer(java.awt.Rectangle origin, java.awt.Rectangle destination)
          reassigns the source bounds and the destination bounds of this this StackCard.
(package private)  void setBounds(int x, int y, int width, int height)
          sets the bounds of this drawer
(package private)  void setBounds(java.awt.Rectangle r)
          sets the bounds of this drawer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackCard

StackCard(Canvas canvas)
Constructs new StackCard with a parent Explorer

Parameters:
canvas -

StackCard

StackCard(Canvas canvas,
          StackExplorer explorer)
Constucts a new StackCard with an explorer

Parameters:
canvas -
explorer -
Throws:
java.lang.RuntimeException - if canvas==null || canvas.name==null || canvas.JCOmponent == null
Method Detail

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

isDirectedToDestination

boolean isDirectedToDestination()
True iff directed to DESTINATION


setBounds

void setBounds(java.awt.Rectangle r)
sets the bounds of this drawer

Parameters:
r -

setBounds

void setBounds(int x,
               int y,
               int width,
               int height)
sets the bounds of this drawer

Parameters:
x -
y -
width -
height -

getDestination

java.awt.Rectangle getDestination()

getOrigin

java.awt.Rectangle getOrigin()

getJComponent

javax.swing.JComponent getJComponent()
Returns:
the JComponent representation of this

reformDrawer

void reformDrawer(java.awt.Rectangle origin,
                  java.awt.Rectangle destination)
reassigns the source bounds and the destination bounds of this this StackCard. When goToOrigin is called, this drawer moves to "origin". When gotoDestination is called, this Drawer moves to "destination"

Parameters:
origin -
destination -

goToOrigin

void goToOrigin()
move to Origin


goToDestination

void goToDestination()
move to destination


animate

void animate()