ks.common.view
Class ColumnView

java.lang.Object
  extended byks.common.view.Widget
      extended byks.common.view.ColumnView
All Implemented Interfaces:
ElementListener

public class ColumnView
extends Widget
implements ElementListener

Represents a column of cards (face up) on the screen. The space will expand to fit the required image size.

Overrides the returnWidget(Widget) method to replace the Card that was extracted during getCardViewForTopCard()

Images do not reflect 'selected' status of the underlying cards.


Constructor Summary
ColumnView(Column col)
          ColumnView constructor.
 
Method Summary
 CardView getCardViewForTopCard(java.awt.event.MouseEvent me)
          If the MouseEvent falls on the top card of this Column, remove the top card from the Model and return a CardView widget to manage the card as it is dragged on the screen.
 ColumnView getColumnView(java.awt.event.MouseEvent me)
          If the MouseEvent falls on a non-top card of this Column, construct a column of these cards and return a CardView widget to manage the column as it is dragged on the screen.
 void redraw()
          Redraw a ColumnView.
 boolean returnWidget(Widget w)
          Return the CardView widget's model element back onto the underlying Column.
 
Methods inherited from class ks.common.view.Widget
getBounds, getCardImages, getContainer, getHeight, getImage, getModelElement, getMouseManager, getName, getWidth, getX, getXY, getY, inBounds, isDirty, modelChanged, paint, paint, paint, refresh, refresh, setBounds, setBounds, setContainer, setDirty, setHeight, setImage, setMouseAdapter, setMouseManager, setMouseMotionAdapter, setName, setUndoAdapter, setWidth, setX, setXY, setY, toString, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ks.common.model.ElementListener
modelChanged
 

Constructor Detail

ColumnView

public ColumnView(Column col)
ColumnView constructor.

Method Detail

getCardViewForTopCard

public CardView getCardViewForTopCard(java.awt.event.MouseEvent me)
If the MouseEvent falls on the top card of this Column, remove the top card from the Model and return a CardView widget to manage the card as it is dragged on the screen. We must pass CardImages as a parameter to make this calculation.

Note: the Column Model will be altered by this method if the mouseEvent maps to the top card in the Column View.

Note: The Widget returned by this method can be restored back to the underlying model element by invoking returnWidget(Widget) (since v1.6).

Parameters:
me - java.awt.event.MouseEvent

getColumnView

public ColumnView getColumnView(java.awt.event.MouseEvent me)
If the MouseEvent falls on a non-top card of this Column, construct a column of these cards and return a CardView widget to manage the column as it is dragged on the screen.

Note: the Column Model will be altered by this method if the mouseEvent maps to the top card in the Column View.

Note: The Widget returned by this method can be restored back to the underlying model element by invoking returnWidget(Widget) (since v1.6).

Parameters:
me - java.awt.event.MouseEvent

redraw

public void redraw()
Redraw a ColumnView. Note that redraw must only be called Image.

If a column is empty, a thin rectangle outline will be drawn showing the base of the column. (since V1.6.10)

Because ColumnView objects may fluctuate in size, we never know our maximal height when creating the image: we start with a default size, but then this may grow... While we can't expand larger than our original Widget size, we should still accommodate as much as we can. Thus, we keep a "high water mark" for the largest height value seen so far, and grow our offscreenImage accordingly. This functionality was added in V1.6.10.

To make programming easier, the smallest size a ColumnView image can be is 13 cards.

Specified by:
redraw in class Widget
Since:
v1.5.1 correctly draws faceup/facedown cards.

returnWidget

public boolean returnWidget(Widget w)
Return the CardView widget's model element back onto the underlying Column. Since a ColumnView can also extract a ColumnView widget, we dynamically handle the difference here.

Overrides:
returnWidget in class Widget
Parameters:
w - ks.common.view.Widget
Returns:
boolean