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.CloneableA 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 voidaddCard(PageItem pageItem)Add a new PageItem to this page.voidaddCard(PageItem pageItem, boolean fit)PageItemaddCardFromTemplate(PageItem template)Clone a PageItem and add the clone to the page; the new clone is returned.voidcenterContent()Centers the content on the page.Pageclone()PageItem[]getAllCardsAtLocation(java.awt.geom.Point2D point)PageItemgetCard(int i)PageItemgetCardAtLocation(java.awt.geom.Point2D point)intgetCardCount()PageItem[]getCards()PageItemgetCardToSnapTo(PageItem card, java.util.EnumSet<PageItem.SnapClass> snapToClass)DeckgetDeck()PageItemgetOverlappedCard(PageItem card)Returns the card with the highest Z-index that overlaps with this card, ornullif the card does not overlap with any other card.java.awt.geom.Point2DgetSnapPosition(PageItem[] cards)Return the position that cards will snap to if snapped from their current position.java.lang.StringgetTitle()PageViewgetView()protected doublegridSeparation()protected doublemargin()voidmoveCardToBack(PageItem card)voidmoveCardToFront(PageItem card)protected doublepageHeight()protected doublepageWidth()voidremoveCard(PageItem card)Remove a card from this page.voidsetTitle(java.lang.String name)voidsetView(PageView view)voidsnapCard(PageItem card)Snap an item into place relative to the highest intersecting item, if any.voidsnapCard(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, ornullif 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:
clonein 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()
-
-