| Method from sun.print.Win32PrintService Detail: |
public void addPrintServiceAttributeListener(PrintServiceAttributeListener listener) {
synchronized (this) {
if (listener == null) {
return;
}
if (notifier == null) {
notifier = new ServiceNotifier(this);
}
notifier.addListener(listener);
}
}
|
public DocPrintJob createPrintJob() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPrintJobAccess();
}
return new Win32PrintJob(this);
}
|
public boolean equals(Object obj) {
return (obj == this ||
(obj instanceof Win32PrintService &&
((Win32PrintService)obj).getName().equals(getName())));
}
|
public MediaSizeName findMatchingMediaSizeNameMM(float w,
float h) {
if (predefMedia != null) {
for (int k=0; k< predefMedia.length;k++) {
if (predefMedia[k] == null) {
continue;
}
if (isSameSize(predefMedia[k].getX(MediaSize.MM),
predefMedia[k].getY(MediaSize.MM),
w, h)) {
return predefMedia[k].getMediaSizeName();
}
}
}
return null;
}
|
public MediaTray findMediaTray(int dmBin) {
if (dmBin >= 1 && dmBin < = dmPaperBinToPrintService.length) {
return dmPaperBinToPrintService[dmBin-1];
}
MediaTray[] trays = getMediaTrays();
if (trays != null) {
for (int i=0;i< trays.length;i++) {
if(trays[i] instanceof Win32MediaTray) {
Win32MediaTray win32Tray = (Win32MediaTray)trays[i];
if (win32Tray.winID == dmBin) {
return win32Tray;
}
}
}
}
return Win32MediaTray.AUTO;
}
|
public int findPaperID(MediaSizeName msn) {
if (msn instanceof Win32MediaSize) {
Win32MediaSize winMedia = (Win32MediaSize)msn;
return winMedia.getDMPaper();
} else {
for (int id=0; id< dmPaperToPrintService.length;id++) {
if (dmPaperToPrintService[id].equals(msn)) {
return id+1; // DMPAPER_LETTER == 1
}
}
if (msn.equals(MediaSizeName.ISO_A2)) {
return DMPAPER_A2;
}
else if (msn.equals(MediaSizeName.ISO_A6)) {
return DMPAPER_A6;
}
else if (msn.equals(MediaSizeName.JIS_B6)) {
return DMPAPER_B6_JIS;
}
}
return 0;
}
|
public MediaSizeName findWin32Media(int dmIndex) {
if (dmIndex >= 1 && dmIndex < = dmPaperToPrintService.length) {
switch(dmIndex) {
/* matching media sizes with indices beyond
dmPaperToPrintService's length */
case DMPAPER_A2:
return MediaSizeName.ISO_A2;
case DMPAPER_A6:
return MediaSizeName.ISO_A6;
case DMPAPER_B6_JIS:
return MediaSizeName.JIS_B6;
default:
return dmPaperToPrintService[dmIndex - 1];
}
}
return null;
}
|
public T getAttribute(Class category) {
if (category == null) {
throw new NullPointerException("category");
}
if (!(PrintServiceAttribute.class.isAssignableFrom(category))) {
throw new IllegalArgumentException("Not a PrintServiceAttribute");
}
if (category == ColorSupported.class) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
return (T)ColorSupported.SUPPORTED;
} else {
return (T)ColorSupported.NOT_SUPPORTED;
}
} else if (category == PrinterName.class) {
return (T)getPrinterName();
} else if (category == PrinterState.class) {
return (T)getPrinterState();
} else if (category == PrinterStateReasons.class) {
return (T)getPrinterStateReasons();
} else if (category == QueuedJobCount.class) {
return (T)getQueuedJobCount();
} else if (category == PrinterIsAcceptingJobs.class) {
return (T)getPrinterIsAcceptingJobs();
} else {
return null;
}
}
|
public PrintServiceAttributeSet getAttributes() {
PrintServiceAttributeSet attrs = new HashPrintServiceAttributeSet();
attrs.add(getPrinterName());
attrs.add(getPrinterIsAcceptingJobs());
PrinterState prnState = getPrinterState();
if (prnState != null) {
attrs.add(prnState);
}
PrinterStateReasons prnStateReasons = getPrinterStateReasons();
if (prnStateReasons != null) {
attrs.add(prnStateReasons);
}
attrs.add(getQueuedJobCount());
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
attrs.add(ColorSupported.SUPPORTED);
} else {
attrs.add(ColorSupported.NOT_SUPPORTED);
}
return AttributeSetUtilities.unmodifiableView(attrs);
}
|
public Object getDefaultAttributeValue(Class category) {
if (category == null) {
throw new NullPointerException("null category");
}
if (!Attribute.class.isAssignableFrom(category)) {
throw new IllegalArgumentException(category +
" is not an Attribute");
}
if (!isAttributeCategorySupported(category)) {
return null;
}
int[] defaults = getDefaultPrinterSettings();
// indices must match those in WPrinterJob.cpp
int defPaper = defaults[0];
int defYRes = defaults[2];
int defQuality = defaults[3];
int defCopies = defaults[4];
int defOrient = defaults[5];
int defSides = defaults[6];
int defCollate = defaults[7];
if (category == Copies.class) {
if (defCopies > 0) {
return new Copies(defCopies);
} else {
return new Copies(1);
}
} else if (category == Chromaticity.class) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) == 0) {
return Chromaticity.MONOCHROME;
} else {
return Chromaticity.COLOR;
}
} else if (category == JobName.class) {
return new JobName("Java Printing", null);
} else if (category == OrientationRequested.class) {
if (defOrient == DMORIENT_LANDSCAPE) {
return OrientationRequested.LANDSCAPE;
} else {
return OrientationRequested.PORTRAIT;
}
} else if (category == PageRanges.class) {
return new PageRanges(1, Integer.MAX_VALUE);
} else if (category == Media.class) {
MediaSizeName msn = findWin32Media(defPaper);
if (msn != null) {
if (!isSupportedMedia(msn) && mediaSizeNames != null) {
msn = mediaSizeNames[0];
defPaper = findPaperID(msn);
}
return msn;
} else {
initMedia();
if ((mediaSizeNames != null) && (mediaSizeNames.length > 0)) {
// if 'mediaSizeNames' is not null, idList and mediaSizes
// cannot be null but to be safe, add a check
if ((idList != null) && (mediaSizes != null) &&
(idList.size() == mediaSizes.length)) {
Integer defIdObj = Integer.valueOf(defPaper);
int index = idList.indexOf(defIdObj);
if (index >=0 && index< mediaSizes.length) {
return mediaSizes[index].getMediaSizeName();
}
}
return mediaSizeNames[0];
}
}
} else if (category == MediaPrintableArea.class) {
/* Verify defPaper */
MediaSizeName msn = findWin32Media(defPaper);
if (msn != null &&
!isSupportedMedia(msn) && mediaSizeNames != null) {
defPaper = findPaperID(mediaSizeNames[0]);
}
float[] prnArea = getMediaPrintableArea(printer, defPaper);
if (prnArea != null) {
MediaPrintableArea printableArea = null;
try {
printableArea = new MediaPrintableArea(prnArea[0],
prnArea[1],
prnArea[2],
prnArea[3],
MediaPrintableArea.INCH);
} catch (IllegalArgumentException e) {
}
return printableArea;
}
return null;
} else if (category == SunAlternateMedia.class) {
return null;
} else if (category == Destination.class) {
try {
return new Destination((new File("out.prn")).toURI());
} catch (SecurityException se) {
try {
return new Destination(new URI("file:out.prn"));
} catch (URISyntaxException e) {
return null;
}
}
} else if (category == Sides.class) {
switch(defSides) {
case DMDUP_VERTICAL :
return Sides.TWO_SIDED_LONG_EDGE;
case DMDUP_HORIZONTAL :
return Sides.TWO_SIDED_SHORT_EDGE;
default :
return Sides.ONE_SIDED;
}
} else if (category == PrinterResolution.class) {
int yRes = defYRes;
int xRes = defQuality;
if ((xRes < 0) || (yRes < 0)) {
int res = (yRes > xRes) ? yRes : xRes;
if (res > 0) {
return new PrinterResolution(res, res, PrinterResolution.DPI);
}
}
else {
return new PrinterResolution(xRes, yRes, PrinterResolution.DPI);
}
} else if (category == ColorSupported.class) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
return ColorSupported.SUPPORTED;
} else {
return ColorSupported.NOT_SUPPORTED;
}
} else if (category == PrintQuality.class) {
if ((defQuality < 0) && (defQuality >= DMRES_HIGH)) {
switch (defQuality) {
case DMRES_HIGH:
return PrintQuality.HIGH;
case DMRES_MEDIUM:
return PrintQuality.NORMAL;
default:
return PrintQuality.DRAFT;
}
}
} else if (category == RequestingUserName.class) {
String userName = "";
try {
userName = System.getProperty("user.name", "");
} catch (SecurityException se) {
}
return new RequestingUserName(userName, null);
} else if (category == SheetCollate.class) {
if (defCollate == DMCOLLATE_TRUE) {
return SheetCollate.COLLATED;
} else {
return SheetCollate.UNCOLLATED;
}
} else if (category == Fidelity.class) {
return Fidelity.FIDELITY_FALSE;
}
return null;
}
|
public String getName() {
return printer;
}
|
public ServiceUIFactory getServiceUIFactory() {
return null;
}
|
public Class[] getSupportedAttributeCategories() {
ArrayList categList = new ArrayList(otherAttrCats.length+3);
for (int i=0; i < otherAttrCats.length; i++) {
categList.add(otherAttrCats[i]);
}
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_DUPLEX) != 0) {
categList.add(Sides.class);
}
if ((caps & DEVCAP_QUALITY) != 0) {
int[] defaults = getDefaultPrinterSettings();
// Added check: if supported, we should be able to get the default.
if ((defaults[3] >= DMRES_HIGH) && (defaults[3] < 0)) {
categList.add(PrintQuality.class);
}
}
PrinterResolution[] supportedRes = getPrintResolutions();
if ((supportedRes!=null) && (supportedRes.length >0)) {
categList.add(PrinterResolution.class);
}
return (Class[])categList.toArray(new Class[categList.size()]);
}
|
public Object getSupportedAttributeValues(Class category,
DocFlavor flavor,
AttributeSet attributes) {
if (category == null) {
throw new NullPointerException("null category");
}
if (!Attribute.class.isAssignableFrom(category)) {
throw new IllegalArgumentException(category +
" does not implement Attribute");
}
if (flavor != null) {
if (!isDocFlavorSupported(flavor)) {
throw new IllegalArgumentException(flavor +
" is an unsupported flavor");
// if postscript & category is already specified within the
// PostScript data we return null
} else if (isAutoSense(flavor) ||(isPostScriptFlavor(flavor) &&
(isPSDocAttr(category)))){
return null;
}
}
if (!isAttributeCategorySupported(category)) {
return null;
}
if (category == JobName.class) {
return new JobName("Java Printing", null);
} else if (category == RequestingUserName.class) {
String userName = "";
try {
userName = System.getProperty("user.name", "");
} catch (SecurityException se) {
}
return new RequestingUserName(userName, null);
} else if (category == ColorSupported.class) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
return ColorSupported.SUPPORTED;
} else {
return ColorSupported.NOT_SUPPORTED;
}
} else if (category == Chromaticity.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
flavor.equals(DocFlavor.URL.GIF) ||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
flavor.equals(DocFlavor.URL.JPEG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
flavor.equals(DocFlavor.URL.PNG)) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) == 0) {
Chromaticity []arr = new Chromaticity[1];
arr[0] = Chromaticity.MONOCHROME;
return (arr);
} else {
Chromaticity []arr = new Chromaticity[2];
arr[0] = Chromaticity.MONOCHROME;
arr[1] = Chromaticity.COLOR;
return (arr);
}
} else {
return null;
}
} else if (category == Destination.class) {
try {
return new Destination((new File("out.prn")).toURI());
} catch (SecurityException se) {
try {
return new Destination(new URI("file:out.prn"));
} catch (URISyntaxException e) {
return null;
}
}
} else if (category == OrientationRequested.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
flavor.equals(DocFlavor.URL.GIF) ||
flavor.equals(DocFlavor.URL.JPEG) ||
flavor.equals(DocFlavor.URL.PNG)) {
OrientationRequested []arr = new OrientationRequested[3];
arr[0] = OrientationRequested.PORTRAIT;
arr[1] = OrientationRequested.LANDSCAPE;
arr[2] = OrientationRequested.REVERSE_LANDSCAPE;
return arr;
} else {
return null;
}
} else if ((category == Copies.class) ||
(category == CopiesSupported.class)) {
synchronized (this) {
if (gotCopies == false) {
nCopies = getCopiesSupported(printer, getPort());
gotCopies = true;
}
}
return new CopiesSupported(1, nCopies);
} else if (category == Media.class) {
initMedia();
int len = (mediaSizeNames == null) ? 0 : mediaSizeNames.length;
MediaTray[] trays = getMediaTrays();
len += (trays == null) ? 0 : trays.length;
Media []arr = new Media[len];
if (mediaSizeNames != null) {
System.arraycopy(mediaSizeNames, 0, arr,
0, mediaSizeNames.length);
}
if (trays != null) {
System.arraycopy(trays, 0, arr,
mediaSizeNames.length, trays.length);
}
return arr;
} else if (category == MediaPrintableArea.class) {
initMedia();
if (mediaPrintables == null) {
return null;
}
// if getting printable area for a specific media size
Media mediaName;
if ((attributes != null) &&
((mediaName =
(Media)attributes.get(Media.class)) != null)) {
if (mediaName instanceof MediaSizeName) {
MediaPrintableArea []arr = new MediaPrintableArea[1];
if (mediaSizeNames.length == mediaPrintables.length) {
for (int j=0; j < mediaSizeNames.length; j++) {
if (mediaName.equals(mediaSizeNames[j])) {
arr[0] = mediaPrintables[j];
return arr;
}
}
}
MediaSize ms =
MediaSize.getMediaSizeForName((MediaSizeName)mediaName);
if (ms != null) {
arr[0] = new MediaPrintableArea(0, 0,
ms.getX(MediaSize.INCH),
ms.getY(MediaSize.INCH),
MediaPrintableArea.INCH);
return arr;
} else {
return null;
}
}
// else an instance of MediaTray, fall thru returning
// all MediaPrintableAreas
}
MediaPrintableArea []arr =
new MediaPrintableArea[mediaPrintables.length];
System.arraycopy(mediaPrintables, 0, arr, 0, mediaPrintables.length);
return arr;
} else if (category == SunAlternateMedia.class) {
return new SunAlternateMedia(
(Media)getDefaultAttributeValue(Media.class));
} else if (category == PageRanges.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
PageRanges []arr = new PageRanges[1];
arr[0] = new PageRanges(1, Integer.MAX_VALUE);
return arr;
} else {
return null;
}
} else if (category == PrinterResolution.class) {
PrinterResolution[] supportedRes = getPrintResolutions();
if (supportedRes == null) {
return null;
}
PrinterResolution []arr =
new PrinterResolution[supportedRes.length];
System.arraycopy(supportedRes, 0, arr, 0, supportedRes.length);
return arr;
} else if (category == Sides.class) {
if (flavor == null ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
Sides []arr = new Sides[3];
arr[0] = Sides.ONE_SIDED;
arr[1] = Sides.TWO_SIDED_LONG_EDGE;
arr[2] = Sides.TWO_SIDED_SHORT_EDGE;
return arr;
} else {
return null;
}
} else if (category == PrintQuality.class) {
PrintQuality []arr = new PrintQuality[3];
arr[0] = PrintQuality.DRAFT;
arr[1] = PrintQuality.HIGH;
arr[2] = PrintQuality.NORMAL;
return arr;
} else if (category == SheetCollate.class) {
if (flavor == null ||
(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
SheetCollate []arr = new SheetCollate[2];
arr[0] = SheetCollate.COLLATED;
arr[1] = SheetCollate.UNCOLLATED;
return arr;
} else {
return null;
}
} else if (category == Fidelity.class) {
Fidelity []arr = new Fidelity[2];
arr[0] = Fidelity.FIDELITY_FALSE;
arr[1] = Fidelity.FIDELITY_TRUE;
return arr;
} else {
return null;
}
}
|
public DocFlavor[] getSupportedDocFlavors() {
int len = supportedFlavors.length;
DocFlavor[] supportedDocFlavors;
int caps = getPrinterCapabilities();
// doc flavors supported
// if PostScript is supported
if ((caps & DEVCAP_POSTSCRIPT) != 0) {
supportedDocFlavors = new DocFlavor[len+3];
System.arraycopy(supportedFlavors, 0, supportedDocFlavors, 0, len);
supportedDocFlavors[len] = DocFlavor.BYTE_ARRAY.POSTSCRIPT;
supportedDocFlavors[len+1] = DocFlavor.INPUT_STREAM.POSTSCRIPT;
supportedDocFlavors[len+2] = DocFlavor.URL.POSTSCRIPT;
} else {
supportedDocFlavors = new DocFlavor[len];
System.arraycopy(supportedFlavors, 0, supportedDocFlavors, 0, len);
}
return supportedDocFlavors;
}
|
public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
AttributeSet attributes) {
if (flavor != null && !isDocFlavorSupported(flavor)) {
throw new IllegalArgumentException("flavor " + flavor +
"is not supported");
}
if (attributes == null) {
return null;
}
Attribute attr;
AttributeSet unsupp = new HashAttributeSet();
Attribute []attrs = attributes.toArray();
for (int i=0; i< attrs.length; i++) {
try {
attr = attrs[i];
if (!isAttributeCategorySupported(attr.getCategory())) {
unsupp.add(attr);
}
else if (!isAttributeValueSupported(attr, flavor, attributes)) {
unsupp.add(attr);
}
} catch (ClassCastException e) {
}
}
if (unsupp.isEmpty()) {
return null;
} else {
return unsupp;
}
}
|
public PrintServiceAttributeSet getUpdatedAttributes() {
PrintServiceAttributeSet currSet = getDynamicAttributes();
if (lastSet == null) {
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(currSet);
} else {
PrintServiceAttributeSet updates =
new HashPrintServiceAttributeSet();
Attribute []attrs = currSet.toArray();
for (int i=0; i< attrs.length; i++) {
Attribute attr = attrs[i];
if (!lastSet.containsValue(attr)) {
updates.add(attr);
}
}
lastSet = currSet;
return AttributeSetUtilities.unmodifiableView(updates);
}
}
|
public int hashCode() {
return this.getClass().hashCode()+getName().hashCode();
}
|
public void invalidateService() {
isInvalid = true;
}
|
public boolean isAttributeCategorySupported(Class category) {
if (category == null) {
throw new NullPointerException("null category");
}
if (!(Attribute.class.isAssignableFrom(category))) {
throw new IllegalArgumentException(category +
" is not an Attribute");
}
Class[] classList = getSupportedAttributeCategories();
for (int i = 0; i < classList.length; i++) {
if (category.equals(classList[i])) {
return true;
}
}
return false;
}
|
public boolean isAttributeValueSupported(Attribute attr,
DocFlavor flavor,
AttributeSet attributes) {
if (attr == null) {
throw new NullPointerException("null attribute");
}
Class category = attr.getCategory();
if (flavor != null) {
if (!isDocFlavorSupported(flavor)) {
throw new IllegalArgumentException(flavor +
" is an unsupported flavor");
// if postscript & category is already specified within the PostScript data
// we return false
} else if (isAutoSense(flavor) || (isPostScriptFlavor(flavor) &&
(isPSDocAttr(category)))) {
return false;
}
}
if (!isAttributeCategorySupported(category)) {
return false;
}
else if (category == Chromaticity.class) {
if ((flavor == null) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
flavor.equals(DocFlavor.URL.GIF) ||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
flavor.equals(DocFlavor.URL.JPEG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
flavor.equals(DocFlavor.URL.PNG)) {
int caps = getPrinterCapabilities();
if ((caps & DEVCAP_COLOR) != 0) {
return true;
} else {
return attr == Chromaticity.MONOCHROME;
}
} else {
return false;
}
} else if (category == Copies.class) {
return isSupportedCopies((Copies)attr);
} else if (category == Destination.class) {
URI uri = ((Destination)attr).getURI();
if ("file".equals(uri.getScheme()) &&
!(uri.getSchemeSpecificPart().equals(""))) {
return true;
} else {
return false;
}
} else if (category == Media.class) {
if (attr instanceof MediaSizeName) {
return isSupportedMedia((MediaSizeName)attr);
}
if (attr instanceof MediaTray) {
return isSupportedMediaTray((MediaTray)attr);
}
} else if (category == MediaPrintableArea.class) {
return isSupportedMediaPrintableArea((MediaPrintableArea)attr);
} else if (category == SunAlternateMedia.class) {
Media media = ((SunAlternateMedia)attr).getMedia();
return isAttributeValueSupported(media, flavor, attributes);
} else if (category == PageRanges.class ||
category == SheetCollate.class ||
category == Sides.class) {
if (flavor != null &&
!(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) {
return false;
}
} else if (category == PrinterResolution.class) {
if (attr instanceof PrinterResolution) {
return isSupportedResolution((PrinterResolution)attr);
}
} else if (category == OrientationRequested.class) {
if (attr == OrientationRequested.REVERSE_PORTRAIT ||
(flavor != null) &&
!(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
flavor.equals(DocFlavor.URL.GIF) ||
flavor.equals(DocFlavor.URL.JPEG) ||
flavor.equals(DocFlavor.URL.PNG))) {
return false;
}
} else if (category == ColorSupported.class) {
int caps = getPrinterCapabilities();
boolean isColorSup = ((caps & DEVCAP_COLOR) != 0);
if ((!isColorSup && (attr == ColorSupported.SUPPORTED)) ||
(isColorSup && (attr == ColorSupported.NOT_SUPPORTED))) {
return false;
}
}
return true;
}
|
public boolean isDocFlavorSupported(DocFlavor flavor) {
/* To avoid a native query which may be time-consuming
* do not invoke native unless postscript support is being queried.
* Instead just check the ones we 'always' support
*/
DocFlavor[] supportedDocFlavors;
if (isPostScriptFlavor(flavor)) {
supportedDocFlavors = getSupportedDocFlavors();
} else {
supportedDocFlavors = supportedFlavors;
}
for (int f=0; f< supportedDocFlavors.length; f++) {
if (flavor.equals(supportedDocFlavors[f])) {
return true;
}
}
return false;
}
|
public void removePrintServiceAttributeListener(PrintServiceAttributeListener listener) {
synchronized (this) {
if (listener == null || notifier == null ) {
return;
}
notifier.removeListener(listener);
if (notifier.isEmpty()) {
notifier.stopNotifier();
notifier = null;
}
}
}
|
public String toString() {
return "Win32 Printer : " + getName();
}
|
public boolean usesClass(Class c) {
return (c == sun.awt.windows.WPrinterJob.class);
}
|
public void wakeNotifier() {
synchronized (this) {
if (notifier != null) {
notifier.wake();
}
}
}
|