javax.print.attribute.standard.MediaTray Java Examples
The following examples show how to use
javax.print.attribute.standard.MediaTray.
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: JavaPrinterTrayFinderFuncTest.java From ph-commons with Apache License 2.0 | 6 votes |
@Test public void testListPrinterTrays () { final PrintService [] aAllServices = PrintServiceLookup.lookupPrintServices (null, null); for (final PrintService aService : aAllServices) { LOGGER.info (aService.toString ()); final Object aAttrs = aService.getSupportedAttributeValues (Media.class, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); if (ArrayHelper.isArray (aAttrs)) { for (final Media aElement : (Media []) aAttrs) if (aElement instanceof MediaTray) LOGGER.info (" " + aElement); } } }
Example #2
Source File: Win32PrintService.java From hottub with GNU General Public License v2.0 | 6 votes |
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; }
Example #3
Source File: WPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #4
Source File: Win32PrintService.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #5
Source File: WPrinterJob.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #6
Source File: Win32PrintService.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example #7
Source File: Win32PrintService.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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; }
Example #8
Source File: WPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #9
Source File: Win32PrintService.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #10
Source File: TextTemplatePrintSettingsDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override protected void okPressed(){ IStructuredSelection selPrintService = (IStructuredSelection) cvPrinters.getSelection(); if (selPrintService != null && !selPrintService.isEmpty()) { selPrinter = ((PrintService) selPrintService.getFirstElement()).getName(); } IStructuredSelection selMediaTray = (IStructuredSelection) cvTrays.getSelection(); if (selMediaTray != null) { if (selMediaTray.isEmpty()) { selTray = ""; } else { selTray = ((MediaTray) selMediaTray.getFirstElement()).toString(); } } super.okPressed(); }
Example #11
Source File: WPrinterJob.java From hottub with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #12
Source File: WPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #13
Source File: WPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #14
Source File: Win32PrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example #15
Source File: WPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void setMediaTrayAttrib(Attribute attr) { if (attr == MediaTray.BOTTOM) { mAttMediaTray = 2; // DMBIN_LOWER } else if (attr == MediaTray.ENVELOPE) { mAttMediaTray = 5; // DMBIN_ENVELOPE } else if (attr == MediaTray.LARGE_CAPACITY) { mAttMediaTray = 11; // DMBIN_LARGECAPACITY } else if (attr == MediaTray.MAIN) { mAttMediaTray =1; // DMBIN_UPPER } else if (attr == MediaTray.MANUAL) { mAttMediaTray = 4; // DMBIN_MANUAL } else if (attr == MediaTray.MIDDLE) { mAttMediaTray = 3; // DMBIN_MIDDLE } else if (attr == MediaTray.SIDE) { // no equivalent predefined value mAttMediaTray = 7; // DMBIN_AUTO } else if (attr == MediaTray.TOP) { mAttMediaTray = 1; // DMBIN_UPPER } else { if (attr instanceof Win32MediaTray) { mAttMediaTray = ((Win32MediaTray)attr).winID; } else { mAttMediaTray = 1; // default } } }
Example #16
Source File: TestMediaTraySelection.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void printTest() { MediaTray tray = null; //tray = getMediaTray( prservices, "Bypass Tray" ); tray = getMediaTray( prservices, "Tray 4" ); PrintRequestAttributeSet atrset = new HashPrintRequestAttributeSet(); //atrset.add( MediaSizeName.ISO_A4 ); atrset.add(tray); PrinterJob pjob = PrinterJob.getPrinterJob(); pjob.setPrintable(new TestMediaTraySelection()); try { pjob.print(atrset); } catch (PrinterException e) { e.printStackTrace(); fail(); } }
Example #17
Source File: Win32PrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public int findTrayID(MediaTray tray) { getMediaTrays(); // make sure they are initialised. if (tray instanceof Win32MediaTray) { Win32MediaTray winTray = (Win32MediaTray)tray; return winTray.getDMBinID(); } for (int id=0; id<dmPaperBinToPrintService.length; id++) { if (tray.equals(dmPaperBinToPrintService[id])) { return id+1; // DMBIN_FIRST = 1; } } return 0; // didn't find the tray }
Example #18
Source File: Win32MediaTray.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected EnumSyntax[] getEnumValueTable() { ArrayList completeList = new ArrayList(); for (int i=0; i < myEnumValueTable.length; i++) { completeList.add(myEnumValueTable[i]); } completeList.addAll(winEnumTable); MediaTray[] enumTable = new MediaTray[completeList.size()]; return (MediaTray[])completeList.toArray(enumTable); }
Example #19
Source File: Win32PrintService.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #20
Source File: Win32PrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public int findTrayID(MediaTray tray) { getMediaTrays(); // make sure they are initialised. if (tray instanceof Win32MediaTray) { Win32MediaTray winTray = (Win32MediaTray)tray; return winTray.getDMBinID(); } for (int id=0; id<dmPaperBinToPrintService.length; id++) { if (tray.equals(dmPaperBinToPrintService[id])) { return id+1; // DMBIN_FIRST = 1; } } return 0; // didn't find the tray }
Example #21
Source File: Win32MediaTray.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected EnumSyntax[] getEnumValueTable() { ArrayList completeList = new ArrayList(); for (int i=0; i < myEnumValueTable.length; i++) { completeList.add(myEnumValueTable[i]); } completeList.addAll(winEnumTable); MediaTray[] enumTable = new MediaTray[completeList.size()]; return (MediaTray[])completeList.toArray(enumTable); }
Example #22
Source File: Win32PrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #23
Source File: Win32PrintService.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #24
Source File: Win32PrintService.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public int findTrayID(MediaTray tray) { getMediaTrays(); // make sure they are initialised. if (tray instanceof Win32MediaTray) { Win32MediaTray winTray = (Win32MediaTray)tray; return winTray.getDMBinID(); } for (int id=0; id<dmPaperBinToPrintService.length; id++) { if (tray.equals(dmPaperBinToPrintService[id])) { return id+1; // DMBIN_FIRST = 1; } } return 0; // didn't find the tray }
Example #25
Source File: TestMediaTraySelection.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static MediaTray getMediaTray( PrintService ps, String name) { Media[] media = (Media[])ps.getSupportedAttributeValues( Media.class, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); for (Media m : media) { if ( m instanceof MediaTray) { System.out.println("MediaTray=" + m.toString() ); if ( m.toString().trim().indexOf( name ) > -1 ) { return (MediaTray)m; } } } return null; }
Example #26
Source File: Win32PrintService.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #27
Source File: Win32PrintService.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public int findTrayID(MediaTray tray) { getMediaTrays(); // make sure they are initialised. if (tray instanceof Win32MediaTray) { Win32MediaTray winTray = (Win32MediaTray)tray; return winTray.getDMBinID(); } for (int id=0; id<dmPaperBinToPrintService.length; id++) { if (tray.equals(dmPaperBinToPrintService[id])) { return id+1; // DMBIN_FIRST = 1; } } return 0; // didn't find the tray }
Example #28
Source File: Win32PrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #29
Source File: Win32PrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private boolean isSupportedMediaTray(MediaTray msn) { MediaTray[] trays = getMediaTrays(); if (trays != null) { for (int i=0; i<trays.length; i++) { if (msn.equals(trays[i])) { return true; } } } return false; }
Example #30
Source File: Win32MediaTray.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected EnumSyntax[] getEnumValueTable() { ArrayList completeList = new ArrayList(); for (int i=0; i < myEnumValueTable.length; i++) { completeList.add(myEnumValueTable[i]); } completeList.addAll(winEnumTable); MediaTray[] enumTable = new MediaTray[completeList.size()]; return (MediaTray[])completeList.toArray(enumTable); }