Package ca.cgjennings.apps.arkham.sheet
Enum FinishStyle
- java.lang.Object
-
- java.lang.Enum<FinishStyle>
-
- ca.cgjennings.apps.arkham.sheet.FinishStyle
-
- All Implemented Interfaces:
IconProvider
,java.io.Serializable
,java.lang.Comparable<FinishStyle>
public enum FinishStyle extends java.lang.Enum<FinishStyle> implements IconProvider
Collapses the set of possible finish options into a collection of simple choices for users to choose from.- Since:
- 3.3
- Author:
- Henrik Rostedt, Chris Jennings
-
-
Enum Constant Summary
Enum Constants Enum Constant Description MARGIN
Include a bleed margin.ROUND
Cut rounded corners if specified by the sheet, otherwise this is the same asSQUARE
.SQUARE
Use square corners with no bleed margin.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
applyPreviewStyleToSheet(Sheet<?> s)
Applies the default style for image previews to the sheet.void
applyTo(Sheet<?> target)
Applies this setting to a sheet.void
applyTo(Sheet<?> target, double marginSize)
Applies this setting to a sheet.static FinishStyle
fromSetting(java.lang.String v)
Convert a setting value to a finish style, returning a default value if the setting key is missing or malformed.static FinishStyle
fromSheet(Sheet<?> s)
Given a sheet, converts its user bleed margin into a matching finish style.javax.swing.Icon
getIcon()
Returns an icon representing this style.static FinishStyle
getPreviewStyle()
Returns the current finish style for image previews from user settings.double
getSuggestedBleedMargin()
Returns the suggested user bleed margin for this setting.void
setAsPreviewStyle()
Updates user settings with a new finish style for image previews.java.lang.String
toSetting()
Convert this to a setting value.java.lang.String
toString()
Returns a localized description of the finish.static FinishStyle
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FinishStyle[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ROUND
public static final FinishStyle ROUND
Cut rounded corners if specified by the sheet, otherwise this is the same asSQUARE
.
-
SQUARE
public static final FinishStyle SQUARE
Use square corners with no bleed margin.
-
MARGIN
public static final FinishStyle MARGIN
Include a bleed margin.
-
-
Method Detail
-
values
public static FinishStyle[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FinishStyle c : FinishStyle.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FinishStyle valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
applyTo
public void applyTo(Sheet<?> target)
Applies this setting to a sheet. If a bleed margin is requested, applies the default preview bleed margin size.- Parameters:
target
- the non-null sheet to apply this option to
-
applyTo
public void applyTo(Sheet<?> target, double marginSize)
Applies this setting to a sheet. If a bleed margin is requested, applies the the specified margin size.- Parameters:
target
- the non-null sheet to apply this option to
-
getSuggestedBleedMargin
public double getSuggestedBleedMargin()
Returns the suggested user bleed margin for this setting.- Returns:
- the user bleed margin to use for this option, or a suggested
margin for type
MARGIN
.
-
toSetting
public java.lang.String toSetting()
Convert this to a setting value.- Returns:
- a suitable setting value
-
fromSetting
public static FinishStyle fromSetting(java.lang.String v)
Convert a setting value to a finish style, returning a default value if the setting key is missing or malformed. The setting is decoded by matching against the declared constant name, ignoring case leading/trailing space.- Parameters:
v
- the setting value to decode- Returns:
- the decoded setting value
-
fromSheet
public static FinishStyle fromSheet(Sheet<?> s)
Given a sheet, converts its user bleed margin into a matching finish style.- Parameters:
s
- the non-null sheet to read- Returns:
- the sheet's finish style
-
getIcon
public javax.swing.Icon getIcon()
Returns an icon representing this style.- Specified by:
getIcon
in interfaceIconProvider
- Returns:
- a UI icon for the style
-
applyPreviewStyleToSheet
public static void applyPreviewStyleToSheet(Sheet<?> s)
Applies the default style for image previews to the sheet.- Parameters:
s
- the sheet to set the user-selected style upon
-
setAsPreviewStyle
public void setAsPreviewStyle()
Updates user settings with a new finish style for image previews.
-
getPreviewStyle
public static FinishStyle getPreviewStyle()
Returns the current finish style for image previews from user settings.- Returns:
- the user-selected finish style
-
toString
public java.lang.String toString()
Returns a localized description of the finish.- Overrides:
toString
in classjava.lang.Enum<FinishStyle>
- Returns:
- a non-null localized string
-
-