List of usage examples for javax.print.attribute PrintRequestAttributeSet containsKey
public boolean containsKey(Class<?> category);
From source file:org.pentaho.reporting.engine.classic.extensions.modules.java14print.Java14PrintUtil.java
/** * This tests, whether the given attribute set defines the same page properties as the given JFreeReport object. * <p/>//from w w w. ja va 2 s . c o m * While showing the print dialog, the user has the chance to alter the page format of the print job. When that * happens, we have to repaginate the whole report, which may render the users page range input invalid. In that case, * we will have to redisplay the dialog. * * @param attributes * @param report * @return */ public static int isValidConfiguration(final PrintRequestAttributeSet attributes, final MasterReport report) { final PrintRequestAttributeSet reportAttributes = copyConfiguration(null, report); // now, compare that minimal set with the given attribute collection. final Attribute[] printAttribs = reportAttributes.toArray(); boolean invalidConfig = false; for (int i = 0; i < printAttribs.length; i++) { final Attribute attrib = printAttribs[i]; if (attributes.containsValue(attrib) == false) { invalidConfig = true; break; } } if (invalidConfig == false) { return CONFIGURATION_VALID; } if (attributes.containsKey(PageRanges.class)) { return CONFIGURATION_SHOW_DIALOG; } return CONFIGURATION_REPAGINATE; }
From source file:org.pentaho.reporting.engine.classic.extensions.modules.java14print.Java14PrintUtil.java
public static PrintRequestAttributeSet copyAuxillaryAttributes(PrintRequestAttributeSet attributes, final MasterReport report) { if (attributes == null) { attributes = new HashPrintRequestAttributeSet(); }/* w w w .j a v a 2 s.c o m*/ if (attributes.containsKey(JobName.class) == false) { final String jobName = report.getReportConfiguration().getConfigProperty(PrintUtil.PRINTER_JOB_NAME_KEY, report.getTitle()); if (jobName != null) { attributes.add(new JobName(jobName, null)); } } if (attributes.containsKey(Copies.class) == false) { final int numberOfCopies = PrintUtil.getNumberOfCopies(report.getReportConfiguration()); attributes.add(new Copies(numberOfCopies)); } return attributes; }