Class CustomTile
- java.lang.Object
-
- All Implemented Interfaces:
EditablePageItem
,FlippablePageItem
,OpacityStyle
,OutlineStyle
,PageItem
,SizablePageItem
,Style
,UserBleedMarginStyle
,java.io.Serializable
,java.lang.Cloneable
public class CustomTile extends Tile implements EditablePageItem, SizablePageItem, UserBleedMarginStyle, OutlineStyle, OpacityStyle
Resizable, customizable tiles that can be placed in a deck.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
PageItem.SnapClass, PageItem.SnapTarget
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PLACEHOLDER_IDENTIFIER
The placeholder identifier that acts as the default for new custom tiles.-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.Tile
identifier
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractRenderedItem
render
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
orientation
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractItem
dragHandles, group, parent, selectionLock, snapClass, snapTarget, snapToClasses, xOff, yOff
-
Fields inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
ICON_SIZE, ORIENT_MIRROR_TURN_LEFT, ORIENT_MIRROR_TURN_RIGHT, ORIENT_MIRROR_UPRIGHT, ORIENT_MIRROR_UPSIDEDOWN, ORIENT_TURN_LEFT, ORIENT_TURN_RIGHT, ORIENT_UPRIGHT, ORIENT_UPSIDEDOWN
-
-
Constructor Summary
Constructors Constructor Description CustomTile(java.lang.String identifier, double dpi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginEditing()
double
getBleedMargin()
Returns the bleed margin used for any automatic crop marks, in points.DragHandle[]
getDragHandles()
Returns an array of the customDragHandle
s for this item.protected java.awt.image.BufferedImage
getImageFromIdentifier()
Fetch this tile's image using its identifier.float
getOpacity()
Returns the opacity (alpha) for the tile.LineCap
getOutlineCap()
Returns the line cap style used on outline ends.java.awt.Color
getOutlineColor()
Returns the color used to draw the outline.DashPattern
getOutlineDashPattern()
Returns the dash pattern used to draw the outline.LineJoin
getOutlineJoin()
Returns the method used to join the line segments that make up the outline.float
getOutlineWidth()
Returns the width, in points, of the outline.javax.swing.Icon
getThumbnailIcon()
Returns a small representative icon for this item.boolean
isBleedMarginMarked()
Returnstrue
if this item should have crop marks added to it.void
paint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)
Paint this item at its current location.protected void
readImpl(java.io.ObjectInputStream in)
void
setBleedMargin(double bleedMargin)
Sets the size of the user-defined bleed margin, in points.void
setBleedMarginMarked(boolean showCropMarks)
Sets whether the user bleed margin is drawn (as crop marks).void
setIdentifier(java.lang.String identifier)
void
setOpacity(float opacity)
Set the opacity (alpha) of the tile.void
setOutlineCap(LineCap cap)
Sets the line cap style used on outline ends.void
setOutlineColor(java.awt.Color borderColor)
Sets the color used to draw the outline.void
setOutlineDashPattern(DashPattern pat)
Sets the dash pattern used to draw the outline.void
setOutlineJoin(LineJoin join)
Sets the method used to join the line segments that make up the outline.void
setOutlineWidth(float borderWidth)
Sets the width, in points, of the outline.void
setSize(double width, double height)
Set the new size of this item, in points.void
setX(double x)
Set the x-location of this item.void
setY(double y)
Set the y-location of this item.protected void
writeImpl(java.io.ObjectOutputStream out)
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.Tile
clearCachedImages, getDPI, getIdentifier, getName, getResolution, getUprightHeight, getUprightWidth, isFastOutlineAllowed, isMipMapCacheEnabledByDefault, renderImage, scaleMipMapUpAtHighZoom, setDPI, setFastOutlineAllowed, setName, setOrientation, setResolution
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractRenderedItem
clearCachedIcon, clone, createOrientedImage, getHeight, getOrientedImage, getWidth, isMipMapCacheEnabled, prepareToPaint, setMipMapCacheEnabled
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
flip, getOrientation, turnLeft, turnRight
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractItem
customizePopupMenu, getClassesSnappedTo, getClientProperty, getFoldMarks, getGroup, getLocation, getOutline, getPage, getRectangle, getSnapClass, getSnapTarget, getX, getY, hasExteriorHandles, hitTest, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, itemChanged, itemChanging, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
clone, customizePopupMenu, getClassesSnappedTo, getClientProperty, getFoldMarks, getGroup, getHeight, getLocation, getName, getOrientation, getOutline, getPage, getRectangle, getSnapClass, getSnapTarget, getWidth, getX, getY, hasExteriorHandles, hitTest, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, prepareToPaint, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget
-
-
-
-
Field Detail
-
PLACEHOLDER_IDENTIFIER
public static final java.lang.String PLACEHOLDER_IDENTIFIER
The placeholder identifier that acts as the default for new custom tiles.- See Also:
- Constant Field Values
-
-
Method Detail
-
getThumbnailIcon
public javax.swing.Icon getThumbnailIcon()
Description copied from interface:PageItem
Returns a small representative icon for this item. The icon should beICON_SIZE
pixels wide and high.- Specified by:
getThumbnailIcon
in interfacePageItem
- Overrides:
getThumbnailIcon
in classAbstractRenderedItem
-
setIdentifier
public void setIdentifier(java.lang.String identifier)
- Overrides:
setIdentifier
in classTile
-
getImageFromIdentifier
protected java.awt.image.BufferedImage getImageFromIdentifier()
Fetch this tile's image using its identifier. Locates the image as a file or URL using the same syntax asGraphicStyleFactory
.- Overrides:
getImageFromIdentifier
in classTile
- Returns:
- an image for this identifier, possibly a "broken image" placeholder image
-
beginEditing
public void beginEditing()
- Specified by:
beginEditing
in interfaceEditablePageItem
-
getDragHandles
public DragHandle[] getDragHandles()
Description copied from class:AbstractItem
Returns an array of the customDragHandle
s for this item. If the item has no handles, returnsnull
.Concrete subclasses should create an array of handles on demand and cache them in the
dragHandles
field in order to ensure that handles are not shared between copies of the item. Example:public DragHandle[] getDragHandles() { if( dragHandles == null ) { dragHandles = new DragHandle[] { ... }; } return dragHandles; }
- Specified by:
getDragHandles
in interfacePageItem
- Overrides:
getDragHandles
in classAbstractItem
- Returns:
- an array of drag handles that can be used to manipulate the item,
or
null
-
setBleedMarginMarked
public void setBleedMarginMarked(boolean showCropMarks)
Description copied from interface:UserBleedMarginStyle
Sets whether the user bleed margin is drawn (as crop marks).- Specified by:
setBleedMarginMarked
in interfaceUserBleedMarginStyle
- Parameters:
showCropMarks
-true
if crop marks are enabled
-
isBleedMarginMarked
public boolean isBleedMarginMarked()
Description copied from interface:PageItem
Returnstrue
if this item should have crop marks added to it. The crop marks will be placedPageItem.getBleedMargin()
points from the ends of each edge.- Specified by:
isBleedMarginMarked
in interfacePageItem
- Specified by:
isBleedMarginMarked
in interfaceUserBleedMarginStyle
- Overrides:
isBleedMarginMarked
in classAbstractItem
- Returns:
true
if crop marks are enabled
-
getBleedMargin
public double getBleedMargin()
Description copied from interface:PageItem
Returns the bleed margin used for any automatic crop marks, in points.- Specified by:
getBleedMargin
in interfacePageItem
- Specified by:
getBleedMargin
in interfaceUserBleedMarginStyle
- Overrides:
getBleedMargin
in classAbstractItem
- Returns:
- the bleed margin for this item
-
setBleedMargin
public void setBleedMargin(double bleedMargin)
Description copied from interface:UserBleedMarginStyle
Sets the size of the user-defined bleed margin, in points. If the specified value is more half of the greater of the width or height of the item, then the value will be silently reduced to this maximum.- Specified by:
setBleedMargin
in interfaceUserBleedMarginStyle
- Parameters:
bleedMargin
- the bleed margin size
-
setSize
public void setSize(double width, double height)
Description copied from interface:SizablePageItem
Set the new size of this item, in points.- Specified by:
setSize
in interfaceSizablePageItem
- Parameters:
width
- the new width of the itemheight
- the new height of the item
-
getOpacity
public float getOpacity()
Returns the opacity (alpha) for the tile.- Specified by:
getOpacity
in interfaceOpacityStyle
- Returns:
- the opacity
-
setOpacity
public void setOpacity(float opacity)
Set the opacity (alpha) of the tile.- Specified by:
setOpacity
in interfaceOpacityStyle
- Parameters:
opacity
- the opacity to set
-
getOutlineColor
public java.awt.Color getOutlineColor()
Description copied from interface:OutlineStyle
Returns the color used to draw the outline.- Specified by:
getOutlineColor
in interfaceOutlineStyle
- Returns:
- the outline color
-
setOutlineColor
public void setOutlineColor(java.awt.Color borderColor)
Description copied from interface:OutlineStyle
Sets the color used to draw the outline.- Specified by:
setOutlineColor
in interfaceOutlineStyle
- Parameters:
borderColor
- the outline color
-
getOutlineWidth
public float getOutlineWidth()
Description copied from interface:OutlineStyle
Returns the width, in points, of the outline.- Specified by:
getOutlineWidth
in interfaceOutlineStyle
- Returns:
- the outline line width
-
setOutlineWidth
public void setOutlineWidth(float borderWidth)
Description copied from interface:OutlineStyle
Sets the width, in points, of the outline.- Specified by:
setOutlineWidth
in interfaceOutlineStyle
- Parameters:
borderWidth
- the outline width
-
getOutlineDashPattern
public DashPattern getOutlineDashPattern()
Description copied from interface:OutlineStyle
Returns the dash pattern used to draw the outline.- Specified by:
getOutlineDashPattern
in interfaceOutlineStyle
- Returns:
- the dash pattern for the outline
-
setOutlineDashPattern
public void setOutlineDashPattern(DashPattern pat)
Description copied from interface:OutlineStyle
Sets the dash pattern used to draw the outline.- Specified by:
setOutlineDashPattern
in interfaceOutlineStyle
- Parameters:
pat
- the dash pattern type
-
getOutlineJoin
public LineJoin getOutlineJoin()
Description copied from interface:OutlineStyle
Returns the method used to join the line segments that make up the outline.- Specified by:
getOutlineJoin
in interfaceOutlineStyle
- Returns:
- the line joining method
-
setOutlineJoin
public void setOutlineJoin(LineJoin join)
Description copied from interface:OutlineStyle
Sets the method used to join the line segments that make up the outline.- Specified by:
setOutlineJoin
in interfaceOutlineStyle
- Parameters:
join
- the line joining method
-
setOutlineCap
public void setOutlineCap(LineCap cap)
Description copied from interface:OutlineStyle
Sets the line cap style used on outline ends.- Specified by:
setOutlineCap
in interfaceOutlineStyle
- Parameters:
cap
- the line cap type
-
getOutlineCap
public LineCap getOutlineCap()
Description copied from interface:OutlineStyle
Returns the line cap style used on outline ends.- Specified by:
getOutlineCap
in interfaceOutlineStyle
- Returns:
- the line cap style
-
setX
public void setX(double x)
Description copied from interface:PageItem
Set the x-location of this item.- Specified by:
setX
in interfacePageItem
- Overrides:
setX
in classAbstractItem
- Parameters:
x
- the new x-location
-
setY
public void setY(double y)
Description copied from interface:PageItem
Set the y-location of this item.- Specified by:
setY
in interfacePageItem
- Overrides:
setY
in classAbstractItem
- Parameters:
y
- the new y-location
-
paint
public void paint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)
Description copied from interface:PageItem
Paint this item at its current location. The graphics context will be scaled so that 1 unit represents 1 point. The resolution hint is a suggestion as to the resolution the item should be rendered at if it must be converted to a bitmap before being drawn. It may or may not represent the actual resolution of the output target.
-
writeImpl
protected void writeImpl(java.io.ObjectOutputStream out) throws java.io.IOException
-
-