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 interfaceDeck.SelectionChangeListener
-
Field Summary
Fields Modifier and Type Field Description static doubleMAX_PAPER_SIZEThe maximum size for any dimension in a page format that is allowed in a deck.static intNUM_SELECTION_GROUPSThe number of selection groups available for use withstoreSelectionInNumberedGroup(int).static java.lang.StringPROPERTY_PAGE_ADDEDA property change that is fired with the page number when a page is added.static java.lang.StringPROPERTY_PAGE_REMOVEDA property change that is fired with the page number when a page is removed.static java.lang.StringPROPERTY_PAGE_REORDEREDA property change that is fired with the old and new page numbers when the page order changes.static intRESELECT_GROUPThe 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 PageaddNewPage()Adds a new page to the end of this deck.PageaddNewPage(int index)Adds a new page which will have the given page index.voidaddPropertyChangeListener(java.beans.PropertyChangeListener pcl)Adds aPropertyChangeListenerto the deck.voidaddSelectionListener(Deck.SelectionChangeListener l)voidaddToSelection(PageItem item)Adds a page item to the current selection.voidapplyFinishStyleToItems()Applies the current deck default finish options to all compatible items in the deck.voidbeginCompoundEdit()voidcenterSelectionOver(double x, double y)Moves the selection so that it is centered over the point (x, y) (in document space).voidclearAll()Sets this component's content to an empty state.voidclearSelection()Unselects all currently selected page items, if any.Deckclone()Returns a deep copy of this game component.voidconvertFrom(ConversionSession session)Called on a component that is being converted into another component type.voidconvertTo(ConversionSession session)Called on the replacement component when converting a component to another component type.voidcopy()Copies the current selection to the clipboard.voidcoreCheck()Checks if all required libraries and extensions are installed.DeckEditorcreateDefaultEditor()Returns a new deck editor for this deck.Sheet<?>[]createDefaultSheets()This is not a valid operation for aDeck.UpgradeConversionTriggercreateUpgradeConversionTrigger()Returns theConversionSessioncreated when the component type no longer handles the component.voidcut()Cuts the current selection, if any.voiddeleteSelection()Deletes the items in the current selection.voidendCompoundEdit()voidflipSelection()PagegetActivePage()Returns the active page.doublegetBleedMarginWidth()Returns the bleed margin width to use when the relevant finish option is selected.java.lang.StringgetComment()Returns the design rationale comments associated with this component.StyleApplicatorgetDefaultStyleApplicator()Returns the default item style applicator that will be used to apply a style to newly added deck items.FinishStylegetFinishStyle()Returns the finish style set on this item, or null if the deck default style should be used.java.lang.StringgetFullName()Returns the "full name" of this component.java.lang.StringgetName()Returns the name of this component.PagegetPage(int index)Returns the page with the specified index.intgetPageCount()Return the number of pages in this deck.PaperPropertiesgetPaperProperties()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.PaperPropertiesgetPrinterPaperProperties()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.doublegetPublishersMarkDistance()Returns the size of the gap between deck objects and their publisher's marks.doublegetPublishersMarkLength()Returns the length of publisher's marks.floatgetPublishersMarkPrintWidth()Returns the width of publisher's marks when printed.booleangetPublishersMarksEnabled()Returns whether publisher's marks are displayed for the deck.floatgetPublishersMarkWidth()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.intgetSelectionGroupSize(int group)Returns the number of items in the selection stored in the specified group.PagegetSelectionPage()Returns the page that containing the currently selected page items, ornullif there is no selection.java.awt.geom.Rectangle2D.DoublegetSelectionRectangle()intgetSelectionSize()Returns the number of currently selected cards.SettingsgetSettings()Returns aSettingsinstance 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.floatgetSplitBorder()Returns the size of the border that will be drawn around virtual pages when page splitting is enabled.java.awt.ColorgetSplitBorderColor()Returns the colour of the border that is drawn around virtual pages.voidgroupSelection()Group the selection into a single unit.booleanhasChanged()Returnstrueif this component has been modified since the last call tohasChanged().booleanhasUnsavedChanges()Returns the value of this component's unsaved changes flag.voidinvertSelection()Invert the set of selected page items on the page where the selection occurs.booleanisAutoBleedMarginEnabled()Deprecated.UsegetFinishStyle()andgetBleedMarginWidth().static booleanisDeckClipboardEmpty()Returns whether the clipboard used for deck objects is empty.booleanisDeckLayoutSupported()Returnstrueif components of this type can be placed in a deck.static booleanisDeckLayoutSupported(java.io.File f)Returnstrueif a given file represents a game component that can be placed in a deck.booleanisPaperSplitting()Returns whether paper splitting is enabled.booleanisSelected(PageItem item)Returnstrueif the specified item is currently selected.voidmarkChanged(int i)Called to signal that changes have been made that require theithe sheet to be redrawn.voidmarkSaved()This method is called by the component's editor when the the component is saved to clear the component's unsaved changes flag.voidmarkUnsavedChanges()This method sets the component's unsaved changes flag.voidmoveSelectionToBack()voidmoveSelectionToFront()voidnudgeSelection(double dx, double dy)voidpaste()Pastes a previously copied selection from the clipboard.voidremoveFromSelection(PageItem item)Removes a page item from the current selection.voidremovePage(int index)Removes the page at the specified page index.voidremovePropertyChangeListener(java.beans.PropertyChangeListener pcl)Removes aPropertyChangeListenerfrom the deck.voidremoveSelectionListener(Deck.SelectionChangeListener l)voidreorderPage(int oldindex, int newindex)voidselectAll(Page page)voidselectNumberedGroup(int groupNumber)Selects the specified numbered group.voidsetActivePage(Page pageToActivate)Changes the active page.voidsetAutoBleedMarginEnabled(boolean enable)Deprecated.voidsetBleedMarginWidth(double widthInPoints)Sets the bleed margin width to use when the relevant finish option is selected.voidsetComment(java.lang.String comment)Sets the design rationale comment text associated with this deck.voidsetFinishStyle(FinishStyle style)Sets the edge finish style to use for this item, or null if the deck default option should be used.voidsetName(java.lang.String name)voidsetPaperProperties(PaperProperties paper)Sets the paper format for pages in this deck.voidsetPaperSplitting(boolean splitPaper)Sets whether paper splitting is enabled.voidsetPrinterPaperProperties(PaperProperties printerPaper)Sets the printed page format for the deck.voidsetPublishersMarkDistance(double pubMarkDistance)Sets the size of the gap between deck objects and their publisher's marks.voidsetPublishersMarkLength(double pubMarkLength)Sets the length of publisher's marks when displayed for editing.voidsetPublishersMarkPrintWidth(float pubMarkWidth)Sets the width of publisher's marks when printed.voidsetPublishersMarksEnabled(boolean pubMarksEnabled)Sets whether publisher's marks are displayed for the deck.voidsetPublishersMarkWidth(float pubMarkWidth)Sets the width of publisher's marks when displayed for editing.voidsetSaveFileHint(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).voidsetSelection(PageItem item)Selects a single page item, clearing any existing selection.voidsetSheets(Sheet[] sheets)This is not a valid operation for aDeck.voidsetSplitBorder(float splitBorder)Sets the size of the border that will be drawn round virtual pages, or 0 for no border.voidsetSplitBorderColor(java.awt.Color borderColor)Sets the colour of the border that is drawn around virtual pages.voidstoreSelectionInNumberedGroup(int group)Stores the current selection in a numbered memory cell.voidturnSelectionLeft()voidturnSelectionRight()voidungroupSelection()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:
createDefaultEditorin 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 aPropertyChangeListenerto 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. Iflisteneris 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 aPropertyChangeListenerfrom 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, ornullif 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)
Returnstrueif the specified item is currently selected.- Parameters:
item- the item to test- Returns:
trueif 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:GameComponentReturns 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:
clonein interfaceGameComponent- Overrides:
clonein 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:GameComponentReturns 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:
getNamein 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:GameComponentReturns 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:
getFullNamein interfaceGameComponent- Returns:
- the full name of the component
- See Also:
GameComponent.getName()
-
hasChanged
public boolean hasChanged()
Description copied from interface:GameComponentReturnstrueif this component has been modified since the last call tohasChanged().- Specified by:
hasChangedin interfaceGameComponent- Returns:
trueif the component has changed since this was last called
-
hasUnsavedChanges
public boolean hasUnsavedChanges()
Description copied from interface:GameComponentReturns the value of this component's unsaved changes flag.- Specified by:
hasUnsavedChangesin interfaceGameComponent- Returns:
trueif this component has unsaved changes
-
clearAll
public void clearAll()
Description copied from interface:GameComponentSets 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:
clearAllin interfaceGameComponent
-
getSheetTitles
public java.lang.String[] getSheetTitles()
Returns an empty array, since decks do not have rendered sheets.- Specified by:
getSheetTitlesin interfaceGameComponent- Returns:
- an array of sheet titles matching the assigned sheets, or
nullif there are no sheets attached - See Also:
GameComponent.createDefaultSheets()
-
getSheets
public Sheet<?>[] getSheets()
This is not a valid operation for aDeck. ThrowsUnsupportedOperationException.- Specified by:
getSheetsin 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:
setSheetsin interfaceGameComponent- Parameters:
sheets- the sheets to associate with the component, ornullto 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:
createDefaultSheetsin interfaceGameComponent- Returns:
- the newly created sheets
-
markSaved
public void markSaved()
Description copied from interface:GameComponentThis method is called by the component's editor when the the component is saved to clear the component's unsaved changes flag.- Specified by:
markSavedin interfaceGameComponent
-
markUnsavedChanges
public void markUnsavedChanges()
Description copied from interface:GameComponentThis method sets the component's unsaved changes flag. It is typically called fromGameComponent.markChanged(int).- Specified by:
markUnsavedChangesin interfaceGameComponent
-
markChanged
public final void markChanged(int i)
Description copied from interface:GameComponentCalled to signal that changes have been made that require theithe 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:
markChangedin 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-nullpage 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:
trueif 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 isnulljava.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 isnulljava.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:
trueif 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;nullis 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:BleedMarginStyleReturns the finish style set on this item, or null if the deck default style should be used.- Specified by:
getFinishStylein interfaceBleedMarginStyle- Returns:
- the finish style to use
-
setFinishStyle
public void setFinishStyle(FinishStyle style)
Description copied from interface:BleedMarginStyleSets the edge finish style to use for this item, or null if the deck default option should be used.- Specified by:
setFinishStylein interfaceBleedMarginStyle- Parameters:
style- the style to use
-
getBleedMarginWidth
public double getBleedMarginWidth()
Description copied from interface:BleedMarginStyleReturns the bleed margin width to use when the relevant finish option is selected.- Specified by:
getBleedMarginWidthin interfaceBleedMarginStyle- Returns:
- the positive width in points
-
setBleedMarginWidth
public void setBleedMarginWidth(double widthInPoints)
Description copied from interface:BleedMarginStyleSets the bleed margin width to use when the relevant finish option is selected.- Specified by:
setBleedMarginWidthin 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:GameComponentReturns the design rationale comments associated with this component. If there are no comments, it should return an empty string.- Specified by:
getCommentin 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;nullis 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:GameComponentReturns aSettingsinstance 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 componentsgenerally 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 settingsfor 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:
getSettingsin interfaceGameComponent- Returns:
- the private settings that can be used to override settings for this component
-
isDeckLayoutSupported
public boolean isDeckLayoutSupported()
Description copied from interface:GameComponentReturnstrueif 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:
isDeckLayoutSupportedin interfaceGameComponent- Returns:
trueif 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)
Returnstrueif 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,falseis returned.- Returns:
- returns
trueif 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:
coreCheckin interfaceGameComponent- See Also:
CoreComponents.validateCoreComponents(java.lang.Object)
-
createUpgradeConversionTrigger
public UpgradeConversionTrigger createUpgradeConversionTrigger()
Description copied from interface:GameComponentReturns theConversionSessioncreated when the component type no longer handles the component. This method is called after a component is read from file. Should returnnullwhen no conversion is needed.- Specified by:
createUpgradeConversionTriggerin interfaceGameComponent- Returns:
- a conversion context if the upgrade requires a conversion
- See Also:
ConversionSession
-
convertFrom
public void convertFrom(ConversionSession session)
Description copied from interface:GameComponentCalled 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:
convertFromin interfaceGameComponent
-
convertTo
public void convertTo(ConversionSession session)
Description copied from interface:GameComponentCalled 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:
convertToin interfaceGameComponent
-
-