Here you can find the source of getJobPriority(int pages, int copies, boolean withDialog)
Parameter | Description |
---|---|
pages | number of pages |
copies | number of copies |
withDialog | dialog gets lower priority than direct print |
static public JobPriority getJobPriority(int pages, int copies, boolean withDialog)
//package com.java2s; /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ import javax.print.attribute.standard.JobPriority; public class Main { /**/*from w ww .j ava 2 s . co m*/ * Get Job Priority based on pages printed. * The more pages, the lower the priority * @param pages number of pages * @param copies number of copies * @param withDialog dialog gets lower priority than direct print * @return Job Priority */ static public JobPriority getJobPriority(int pages, int copies, boolean withDialog) { // Set priority (the more pages, the lower the priority) int priority = copies * pages; if (withDialog) // prefer direct print priority *= 2; priority = 100 - priority; // convert to 1-100 supported range if (priority < 10) priority = 10; else if (priority > 100) priority = 100; return new JobPriority(priority); } }