com.levigo.jadice.printer
Class PrintEnvironment

java.lang.Object
  extended by com.levigo.jadice.printer.PrintEnvironment

public class PrintEnvironment
extends Object


Field Summary
static String PRINT_ALL
          Configuration setting identifier for print mode: "Print document and annotations"
static String PRINT_ENLARGE_FIT
          Configuration setting identifier for print mode: "Enlarge document to fit into paper size if needed"
static String PRINT_FIT
          Configuration setting identifier for print mode: "Always fit document into paper size"
static String PRINT_ONLY_ANNOTATIONS
          Configuration setting identifier for print mode: "Print only the annotations"
static String PRINT_ONLY_DOCUMENT
          Configuration setting identifier for print mode: "Print only the document"
static String PRINT_ORIG_SIZE
          Configuration setting identifier for print mode: "Print document in original size"
static String PRINT_SHRINK_FIT
          Configuration setting identifier for print mode: "Shrink document to fit into paper size if needed"
 
Constructor Summary
PrintEnvironment()
           
 
Method Summary
static PageFormat createDefaultPageFormat(com.levigo.util.preferences.PreferenceStore ps)
          Returns the default PageFormat.
static LayerSelection findMatchingLayerSelection(Collection<DocumentLayer> layers)
           
static LayerSelection getDefaultLayerSelection()
           
static String getDefaultPrintElement(com.levigo.util.preferences.PreferenceStore ps)
          Retrieves the default print elements.
static String getLastPrintServiceName()
          Returns the last used print service name if available.
static String[] getLastPrintServiceNames()
          Returns all last used print service names if available.
static OutputReferenceBase getOutputReferenceBase(com.levigo.util.preferences.PreferenceStore ps)
          Retrieves the setting for output reference base to manipulate the imageable area of the print output.
static List<DocumentLayer> getRegisteredLayers()
          Returns the list of available layers to be printed based on the preferences.
static Collection<LayerSelection> getRegisteredLayerSelections()
           
static boolean isAnnotationPrintEnabled(com.levigo.util.preferences.PreferenceStore ps)
          Determines whether the annotations should be printed or not.
static boolean isDocumentPrintEnabled(com.levigo.util.preferences.PreferenceStore ps)
          Determines whether the document should be printed or not.
static boolean isEnlargeToPaper(com.levigo.util.preferences.PreferenceStore ps)
          Determines whether pages should be enlarged to fit into paper size.
static boolean isOriginalSize(com.levigo.util.preferences.PreferenceStore ps)
          Determines whether documents should be printed in original size.
static boolean isShrinkToPaper(com.levigo.util.preferences.PreferenceStore ps)
          Determines whether documents should be shrunk to fit into paper size.
static void registerLayer(DocumentLayer layer)
          Registers given layer for printing.
static void registerLayerSelection(LayerSelection layerSelection)
          Registers a LayerSelection.
static void setDefaultAdjusting(com.levigo.util.preferences.PreferenceStore ps, String value)
          Sets the default adjusting method.
static void setDefaultLayerSelection(LayerSelection layerSelection)
          Sets the default layer collection for being printed.
static void setDefaultOutputReferenceBase(com.levigo.util.preferences.PreferenceStore ps, OutputReferenceBase referenceBase)
          Sets the default output reference base.
static void setDefaultPrintElement(com.levigo.util.preferences.PreferenceStore ps, String value)
          Sets the default print elements.
static void setLastPrintServiceName(String lastPrintServiceName)
          Sets the last used print service name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRINT_ALL

public static final String PRINT_ALL
Configuration setting identifier for print mode: "Print document and annotations"

See Also:
Constant Field Values

PRINT_ONLY_DOCUMENT

public static final String PRINT_ONLY_DOCUMENT
Configuration setting identifier for print mode: "Print only the document"

See Also:
Constant Field Values

PRINT_ONLY_ANNOTATIONS

public static final String PRINT_ONLY_ANNOTATIONS
Configuration setting identifier for print mode: "Print only the annotations"

See Also:
Constant Field Values

PRINT_ORIG_SIZE

public static final String PRINT_ORIG_SIZE
Configuration setting identifier for print mode: "Print document in original size"

See Also:
Constant Field Values

PRINT_SHRINK_FIT

public static final String PRINT_SHRINK_FIT
Configuration setting identifier for print mode: "Shrink document to fit into paper size if needed"

See Also:
Constant Field Values

PRINT_ENLARGE_FIT

public static final String PRINT_ENLARGE_FIT
Configuration setting identifier for print mode: "Enlarge document to fit into paper size if needed"

See Also:
Constant Field Values

PRINT_FIT

public static final String PRINT_FIT
Configuration setting identifier for print mode: "Always fit document into paper size"

See Also:
Constant Field Values
Constructor Detail

PrintEnvironment

public PrintEnvironment()
Method Detail

setDefaultAdjusting

public static void setDefaultAdjusting(com.levigo.util.preferences.PreferenceStore ps,
                                       String value)
Sets the default adjusting method. Use one of the following constants:

Parameters:
ps - the preference store that should receive the preference
value - use a constant from the above list

isEnlargeToPaper

public static boolean isEnlargeToPaper(com.levigo.util.preferences.PreferenceStore ps)
Determines whether pages should be enlarged to fit into paper size.

Parameters:
ps - the preference store that contains the preference
Returns:
true if documents should be enlarged to fit into paper size. Otherwise false.

isOriginalSize

public static boolean isOriginalSize(com.levigo.util.preferences.PreferenceStore ps)
Determines whether documents should be printed in original size.

Parameters:
ps - the preference store that contains the preference
Returns:
true if document should be printed in original size. Otherwise false.

isShrinkToPaper

public static boolean isShrinkToPaper(com.levigo.util.preferences.PreferenceStore ps)
Determines whether documents should be shrunk to fit into paper size.

Parameters:
ps - the preference store that contains the preference
Returns:
true if documents should be shrunk to fit into paper size. Otherwise false.

getDefaultPrintElement

public static String getDefaultPrintElement(com.levigo.util.preferences.PreferenceStore ps)
Retrieves the default print elements. The default print mode describes which layer(s) should be printed by default. Possible values are PRINT_ALL, PRINT_ONLY_ANNOTATIONS and PRINT_ONLY_DOCUMENT.

Parameters:
ps - the preference store that contains the preference
Returns:
the default print mode as string.
See Also:
PRINT_ALL, PRINT_ONLY_ANNOTATIONS, PRINT_ONLY_DOCUMENT

setDefaultPrintElement

public static void setDefaultPrintElement(com.levigo.util.preferences.PreferenceStore ps,
                                          String value)
Sets the default print elements. The default print mode describes which layer(s) should be printed by default. Possible values are PRINT_ALL, PRINT_ONLY_ANNOTATIONS and PRINT_ONLY_DOCUMENT.

Parameters:
ps - the preference store that contains the preference
value - use a constant from the above list
See Also:
PRINT_ALL, PRINT_ONLY_ANNOTATIONS, PRINT_ONLY_DOCUMENT

isAnnotationPrintEnabled

public static boolean isAnnotationPrintEnabled(com.levigo.util.preferences.PreferenceStore ps)
Determines whether the annotations should be printed or not.

Parameters:
ps - the preference store that contains the preference
Returns:
true if annotations should be printed.
false if not.
See Also:
getDefaultPrintElement(PreferenceStore)

isDocumentPrintEnabled

public static boolean isDocumentPrintEnabled(com.levigo.util.preferences.PreferenceStore ps)
Determines whether the document should be printed or not.

Parameters:
ps - the preference store that contains the preference
Returns:
true if document should be printed.
false if not.
See Also:
getDefaultPrintElement(PreferenceStore)

getRegisteredLayers

public static List<DocumentLayer> getRegisteredLayers()
Returns the list of available layers to be printed based on the preferences.

Automatically registered layers:

Returns:
the default list of layers to be printed.

registerLayer

public static void registerLayer(DocumentLayer layer)
Registers given layer for printing.

Parameters:
layer - the layer to register.

setDefaultLayerSelection

public static void setDefaultLayerSelection(LayerSelection layerSelection)
Sets the default layer collection for being printed.

Parameters:
layerSelection - the LayerSelection to be used as default.

getDefaultLayerSelection

public static LayerSelection getDefaultLayerSelection()
Returns:
the currently default LayerSelection

registerLayerSelection

public static void registerLayerSelection(LayerSelection layerSelection)
Registers a LayerSelection. All registered LayerSelections can be used while printing.

Parameters:
layerSelection - the LayerSelection to be registered.

getRegisteredLayerSelections

public static Collection<LayerSelection> getRegisteredLayerSelections()
Returns:
all registered LayerSelections can be used while printing.

findMatchingLayerSelection

public static LayerSelection findMatchingLayerSelection(Collection<DocumentLayer> layers)
Parameters:
layers - a collection of layers
Returns:
a best matching registered LayerSelection or null if no match found.

getOutputReferenceBase

public static OutputReferenceBase getOutputReferenceBase(com.levigo.util.preferences.PreferenceStore ps)
Retrieves the setting for output reference base to manipulate the imageable area of the print output.

Parameters:
ps - the preference store that contains the preference
Returns:
the retrieved OutputReferenceBase.
See Also:
OutputReferenceBase

setDefaultOutputReferenceBase

public static void setDefaultOutputReferenceBase(com.levigo.util.preferences.PreferenceStore ps,
                                                 OutputReferenceBase referenceBase)
Sets the default output reference base.

Parameters:
ps - the preference store should receive the given reference base
referenceBase - the reference base preference so store

createDefaultPageFormat

public static PageFormat createDefaultPageFormat(com.levigo.util.preferences.PreferenceStore ps)
Returns the default PageFormat.

If the object wasn't build until now, the method retrieves all required information and builds the default PageFormat. The gathered information will be stored in JadicePreferenceHolder if not done so far.

Parameters:
ps - the preference store that contains the preference
Returns:
the default PageFormat.

getLastPrintServiceName

public static String getLastPrintServiceName()
Returns the last used print service name if available. Access to the print service name stack is synchronized.

Returns:
last used print service name or null if not available.

getLastPrintServiceNames

public static String[] getLastPrintServiceNames()
Returns all last used print service names if available. Access to the print service name stack is synchronized.

Returns:
all last used print service names or null if not available

setLastPrintServiceName

public static void setLastPrintServiceName(String lastPrintServiceName)
Sets the last used print service name. Access to the print service name stack is synchronized.

Parameters:
lastPrintServiceName - last used print service name.
Throws:
IllegalArgumentException - if argument for lastPrintServiceName is null.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.