Class 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
    • 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, or null if the card does not overlap with any other card.
      • clone

        public Page clone()
        Overrides:
        clone in class java.lang.Object
      • 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()