From c4155ddb79f84fadcb26bc4100c545d43d0909f0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 18 Nov 2016 13:10:21 -0500 Subject: [PATCH] Hatch printer-options continued Signed-off-by: Bill Erickson --- src/org/evergreen_ils/hatch/PrintManager.java | 56 ++++++++++++++++++--------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/org/evergreen_ils/hatch/PrintManager.java b/src/org/evergreen_ils/hatch/PrintManager.java index b0afe855fd..c751ca4fe2 100644 --- a/src/org/evergreen_ils/hatch/PrintManager.java +++ b/src/org/evergreen_ils/hatch/PrintManager.java @@ -337,60 +337,78 @@ public class PrintManager { if (printer == null) return null; JSONObject options = new JSONObject(); - PrinterAttributes printerAttrs = printer.getPrinterAttributes(); - Set papers = printerAttrs.getSupportedPapers(); JSONArray papersArray = new JSONArray(); - for (Paper source : papers) { + for (Paper source : printerAttrs.getSupportedPapers()) { papersArray.put(source.getName()); } options.put("paper", papersArray); + options.put("defaultPaper", + printerAttrs.getDefaultPaper().getName()); - Set paperSources = - printerAttrs.getSupportedPaperSources(); JSONArray paperSourcesArray = new JSONArray(); - for (PaperSource source : paperSources) { + for (PaperSource source : + printerAttrs.getSupportedPaperSources()) { paperSourcesArray.put(source.getName()); } options.put("paperSource", papersArray); + options.put("defaultPaperSource", + printerAttrs.getDefaultPaperSource().getName()); - - Set collations = printerAttrs.getSupportedCollations(); JSONArray collationsArray = new JSONArray(); - for (Collation collation : collations) { + for (Collation collation : + printerAttrs.getSupportedCollations()) { collationsArray.put(collation.toString()); } options.put("collation", collationsArray); + options.put("defaultCollation", + printerAttrs.getDefaultCollation().toString()); - Set colors = printerAttrs.getSupportedPrintColors(); JSONArray colorsArray = new JSONArray(); - for (PrintColor color : colors) { + for (PrintColor color : + printerAttrs.getSupportedPrintColors()) { colorsArray.put(color.toString()); } options.put("printColor", colorsArray); + options.put("defaultPrintColor", + printerAttrs.getDefaultPrintColor().toString()); - Set qualities = printerAttrs.getSupportedPrintQuality(); JSONArray qualityArray = new JSONArray(); - for (PrintQuality quality : qualities) { + for (PrintQuality quality : + printerAttrs.getSupportedPrintQuality()) { qualityArray.put(quality.toString()); } options.put("printQuality", qualityArray); + options.put("defaultPrintQuality", + printerAttrs.getDefaultPrintQuality().toString()); - Set sides = printerAttrs.getSupportedPrintSides(); JSONArray sidesArray = new JSONArray(); - for (PrintSides side : sides) { + for (PrintSides side : printerAttrs.getSupportedPrintSides()) { sidesArray.put(side.toString()); } - options.put("printSides", qualityArray); + options.put("printSides", sidesArray); + options.put("defaultPrintSides", + printerAttrs.getDefaultPrintSides().toString()); - Set orients = - printerAttrs.getSupportedPageOrientations(); JSONArray orientsArray = new JSONArray(); - for (PageOrientation orient : orients) { + for (PageOrientation orient : + printerAttrs.getSupportedPageOrientations()) { orientsArray.put(orient.toString()); } options.put("pageOrientation", orientsArray); + options.put("defaultPageOrientation", + printerAttrs.getDefaultPageOrientation().toString()); + + JSONArray marginsArray = new JSONArray(); + for (Printer.MarginType margin : Printer.MarginType.values()) { + marginsArray.put(margin.toString()); + } + options.put("marginType", marginsArray); + options.put("defaultMarginType", Printer.MarginType.DEFAULT); + + options.put("supportsPageRanges", printerAttrs.supportsPageRanges()); + options.put("defaultCopies", printerAttrs.getDefaultCopies()); return options; } -- 2.11.0