[ 1684853 ] Add Print Preview button

This commit is contained in:
Heng Sin Low 2007-06-13 05:17:03 +00:00
parent 0dc865317d
commit 4a5b39811f
2 changed files with 23 additions and 5 deletions

View File

@ -799,10 +799,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
/**
* Write PostScript to writer
* @param fos file output stream
* @param os output stream
* @return true if success
*/
public boolean createPS (FileOutputStream fos)
public boolean createPS (OutputStream os)
{
try
{
@ -817,7 +817,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
}
// just use first one - sun.print.PSStreamPrinterFactory
// System.out.println("- " + spsfactories[0]);
StreamPrintService sps = spsfactories[0].getPrintService(fos);
StreamPrintService sps = spsfactories[0].getPrintService(os);
// get format
if (m_layout == null)
layout();
@ -825,8 +825,10 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
sps.createPrintJob().print(m_layout.getPageable(false),
new HashPrintRequestAttributeSet());
//
fos.flush();
fos.close();
os.flush();
//following 2 line for backward compatibility
if (os instanceof FileOutputStream)
((FileOutputStream)os).close();
}
catch (Exception e)
{

View File

@ -44,6 +44,10 @@ public class ProcessInfo implements Serializable
setAD_Process_ID(AD_Process_ID);
setTable_ID (Table_ID);
setRecord_ID (Record_ID);
if (Ini.isPropertyBool(Ini.P_PRINTPREVIEW))
m_printPreview = true;
else
m_printPreview = false;
} // ProcessInfo
/**
@ -105,6 +109,8 @@ public class ProcessInfo implements Serializable
/** Transaction Name */
private String m_transactionName = null;
private boolean m_printPreview = false;
/**
@ -602,4 +608,14 @@ public class ProcessInfo implements Serializable
{
m_transactionName = trxName;
}
public void setPrintPreview(boolean b)
{
m_printPreview = b;
}
public boolean isPrintPreview()
{
return m_printPreview;
}
} // ProcessInfo