Java Code Examples for javax.print.attribute.standard.MediaSizeName#equals()

The following examples show how to use javax.print.attribute.standard.MediaSizeName#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PSStreamPrintService.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: Win32PrintService.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}
 
Example 3
Source File: Win32PrintService.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {

        initMedia();

        if (mediaSizeNames != null) {
            for (int i=0; i<mediaSizeNames.length; i++) {
                if (msn.equals(mediaSizeNames[i])) {
                    return true;
                }
            }
        }
        return false;
    }
 
Example 4
Source File: PSStreamPrintService.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 5
Source File: PSStreamPrintService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 6
Source File: UnixPrintService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 7
Source File: Win32PrintService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {

        initMedia();

        if (mediaSizeNames != null) {
            for (int i=0; i<mediaSizeNames.length; i++) {
                if (msn.equals(mediaSizeNames[i])) {
                    return true;
                }
            }
        }
        return false;
    }
 
Example 8
Source File: Win32PrintService.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}
 
Example 9
Source File: PSStreamPrintService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 10
Source File: UnixPrintService.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 11
Source File: PSStreamPrintService.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 12
Source File: Win32PrintService.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {

        initMedia();

        if (mediaSizeNames != null) {
            for (int i=0; i<mediaSizeNames.length; i++) {
                if (msn.equals(mediaSizeNames[i])) {
                    return true;
                }
            }
        }
        return false;
    }
 
Example 13
Source File: UnixPrintService.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 14
Source File: Win32PrintService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}
 
Example 15
Source File: Win32PrintService.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {

        initMedia();

        if (mediaSizeNames != null) {
            for (int i=0; i<mediaSizeNames.length; i++) {
                if (msn.equals(mediaSizeNames[i])) {
                    return true;
                }
            }
        }
        return false;
    }
 
Example 16
Source File: UnixPrintService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 17
Source File: Win32PrintService.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}
 
Example 18
Source File: UnixPrintService.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isSupportedMedia(MediaSizeName msn) {
    for (int i=0; i<mediaSizes.length; i++) {
        if (msn.equals(mediaSizes[i])) {
            return true;
        }
    }
    return false;
}
 
Example 19
Source File: Win32PrintService.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}
 
Example 20
Source File: Win32PrintService.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
        }
    }

    // If not found in predefined Windows ID, then we search through
    // the returned IDs of the driver because they can define their own
    // unique IDs.
    initMedia();

    if ((idList != null) && (mediaSizes != null) &&
        (idList.size() == mediaSizes.length)) {
        for (int i=0; i< idList.size(); i++) {
            if (mediaSizes[i].getMediaSizeName() == msn) {
                return ((Integer)idList.get(i)).intValue();
            }
        }
    }
    return 0;
}