Package javax.print.attribute.standard

Examples of javax.print.attribute.standard.Copies


     * verifyAttributeValue(Object attribute, Class interfaceName) method testing.
     * Tests that method returns object downcasted to type Attribute and no
     * exception is thown if arguments are valid.
     */
    public final void testVerifyAttributeValue() {
        PrintJobAttribute att = new Copies(10);
        assertEquals(att,
            AttributeSetUtilities.
                verifyAttributeValue(att, PrintJobAttribute.class));
        assertEquals(att,
                AttributeSetUtilities.
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

        for (int i = 0; i < requestAttrs.length; i++) {
            Class category = requestAttrs[i].getCategory();
            if (!isAttributeValueSupported(requestAttrs[i], flavor, attrs)) {
                // Do nothing or throw PrintException if Fidelity supported.
            } else if (category.equals(Copies.class)) {
                Copies copies = (Copies)requestAttrs[i];
                printAttributes[COPIES_INDEX] = copies.getValue();
            } else if (category.equals(Sides.class)) {
                Sides sides = (Sides)requestAttrs[i];
                printAttributes[SIDES_INDEX] = 1;
                if (sides.equals(Sides.DUPLEX) ||
                    sides.equals(Sides.TWO_SIDED_LONG_EDGE)) {
View Full Code Here

    /*
     * hashCode() method testing. Tests that hash code is just this integer
     * attribute's integer value.
     */
    public final void testHashCode2() {
        is1 = new Copies(5);
        is2 = new NumberUp(5);
        assertTrue(is1.hashCode() == 5);
        assertTrue(is2.hashCode() == 5);
        assertTrue(is1.hashCode() == is2.hashCode());
    }
View Full Code Here

    /*
     * equals(Object object) method testing. Tests if two IntegerSyntax
     * objects are equal equals() return true.
     */
    public final void testEquals() {
        is1 = new Copies(99);
        is2 = new Copies(99);
        assertTrue(is1.equals(is2));
    }
View Full Code Here

    /*
     * equals(Object object) method testing. Tests if two IntegerSyntax
     * objects aren't equal equals() return false.
     */
    public final void testEquals1() {
        is1 = new Copies(99);
        is2 = new NumberUp(99);
        assertFalse(is1.equals(is2));

        is2 = null;
        assertFalse(is1.equals(is2));
View Full Code Here

            int value = (firstUse && attrs.containsKey(Copies.class
                        ? ((Copies) (attrs.get(Copies.class))).getValue() 
                        : ((Integer) cpSpinner.getValue()).intValue());
            CopiesSupported supported = (CopiesSupported) myService
                    .getSupportedAttributeValues(Copies.class, flavor, attrs);
            Copies defaul = (Copies)
                    myService.getDefaultAttributeValue(Copies.class);
           
            if(supported == null) {
                /*
                 * It is incorrect situation, however it is possible: Copies
                 * category is supported, but there are no supported values. I
                 * suppose that only default Copies value is supported in this
                 * case. If default Copies value is null - I suppose that default
                 * and supported value is 1 Copy only.
                */
                supported = new CopiesSupported( (defaul == null)
                        ? defaul.getValue()
                        : 1);
            }
           
            int [][] range = supported.getMembers();
           
            if (!supported.contains(value)) {
                value = (((defaul == null)
                                || (!supported.contains(defaul.getValue())))
                        ? range[0][0]
                        : defaul.getValue());
            }
           
            cpSpinner.setModel(
                    new SpinnerNumberModel(value, range[0][0], range[0][1], 1));
        }
View Full Code Here

    */
    private void updateCopies() {
        if (cpSpinner.isEnabled()) {
            int copiesValue = ((SpinnerNumberModel)
                    (cpSpinner.getModel())).getNumber().intValue();
            newAttrs.add(new Copies(copiesValue));
        } else {
            removeAttribute(Copies.class);
        }
    }
View Full Code Here

    public void setJobName(String jobName) {
        attrs.add(new JobName(jobName, Locale.getDefault()));
    }

    public void setCopies(int copies) {
        attrs.add(new Copies(copies));
    }
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

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.