de.caff.util.settings

## Class PrintRequestProperties

- java.lang.Object
- - javax.print.attribute.HashAttributeSet
  - - javax.print.attribute.HashPrintRequestAttributeSet
    - - de.caff.util.settings.PrintRequestProperties

- All Implemented Interfaces:
    java.io.Serializable, javax.print.attribute.AttributeSet, javax.print.attribute.PrintRequestAttributeSet

      public class PrintRequestProperties
      extends javax.print.attribute.HashPrintRequestAttributeSet

  The Java printing interface is cluttered and fails to fulfill all wishes. This is a try at a class which stores the print settings in the preferences so they are restored on the next read.

  Because of the uninspired interface of the `javax.print.attribute.EnumSyntax` class it is necessary that several inner classes extend specific `EnumSyntax` classes from the `javax.print.attribute.standard` package here to get access to their enum values. This allows to access all values and be save for future changes. But some of the `EnumSyntax` are declared final, in which case we have to copy their values to access them and hope that they will never be extended.

  Author:
    Rammi
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `PrintRequestProperties.EnumAttributeFinder` Interface for finders of enum values.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static javax.print.attribute.standard.Chromaticity[]` | `CHROMATICITY_VALUES` Possible values for chromaticity because some clever guy made the class final so we cannot use our standard method on accessing enum values.
    `static PrintRequestProperties.EnumAttributeFinder` | `JOB_SHEETS_FINDER` Accessor class for job sheets.
    `static PrintRequestProperties.EnumAttributeFinder[]` | `MEDIA_FINDER` Accessor classes for media.
    `static javax.print.attribute.standard.OrientationRequested[]` | `ORIENTATION_VALUES` Possible values for orientation because some clever guy made the class final so we cannot use our standard method on accessing enum values.
    `static java.lang.String` | `PREF_KEY_CHROMATICITY` Preference key for chromaticity.
    `static java.lang.String` | `PREF_KEY_EXT_CLASS` The extension used for the class of an attribute.
    `static java.lang.String` | `PREF_KEY_JOB_SHEETS` Preference key for job sheets.
    `static java.lang.String` | `PREF_KEY_MEDIA` Preferences key for media.
    `static java.lang.String` | `PREF_KEY_MEDIA_PRINTABLE_AREA_HEIGHT` Preferences key for media size height.
    `static java.lang.String` | `PREF_KEY_MEDIA_PRINTABLE_AREA_WIDTH` Preferences key for media size width.
    `static java.lang.String` | `PREF_KEY_MEDIA_PRINTABLE_AREA_X` Preferences key for media size x.
    `static java.lang.String` | `PREF_KEY_MEDIA_PRINTABLE_AREA_Y` Preferences key for media size y.
    `static java.lang.String` | `PREF_KEY_ORIENTATION` Preference key for orientation.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PrintRequestProperties()` Construct a new, empty print request attribute set.
    `PrintRequestProperties(java.util.prefs.Preferences preferences)` Construct a new print request attribute set, trying to restore it from the preferences.
    `PrintRequestProperties(javax.print.attribute.PrintRequestAttribute attribute)` Construct a new print request attribute set, initially populated with the given value.
    `PrintRequestProperties(javax.print.attribute.PrintRequestAttribute[] attributes)` Construct a new print request attribute set, initially populated with the values from the given array.
    `PrintRequestProperties(javax.print.attribute.PrintRequestAttributeSet attributes)` Construct a new attribute set, initially populated with the values from the given set where the members of the attribute set are restricted to the `(PrintRequestAttributeSe` interface.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `loadFrom(java.util.prefs.Preferences preferences)` Load some of the preferences from the preferences.
    `void` | `storeTo(java.util.prefs.Preferences preferences)` Save some of the preferences to the preferences.
    `java.lang.String` | `toString()` Returns a string representation of the object.

    - ### Methods inherited from class javax.print.attribute.HashAttributeSet

      `add, addAll, clear, containsKey, containsValue, equals, get, hashCode, isEmpty, remove, remove, size, toArray`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface javax.print.attribute.PrintRequestAttributeSet

      `add, addAll`

    - ### Methods inherited from interface javax.print.attribute.AttributeSet

      `clear, containsKey, containsValue, equals, get, hashCode, isEmpty, remove, remove, size, toArray`

- - ### Field Detail

    - #### PREF_KEY_EXT_CLASS

          public static final java.lang.String PREF_KEY_EXT_CLASS

      The extension used for the class of an attribute.
      See Also:
        Constant Field Values

    - #### PREF_KEY_MEDIA

          public static final java.lang.String PREF_KEY_MEDIA

      Preferences key for media.
      See Also:
        Constant Field Values

    - #### MEDIA_FINDER

          public static final PrintRequestProperties.EnumAttributeFinder[] MEDIA_FINDER

      Accessor classes for media.

    - #### PREF_KEY_MEDIA_PRINTABLE_AREA_X

          public static final java.lang.String PREF_KEY_MEDIA_PRINTABLE_AREA_X

      Preferences key for media size x.
      See Also:
        Constant Field Values

    - #### PREF_KEY_MEDIA_PRINTABLE_AREA_Y

          public static final java.lang.String PREF_KEY_MEDIA_PRINTABLE_AREA_Y

      Preferences key for media size y.
      See Also:
        Constant Field Values

    - #### PREF_KEY_MEDIA_PRINTABLE_AREA_WIDTH

          public static final java.lang.String PREF_KEY_MEDIA_PRINTABLE_AREA_WIDTH

      Preferences key for media size width.
      See Also:
        Constant Field Values

    - #### PREF_KEY_MEDIA_PRINTABLE_AREA_HEIGHT

          public static final java.lang.String PREF_KEY_MEDIA_PRINTABLE_AREA_HEIGHT

      Preferences key for media size height.
      See Also:
        Constant Field Values

    - #### PREF_KEY_JOB_SHEETS

          public static final java.lang.String PREF_KEY_JOB_SHEETS

      Preference key for job sheets.
      See Also:
        Constant Field Values

    - #### JOB_SHEETS_FINDER

          public static final PrintRequestProperties.EnumAttributeFinder JOB_SHEETS_FINDER

      Accessor class for job sheets.

    - #### PREF_KEY_CHROMATICITY

          public static final java.lang.String PREF_KEY_CHROMATICITY

      Preference key for chromaticity.
      See Also:
        Constant Field Values

    - #### CHROMATICITY_VALUES

          public static final javax.print.attribute.standard.Chromaticity[] CHROMATICITY_VALUES

      Possible values for chromaticity because some clever guy made the class final so we cannot use our standard method on accessing enum values.

    - #### PREF_KEY_ORIENTATION

          public static final java.lang.String PREF_KEY_ORIENTATION

      Preference key for orientation.
      See Also:
        Constant Field Values

    - #### ORIENTATION_VALUES

          public static final javax.print.attribute.standard.OrientationRequested[] ORIENTATION_VALUES

      Possible values for orientation because some clever guy made the class final so we cannot use our standard method on accessing enum values.

  - ### Constructor Detail

    - #### PrintRequestProperties

          public PrintRequestProperties()

      Construct a new, empty print request attribute set.

    - #### PrintRequestProperties

          public PrintRequestProperties(@Nullable
                                        java.util.prefs.Preferences preferences)

      Construct a new print request attribute set, trying to restore it from the preferences.
      Parameters:
        `preferences` - preferences object to restore from
      See Also:
        `loadFrom(java.util.prefs.Preferences)`

    - #### PrintRequestProperties

          public PrintRequestProperties(javax.print.attribute.PrintRequestAttribute attribute)

      Construct a new print request attribute set, initially populated with the given value.
      Parameters:
        `attribute` - Attribute value to add to the set.
      Throws:
        `java.lang.NullPointerException` - (unchecked exception) Thrown if `attribute` is null.

    - #### PrintRequestProperties

          public PrintRequestProperties(javax.print.attribute.PrintRequestAttribute[] attributes)

      Construct a new print request attribute set, initially populated with the values from the given array. The new attribute set is populated by adding the elements of `attributes` array to the set in sequence, starting at index 0. Thus, later array elements may replace earlier array elements if the array contains duplicate attribute values or attribute categories.
      Parameters:
        `attributes` - Array of attribute values to add to the set. If null, an empty attribute set is constructed.
      Throws:
        `java.lang.NullPointerException` - (unchecked exception) Thrown if any element of `attributes` is null.

    - #### PrintRequestProperties

          public PrintRequestProperties(javax.print.attribute.PrintRequestAttributeSet attributes)

      Construct a new attribute set, initially populated with the values from the given set where the members of the attribute set are restricted to the `(PrintRequestAttributeSe` interface.
      Parameters:
        `attributes` - set of attribute values to initialise the set. If null, an empty attribute set is constructed.
      Throws:
        `java.lang.ClassCastException` - (unchecked exception) Thrown if any element of `attributes` is not an instance of `(PrintRequestAttributeSe`.

  - ### Method Detail

    - #### storeTo

          public void storeTo(java.util.prefs.Preferences preferences)

      Save some of the preferences to the preferences. The interface is too cluttered to store all settings without getting headaches.
      Parameters:
        `preferences` - preferences to store the settings
      See Also:
        `loadFrom(java.util.prefs.Preferences)`

    - #### loadFrom

          public void loadFrom(java.util.prefs.Preferences preferences)

      Load some of the preferences from the preferences. The interface is too cluttered to store all settings without getting headaches.
      Parameters:
        `preferences` - preferences to load the settings
      See Also:
        `storeTo(java.util.prefs.Preferences)`

    - #### toString

          public java.lang.String toString()

      Returns a string representation of the object.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the object.