|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectks.common.view.Widget
ks.common.view.RowView
Represents a row of cards on the screen. Note: This defaults to a row of thirteen cards. If more cards are necessary, the RowView simply expands to show them all.
A RowView is based on a Column model element, because the only difference is the
orientation on the screen. From this Column of cards, the first card drawn on the
screen is determined by the method firstDrawn
(which defaults to 0
but can be overridden by subclasses). The remaining cards in the column after this
index value are all drawn. The method numCoveredCards()
returns the
number of covered cards in a RowView.
Since V1.6.10, a RowView can be justified LEFT or RIGHT. Put together with the direction, there are now four possibilities. For example, a LEFT oriented RowView could be flushed with the RIGHT edge of the Widget boundaries. TODO: WHEN EMPTY, DRAW BASED on JUSTIFICATION/DIRECTION
Field Summary | |
static int |
LEFT
LEFT direction for the row. |
static int |
RIGHT
RIGHT direction for the row. |
Constructor Summary | |
RowView(Column col)
RowView 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. |
int |
getDirection()
Gets the direction of the row (either LEFT or RIGHT) |
int |
getJustification()
Gets the justification of the row (either flush LEFT or flush RIGHT) |
RowView |
getRowView(java.awt.event.MouseEvent me)
If the MouseEvent falls within this row, return a Column of cards from the Model and return a RowView widget to manage these cards as they are dragged on the screen. |
void |
redraw()
Redraw a row. |
boolean |
returnWidget(Widget w)
Return the CardView widget's model element back onto the underlying Column. |
void |
setDirection(int newDirection)
Sets the direction of the row (facing LEFT or RIGHT). |
void |
setJustification(int newJustification)
Sets the justification of the row (flush LEFT or flush RIGHT). |
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 |
Field Detail |
public static final int LEFT
public static final int RIGHT
Constructor Detail |
public RowView(Column col)
Method Detail |
public CardView getCardViewForTopCard(java.awt.event.MouseEvent me)
Note: the Column Model will be altered by this method if the mouseEvent maps to the top card in the Column View.
me
- java.awt.event.MouseEventpublic int getDirection()
public int getJustification()
public RowView getRowView(java.awt.event.MouseEvent me)
Note: the Column Model will be altered by this method.
me
- java.awt.event.MouseEventpublic void redraw()
This redraw algorithm uses the values returned by firstDrawn
and lastDrawn
.
In particular, for the default case, [0, size] form the boundaries, but other subclasses
may choose a different subset of cards to draw (in particular FanPile
).
Because RowView objects may fluctuate in size, we never know our maximal width 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 width value seen so far, and grow our offscreenImage accordingly.
To make programming easier, the smallest size a RowView image can be is 13 cards...
A finely drawn frame is drawn around an empty RowView image. Also see FanPile
redraw
in class Widget
public boolean returnWidget(Widget w)
RowView
object, it is possible to generate both
CardView
and RowView
objects.
returnWidget
in class Widget
w
- ks.common.view.Widget
public void setDirection(int newDirection)
newDirection
- LEFT or RIGHT direction for widget.public void setJustification(int newJustification)
newJustification
- flush LEFT or RIGHT
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |