Class TuckBox
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.item.AbstractItem
-
- ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
-
- ca.cgjennings.apps.arkham.deck.item.TuckBox
-
- All Implemented Interfaces:
EditablePageItem
,FlippablePageItem
,PageItem
,java.io.Serializable
,java.lang.Cloneable
public final class TuckBox extends AbstractFlippableItem implements EditablePageItem
The tuck box item is used to create tuck boxes (or other fold-up boxes). It also supports the registration ofTuckBox.BoxSizer
s, which assist the user in creating boxes of the right size for a particular application.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TuckBox.BoxSizer
A sizing tool for a particular type of component.static class
TuckBox.BoxType
An enumeration of the supported box designs.static class
TuckBox.SimpleDepthwiseSizer
An implementation ofTuckBox.BoxSizer
that has a fixed width and height but varies in depth according to the number of components the box will contain.static class
TuckBox.SimpleHeightwiseSizer
An implementation ofTuckBox.BoxSizer
that has a fixed width and depth but varies in height according to the number of components the box will contain.-
Nested classes/interfaces inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
PageItem.SnapClass, PageItem.SnapTarget
-
-
Field Summary
-
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 TuckBox()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginEditing()
static TuckBox.BoxSizer[]
getBoxSizers()
Returns a copy of the current set of standard box sizers as an array.TuckBox.BoxType
getBoxType()
double[]
getDimensions()
java.awt.Color
getExteriorFill()
java.awt.Color
getFoldColour()
double
getHeight()
Return the height of this item, in points.java.awt.Color
getInteriorFill()
java.awt.Color
getLineColor()
float
getLineThickness()
java.lang.String
getName()
Return the user-friendly short name of this item.javax.swing.Icon
getThumbnailIcon()
Returns a small representative icon for this item.double
getWidth()
Return the width of this item, in points.boolean
hasFoldLines()
boolean
hasHingeCut()
boolean
hasRoundedSideFlaps()
boolean
isThumbNotched()
void
paint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)
Paint this item at its current location.protected void
readImpl(java.io.ObjectInputStream in)
static void
registerBoxSizer(TuckBox.BoxSizer sizer)
Registers a new sizer, adding it to the set of standard box sizing helpers.void
setBoxType(TuckBox.BoxType type)
void
setDimensions(double width, double height, double depth)
void
setExteriorFill(java.awt.Color exteriorFill)
void
setFoldColour(java.awt.Color foldColour)
void
setFoldLines(boolean foldLines)
void
setHingeCut(boolean hingeCut)
void
setInteriorFill(java.awt.Color interiorFill)
void
setLineColour(java.awt.Color lineColour)
void
setLineThickness(float points)
void
setRoundedSideFlaps(boolean roundedSideFlaps)
void
setThumbNotched(boolean thumbNotch)
protected void
writeImpl(java.io.ObjectOutputStream out)
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
flip, getOrientation, setOrientation, turnLeft, turnRight
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractItem
clone, customizePopupMenu, getBleedMargin, getClassesSnappedTo, getClientProperty, getDragHandles, getFoldMarks, getGroup, getLocation, getOutline, getPage, getRectangle, getSnapClass, getSnapTarget, getX, getY, hasExteriorHandles, hitTest, isBleedMarginMarked, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, itemChanged, itemChanging, prepareToPaint, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget, setX, setY, 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, getBleedMargin, getClassesSnappedTo, getClientProperty, getDragHandles, getFoldMarks, getGroup, getLocation, getOutline, getPage, getRectangle, getSnapClass, getSnapTarget, getX, getY, hasExteriorHandles, hitTest, isBleedMarginMarked, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, prepareToPaint, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget, setX, setY
-
-
-
-
Method Detail
-
registerBoxSizer
public static void registerBoxSizer(TuckBox.BoxSizer sizer)
Registers a new sizer, adding it to the set of standard box sizing helpers. Ifsizer
has already been added, nothing happens. Otherwise, the new sizer is added to the set of helpers that is returned bygetBoxSizers()
.- Parameters:
sizer
- a sizing helper to add to the standard list of helpers- Throws:
java.lang.NullPointerException
- ifsizer
isnull
-
getBoxSizers
public static TuckBox.BoxSizer[] getBoxSizers()
Returns a copy of the current set of standard box sizers as an array.- Returns:
- an array of the current standard box sizing helpers
-
getName
public java.lang.String getName()
Description copied from interface:PageItem
Return the user-friendly short name of this item.
-
getHeight
public double getHeight()
Description copied from interface:PageItem
Return the height of this item, in points.- Specified by:
getHeight
in interfacePageItem
- Specified by:
getHeight
in classAbstractItem
- Returns:
- the item's height
-
getWidth
public double getWidth()
Description copied from interface:PageItem
Return the width of this item, in points.- Specified by:
getWidth
in interfacePageItem
- Specified by:
getWidth
in classAbstractItem
- Returns:
- the item's width
-
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
- Specified by:
getThumbnailIcon
in classAbstractItem
-
setDimensions
public void setDimensions(double width, double height, double depth)
-
getDimensions
public double[] getDimensions()
-
setBoxType
public void setBoxType(TuckBox.BoxType type)
-
getBoxType
public TuckBox.BoxType getBoxType()
-
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.- Specified by:
paint
in interfacePageItem
- Specified by:
paint
in classAbstractItem
- Parameters:
g
- the graphics context to paint totarget
- the type of destination being drawn torenderResolutionHint
- a source resolution hint
-
beginEditing
public void beginEditing()
- Specified by:
beginEditing
in interfaceEditablePageItem
-
setLineThickness
public void setLineThickness(float points)
-
getLineThickness
public float getLineThickness()
-
isThumbNotched
public boolean isThumbNotched()
-
setThumbNotched
public void setThumbNotched(boolean thumbNotch)
-
getInteriorFill
public java.awt.Color getInteriorFill()
-
setInteriorFill
public void setInteriorFill(java.awt.Color interiorFill)
-
getExteriorFill
public java.awt.Color getExteriorFill()
-
setExteriorFill
public void setExteriorFill(java.awt.Color exteriorFill)
-
getLineColor
public java.awt.Color getLineColor()
-
setLineColour
public void setLineColour(java.awt.Color lineColour)
-
hasRoundedSideFlaps
public boolean hasRoundedSideFlaps()
-
setRoundedSideFlaps
public void setRoundedSideFlaps(boolean roundedSideFlaps)
-
hasHingeCut
public boolean hasHingeCut()
-
setHingeCut
public void setHingeCut(boolean hingeCut)
-
getFoldColour
public java.awt.Color getFoldColour()
-
setFoldColour
public void setFoldColour(java.awt.Color foldColour)
-
hasFoldLines
public boolean hasFoldLines()
-
setFoldLines
public void setFoldLines(boolean foldLines)
-
writeImpl
protected void writeImpl(java.io.ObjectOutputStream out) throws java.io.IOException
- Overrides:
writeImpl
in classAbstractFlippableItem
- Throws:
java.io.IOException
-
readImpl
protected void readImpl(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Overrides:
readImpl
in classAbstractFlippableItem
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-