Class Deck
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.Deck
-
- All Implemented Interfaces:
GameComponent
,BleedMarginStyle
,Style
,java.io.Serializable
,java.lang.Cloneable
public class Deck extends java.lang.Object implements GameComponent, BleedMarginStyle
A deck of game component sheets, organized into pages for printing.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Deck.SelectionChangeListener
-
Field Summary
Fields Modifier and Type Field Description static double
MAX_PAPER_SIZE
The maximum size for any dimension in a page format that is allowed in a deck.static int
NUM_SELECTION_GROUPS
The number of selection groups available for use withstoreSelectionInNumberedGroup(int)
.static java.lang.String
PROPERTY_PAGE_ADDED
A property change that is fired with the page number when a page is added.static java.lang.String
PROPERTY_PAGE_REMOVED
A property change that is fired with the page number when a page is removed.static java.lang.String
PROPERTY_PAGE_REORDERED
A property change that is fired with the old and new page numbers when the page order changes.static int
RESELECT_GROUP
The number of a selection group that is automatically populated with the previous selection when the selection is cleared.
-
Constructor Summary
Constructors Constructor Description Deck()
Creates a new, empty deck using the default paper size.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Page
addNewPage()
Adds a new page to the end of this deck.Page
addNewPage(int index)
Adds a new page which will have the given page index.void
addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds aPropertyChangeListener
to the deck.void
addSelectionListener(Deck.SelectionChangeListener l)
void
addToSelection(PageItem item)
Adds a page item to the current selection.void
applyFinishStyleToItems()
Applies the current deck default finish options to all compatible items in the deck.void
beginCompoundEdit()
void
centerSelectionOver(double x, double y)
Moves the selection so that it is centered over the point (x, y) (in document space).void
clearAll()
Sets this component's content to an empty state.void
clearSelection()
Unselects all currently selected page items, if any.Deck
clone()
Returns a deep copy of this game component.void
convertFrom(ConversionSession session)
Called on a component that is being converted into another component type.void
convertTo(ConversionSession session)
Called on the replacement component when converting a component to another component type.void
copy()
Copies the current selection to the clipboard.void
coreCheck()
Checks if all required libraries and extensions are installed.DeckEditor
createDefaultEditor()
Returns a new deck editor for this deck.Sheet<?>[]
createDefaultSheets()
This is not a valid operation for aDeck
.UpgradeConversionTrigger
createUpgradeConversionTrigger()
Returns theConversionSession
created when the component type no longer handles the component.void
cut()
Cuts the current selection, if any.void
deleteSelection()
Deletes the items in the current selection.void
endCompoundEdit()
void
flipSelection()
Page
getActivePage()
Returns the active page.double
getBleedMarginWidth()
Returns the bleed margin width to use when the relevant finish option is selected.java.lang.String
getComment()
Returns the design rationale comments associated with this component.StyleApplicator
getDefaultStyleApplicator()
Returns the default item style applicator that will be used to apply a style to newly added deck items.FinishStyle
getFinishStyle()
Returns the finish style set on this item, or null if the deck default style should be used.java.lang.String
getFullName()
Returns the "full name" of this component.java.lang.String
getName()
Returns the name of this component.Page
getPage(int index)
Returns the page with the specified index.int
getPageCount()
Return the number of pages in this deck.PaperProperties
getPaperProperties()
Returns the paper format for pages in this deck.java.util.Set<PaperProperties>
getPaperSizes()
Returns a set of paper sizes that are appropriate for this deck at the current time.PaperProperties
getPrinterPaperProperties()
Returns the paper properties of the physical paper size for pages in this deck.java.util.Set<PaperProperties>
getPrinterPaperSizes()
Returns a set of printer paper sizes that are appropriate for this deck at the current time.double
getPublishersMarkDistance()
Returns the size of the gap between deck objects and their publisher's marks.double
getPublishersMarkLength()
Returns the length of publisher's marks.float
getPublishersMarkPrintWidth()
Returns the width of publisher's marks when printed.boolean
getPublishersMarksEnabled()
Returns whether publisher's marks are displayed for the deck.float
getPublishersMarkWidth()
Returns the width of publisher's marks when displayed for editing.PageItem[]
getSelection()
Returns the members of the current selection as a possibly empty array.int
getSelectionGroupSize(int group)
Returns the number of items in the selection stored in the specified group.Page
getSelectionPage()
Returns the page that containing the currently selected page items, ornull
if there is no selection.java.awt.geom.Rectangle2D.Double
getSelectionRectangle()
int
getSelectionSize()
Returns the number of currently selected cards.Settings
getSettings()
Returns aSettings
instance that will return this component's private settings.Sheet<?>[]
getSheets()
This is not a valid operation for aDeck
.java.lang.String[]
getSheetTitles()
Returns an empty array, since decks do not have rendered sheets.float
getSplitBorder()
Returns the size of the border that will be drawn around virtual pages when page splitting is enabled.java.awt.Color
getSplitBorderColor()
Returns the colour of the border that is drawn around virtual pages.void
groupSelection()
Group the selection into a single unit.boolean
hasChanged()
Returnstrue
if this component has been modified since the last call tohasChanged()
.boolean
hasUnsavedChanges()
Returns the value of this component's unsaved changes flag.void
invertSelection()
Invert the set of selected page items on the page where the selection occurs.boolean
isAutoBleedMarginEnabled()
Deprecated.UsegetFinishStyle()
andgetBleedMarginWidth()
.static boolean
isDeckClipboardEmpty()
Returns whether the clipboard used for deck objects is empty.boolean
isDeckLayoutSupported()
Returnstrue
if components of this type can be placed in a deck.static boolean
isDeckLayoutSupported(java.io.File f)
Returnstrue
if a given file represents a game component that can be placed in a deck.boolean
isPaperSplitting()
Returns whether paper splitting is enabled.boolean
isSelected(PageItem item)
Returnstrue
if the specified item is currently selected.void
markChanged(int i)
Called to signal that changes have been made that require thei
the sheet to be redrawn.void
markSaved()
This method is called by the component's editor when the the component is saved to clear the component's unsaved changes flag.void
markUnsavedChanges()
This method sets the component's unsaved changes flag.void
moveSelectionToBack()
void
moveSelectionToFront()
void
nudgeSelection(double dx, double dy)
void
paste()
Pastes a previously copied selection from the clipboard.void
removeFromSelection(PageItem item)
Removes a page item from the current selection.void
removePage(int index)
Removes the page at the specified page index.void
removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes aPropertyChangeListener
from the deck.void
removeSelectionListener(Deck.SelectionChangeListener l)
void
reorderPage(int oldindex, int newindex)
void
selectAll(Page page)
void
selectNumberedGroup(int groupNumber)
Selects the specified numbered group.void
setActivePage(Page pageToActivate)
Changes the active page.void
setAutoBleedMarginEnabled(boolean enable)
Deprecated.void
setBleedMarginWidth(double widthInPoints)
Sets the bleed margin width to use when the relevant finish option is selected.void
setComment(java.lang.String comment)
Sets the design rationale comment text associated with this deck.void
setFinishStyle(FinishStyle style)
Sets the edge finish style to use for this item, or null if the deck default option should be used.void
setName(java.lang.String name)
void
setPaperProperties(PaperProperties paper)
Sets the paper format for pages in this deck.void
setPaperSplitting(boolean splitPaper)
Sets whether paper splitting is enabled.void
setPrinterPaperProperties(PaperProperties printerPaper)
Sets the printed page format for the deck.void
setPublishersMarkDistance(double pubMarkDistance)
Sets the size of the gap between deck objects and their publisher's marks.void
setPublishersMarkLength(double pubMarkLength)
Sets the length of publisher's marks when displayed for editing.void
setPublishersMarkPrintWidth(float pubMarkWidth)
Sets the width of publisher's marks when printed.void
setPublishersMarksEnabled(boolean pubMarksEnabled)
Sets whether publisher's marks are displayed for the deck.void
setPublishersMarkWidth(float pubMarkWidth)
Sets the width of publisher's marks when displayed for editing.void
setSaveFileHint(java.io.File f)
Sets a hint value that is saved with the deck in order to assist with locating linked files (such as game components used in the deck).void
setSelection(PageItem item)
Selects a single page item, clearing any existing selection.void
setSheets(Sheet[] sheets)
This is not a valid operation for aDeck
.void
setSplitBorder(float splitBorder)
Sets the size of the border that will be drawn round virtual pages, or 0 for no border.void
setSplitBorderColor(java.awt.Color borderColor)
Sets the colour of the border that is drawn around virtual pages.void
storeSelectionInNumberedGroup(int group)
Stores the current selection in a numbered memory cell.void
turnSelectionLeft()
void
turnSelectionRight()
void
ungroupSelection()
Break any groups in the selection.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.cgjennings.apps.arkham.component.GameComponent
getClassName
-
-
-
-
Field Detail
-
PROPERTY_PAGE_ADDED
public static final java.lang.String PROPERTY_PAGE_ADDED
A property change that is fired with the page number when a page is added.- See Also:
- Constant Field Values
-
PROPERTY_PAGE_REMOVED
public static final java.lang.String PROPERTY_PAGE_REMOVED
A property change that is fired with the page number when a page is removed.- See Also:
- Constant Field Values
-
PROPERTY_PAGE_REORDERED
public static final java.lang.String PROPERTY_PAGE_REORDERED
A property change that is fired with the old and new page numbers when the page order changes.- See Also:
- Constant Field Values
-
MAX_PAPER_SIZE
public static final double MAX_PAPER_SIZE
The maximum size for any dimension in a page format that is allowed in a deck. It is equal to 7200 points (100 inches, 81/3 feet, or 2.54 metres).- See Also:
- Constant Field Values
-
RESELECT_GROUP
public static final int RESELECT_GROUP
The number of a selection group that is automatically populated with the previous selection when the selection is cleared. This allows the previous selection to be easily restored. This is the last group, and so is equal toNUM_SELECTION_GROUPS-1
.- See Also:
- Constant Field Values
-
NUM_SELECTION_GROUPS
public static final int NUM_SELECTION_GROUPS
The number of selection groups available for use withstoreSelectionInNumberedGroup(int)
. This is guaranteed to be at least 10.- See Also:
- Constant Field Values
-
-
Method Detail
-
createDefaultEditor
public DeckEditor createDefaultEditor()
Returns a new deck editor for this deck. A core check will be performed using the value of the cores private setting, if any.- Specified by:
createDefaultEditor
in interfaceGameComponent
- Returns:
- a new editor for the deck
- See Also:
StrangeEonsAppWindow.addEditor(ca.cgjennings.apps.arkham.StrangeEonsEditor)
-
beginCompoundEdit
public void beginCompoundEdit()
-
endCompoundEdit
public void endCompoundEdit()
-
getPageCount
public int getPageCount()
Return the number of pages in this deck.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener pcl)
Adds aPropertyChangeListener
to the deck. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. Iflistener
is null, no exception is thrown and no action is taken.- Parameters:
pcl
- the listener to add
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener pcl)
Removes aPropertyChangeListener
from the deck. This removes a listener that was registered for all properties. If the listener was added more than once, it will be notified one less time after being removed. If the listener isnull
, or was never added, no exception is thrown and no action is taken.- Parameters:
pcl
- the listener to remove
-
addNewPage
public final Page addNewPage()
Adds a new page to the end of this deck.
-
addNewPage
public Page addNewPage(int index)
Adds a new page which will have the given page index. The newly created page will be made the active page and returned.- Parameters:
index
- the page index, from 0 togetPageCount()
inclusive- Returns:
- the newly added blank page
-
removePage
public void removePage(int index)
Removes the page at the specified page index.- Parameters:
index
- the index of the page to remove
-
getPage
public Page getPage(int index)
Returns the page with the specified index.- Parameters:
index
- the index of the page to return- Returns:
- the requested page
- See Also:
getPageCount()
-
getSelectionPage
public Page getSelectionPage()
Returns the page that containing the currently selected page items, ornull
if there is no selection.- Returns:
- the page containing
-
clearSelection
public void clearSelection()
Unselects all currently selected page items, if any.
-
addToSelection
public void addToSelection(PageItem item)
Adds a page item to the current selection. If the new item is on a different page than the existing selection, the current selection is cleared first.- Parameters:
item
- the item to add to the selection
-
removeFromSelection
public void removeFromSelection(PageItem item)
Removes a page item from the current selection. Has no effect if the item is not selected.- Parameters:
item
- the item to deselect
-
invertSelection
public void invertSelection()
Invert the set of selected page items on the page where the selection occurs. If there is no selection, all cards on the active page are selected.
-
storeSelectionInNumberedGroup
public void storeSelectionInNumberedGroup(int group)
Stores the current selection in a numbered memory cell. There are guaranteed to be at least 10 general purpose cells available to the user.- Parameters:
group
- the cell number to store the selection in- Throws:
java.lang.IndexOutOfBoundsException
- if the group number is negative or equal to or greater thanNUM_SELECTION_GROUPS
-
selectNumberedGroup
public void selectNumberedGroup(int groupNumber)
Selects the specified numbered group. Numbered groups store selections in numbered memory cells as an aid to the user.- Parameters:
groupNumber
- the index of the group
-
getSelectionGroupSize
public int getSelectionGroupSize(int group)
Returns the number of items in the selection stored in the specified group.- Parameters:
group
- the selection group number to measure- Returns:
- the number of items in the selection group, or 0
-
setSelection
public void setSelection(PageItem item)
Selects a single page item, clearing any existing selection.- Parameters:
item
- the item to select
-
getSelection
public PageItem[] getSelection()
Returns the members of the current selection as a possibly empty array.- Returns:
- the selected items
-
getSelectionSize
public int getSelectionSize()
Returns the number of currently selected cards.- Returns:
- the selection size, or 0 if there is no selection
-
isSelected
public boolean isSelected(PageItem item)
Returnstrue
if the specified item is currently selected.- Parameters:
item
- the item to test- Returns:
true
if the item is in the current selection
-
deleteSelection
public void deleteSelection()
Deletes the items in the current selection.
-
selectAll
public void selectAll(Page page)
-
turnSelectionLeft
public void turnSelectionLeft()
-
turnSelectionRight
public void turnSelectionRight()
-
flipSelection
public void flipSelection()
-
moveSelectionToFront
public void moveSelectionToFront()
-
moveSelectionToBack
public void moveSelectionToBack()
-
nudgeSelection
public void nudgeSelection(double dx, double dy)
-
groupSelection
public void groupSelection()
Group the selection into a single unit.
-
ungroupSelection
public void ungroupSelection()
Break any groups in the selection.
-
getSelectionRectangle
public java.awt.geom.Rectangle2D.Double getSelectionRectangle()
-
reorderPage
public void reorderPage(int oldindex, int newindex)
-
clone
public Deck clone()
Description copied from interface:GameComponent
Returns a deep copy of this game component. The default clone implementation provided bysuper.clone()
will return a shallow copy of the object. This will correctly clone all of this instance's fields that have primitive types. It is then up to you to clone any object fields where the field is not of an immutable type. Images used to store portraits, although not technically immutable, are treated as immutable by Strange Eons. So long as you also follow this convention, you can save memory by sharing the shallow copy of the image.Debugging tip: One operation that makes use of the
clone()
method is the Spin Off command. If you apply this command, make changes to the copied component, redraw the original component, and notice that changes in the copy have carried over to the original, then you are using a shallow copy rather than a deep copy. (That is, you are sharing a reference to the same mutable object rather than making a copy of the mutable object during the cloning.)- Specified by:
clone
in interfaceGameComponent
- Overrides:
clone
in classjava.lang.Object
- Returns:
- a deep copy of this component
-
getPublishersMarksEnabled
public boolean getPublishersMarksEnabled()
Returns whether publisher's marks are displayed for the deck.- Returns:
- if
true
, publisher's marks will be generated for objects in the deck
-
setPublishersMarksEnabled
public void setPublishersMarksEnabled(boolean pubMarksEnabled)
Sets whether publisher's marks are displayed for the deck.- Parameters:
pubMarksEnabled
- iftrue
, publisher's marks will be generated for objects in the deck
-
getPublishersMarkWidth
public float getPublishersMarkWidth()
Returns the width of publisher's marks when displayed for editing.- Returns:
- the non-negative length, in points
- See Also:
setPublishersMarkWidth(float)
-
setPublishersMarkWidth
public void setPublishersMarkWidth(float pubMarkWidth)
Sets the width of publisher's marks when displayed for editing.- Parameters:
pubMarkWidth
- the non-negative length, in points- See Also:
getPublishersMarkWidth()
-
getPublishersMarkPrintWidth
public float getPublishersMarkPrintWidth()
Returns the width of publisher's marks when printed.- Returns:
- the non-negative length, in points
- See Also:
setPublishersMarkPrintWidth(float)
-
setPublishersMarkPrintWidth
public void setPublishersMarkPrintWidth(float pubMarkWidth)
Sets the width of publisher's marks when printed.- Parameters:
pubMarkWidth
- the non-negative length, in points- See Also:
getPublishersMarkPrintWidth()
-
getPublishersMarkLength
public double getPublishersMarkLength()
Returns the length of publisher's marks.- Returns:
- the non-negative length, in points
-
setPublishersMarkLength
public void setPublishersMarkLength(double pubMarkLength)
Sets the length of publisher's marks when displayed for editing.- Parameters:
pubMarkLength
- the non-negative length, in points
-
getPublishersMarkDistance
public double getPublishersMarkDistance()
Returns the size of the gap between deck objects and their publisher's marks.- Returns:
- the distance, in points
-
setPublishersMarkDistance
public void setPublishersMarkDistance(double pubMarkDistance)
Sets the size of the gap between deck objects and their publisher's marks.- Parameters:
pubMarkDistance
- the non-negative distance, in points
-
setSaveFileHint
public void setSaveFileHint(java.io.File f)
Sets a hint value that is saved with the deck in order to assist with locating linked files (such as game components used in the deck).- Parameters:
f
- the file that the deck will be saved to
-
setName
public void setName(java.lang.String name)
-
getName
public java.lang.String getName()
Description copied from interface:GameComponent
Returns the name of this component. This is not the name of the component type, but the name of the specific component. For example, a component that represents a game item would return the name of the item.- Specified by:
getName
in interfaceGameComponent
- Returns:
- the component's name; possibly a shortened version of the full name
- See Also:
GameComponent.getFullName()
-
getFullName
public java.lang.String getFullName()
Description copied from interface:GameComponent
Returns the "full name" of this component. Typically this is the same asGameComponent.getName()
, butGameComponent.getName()
may optionally return a shorter name. For example, a component that represents a human character might return the character's first name fromGameComponent.getName()
and their full name from this method.- Specified by:
getFullName
in interfaceGameComponent
- Returns:
- the full name of the component
- See Also:
GameComponent.getName()
-
hasChanged
public boolean hasChanged()
Description copied from interface:GameComponent
Returnstrue
if this component has been modified since the last call tohasChanged()
.- Specified by:
hasChanged
in interfaceGameComponent
- Returns:
true
if the component has changed since this was last called
-
hasUnsavedChanges
public boolean hasUnsavedChanges()
Description copied from interface:GameComponent
Returns the value of this component's unsaved changes flag.- Specified by:
hasUnsavedChanges
in interfaceGameComponent
- Returns:
true
if this component has unsaved changes
-
clearAll
public void clearAll()
Description copied from interface:GameComponent
Sets this component's content to an empty state. Typically, this is called from an editor when the user wishes to erase their work and start over.- Specified by:
clearAll
in interfaceGameComponent
-
getSheetTitles
public java.lang.String[] getSheetTitles()
Returns an empty array, since decks do not have rendered sheets.- Specified by:
getSheetTitles
in interfaceGameComponent
- Returns:
- an array of sheet titles matching the assigned sheets, or
null
if there are no sheets attached - See Also:
GameComponent.createDefaultSheets()
-
getSheets
public Sheet<?>[] getSheets()
This is not a valid operation for aDeck
. ThrowsUnsupportedOperationException
.- Specified by:
getSheets
in interfaceGameComponent
- Returns:
- the sheets that will be updated by calls to
GameComponent.markChanged(int)
. - See Also:
GameComponent.getSheets()
-
setSheets
public void setSheets(Sheet[] sheets)
This is not a valid operation for aDeck
. ThrowsUnsupportedOperationException
.- Specified by:
setSheets
in interfaceGameComponent
- Parameters:
sheets
- the sheets to associate with the component, ornull
to clear the associated sheets- See Also:
GameComponent.getSheets()
,GameComponent.createDefaultSheets()
-
createDefaultSheets
public Sheet<?>[] createDefaultSheets()
This is not a valid operation for aDeck
. ThrowsUnsupportedOperationException
.- Specified by:
createDefaultSheets
in interfaceGameComponent
- Returns:
- the newly created sheets
-
markSaved
public void markSaved()
Description copied from interface:GameComponent
This method is called by the component's editor when the the component is saved to clear the component's unsaved changes flag.- Specified by:
markSaved
in interfaceGameComponent
-
markUnsavedChanges
public void markUnsavedChanges()
Description copied from interface:GameComponent
This method sets the component's unsaved changes flag. It is typically called fromGameComponent.markChanged(int)
.- Specified by:
markUnsavedChanges
in interfaceGameComponent
-
markChanged
public final void markChanged(int i)
Description copied from interface:GameComponent
Called to signal that changes have been made that require thei
the sheet to be redrawn. This is typically not called directly. Instead, calling a method like "setName
" should check if the name being set is actually different, and if so then call this method for each sheet that may have changed as a result. Plug-ins that customize an existing component may also call this method as needed to reflect new features that they have added.Implementations of this method will typically call the
Sheet.markChanged()
method of the relevant sheet (unless the sheet set isnull
), set a flag for use byGameComponent.hasChanged()
, and then callGameComponent.markUnsavedChanges()
.- Specified by:
markChanged
in interfaceGameComponent
- Parameters:
i
- the index of the sheet that needs to be redrawn
-
setActivePage
public void setActivePage(Page pageToActivate)
Changes the active page. The active page is the default target for commands that affect a particular page. When the deck is shown in a deck editor, the currently visible page and the active page are typically synchronized.- Parameters:
pageToActivate
- the non-null
page to activate- See Also:
getActivePage()
-
getActivePage
public Page getActivePage()
Returns the active page.- Returns:
- the currently active page
- See Also:
setActivePage(ca.cgjennings.apps.arkham.deck.Page)
-
cut
public void cut()
Cuts the current selection, if any. The selection is removed from the deck and placed on the clipboard.
-
paste
public void paste()
Pastes a previously copied selection from the clipboard.
-
centerSelectionOver
public void centerSelectionOver(double x, double y)
Moves the selection so that it is centered over the point (x, y) (in document space).- Parameters:
x
- the x-coordinate to center overy
- the y-coordinate to center over
-
isDeckClipboardEmpty
public static boolean isDeckClipboardEmpty()
Returns whether the clipboard used for deck objects is empty. If empty, pasting will have no effect. The deck object clipboard is shared by all decks in the current instance of the application.- Returns:
true
if the clipboard deck is empty
-
setPaperProperties
public void setPaperProperties(PaperProperties paper)
Sets the paper format for pages in this deck. If page splitting is disabled, then this will also be the physical paper size for printing. When creating large objects, such as game boards, this will typically be set to a format matching the size of the physical object.- Parameters:
paper
- the new paper format for deck pages- Throws:
java.lang.NullPointerException
- if the paper format isnull
java.lang.IllegalArgumentException
- if any paper measurement is larger thanMAX_PAPER_SIZE
- See Also:
getPaperProperties()
-
getPaperProperties
public PaperProperties getPaperProperties()
Returns the paper format for pages in this deck.- Returns:
- the properties of the paper format for this deck
- See Also:
setPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
-
setPrinterPaperProperties
public void setPrinterPaperProperties(PaperProperties printerPaper)
Sets the printed page format for the deck. If page splitting is enabled, then pages in the deck will be split into tiles sized for paper with this physical size. This value will be ignored unless page splitting is enabled.- Parameters:
printerPaper
- the new paper format for printed pages- Throws:
java.lang.NullPointerException
- if the paper format isnull
java.lang.IllegalArgumentException
- if any paper measurement is larger thanMAX_PAPER_SIZE
- See Also:
getPrinterPaperProperties()
-
getPrinterPaperProperties
public PaperProperties getPrinterPaperProperties()
Returns the paper properties of the physical paper size for pages in this deck. Note that this value will be ignored unless page splitting is enabled.- Returns:
- the physical paper format for printing
- See Also:
setPrinterPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
-
getPaperSizes
public java.util.Set<PaperProperties> getPaperSizes()
Returns a set of paper sizes that are appropriate for this deck at the current time. This will include all paper sizes that are registered for either all games or for the particular game associated with this deck in its settings (if any).- Returns:
- a set of appropriate paper sizes for this deck
- See Also:
setPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
-
getPrinterPaperSizes
public java.util.Set<PaperProperties> getPrinterPaperSizes()
Returns a set of printer paper sizes that are appropriate for this deck at the current time. This set will include all physical paper sizes that are registered for either all games or for the particular game associated with this deck in its settings (if any).- Returns:
- a set of appropriate physical paper sizes for this deck
- See Also:
setPrinterPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
-
isPaperSplitting
public boolean isPaperSplitting()
Returns whether paper splitting is enabled.- Returns:
true
if tiling is enabled- See Also:
setPaperSplitting(boolean)
-
setPaperSplitting
public void setPaperSplitting(boolean splitPaper)
Sets whether paper splitting is enabled. When enabled, each deck page is split into as many tiles as necessary to print it on one physical printer page.- Parameters:
splitPaper
- whether the deck pages should be split into tiles for the printer paper size- See Also:
isPaperSplitting()
,setPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
,setPrinterPaperProperties(ca.cgjennings.apps.arkham.deck.PaperProperties)
-
getSplitBorder
public float getSplitBorder()
Returns the size of the border that will be drawn around virtual pages when page splitting is enabled.- Returns:
- the border size, in points
- See Also:
setSplitBorder(float)
-
setSplitBorder
public void setSplitBorder(float splitBorder)
Sets the size of the border that will be drawn round virtual pages, or 0 for no border.- Parameters:
splitBorder
- the border size, or 0- See Also:
getSplitBorder()
,setPaperSplitting(boolean)
-
getSplitBorderColor
public java.awt.Color getSplitBorderColor()
Returns the colour of the border that is drawn around virtual pages.- Returns:
- the split border colour
- See Also:
setSplitBorderColor(java.awt.Color)
-
setSplitBorderColor
public void setSplitBorderColor(java.awt.Color borderColor)
Sets the colour of the border that is drawn around virtual pages.- Parameters:
borderColor
- the split border colour;null
is treated as black- See Also:
getSplitBorderColor()
,setPaperSplitting(boolean)
-
setAutoBleedMarginEnabled
@Deprecated public void setAutoBleedMarginEnabled(boolean enable)
Deprecated.
-
isAutoBleedMarginEnabled
@Deprecated public boolean isAutoBleedMarginEnabled()
Deprecated.UsegetFinishStyle()
andgetBleedMarginWidth()
.
-
getFinishStyle
public FinishStyle getFinishStyle()
Description copied from interface:BleedMarginStyle
Returns the finish style set on this item, or null if the deck default style should be used.- Specified by:
getFinishStyle
in interfaceBleedMarginStyle
- Returns:
- the finish style to use
-
setFinishStyle
public void setFinishStyle(FinishStyle style)
Description copied from interface:BleedMarginStyle
Sets the edge finish style to use for this item, or null if the deck default option should be used.- Specified by:
setFinishStyle
in interfaceBleedMarginStyle
- Parameters:
style
- the style to use
-
getBleedMarginWidth
public double getBleedMarginWidth()
Description copied from interface:BleedMarginStyle
Returns the bleed margin width to use when the relevant finish option is selected.- Specified by:
getBleedMarginWidth
in interfaceBleedMarginStyle
- Returns:
- the positive width in points
-
setBleedMarginWidth
public void setBleedMarginWidth(double widthInPoints)
Description copied from interface:BleedMarginStyle
Sets the bleed margin width to use when the relevant finish option is selected.- Specified by:
setBleedMarginWidth
in interfaceBleedMarginStyle
- Parameters:
widthInPoints
- the positive bleed margin width
-
applyFinishStyleToItems
public void applyFinishStyleToItems()
Applies the current deck default finish options to all compatible items in the deck.
-
addSelectionListener
public void addSelectionListener(Deck.SelectionChangeListener l)
-
removeSelectionListener
public void removeSelectionListener(Deck.SelectionChangeListener l)
-
getComment
public java.lang.String getComment()
Description copied from interface:GameComponent
Returns the design rationale comments associated with this component. If there are no comments, it should return an empty string.- Specified by:
getComment
in interfaceGameComponent
- Returns:
- design comments supplied by the user of the component
-
setComment
public void setComment(java.lang.String comment)
Sets the design rationale comment text associated with this deck.- Parameters:
comment
- the new comment to set;null
is treated as an empty string
-
getDefaultStyleApplicator
public StyleApplicator getDefaultStyleApplicator()
Returns the default item style applicator that will be used to apply a style to newly added deck items. The default style applicator for a deck is determined by the game associated with the deck.- Returns:
- an applicator used to set the default style for new objects
-
getSettings
public Settings getSettings()
Description copied from interface:GameComponent
Returns aSettings
instance that will return this component's private settings. A component's private settings are saved along with the component when it is written to a file. This can be used to override the default settings for component (which are determined by the the shared game settings for the game associated with the component) as a way to "hack" existing component designs. It can also be used by the component itself to store arbitrary information.DIY components
generally use the component's private settings to store the current user-configurable state of the component.Note that setting the key with the name
Game.GAME_SETTING_KEY
("game") will change the parent scope of the private settings to therelevant game's settings
for that game whose code matches the new value. (The initial value of this key is normally set on the component's half using the game code specified in the component's class map entry.)- Specified by:
getSettings
in interfaceGameComponent
- Returns:
- the private settings that can be used to override settings for this component
-
isDeckLayoutSupported
public boolean isDeckLayoutSupported()
Description copied from interface:GameComponent
Returnstrue
if components of this type can be placed in a deck. Typically, only components that don't have faces returnfalse
. (Decks themselves, for example, cannot be placed inside other decks.)- Specified by:
isDeckLayoutSupported
in interfaceGameComponent
- Returns:
true
if and only if this component can be added to a deck- See Also:
GameComponent.createDefaultSheets()
,isDeckLayoutSupported(java.io.File)
-
isDeckLayoutSupported
public static boolean isDeckLayoutSupported(java.io.File f)
Returnstrue
if a given file represents a game component that can be placed in a deck. For recent file format versions, this can be determined without fully opening the file by examining its metadata. For older files, the component must first be read in. If for any reason the value cannot be read from the file,false
is returned.- Returns:
- returns
true
if the game component in the specified file can be placed in a deck - See Also:
GameComponent.isDeckLayoutSupported()
-
coreCheck
public void coreCheck()
Checks if all required libraries and extensions are installed. If a required library is not install This method is called when the component is read from a file, and possibly at other timesThis can safely be implemented as an empty method. However, implementing it correctly improves the user experience since they can be notified of which plug-ins they need to install to correctly use the component. In the case of a required but not installed library, the library can actually be downloaded and installed on demand and the component can then be successfully opened.
For decks, the cores private setting is checked; if it it exists, its value is passed to
validateCoreComponents
.- Specified by:
coreCheck
in interfaceGameComponent
- See Also:
CoreComponents.validateCoreComponents(java.lang.Object)
-
createUpgradeConversionTrigger
public UpgradeConversionTrigger createUpgradeConversionTrigger()
Description copied from interface:GameComponent
Returns theConversionSession
created when the component type no longer handles the component. This method is called after a component is read from file. Should returnnull
when no conversion is needed.- Specified by:
createUpgradeConversionTrigger
in interfaceGameComponent
- Returns:
- a conversion context if the upgrade requires a conversion
- See Also:
ConversionSession
-
convertFrom
public void convertFrom(ConversionSession session)
Description copied from interface:GameComponent
Called on a component that is being converted into another component type. Based on the conversion strategy, the old component may modify the new component directly, or modify the conversion context, or do nothing. This method is called before calling#convertTo(GameComponent, ConversionContext)
on the target, and before any automatic conversion steps.- Specified by:
convertFrom
in interfaceGameComponent
-
convertTo
public void convertTo(ConversionSession session)
Description copied from interface:GameComponent
Called on the replacement component when converting a component to another component type. Based on the conversion strategy, the new component may modify itself directly, or modify the conversion context, or do nothing. This method is called after calling#convertFrom(GameComponent, ConversionContext)
on the source, but before any automatic conversion steps.- Specified by:
convertTo
in interfaceGameComponent
-
-