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.BoxSizers, 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 interfaceTuckBox.BoxSizerA sizing tool for a particular type of component.static classTuckBox.BoxTypeAn enumeration of the supported box designs.static classTuckBox.SimpleDepthwiseSizerAn implementation ofTuckBox.BoxSizerthat has a fixed width and height but varies in depth according to the number of components the box will contain.static classTuckBox.SimpleHeightwiseSizerAn implementation ofTuckBox.BoxSizerthat 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 voidbeginEditing()static TuckBox.BoxSizer[]getBoxSizers()Returns a copy of the current set of standard box sizers as an array.TuckBox.BoxTypegetBoxType()double[]getDimensions()java.awt.ColorgetExteriorFill()java.awt.ColorgetFoldColour()doublegetHeight()Return the height of this item, in points.java.awt.ColorgetInteriorFill()java.awt.ColorgetLineColor()floatgetLineThickness()java.lang.StringgetName()Return the user-friendly short name of this item.javax.swing.IcongetThumbnailIcon()Returns a small representative icon for this item.doublegetWidth()Return the width of this item, in points.booleanhasFoldLines()booleanhasHingeCut()booleanhasRoundedSideFlaps()booleanisThumbNotched()voidpaint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)Paint this item at its current location.protected voidreadImpl(java.io.ObjectInputStream in)static voidregisterBoxSizer(TuckBox.BoxSizer sizer)Registers a new sizer, adding it to the set of standard box sizing helpers.voidsetBoxType(TuckBox.BoxType type)voidsetDimensions(double width, double height, double depth)voidsetExteriorFill(java.awt.Color exteriorFill)voidsetFoldColour(java.awt.Color foldColour)voidsetFoldLines(boolean foldLines)voidsetHingeCut(boolean hingeCut)voidsetInteriorFill(java.awt.Color interiorFill)voidsetLineColour(java.awt.Color lineColour)voidsetLineThickness(float points)voidsetRoundedSideFlaps(boolean roundedSideFlaps)voidsetThumbNotched(boolean thumbNotch)protected voidwriteImpl(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. Ifsizerhas 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- ifsizerisnull
-
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:PageItemReturn the user-friendly short name of this item.
-
getHeight
public double getHeight()
Description copied from interface:PageItemReturn the height of this item, in points.- Specified by:
getHeightin interfacePageItem- Specified by:
getHeightin classAbstractItem- Returns:
- the item's height
-
getWidth
public double getWidth()
Description copied from interface:PageItemReturn the width of this item, in points.- Specified by:
getWidthin interfacePageItem- Specified by:
getWidthin classAbstractItem- Returns:
- the item's width
-
getThumbnailIcon
public javax.swing.Icon getThumbnailIcon()
Description copied from interface:PageItemReturns a small representative icon for this item. The icon should beICON_SIZEpixels wide and high.- Specified by:
getThumbnailIconin interfacePageItem- Specified by:
getThumbnailIconin 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:PageItemPaint 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:
paintin interfacePageItem- Specified by:
paintin 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:
beginEditingin 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:
writeImplin classAbstractFlippableItem- Throws:
java.io.IOException
-
readImpl
protected void readImpl(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException- Overrides:
readImplin classAbstractFlippableItem- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-