Spec-Zone .ru
спецификации, руководства, описания, API
|
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 029import java.util.Collections; 030import java.util.Set; 031import java.util.TreeSet; 032 033import static javafx.print.PageOrientation.*; 034 035import com.sun.javafx.print.PrinterImpl; 036 037/** 038 * This class encapsulates the attributes of a printer which 039 * relate to its job printing capabilities and other attributes. 040 * <p> 041 * there are methods to retrieve the default or current value, 042 * as well as the set or range of supported values, as appropriate. 043 * <p> 044 * Instances of this class are delegates of the <code>Printer</code> 045 * and must be obtained from the printer. They cannot be mutated by 046 * the application as changing settings of a printer is outside the 047 * scope of this API. 048 * 049 * @since JavaFX 8 050 */ 051 052public final class PrinterAttributes { 053 054 private PrinterImpl impl; 055 056 PrinterAttributes(PrinterImpl impl) { 057 this.impl = impl; 058 } 059 060 /** 061 * The default number of copies to print. 062 * @return default number of copies 063 */ 064 public int getDefaultCopies() { 065 return impl.defaultCopies(); 066 } 067 068 /** 069 * The maximum supported number of copies. 070 */ 071 public int getMaxCopies() { 072 return impl.maxCopies(); 073 } 074 075 /** 076 * Reports if page ranges are supported. 077 * @return true if page ranges supported. 078 */ 079 public boolean supportsPageRanges() { 080 return impl.supportsPageRanges(); 081 } 082 083 /** 084 * The default collation setting. 085 * @return default value of <code>Collation</code> 086 */ 087 public Collation getDefaultCollation() { 088 return impl.defaultCollation(); 089 } 090 091 /** 092 * Returns an unmodifiable set of the supported collation settings 093 * for this printer. 094 * @return the supported values of <code>Collation</code> 095 */ 096 public Set<Collation> getSupportedCollations() { 097 return impl.supportedCollations(); 098 } 099 100 /** 101 * Returns the default value for duplex settings. 102 * @return default value of <code>PrintSides</code> 103 */ 104 public PrintSides getDefaultPrintSides() { 105 return impl.defaultSides(); 106 } 107 108 /** 109 * Returns an unmodifiable set of the supported duplex settings 110 * for this printer. 111 * @return the supported values of <code>PrintSides</code> 112 */ 113 public Set<PrintSides> getSupportedPrintSides() { 114 return impl.supportedSides(); 115 } 116 117 /** 118 * Get the default color setting : greyscale or color 119 * @return default print color setting. 120 */ 121 public PrintColor getDefaultPrintColor() { 122 return impl.defaultPrintColor(); 123 } 124 125 /** 126 * Returns an unmodifiable set of the supported color settings 127 * for this printer. 128 * @return the supported values of <code>PrintColor</code> 129 */ 130 public Set<PrintColor> getSupportedPrintColors() { 131 return impl.supportedPrintColor(); 132 } 133 134 135 /** 136 * Return the default quality setting 137 * @return default print quality setting. 138 */ 139 public PrintQuality getDefaultPrintQuality() { 140 return impl.defaultPrintQuality(); 141 } 142 143 /** 144 * Returns an unmodifiable set of the supported quality settings 145 * for this printer. 146 * @return the supported values of <code>PrintQuality</code> 147 */ 148 public Set<PrintQuality> getSupportedPrintQuality() { 149 return impl.supportedPrintQuality(); 150 } 151 152 /** 153 * Return the default print resolution for paper on this printer. 154 * @return default paper resolution 155 */ 156 public PrintResolution getDefaultPrintResolution() { 157 return impl.defaultPrintResolution(); 158 } 159 160 /** 161 * Returns an unmodifiable set of the supported print resolutions 162 * for this printer. 163 * @return the supported values of <code>PrintResolution</code> 164 */ 165 public Set<PrintResolution> getSupportedPrintResolutions() { 166 return impl.supportedPrintResolution(); 167 } 168 169 /** 170 * Return the default orientation for paper on this printer. 171 * @return default paper orientation 172 */ 173 public PageOrientation getDefaultPageOrientation() { 174 return impl.defaultOrientation(); 175 } 176 177 /** 178 * Returns an unmodifiable set of the supported orientations 179 * for this printer. 180 * @return the supported values of <code>PageOrientation</code> 181 */ 182 public Set<PageOrientation> getSupportedPageOrientations() { 183 return impl.supportedOrientation(); 184 } 185 186 /** 187 * Return the default paper size used on this printer. 188 * @return default Paper 189 */ 190 public Paper getDefaultPaper() { 191 return impl.defaultPaper(); 192 } 193 194 /** 195 * Returns an unmodifiable set of the supported paper sizes 196 * for this printer. 197 * @return the supported values of <code>Paper</code> 198 */ 199 public Set<Paper> getSupportedPapers() { 200 return impl.supportedPapers(); 201 } 202 203 /** 204 * Return the default paper input source/tray/ 205 * @return the default paper input source. 206 */ 207 public PaperSource getDefaultPaperSource() { 208 return impl.defaultPaperSource(); 209 } 210 211 /** 212 * Returns an unmodifiable set of the supported paper sources 213 * (ie input bins or trays) for this printer. 214 * @return the supported paper input sources 215 */ 216 public Set<PaperSource> getSupportedPaperSources() { 217 return impl.supportedPaperSources(); 218 } 219}