Package ca.cgjennings.apps.arkham.deck
Class Page
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.Page
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public final class Page extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
A page layout of card sheets.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCard(PageItem pageItem)
Add a new PageItem to this page.void
addCard(PageItem pageItem, boolean fit)
PageItem
addCardFromTemplate(PageItem template)
Clone a PageItem and add the clone to the page; the new clone is returned.void
centerContent()
Centers the content on the page.Page
clone()
PageItem[]
getAllCardsAtLocation(java.awt.geom.Point2D point)
PageItem
getCard(int i)
PageItem
getCardAtLocation(java.awt.geom.Point2D point)
int
getCardCount()
PageItem[]
getCards()
PageItem
getCardToSnapTo(PageItem card, java.util.EnumSet<PageItem.SnapClass> snapToClass)
Deck
getDeck()
PageItem
getOverlappedCard(PageItem card)
Returns the card with the highest Z-index that overlaps with this card, ornull
if the card does not overlap with any other card.java.awt.geom.Point2D
getSnapPosition(PageItem[] cards)
Return the position that cards will snap to if snapped from their current position.java.lang.String
getTitle()
PageView
getView()
protected double
gridSeparation()
protected double
margin()
void
moveCardToBack(PageItem card)
void
moveCardToFront(PageItem card)
protected double
pageHeight()
protected double
pageWidth()
void
removeCard(PageItem card)
Remove a card from this page.void
setTitle(java.lang.String name)
void
setView(PageView view)
void
snapCard(PageItem card)
Snap an item into place relative to the highest intersecting item, if any.void
snapCard(PageItem[] cards)
Snaps a group of cards into place as a unit.
-
-
-
Constructor Detail
-
Page
public Page(Deck deck)
-
-
Method Detail
-
addCardFromTemplate
public PageItem addCardFromTemplate(PageItem template)
Clone a PageItem and add the clone to the page; the new clone is returned.
-
addCard
public void addCard(PageItem pageItem)
Add a new PageItem to this page.
-
addCard
public void addCard(PageItem pageItem, boolean fit)
-
moveCardToFront
public void moveCardToFront(PageItem card)
-
moveCardToBack
public void moveCardToBack(PageItem card)
-
centerContent
public void centerContent()
Centers the content on the page. Finds the bounding box of all cards, determines the translation needed to center that bounding box on the page, and then applies the translation to each card.
-
snapCard
public void snapCard(PageItem card)
Snap an item into place relative to the highest intersecting item, if any.
-
snapCard
public void snapCard(PageItem[] cards)
Snaps a group of cards into place as a unit.
-
getSnapPosition
public java.awt.geom.Point2D getSnapPosition(PageItem[] cards)
Return the position that cards will snap to if snapped from their current position.- Parameters:
cards
- the cards to determine the snap position for- Returns:
- the point that the cards would snap to
-
removeCard
public void removeCard(PageItem card)
Remove a card from this page.
-
getCard
public PageItem getCard(int i)
-
getCards
public PageItem[] getCards()
-
getCardCount
public int getCardCount()
-
getCardAtLocation
public PageItem getCardAtLocation(java.awt.geom.Point2D point)
-
getAllCardsAtLocation
public PageItem[] getAllCardsAtLocation(java.awt.geom.Point2D point)
-
getOverlappedCard
public PageItem getOverlappedCard(PageItem card)
Returns the card with the highest Z-index that overlaps with this card, ornull
if the card does not overlap with any other card.
-
getCardToSnapTo
public PageItem getCardToSnapTo(PageItem card, java.util.EnumSet<PageItem.SnapClass> snapToClass)
-
clone
public Page clone()
- Overrides:
clone
in classjava.lang.Object
-
getView
public PageView getView()
-
setView
public void setView(PageView view)
-
pageWidth
protected double pageWidth()
-
pageHeight
protected double pageHeight()
-
gridSeparation
protected double gridSeparation()
-
margin
protected double margin()
-
getDeck
public Deck getDeck()
-
setTitle
public void setTitle(java.lang.String name)
-
getTitle
public java.lang.String getTitle()
-
-