|
From: <doc...@us...> - 2007-09-25 23:45:57
|
Revision: 176
http://openpcl.svn.sourceforge.net/openpcl/?rev=176&view=rev
Author: documentsystems
Date: 2007-09-25 16:46:00 -0700 (Tue, 25 Sep 2007)
Log Message:
-----------
Howard Hoagland. 1. Instantiate the new PCLPrintJob class. 2. Moved all the PrintRequestAttributes to the PCLPrintJob class. 3. Set and Get for the PrintRequestAttributes in the PCLPrintJob class.
Modified Paths:
--------------
openpcl/src/com/openpcl/viewer/OpenPCLViewer.java
Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java
===================================================================
--- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-25 23:41:08 UTC (rev 175)
+++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-25 23:46:00 UTC (rev 176)
@@ -21,21 +21,10 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
-import java.util.Locale;
import java.util.Vector;
import java.util.prefs.Preferences;
-import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
-import javax.print.attribute.Size2DSyntax;
-import javax.print.attribute.standard.Chromaticity;
-import javax.print.attribute.standard.JobKOctets;
-import javax.print.attribute.standard.JobName;
-import javax.print.attribute.standard.MediaPrintableArea;
-import javax.print.attribute.standard.MediaSize;
-import javax.print.attribute.standard.OrientationRequested;
-import javax.print.attribute.standard.PrintQuality;
-import javax.print.attribute.standard.Sides;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JApplet;
@@ -74,6 +63,7 @@
import com.openpcl.viewer.panels.PosView;
import com.openpcl.viewer.panels.PosWindowControlList;
import com.openpcl.viewer.panels.PosZoomSlider;
+import com.openpcl.viewer.printing.PCLPrintJob;
import com.openpcl.viewer.printing.PosPersistPrintOptionsValues;
import com.openpcl.viewer.printing.PosPrintPages;
import com.openpcl.viewer.printing.PosPrintSetupDialogChoices;
@@ -189,7 +179,7 @@
private PosPersistPrintOptionsValues mPosPersistPrintOptionsValues = null;
private PosStartupOptions mPosStartupOptions = null;
private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null;
- private PrintRequestAttributeSet mPrintRequestAttributeSet = null;
+ private PCLPrintJob mPCLPrintJob = null;
private int mViewframeX = 0;
private int mViewframeY = 0;
private int mViewframeWidth = 100;
@@ -570,6 +560,8 @@
showStatusBar();
// Show the status bar now so the user doesn't have to wait longer while the rest of the items are built
validate();
+ // Instantiate the PCLPrintJob class
+ buildPrintingSupport();
// Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later
buildPopupDialogs();
@@ -648,6 +640,11 @@
return tPosMdiDesktopPane;
}
+ // Instantiate the PCLPrintJob class
+ protected void buildPrintingSupport() {
+ mPCLPrintJob = new PCLPrintJob();
+ }
+
// Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later
protected void buildPopupDialogs() {
@@ -671,20 +668,6 @@
mHelpAboutDialog.pack();
}
- // Set the default choices on the print dialog for portrait, Legal, one sided, print job name, 4 margins
- mPrintRequestAttributeSet = new HashPrintRequestAttributeSet();
- mPrintRequestAttributeSet.add(OrientationRequested.PORTRAIT);
-
- // Don't set to "DRAFT" or else the print driver picks the lowest resolution the printer can do.
- mPrintRequestAttributeSet.add(PrintQuality.HIGH);
-
- mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH));
- mPrintRequestAttributeSet.add(Sides.ONE_SIDED);
- mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME);
- mPrintRequestAttributeSet.add(new JobKOctets((int)(256))); // each page image bytes max
- mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault()));
- mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH));
-
// 8/22/07 HowardH. Commented out the below line. Don't set the DPI here, let the print driver set the DPI and
// the printing framework will auto scale the image to the print driver's DPI setting.
// If you set the DPI here, you're forcing it to that exact resolution which will result in
@@ -695,7 +678,7 @@
// Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print)
mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices();
mPosUserOptionsDialog = new PosUserOptionsDialog(
- mPosPrintSetupDialogChoices, mPrintRequestAttributeSet, this, "Options Dialog", true);
+ mPosPrintSetupDialogChoices, this.getPrintRequestAttributeSet(), this, "Options Dialog", true);
//----- Print choices list
mPosPrintChoicesList = new PosPrintChoicesList(createPrintChoicesListSelectionListener());
@@ -927,7 +910,16 @@
public String getFilePathAndFileName() { return mFilePathAndFileName; }
public PosStartupOptions getPosStartupOptions() { return mPosStartupOptions; }
public PosPrintSetupDialogChoices getPosPrintSetupDialogChoices() { return mPosPrintSetupDialogChoices; }
- public PrintRequestAttributeSet getPrintRequestAttributeSet() { return mPrintRequestAttributeSet; }
+ public PCLPrintJob getPCLPrintJob() { return mPCLPrintJob; }
+
+ // Get the PrintRequestAttributeSet out of the PCLPrintJob object
+ public PrintRequestAttributeSet getPrintRequestAttributeSet() {
+ if (mPCLPrintJob != null) {
+ return mPCLPrintJob.getPrintRequestAttributeSet();
+ } else {
+ return null;
+ }
+ }
// One line setters
public void setIsDrawingForPrinting(boolean pIsDrawingForPrinting) { mIsDrawingForPrinting = pIsDrawingForPrinting; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|