001/*
002 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.  Oracle designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Oracle in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
022 * or visit www.oracle.com if you need additional information or have any
023 * questions.
024 */
025
026package javafx.print;
027
028/**
029 * A PaperSource is the input tray to be used for the Paper.
030 * The enumerated values here cover many of the most common sources,
031 * which may map to platform IDs. However there are also printer specific
032 * tray names which may be in use. So queries of the supported paper
033 * sources may include other values.
034 *
035 * @since JavaFX 8
036 */
037public final class PaperSource {
038
039    /**
040     * Specify to automatically select the tray.
041     */
042    public static final PaperSource AUTOMATIC = new PaperSource("Automatic");
043
044    /**
045     * Specify to select the MAIN tray.
046     */
047    public static final PaperSource MAIN      = new PaperSource("Main");
048
049    /**
050     * Specify to select the MANUAL tray.
051     */
052    public static final PaperSource MANUAL    = new PaperSource("Manual");
053
054    /**
055     * Specify to select the BOTTOM tray.
056     */
057    public static final PaperSource BOTTOM    = new PaperSource("Bottom");
058
059    /**
060     * Specify to select the MIDDLE tray.
061     */
062    public static final PaperSource MIDDLE    = new PaperSource("Middle");
063
064    /**
065     * Specify to select the TOP tray.
066     */
067    public static final PaperSource TOP       = new PaperSource("Top");
068
069    /**
070     * Specify to select the SIDE tray.
071     */
072    public static final PaperSource SIDE      = new PaperSource("Side");
073
074    /**
075     * Specify to select the ENVELOPE tray.
076     */
077    public static final PaperSource ENVELOPE  = new PaperSource("Envelope");
078
079    /**
080     * Specify to select the LARGE_CAPACITY tray.
081     */
082    public static final PaperSource LARGE_CAPACITY =
083        new PaperSource("Large Capacity");
084
085
086    private String name;
087
088    PaperSource(String sourceName) {
089        if (sourceName != null) {
090            name = sourceName;
091        } else {
092            name = "Unknown";
093        }
094    }
095
096    /**
097     * Returns the name of this paper source.
098     * @return paper source name.
099     */
100    public String getName() {
101        return name;
102    }
103
104    @Override
105    public String toString() {
106        return "Paper source : " + getName();
107    }
108}