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

View File

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