ch.aplu.jcardgame
Class RowLayout

java.lang.Object
  extended by ch.aplu.jcardgame.HandLayout
      extended by ch.aplu.jcardgame.RowLayout

public class RowLayout
extends HandLayout

Class to store the row layout options for a hand. Displays the cards in a row with given maximal width. If stepDelay > 0, the display is animated and the method blocks until the final position is reached. The cards are drawn one on top others with the current card list order. If the row width is equal or less than the card width, the hand shows like stacked, but uses more memory than a when StackLayout is used.

For negative rowWidth, the horizontal card distance is fixed to the absolute value of this parameter. This is useful to align lines of cards.


Constructor Summary
RowLayout(Location handLocation, int rowWidth)
          Same as RoyLayout(handLocation, rowWidth, rotationAngle) with rotationAngle = 0.
RowLayout(Location handLocation, int rowWidth, double rotationAngle)
          Creates a RowLayout instance with given hand location , maximum row width and rotation angle.
 
Method Summary
 RowLayout clone()
          Creates a new RowLayout instance with same options.
 Hand.CardAlignment getCardAlignment()
          Returns the current card alignment
 double getRotationAngle()
          Returns the current rotation angle.
 int getRowWidth()
          Returns the current row width.
 int getStepDelay()
          Returns the current step delay.
 void setCardAlignment(Hand.CardAlignment cardAlignment)
          Sets the current card alignment to the given alignment.
 void setRotationAngle(double rotationAngle)
          Sets the current rotation angle to the given angle.
 void setRowWidth(int rowWidth)
          Sets the current row width to the given width.
 void setStepDelay(int stepDelay)
          Sets the current step delay to the given delay (in ms).
 
Methods inherited from class ch.aplu.jcardgame.HandLayout
getHandLocation, getScaleFactor, setHandLocation, setScaleFactor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowLayout

public RowLayout(Location handLocation,
                 int rowWidth)
Same as RoyLayout(handLocation, rowWidth, rotationAngle) with rotationAngle = 0. Defaults:
scaleFactor = 1
rotationAngle = 0
stepDelay = 0
cardAlignment = Hand.CardAlignment.MIDDLE

Parameters:
handLocation - the location of the first, last or middle card, depending on the card alignment.
rowWidth - the width of the row

RowLayout

public RowLayout(Location handLocation,
                 int rowWidth,
                 double rotationAngle)
Creates a RowLayout instance with given hand location , maximum row width and rotation angle. For negative rowWidth, the horizontal card distance is fixed to the absolute value of this parameter. This is useful to align lines of cards.
Defaults:
scaleFactor = 1
stepDelay = 0
cardAlignment = Hand.CardAlignment.MIDDLE

Parameters:
handLocation - the location of the first, last or middle card, depending on the card alignment.
rowWidth - the width of the row
rotationAngle - the rotion angle (in degrees, clockwise, zero to east)
Method Detail

clone

public RowLayout clone()
Creates a new RowLayout instance with same options.

Overrides:
clone in class java.lang.Object
Returns:
the new instance with same options

getRowWidth

public int getRowWidth()
Returns the current row width.

Returns:
the row width

getRotationAngle

public double getRotationAngle()
Returns the current rotation angle.

Returns:
the rotation angle (in degrees, clockwise)

getStepDelay

public int getStepDelay()
Returns the current step delay. If zero, no animation.

Returns:
the step delay (in ms)

getCardAlignment

public Hand.CardAlignment getCardAlignment()
Returns the current card alignment

Returns:
the card alignment

setRowWidth

public void setRowWidth(int rowWidth)
Sets the current row width to the given width. For negative rowWidth, the horizontal card distance is fixed to the absolute value of this parameter. This is useful to align lines of cards.

Parameters:
rowWidth - the new current row width

setRotationAngle

public void setRotationAngle(double rotationAngle)
Sets the current rotation angle to the given angle.

Parameters:
rotationAngle - the new current rotation angle (in degrees, clockwise)

setStepDelay

public void setStepDelay(int stepDelay)
Sets the current step delay to the given delay (in ms).

Parameters:
stepDelay - the new current step delay

setCardAlignment

public void setCardAlignment(Hand.CardAlignment cardAlignment)
Sets the current card alignment to the given alignment.

Parameters:
cardAlignment - the new current card alignment