Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.Copies


    }
    if (attributes.containsKey(Copies.class) == false)
    {
      final int numberOfCopies =
          PrintUtil.getNumberOfCopies(report.getReportConfiguration());
      attributes.add(new Copies(numberOfCopies));
    }

    return attributes;
  }
View Full Code Here


        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        HashDocAttributeSet daset = new HashDocAttributeSet();
        DocPrintJob pj;
        Doc doc;

        aset.add(new Copies(2));
        aset.add(MediaSizeName.ISO_A4);
        daset.add(MediaName.ISO_A4_WHITE);
        daset.add(Sides.TWO_SIDED_LONG_EDGE);

        try {
View Full Code Here

    /*
     * contains(IntegerSyntax attribute) method testing.
     */
    public final void testContains1() {
        IntegerSyntax att1 = new Copies(10);
        IntegerSyntax att2 = new Copies(1);
        set1 = new setOfIntegerSyntax("10, 5-8");
        assertTrue(set1.contains(att1));
        assertFalse(set1.contains(att2));
    }
View Full Code Here

     * exception is thown if arguments are valid.
     */
    public final void testVerifyAttributeValue() {

        try {
            PrintJobAttribute att = new Copies(10);
            assertEquals(att,
                AttributeSetUtilities.
                    verifyAttributeValue(att, PrintJobAttribute.class));
            assertEquals(att,
                    AttributeSetUtilities.
View Full Code Here

}

public void testHashPrintRequestAttributeSet() {
    startTest("HashPrintRequestAttributeSet class testing...");

    Copies copies = new Copies(2);
    PrintRequestAttributeSet set1 = new HashPrintRequestAttributeSet();
    PrintRequestAttributeSet set2 = new HashPrintRequestAttributeSet(copies);
    PrintRequestAttributeSet set3 = new HashPrintRequestAttributeSet(set2);
    PrintRequestAttribute [] arr = {copies,
                                    MediaName.NA_LETTER_WHITE};
    PrintRequestAttributeSet set4 = new HashPrintRequestAttributeSet(arr);
    Attribute [] attrArr = set1.toArray();

    assertTrue(set1.isEmpty());
    assertFalse(set2.isEmpty());
    assertTrue(set3.equals(set2));
    assertFalse(set3.equals(set1));
    set3.clear();
    assertEquals(set3, set1);
    set3.add(copies);
    set3.add(MediaName.NA_LETTER_WHITE);
    assertTrue(set3.containsKey(copies.getClass()));
    assertFalse(set2.containsKey(MediaName.NA_LETTER_WHITE.getClass()));
    assertTrue(set3.containsValue(copies));
    assertFalse(set3.containsValue(OrientationRequested.PORTRAIT));
    assertFalse(set3.containsValue(PrintQuality.DRAFT));
    assertEquals(set1.size(), 0);
    assertEquals(set2.size(), 1);
    assertEquals(set3.size(), 2);
    assertTrue(set4.equals(set3));
    assertEquals(set3.get(copies.getClass()), copies);
    set1.addAll(set3);
    assertEquals(set3, set1);
    set1.remove(copies.getClass());
    assertEquals(set1.size(), 1);
    attrArr = set1.toArray();
    assertEquals(attrArr.length, 1);
    assertEquals(attrArr[0], MediaName.NA_LETTER_WHITE);
}
View Full Code Here

        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        HashDocAttributeSet daset = new HashDocAttributeSet();
        DocPrintJob pj;
        Doc doc;

        aset.add(new Copies(2));
        aset.add(MediaSizeName.ISO_A4);
        daset.add(MediaName.ISO_A4_WHITE);
        daset.add(Sides.TWO_SIDED_LONG_EDGE);

        try {
View Full Code Here

    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
View Full Code Here

        if (printService == null) {
            throw new PrintException("Printer lookup failure. No default printer set up for this host");
        }
        flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
        printRequestAttributeSet = new HashPrintRequestAttributeSet();
        printRequestAttributeSet.add(new Copies(1));
        printRequestAttributeSet.add(MediaSizeName.NA_LETTER);
        printRequestAttributeSet.add(Sides.ONE_SIDED);
    }
View Full Code Here

    }
    if (attributes.containsKey(Copies.class) == false)
    {
      final int numberOfCopies =
          PrintUtil.getNumberOfCopies(report.getReportConfiguration());
      attributes.add(new Copies(numberOfCopies));
    }

    return attributes;
  }
View Full Code Here

                    File.separator + "output.prn");
            return new Destination(file.toURI());
        } else if (category.equals(SheetCollate.class)) {
            return SheetCollate.COLLATED;
        } else if (category.equals(Copies.class)) {
            return new Copies(1);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of javax.print.attribute.standard.Copies

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.