/*
 * This file (TestableZebraLabelPrinter.java) is part of DebGen-LabelPrintLib  developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 *  Copyright ASTRID Research, Hungary, 2010.
 *
 *  ASTRID Research
 *  Headquaters: Csapó utca 42. Debrecen H-4029 HUNGARY
 *  Phone: +36-52-533-173        Fax: +36-52-533-174
 *  Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DEBGEN-Biobank-Project.
 * File last modified at 2010.01.12 11:02
 */
package hu.astrid.debgen.labelprint.printer;

import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.AttributeSet;

/**
 * Created by IntelliJ IDEA.
 * User: inagy
 * Date: Jan 12, 2010
 * Time: 11:02:18 AM
 */
public class TestableZebraLabelPrinter extends ZebraLabelPrinter {

    interface PrintServicesFactory {

        PrintService[] lookupPrintServices(DocFlavor docFlavor, AttributeSet attributeSet);
    }
    private final PrintServicesFactory DEFAULT_PRINTSERVICES_FACTORY = new PrintServicesFactory() {
     /**
     * Implements PrintServicesFactory
     */
        @Override
        public PrintService[] lookupPrintServices(DocFlavor docFlavor, AttributeSet attributeSet) {
            return PrintServiceLookup.lookupPrintServices(docFlavor, attributeSet);
        }
    };
    /**
     * printServicesFactory.
     */
    private PrintServicesFactory printServicesFactory = DEFAULT_PRINTSERVICES_FACTORY;

    /**
     * Sets printServicesFactory.
     * @param printServicesFactory
     */
    void setPrintServicesFactory(PrintServicesFactory printServicesFactory) {
        this.printServicesFactory = printServicesFactory;
    }

    /**
     * Return printservices.
     */
    @Override
    protected PrintService[] getPrintServices() {
        return printServicesFactory.lookupPrintServices(null, null);
    }
}
