You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
(19) |
Jul
(39) |
Aug
(30) |
Sep
(14) |
Oct
(4) |
Nov
(12) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(2) |
2009 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <doc...@us...> - 2007-07-10 02:09:56
|
Revision: 105 http://openpcl.svn.sourceforge.net/openpcl/?rev=105&view=rev Author: documentsystems Date: 2007-07-09 19:09:57 -0700 (Mon, 09 Jul 2007) Log Message: ----------- Howard Hoagland. 1. Moved the PrintRequestAttributeSet from PosPrintPages to OpenPCLViewer and passed the object down to both the User Options dialog and the Print Setup dialog so that those users settings are shared in those two places. 2. Added the "JDK Print Dialog" button to the Print Setup dialog, and passed in the same PrintRequestAttributeSet, and when clicked, it brings up the JDK Print Setup dialog. 3. On the Print Setup dialog, added the "Print Order" group box that has "Print as Displayed, Legal first then Letter, Letter first, then Legal". Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-07 01:01:10 UTC (rev 104) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-10 02:09:57 UTC (rev 105) @@ -21,9 +21,19 @@ 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.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; @@ -175,6 +185,7 @@ private PosPersistViewValues mPosPersistViewValues = null; private PosStartupOptions mPosStartupOptions = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; + private PrintRequestAttributeSet mPrintRequestAttributeSet = null; private int mViewframeX = 0; private int mViewframeY = 0; private int mViewframeWidth = 100; @@ -644,10 +655,20 @@ mHelpAboutDialog.pack(); } - //----- Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) + // 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); + mPrintRequestAttributeSet.add(PrintQuality.HIGH); + mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); + mPrintRequestAttributeSet.add(Sides.ONE_SIDED); + mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); + mPrintRequestAttributeSet.add(new MediaPrintableArea(0.20f, 0.20f, 8.1f, 13.6f, MediaPrintableArea.INCH)); + + // Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); - mPosUserOptionsDialog = new PosUserOptionsDialog(mPosPrintSetupDialogChoices, this, "Options Dialog", true); - + mPosUserOptionsDialog = new PosUserOptionsDialog( + mPosPrintSetupDialogChoices, mPrintRequestAttributeSet, this, "Options Dialog", true); + //----- Print choices list mPosPrintChoicesList = new PosPrintChoicesList(createPrintChoicesListSelectionListener()); // Popup dialog for print choices list @@ -786,6 +807,7 @@ public String getFilePathAndFileName() { return mFilePathAndFileName; } public PosStartupOptions getPosStartupOptions() { return mPosStartupOptions; } public PosPrintSetupDialogChoices getPosPrintSetupDialogChoices() { return mPosPrintSetupDialogChoices; } + public PrintRequestAttributeSet getPrintRequestAttributeSet() { return mPrintRequestAttributeSet; } // One line setters public void setIsDrawingForPrinting(boolean pIsDrawingForPrinting) { mIsDrawingForPrinting = pIsDrawingForPrinting; } Modified: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-07 01:01:10 UTC (rev 104) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-10 02:09:57 UTC (rev 105) @@ -8,9 +8,11 @@ import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.awt.print.PrinterJob; import info.clearthought.layout.TableLayout; +import javax.print.attribute.PrintRequestAttributeSet; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JButton; @@ -37,7 +39,9 @@ private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; private OpenPCLViewer mOpenPCLViewer = null; private Frame mParentFrame = null; - + private PrintRequestAttributeSet mPrintRequestAttributeSet = null; + private PrinterJob mPrinterJob = null; + // Dialogs private PosPrintSetupDialog mPosPrintSetupDialog = null; @@ -127,7 +131,9 @@ private static final String sNotImplementedString = "Not implemented: "; // Constructor - public PosUserOptionsDialog(PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, OpenPCLViewer pOpenPCLViewer, + public PosUserOptionsDialog(PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, + PrintRequestAttributeSet pPrintRequestAttributeSet, + OpenPCLViewer pOpenPCLViewer, String pTitleString, boolean pIsModal) { // Call JDialog superclass constructor passing the parent frame, title bar text, is modal @@ -138,6 +144,10 @@ mParentFrame = pOpenPCLViewer.getAppFrame(); // Set the object that will hold the settings of the values from the dialog on the screen mPosPrintSetupDialogChoices = pPosPrintSetupDialogChoices; + // Print attributes + mPrintRequestAttributeSet = pPrintRequestAttributeSet; + // Get a new PrinterJob using its static method + mPrinterJob = PrinterJob.getPrinterJob(); // Build the UI buildUI(); } @@ -206,7 +216,7 @@ private void showPrintSetupDefaultsDialog() { mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, "Print Setup Defaults", mOpenPCLViewer.getPosStartupOptions(), mPosPrintSetupDialogChoices, - null, null, "No pages will print at this time because this is Printer Setup Defaluts."); + mPrintRequestAttributeSet, mPrinterJob, "No pages will print at this time because this is Printer Setup Defaluts."); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-07 01:01:10 UTC (rev 104) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-10 02:09:57 UTC (rev 105) @@ -51,7 +51,7 @@ private PosPrintBufferedImage mPosPrintBufferedImage = null; private PosPrintPageableInterface mPosPrintPageableInterface = null; private PrinterJob mPrinterJob = null; - private PrintRequestAttributeSet mAttributes = null; + private PrintRequestAttributeSet mPrintRequestAttributeSet = null; private PrintService mPrintService = null; private PosPrintSetupDialog mPosPrintSetupDialog = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; @@ -85,11 +85,11 @@ super(); mPosView = pPosView; mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); + mPrintRequestAttributeSet = mPosView.getOpenPCLViewer().getPrintRequestAttributeSet(); mPosPrintSetupDialogChoices = mPosView.getOpenPCLViewer().getPosPrintSetupDialogChoices(); mPosPrintBufferedImage = new PosPrintBufferedImage(mPosView); mPosPrintPageableInterface = new PosPrintPageableInterface(mPosView); mPriModifyPclBytes = new PriModifyPclBytes(); - mAttributes = new HashPrintRequestAttributeSet(); mPrintingProgressBar = new JProgressBar(); mPrintingProgressBar.setStringPainted(true); mPrintingProgressBar.setIndeterminate(false); @@ -107,14 +107,6 @@ mPrintingProgressJDialog.add(tJPanel, BorderLayout.CENTER); mPrintingProgressJDialog.pack(); mPosPrintBufferedImage.setPrintingProgressBar(mPrintingProgressBar); - - // Set the default choices on the print dialog for portrait, Legal, one sided, print job name, 4 margins - mAttributes.add(OrientationRequested.PORTRAIT); - mAttributes.add(PrintQuality.HIGH); - mAttributes.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); - mAttributes.add(Sides.ONE_SIDED); - mAttributes.add(new JobName(mPosView.getOpenPCLViewer().getAppName() + " print", Locale.getDefault())); - mAttributes.add(new MediaPrintableArea(0.20f, 0.20f, 8.1f, 13.6f, MediaPrintableArea.INCH)); } /** @@ -214,7 +206,7 @@ mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, tDialogTitleBarString, mPosView.getOpenPCLViewer().getPosStartupOptions(), mPosPrintSetupDialogChoices, - mAttributes, mPrinterJob, mIndexNumbersStringBuffer.toString()); + mPrintRequestAttributeSet, mPrinterJob, mIndexNumbersStringBuffer.toString()); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); @@ -289,10 +281,10 @@ // Call "Use Windows Print" or "Print PCL Direct" if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, - mPrintingProgressBar, mAttributes); + mPrintingProgressBar, mPrintRequestAttributeSet); } else { mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, - mPrintingProgressBar, mAttributes); + mPrintingProgressBar, mPrintRequestAttributeSet); } } @@ -320,12 +312,12 @@ * @param pPagesToPrintArrayList * @param pPosPrintSetupDialogChoices * @param pPrintingProgressBar - * @param pAttributes + * @param pPrintRequestAttributeSet * @return boolean */ private boolean printPclDirect(ArrayList<PosTreeNode> pPagesToPrintArrayList, PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, JProgressBar pPrintingProgressBar, - PrintRequestAttributeSet pAttributes) { + PrintRequestAttributeSet pPrintRequestAttributeSet) { DocFlavor tDocFlavor = DocFlavor.INPUT_STREAM.AUTOSENSE; SimpleDoc tSimpleDoc = null; @@ -422,7 +414,7 @@ if (tDocPrintJob == null) { return false; } try { - tDocPrintJob.print(tSimpleDoc, pAttributes); + tDocPrintJob.print(tSimpleDoc, pPrintRequestAttributeSet); } catch (PrintException e) { PriDebug.error("In PosPrintPages, PrintException trying to print PCL Direct.", e); return false; @@ -438,12 +430,12 @@ * @param pPagesToPrintArrayList * @param pPosPrintSetupDialogChoices * @param pPrintingProgressBar - * @param pAttributes + * @param pPrintRequestAttributeSet * @return boolean */ private boolean imagePrint(ArrayList<PosTreeNode> pPagesToPrintArrayList, PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, JProgressBar pPrintingProgressBar, - PrintRequestAttributeSet pAttributes) { + PrintRequestAttributeSet pPrintRequestAttributeSet) { // Set the pages to print so that when PrinterJob calls Printable.print(), it uses the PosTreeNode values // that are the Objects in this ArrayList, to do Graphics draw commands from the PCL to render the image mPosPrintBufferedImage.setPagesToPrint(pPagesToPrintArrayList); @@ -470,7 +462,7 @@ // Set the user selected printer on the PrinterJob mPrinterJob.setPrintService(mPrintService); // Print all the pages - mPrinterJob.print(mAttributes); + mPrinterJob.print(pPrintRequestAttributeSet); } catch (PrinterException e) { PriDebug.error("PrinterException in PosPrintPages", e); return false; Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-07 01:01:10 UTC (rev 104) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-10 02:09:57 UTC (rev 105) @@ -42,7 +42,6 @@ import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; -import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.SwingConstants; @@ -52,16 +51,14 @@ import com.openpcl.pclrenderimage.util.PriDebug; import com.openpcl.viewer.options.PosStartupOptions; -import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.util.PosReadImageIcon; public class PosPrintSetupDialog extends JDialog { private static final long serialVersionUID = 1L; - private PosView mPosView = null; private PosStartupOptions mPosStartupOptions = null; private Frame mParentFrame = null; private PosPrintSetupDialogChoices mPrintChoices = null; - private PrintRequestAttributeSet mAttributes = null; + private PrintRequestAttributeSet mPrintRequestAttributeSet = null; private PrinterJob mPrinterJob = null; private PrintService mSelectedPrinter = null; private ArrayList<JComponent> mItemsOnDialogBox = new ArrayList<JComponent>(30); @@ -69,26 +66,26 @@ private double mTloFill = TableLayout.FILL; private double mTloHgap = 5; private double mTloVgap = 5; - private String mSelectedPageNumbers = null; - private JDialog mAdvancedOptionsJDialog = null; +// private String mSelectedPageNumbers = null; +// private JDialog mAdvancedOptionsJDialog = null; // Adjust to fonts private final Font mAdjustToSmallFont = getFont(); private final float mSmallFontPointSize = mAdjustToSmallFont.getSize2D(); - private final Font mAdjustToDinkyFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize - 2.0f); - private final Font mAdjustToMediumFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize + 2.0f); - private final Font mAdjustToLargeFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize + 4.0f); +// private final Font mAdjustToDinkyFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize - 2.0f); +// private final Font mAdjustToMediumFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize + 2.0f); +// private final Font mAdjustToLargeFont = mAdjustToSmallFont.deriveFont(mSmallFontPointSize + 4.0f); // Get the local client personal user settings font, then make titled border font be bold, and add 2 points from that - private final Font mTitledBorderDinkyFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize); +// private final Font mTitledBorderDinkyFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize); private final Font mTitledBorderSmallFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize + 2.0f); - private final Font mTitledBorderMediumFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize + 4.0f); - private final Font mTitledBorderLargeFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize + 6.0f); +// private final Font mTitledBorderMediumFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize + 4.0f); +// private final Font mTitledBorderLargeFont = mAdjustToSmallFont.deriveFont(Font.BOLD, mSmallFontPointSize + 6.0f); private Font mTitledBorderFont = mTitledBorderSmallFont; private Font mNonChangingTitledBorderFont = new Font("Arial", Font.BOLD, 12); // Panels that go directly on the contentPane - private JPanel mControlJPanel = null; +// private JPanel mControlJPanel = null; private JTabbedPane mJTabbedPane = new JTabbedPane(); private JPanel mBottomButtonsJPanel = null; @@ -103,10 +100,10 @@ private JPanel mDuplexJPanel = null; // Tab 2's sub panels - private JPanel mTab2 = new JPanel(); +// private JPanel mTab2 = new JPanel(); // Tab 3's sub panels - private JPanel mTab3 = new JPanel(); +// private JPanel mTab3 = new JPanel(); // JLabels private JLabel mAddlCopiesJLabel = new JLabel("Additional Copies: "); @@ -117,8 +114,8 @@ private JTextField mAddlCopiesJTextField = new JTextField(3); // JTextAreas - private JTextArea mPageNumbersThatWillPrintJTextArea = new JTextArea(); - private JScrollPane mPageNumbersThatWillPrintJScrollPane = null; +// private JTextArea mPageNumbersThatWillPrintJTextArea = new JTextArea(); +// private JScrollPane mPageNumbersThatWillPrintJScrollPane = null; private Color mTextAreaBgColor = new Color(244, 244, 244); // a very light gray private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); @@ -141,7 +138,7 @@ private JButton mFontSizeLargeJButton = new JButton("L"); private JButton mOKJButton = new JButton("OK"); private JButton mCancelJButton = new JButton("Cancel"); - private JButton mOpenJDKPrintDialogJButton = new JButton("Open JDK Print Dialog"); + private JButton mOpenJDKPrintDialogJButton = new JButton("JDK Print Dialog"); private JButton mAdvancedOptionsJButton = new JButton("Advanced Options"); private JButton mAdvancedOptionsOkJButton = null; @@ -166,7 +163,7 @@ "<html>Unselect if printer supports PCL (Example: HP LaserJet 4050)</html>"; public PosPrintSetupDialog(Frame pParentFrame, String pTitleBarText, PosStartupOptions pPosStartupOptions, - PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pAttributes, + PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pPrintRequestAttributeSet, PrinterJob pPrinterJob, String pSelectedPageNumbers) throws HeadlessException { super(pParentFrame, pTitleBarText, true); mPosStartupOptions = pPosStartupOptions; @@ -180,9 +177,9 @@ mPrintChoices = pPrintChoices; } - mAttributes = pAttributes; + mPrintRequestAttributeSet = pPrintRequestAttributeSet; mPrinterJob = pPrinterJob; - mSelectedPageNumbers = pSelectedPageNumbers; +// mSelectedPageNumbers = pSelectedPageNumbers; buildUI(); } @@ -190,9 +187,9 @@ setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new DialogWindowListener()); - mPageNumbersThatWillPrintJTextArea.setBackground(mTextAreaBgColor); - mPageNumbersThatWillPrintJTextArea.setForeground(Color.BLACK); - mPageNumbersThatWillPrintJTextArea.setFont(mTextAreaFont); +// mPageNumbersThatWillPrintJTextArea.setBackground(mTextAreaBgColor); +// mPageNumbersThatWillPrintJTextArea.setForeground(Color.BLACK); +// mPageNumbersThatWillPrintJTextArea.setFont(mTextAreaFont); mListOfPrintersJPanel = makeListOfPrintersPanel(); mWindowsPrintOrPclPrintJPanel = makeWindowsPrintOrPclPrintPanel(); @@ -204,16 +201,18 @@ // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { - { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloPref, mTloPref, mTloPref, mTloPref}}; // rows + { mTloFill, mTloHgap, mTloFill}, // columns + { mTloFill, mTloVgap, mTloPref, mTloPref, mTloPref, mTloPref, mTloVgap, mTloPref, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); - mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 1, 2, 1"); - mTab1.add(mShrinkLegalToFitOnLetterJCheckBox, "0, 2, 2, 2"); - mTab1.add(mPrintAllOnLegalSizeJCheckBox, "0, 3, 2, 3"); - mTab1.add(mAddlCopiesJPanel, "0, 4, 2, 4"); + mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 2, 2, 2"); + mTab1.add(makeFillerOnRightPanel(mShrinkLegalToFitOnLetterJCheckBox), "0, 3, 2, 3"); + mTab1.add(makeFillerOnRightPanel(mPrintAllOnLegalSizeJCheckBox), "0, 4, 2, 4"); + mTab1.add(mAddlCopiesJPanel, "0, 5, 2, 5"); + mTab1.add(mPrintOrderJPanel, "0, 7, 2, 7"); + mTab1.add(makeFillerOnRightPanel(mOpenJDKPrintDialogJButton), "0, 8, 2, 8"); // mTab1.add(mPrintBarCodesJPanel, "0, 6"); // mTab1.add(mPrintOrderJPanel, "2, 6"); @@ -221,44 +220,44 @@ // mTab1.add(mDuplexJPanel, "2, 8"); // Lay out tab 2 items - double tloTab2GridSpec[][] = new double[][] { - { mTloPref, mTloFill }, // columns - { mTloPref, 5, mTloFill }}; // rows - TableLayout tloTab2Layout = new TableLayout(tloTab2GridSpec); - mTab2.setLayout(tloTab2Layout); - mTab2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - mTab2.add(mPageNumbersThatWillPrintJLabel, "0, 0"); - mPageNumbersThatWillPrintJTextArea.setLineWrap(true); - mPageNumbersThatWillPrintJTextArea.setWrapStyleWord(true); - mPageNumbersThatWillPrintJTextArea.setText("Page numbers that will print:\n" + mSelectedPageNumbers); - mPageNumbersThatWillPrintJTextArea.setEditable(false); - mPageNumbersThatWillPrintJTextArea.setPreferredSize(new Dimension(400, 200)); - mPageNumbersThatWillPrintJScrollPane = new JScrollPane(mPageNumbersThatWillPrintJTextArea, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +// double tloTab2GridSpec[][] = new double[][] { +// { mTloPref, mTloFill }, // columns +// { mTloPref, 5, mTloFill }}; // rows +// TableLayout tloTab2Layout = new TableLayout(tloTab2GridSpec); +// mTab2.setLayout(tloTab2Layout); +// mTab2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); +// mTab2.add(mPageNumbersThatWillPrintJLabel, "0, 0"); +// mPageNumbersThatWillPrintJTextArea.setLineWrap(true); +// mPageNumbersThatWillPrintJTextArea.setWrapStyleWord(true); +// mPageNumbersThatWillPrintJTextArea.setText("Page numbers that will print:\n" + mSelectedPageNumbers); +// mPageNumbersThatWillPrintJTextArea.setEditable(false); +// mPageNumbersThatWillPrintJTextArea.setPreferredSize(new Dimension(400, 200)); +// mPageNumbersThatWillPrintJScrollPane = new JScrollPane(mPageNumbersThatWillPrintJTextArea, +// JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // mTab2.add(mPageNumbersThatWillPrintJScrollPane, "0, 2, 1, 2"); - mAdvancedOptionsJDialog = new JDialog(mParentFrame, "Advanced Options", true); - double tloAdvancedOptionsJDialog[][] = new double[][] { - { 10, mTloFill, mTloPref, 10}, // columns - { 10, mTloFill, 10, mTloPref, 10} // rows - }; - TableLayout tloAdvancedOptionsLayout = new TableLayout(tloAdvancedOptionsJDialog); - JPanel tJPanel = new JPanel(tloAdvancedOptionsLayout); - tJPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); - tJPanel.add("1, 1, 2, 1", mPageNumbersThatWillPrintJScrollPane); - mAdvancedOptionsOkJButton = new JButton("OK"); - tJPanel.add("2, 3", mAdvancedOptionsOkJButton); - mAdvancedOptionsJDialog.setContentPane(tJPanel); - mAdvancedOptionsJDialog.setSize(400, 280); +// mAdvancedOptionsJDialog = new JDialog(mParentFrame, "Advanced Options", true); +// double tloAdvancedOptionsJDialog[][] = new double[][] { +// { 10, mTloFill, mTloPref, 10}, // columns +// { 10, mTloFill, 10, mTloPref, 10} // rows +// }; +// TableLayout tloAdvancedOptionsLayout = new TableLayout(tloAdvancedOptionsJDialog); +// JPanel tJPanel = new JPanel(tloAdvancedOptionsLayout); +// tJPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); +// tJPanel.add("1, 1, 2, 1", mPageNumbersThatWillPrintJScrollPane); +// mAdvancedOptionsOkJButton = new JButton("OK"); +// tJPanel.add("2, 3", mAdvancedOptionsOkJButton); +// mAdvancedOptionsJDialog.setContentPane(tJPanel); +// mAdvancedOptionsJDialog.setSize(400, 280); // Lay out tab 3 items - double tloTab3GridSpec[][] = new double[][] { - { mTloPref, mTloFill }, // columns - { mTloPref, mTloFill }}; // rows +// double tloTab3GridSpec[][] = new double[][] { +// { mTloPref, mTloFill }, // columns +// { mTloPref, mTloFill }}; // rows // { mTloButtonHeight, mTloFill }}; // rows - TableLayout tloTab3Layout = new TableLayout(tloTab3GridSpec); - mTab3.setLayout(tloTab3Layout); - mTab3.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - mTab3.add(mOpenJDKPrintDialogJButton, "0, 0"); +// TableLayout tloTab3Layout = new TableLayout(tloTab3GridSpec); +// mTab3.setLayout(tloTab3Layout); +// mTab3.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); +// mTab3.add(mOpenJDKPrintDialogJButton, "0, 0"); // Add the tab panels to the JTabbedPane // mJTabbedPane.add(mTab1, "View Specific"); @@ -268,15 +267,15 @@ // Add the Control Panel, JTabbedPane, and buttons panel to the contentPane double tloContentPaneGridSpec[][] = new double[][] { { mTloHgap, mTloFill, mTloHgap }, // columns - { mTloVgap, mTloPref, mTloFill, 1, mTloPref, mTloVgap, mTloVgap }}; // rows + { mTloFill, mTloPref, mTloVgap }}; // rows TableLayout tloContentPaneLayout = new TableLayout(tloContentPaneGridSpec); setLayout(tloContentPaneLayout); - mControlJPanel = makeControlPanel(); +// mControlJPanel = makeControlPanel(); mBottomButtonsJPanel = makeBottomButtonsPanel(); - add(mControlJPanel, "1, 1"); +// add(mControlJPanel, "1, 1"); // add(mJTabbedPane, "1, 2"); - add(mTab1, "1, 2"); - add(mBottomButtonsJPanel, "1, 4"); + add(mTab1, "1, 0"); + add(mBottomButtonsJPanel, "1, 1"); // ActionListeners mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { @@ -313,67 +312,67 @@ } }); - mFontSizeDinkyJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - mFontSizeDinkyJButton.setText("*D*"); - mFontSizeSmallJButton.setText("S"); - mFontSizeMediumJButton.setText("M"); - mFontSizeLargeJButton.setText("L"); - mTitledBorderFont = mTitledBorderDinkyFont; - adjustFontOnDialogItems(mAdjustToDinkyFont); - pack(); - } - }); +// mFontSizeDinkyJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// mFontSizeDinkyJButton.setText("*D*"); +// mFontSizeSmallJButton.setText("S"); +// mFontSizeMediumJButton.setText("M"); +// mFontSizeLargeJButton.setText("L"); +// mTitledBorderFont = mTitledBorderDinkyFont; +// adjustFontOnDialogItems(mAdjustToDinkyFont); +// pack(); +// } +// }); +// +// mFontSizeSmallJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// mFontSizeDinkyJButton.setText("D"); +// mFontSizeSmallJButton.setText("*S*"); +// mFontSizeMediumJButton.setText("M"); +// mFontSizeLargeJButton.setText("L"); +// mTitledBorderFont = mTitledBorderSmallFont; +// adjustFontOnDialogItems(mAdjustToSmallFont); +// pack(); +// } +// }); +// +// mFontSizeMediumJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// mFontSizeDinkyJButton.setText("D"); +// mFontSizeSmallJButton.setText("S"); +// mFontSizeMediumJButton.setText("*M*"); +// mFontSizeLargeJButton.setText("L"); +// mTitledBorderFont = mTitledBorderMediumFont; +// adjustFontOnDialogItems(mAdjustToMediumFont); +// pack(); +// } +// }); +// +// mFontSizeLargeJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// mFontSizeDinkyJButton.setText("D"); +// mFontSizeSmallJButton.setText("S"); +// mFontSizeMediumJButton.setText("M"); +// mFontSizeLargeJButton.setText("*L*"); +// mTitledBorderFont = mTitledBorderLargeFont; +// adjustFontOnDialogItems(mAdjustToLargeFont); +// pack(); +// } +// }); - mFontSizeSmallJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - mFontSizeDinkyJButton.setText("D"); - mFontSizeSmallJButton.setText("*S*"); - mFontSizeMediumJButton.setText("M"); - mFontSizeLargeJButton.setText("L"); - mTitledBorderFont = mTitledBorderSmallFont; - adjustFontOnDialogItems(mAdjustToSmallFont); - pack(); - } - }); +// mAdvancedOptionsJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent e) { +// mAdvancedOptionsJDialog.setLocationRelativeTo(mParentFrame); +// mAdvancedOptionsJDialog.setVisible(true); +// } +// }); - mFontSizeMediumJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - mFontSizeDinkyJButton.setText("D"); - mFontSizeSmallJButton.setText("S"); - mFontSizeMediumJButton.setText("*M*"); - mFontSizeLargeJButton.setText("L"); - mTitledBorderFont = mTitledBorderMediumFont; - adjustFontOnDialogItems(mAdjustToMediumFont); - pack(); - } - }); +// mAdvancedOptionsOkJButton.addActionListener(new ActionListener() { +// public void actionPerformed(ActionEvent pE) { +// mAdvancedOptionsJDialog.setVisible(false); +// } +// }); - mFontSizeLargeJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - mFontSizeDinkyJButton.setText("D"); - mFontSizeSmallJButton.setText("S"); - mFontSizeMediumJButton.setText("M"); - mFontSizeLargeJButton.setText("*L*"); - mTitledBorderFont = mTitledBorderLargeFont; - adjustFontOnDialogItems(mAdjustToLargeFont); - pack(); - } - }); - - mAdvancedOptionsJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - mAdvancedOptionsJDialog.setLocationRelativeTo(mParentFrame); - mAdvancedOptionsJDialog.setVisible(true); - } - }); - - mAdvancedOptionsOkJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent pE) { - mAdvancedOptionsJDialog.setVisible(false); - } - }); - mOKJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!hasUserInputErrors()) { @@ -394,12 +393,12 @@ mOpenJDKPrintDialogJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Put up the JDK unmodified print dialog - boolean userHitOk = mPrinterJob.printDialog(mAttributes); + boolean userHitOk = mPrinterJob.printDialog(mPrintRequestAttributeSet); if (userHitOk) { // Don't get the printer the user selelcted in the JDK unmodified print dialog // mSelectedPrinter = mPrinterJob.getPrintService(); // Get the margin choices instead - Attribute mpAattribute = mAttributes.get(MediaPrintableArea.class); + Attribute mpAattribute = mPrintRequestAttributeSet.get(MediaPrintableArea.class); MediaPrintableArea mpa = null; if (mpAattribute instanceof MediaPrintableArea) { mpa = (MediaPrintableArea)mpAattribute; @@ -517,21 +516,21 @@ return panel; } - private JPanel makeControlPanel() { - JPanel panel = new JPanel(); - if (mPosStartupOptions.getShowDSMLPrintDialogButtons()) { - double tloGridSpec[][] = new double[][] {{ - mTloFill, mTloPref, mTloPref, mTloPref, mTloPref, mTloPref}, { mTloPref} }; - TableLayout tloLayout = new TableLayout(tloGridSpec); - panel.setLayout(tloLayout); - panel.add(mFontSizeJLabel, "1, 0"); - panel.add(mFontSizeDinkyJButton, "2, 0"); - panel.add(mFontSizeSmallJButton, "3, 0"); - panel.add(mFontSizeMediumJButton, "4, 0"); - panel.add(mFontSizeLargeJButton, "5, 0"); - } - return panel; - } +// private JPanel makeControlPanel() { +// JPanel panel = new JPanel(); +// if (mPosStartupOptions.getShowDSMLPrintDialogButtons()) { +// double tloGridSpec[][] = new double[][] {{ +// mTloFill, mTloPref, mTloPref, mTloPref, mTloPref, mTloPref}, { mTloPref} }; +// TableLayout tloLayout = new TableLayout(tloGridSpec); +// panel.setLayout(tloLayout); +// panel.add(mFontSizeJLabel, "1, 0"); +// panel.add(mFontSizeDinkyJButton, "2, 0"); +// panel.add(mFontSizeSmallJButton, "3, 0"); +// panel.add(mFontSizeMediumJButton, "4, 0"); +// panel.add(mFontSizeLargeJButton, "5, 0"); +// } +// return panel; +// } private JPanel makeBottomButtonsPanel() { JPanel panel = new JPanel(); @@ -547,6 +546,15 @@ return panel; } + private JPanel makeFillerOnRightPanel(JComponent pJc) { + JPanel panel = new JPanel(); + double tloGridSpec[][] = new double[][] {{mTloPref, mTloFill}, { mTloPref }}; + TableLayout tloLayout = new TableLayout(tloGridSpec); + panel.setLayout(tloLayout); + panel.add(pJc,"0,0"); + return panel; + } + private void grayOutShrinkToLetterOrForceLegalCheckBoxes() { if (mIsPclPrinterJCheckBox.isSelected()) { mShrinkLegalToFitOnLetterJCheckBox.setEnabled(true); @@ -645,7 +653,7 @@ mItemsOnDialogBox.add(mDuplexNoJRadioButton); mItemsOnDialogBox.add(mPageNumbersThatWillPrintJLabel); - mItemsOnDialogBox.add(mPageNumbersThatWillPrintJTextArea); +// mItemsOnDialogBox.add(mPageNumbersThatWillPrintJTextArea); mItemsOnDialogBox.add(mOpenJDKPrintDialogJButton); @@ -780,11 +788,8 @@ private void grayOutItemsNotImplemented() { mPrintBarCodesYesJRadioButton.setEnabled(false); - mPrintOrderLegalFirstThenLetterJRadioButton.setEnabled(false); - mPrintOrderLetterFirstThenLegalJRadioButton.setEnabled(false); mPrintFormNamesYesJRadioButton.setEnabled(false); mDuplexYesJRadioButton.setEnabled(false); - mOpenJDKPrintDialogJButton.setEnabled(false); } public class DialogWindowListener implements WindowListener { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-07 01:01:09
|
Revision: 104 http://openpcl.svn.sourceforge.net/openpcl/?rev=104&view=rev Author: documentsystems Date: 2007-07-06 18:01:10 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Howard Hoagland. Changed 4 files: OpenPCLViewer, PosUserOptionsDialog, PosPrintPages, PosPrintSetupDialog to implement share user options for the "Print Setup Defaults" dialog user choices with per print settings on the Print dialog. User choices made on the "Print Setup Defaults" dialog didn't take effect on the per each print "Print" dialog, and it wasn't possible to show the "Print Setup Defaults" dialog until the user opened a PCL file or a Blockument. Fixed both problems by moving the instantiation of the PosPrintSetupOptions object from the PosView object for each open file, higher up in the conatainment hierarchy to the OpenPCLviewer class, then for showing both the Print Setup Defaults dialog from the User Options dialog, and for each printout, passed in the same PosPrintSetupOptions, so changing any print option in either place effects the other one bidirectionally. Fixing this problem needed to be done before the Print Setup Defaults can be persisted in a platform independent way (the running platform's JVM writes to the Windows registry when running on Windows, or does it the Macintosh way when running on a Macintosh) so that the data flow between persistent local storage on the client PC/Macintosh is the same data that gets set on the Print Setup Defaults dialog via the User Options dialog, and also the same settings on the Print dialog for each printout, then saved back to persistent storage. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-06 20:27:56 UTC (rev 103) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-07 01:01:10 UTC (rev 104) @@ -169,12 +169,12 @@ private PosHtmlViewerButtonChoicesDialog mHelpAboutDialog = null; private PosHtmlViewerButtonChoicesDialog mLicenseInfoDialog = null; private PosUserOptionsDialog mPosUserOptionsDialog = null; - private PosPrintSetupDialogChoices mPosUserOptionsPosPrintSetupDialogChoices = null; private ComponentListener mFrameComponentListener = null; private String mFilePathAndFileName = "C:\\"; private Preferences mPackagePreferences = null; private PosPersistViewValues mPosPersistViewValues = null; private PosStartupOptions mPosStartupOptions = null; + private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; private int mViewframeX = 0; private int mViewframeY = 0; private int mViewframeWidth = 100; @@ -644,6 +644,10 @@ mHelpAboutDialog.pack(); } + //----- Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) + mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); + mPosUserOptionsDialog = new PosUserOptionsDialog(mPosPrintSetupDialogChoices, this, "Options Dialog", true); + //----- Print choices list mPosPrintChoicesList = new PosPrintChoicesList(createPrintChoicesListSelectionListener()); // Popup dialog for print choices list @@ -781,6 +785,7 @@ public PosView getPosViewSelected() { return mPosViewSelected; } public String getFilePathAndFileName() { return mFilePathAndFileName; } public PosStartupOptions getPosStartupOptions() { return mPosStartupOptions; } + public PosPrintSetupDialogChoices getPosPrintSetupDialogChoices() { return mPosPrintSetupDialogChoices; } // One line setters public void setIsDrawingForPrinting(boolean pIsDrawingForPrinting) { mIsDrawingForPrinting = pIsDrawingForPrinting; } @@ -943,6 +948,7 @@ SwingUtilities.updateComponentTreeUI(mPosHelpChoicesPopupDialog); SwingUtilities.updateComponentTreeUI(mLicenseInfoDialog); SwingUtilities.updateComponentTreeUI(mHelpAboutDialog); + SwingUtilities.updateComponentTreeUI(mPosUserOptionsDialog); if (mPosViewArray != null && mPosViewArray.length > 0) { for (PosView tPosView : mPosViewArray) { @@ -2259,14 +2265,8 @@ /** Show the Options dialog */ public void actionShowOptionsDialog() { - if (mPosUserOptionsDialog == null) { - mPosUserOptionsPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); - } - mPosUserOptionsDialog = new PosUserOptionsDialog( - mPosUserOptionsPosPrintSetupDialogChoices, this, "Options Dialog", true); mPosUserOptionsDialog.setLocationRelativeTo(getAppFrame()); mPosUserOptionsDialog.setVisible(true); - // TODO read the values that were set in the user options dialog and handle the different settings } Modified: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-06 20:27:56 UTC (rev 103) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-07 01:01:10 UTC (rev 104) @@ -26,6 +26,7 @@ import com.openpcl.viewer.OpenPCLViewer; import com.openpcl.viewer.panels.PosView; +import com.openpcl.viewer.printing.PosPrintSetupDialog; import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; import com.openpcl.viewer.util.PosReadImageIcon; @@ -37,6 +38,9 @@ private OpenPCLViewer mOpenPCLViewer = null; private Frame mParentFrame = null; + // Dialogs + private PosPrintSetupDialog mPosPrintSetupDialog = null; + // Values for laying out panels, buttons, labels, textfields private double mTloPref = TableLayout.PREFERRED; private double mTloFill = TableLayout.FILL; @@ -69,7 +73,7 @@ // Buttons private JButton mCreateShortcutJButton = new JButton(PosReadImageIcon.read("pclIcon_32x32.png")); private JButton mRegisterFileTypeJButton = new JButton(PosReadImageIcon.read("PageNewBig.gif")); - private JButton mPrinterSetupDefaultsJButton = new JButton("Printer Setup dialog"); + private JButton mPrinterSetupDefaultsJButton = new JButton("Print Setup Defaults"); private JButton mEMailAdvancedSettingsJButton = new JButton("Advanced Settings for EMail"); private JButton mScanningSetupJButton = new JButton("Scanning Setup"); private JButton mCheckForUpdatesJButton = new JButton("Check for Updates Now"); @@ -123,7 +127,6 @@ private static final String sNotImplementedString = "Not implemented: "; // Constructor - public PosUserOptionsDialog(PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, OpenPCLViewer pOpenPCLViewer, String pTitleString, boolean pIsModal) { @@ -180,14 +183,7 @@ private void addActionListeners() { mPrinterSetupDefaultsJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - PosView tPosView = mOpenPCLViewer.getPosViewSelected(); - if (tPosView != null) { - tPosView.getPosPrintPages().showPrintDialog(); - } else { - JOptionPane.showMessageDialog(mParentFrame, "To show the Print Setup dialog, a file needs to be opened", - "To show the Print Setup dialog", - JOptionPane.WARNING_MESSAGE); - } + showPrintSetupDefaultsDialog(); } }); @@ -207,6 +203,15 @@ }); } + private void showPrintSetupDefaultsDialog() { + mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, "Print Setup Defaults", + mOpenPCLViewer.getPosStartupOptions(), mPosPrintSetupDialogChoices, + null, null, "No pages will print at this time because this is Printer Setup Defaluts."); + + mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); + mPosPrintSetupDialog.setVisible(true); + } + private void makePanelTitledBorders() { mPrintingOptionsJPanel.setBorder(generateTitledBorder(mPrintingGroupBoxString)); mEMailJPanel.setBorder(generateTitledBorder(mEMailGroupBoxString)); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-06 20:27:56 UTC (rev 103) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-07 01:01:10 UTC (rev 104) @@ -85,11 +85,11 @@ super(); mPosView = pPosView; mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); + mPosPrintSetupDialogChoices = mPosView.getOpenPCLViewer().getPosPrintSetupDialogChoices(); mPosPrintBufferedImage = new PosPrintBufferedImage(mPosView); mPosPrintPageableInterface = new PosPrintPageableInterface(mPosView); mPriModifyPclBytes = new PriModifyPclBytes(); mAttributes = new HashPrintRequestAttributeSet(); - mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); mPrintingProgressBar = new JProgressBar(); mPrintingProgressBar.setStringPainted(true); mPrintingProgressBar.setIndeterminate(false); @@ -113,7 +113,7 @@ mAttributes.add(PrintQuality.HIGH); mAttributes.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); mAttributes.add(Sides.ONE_SIDED); - mAttributes.add(new JobName("OpenPCL OpenPCLViewer print", Locale.getDefault())); + mAttributes.add(new JobName(mPosView.getOpenPCLViewer().getAppName() + " print", Locale.getDefault())); mAttributes.add(new MediaPrintableArea(0.20f, 0.20f, 8.1f, 13.6f, MediaPrintableArea.INCH)); } @@ -210,11 +210,11 @@ // Put up our custom printer setup dialog // String tDialogTitleBarString = "Print" + mTitleBarTextForPrintDialog[pProcessPrintType] + " (" + // tNumberOfPagesThatWillPrint + (tNumberOfPagesThatWillPrint ==1 ? " page" : " pages") + " will print)"; - String tDialogTitleBarString = "Print"; - mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, tDialogTitleBarString, - mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, mIndexNumbersStringBuffer.toString()); + mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, tDialogTitleBarString, + mPosView.getOpenPCLViewer().getPosStartupOptions(), mPosPrintSetupDialogChoices, + mAttributes, mPrinterJob, mIndexNumbersStringBuffer.toString()); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); @@ -480,24 +480,4 @@ return true; } - public boolean showPrintDialog() { - // Get a new PrinterJob using its static method - mPrinterJob = PrinterJob.getPrinterJob(); - - // Put up our custom printer setup dialog - mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, "Print", - mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, - "No pages will print at this time because this is Printer Setup options only. Make sure to hit OK to save your changes."); - - mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); - mPosPrintSetupDialog.setVisible(true); - - boolean userHitOk = mPosPrintSetupDialogChoices.getDidUserHitOk(); - - if (userHitOk) { - return true; - } else { - return false; - } - } } Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-06 20:27:56 UTC (rev 103) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-07 01:01:10 UTC (rev 104) @@ -165,13 +165,12 @@ private static final String sPrinterModeHoverOverString = "<html>Unselect if printer supports PCL (Example: HP LaserJet 4050)</html>"; - public PosPrintSetupDialog(PosView pPosView, String pTitleBarText, PosPrintSetupDialogChoices pPrintChoices, - PrintRequestAttributeSet pAttributes, PrinterJob pPrinterJob, String pSelectedPageNumbers) - throws HeadlessException { - super(pPosView.getOpenPCLViewer().getAppFrame(), pTitleBarText, true); - mPosView = pPosView; - mPosStartupOptions = mPosView.getOpenPCLViewer().getPosStartupOptions(); - mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); + public PosPrintSetupDialog(Frame pParentFrame, String pTitleBarText, PosStartupOptions pPosStartupOptions, + PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pAttributes, + PrinterJob pPrinterJob, String pSelectedPageNumbers) throws HeadlessException { + super(pParentFrame, pTitleBarText, true); + mPosStartupOptions = pPosStartupOptions; + mParentFrame = pParentFrame; // Set to false the show DSML buttons even if the user said true on the command line mPosStartupOptions.setShowDSMLPrintDialogButtons(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-06 20:27:55
|
Revision: 103 http://openpcl.svn.sourceforge.net/openpcl/?rev=103&view=rev Author: documentsystems Date: 2007-07-06 13:27:56 -0700 (Fri, 06 Jul 2007) Log Message: ----------- Howard Hoagland. Implemented new feature "Shrink all Legal pages to fit on Letter" that scales Legal pages by 11/14 and selectes Letter paper intead of Legal paper. On the print setup dialog, if the user unchecks the "Use Windows Print" then the "Shrink all Legal pages to fit on Letter" is automatically unselected and grayed out, because shrink Legal pages to fit on Letter isn't available for print PCL Direct. Also, when the user puts a check in "Print All Documents on Legal Size", the "Shrink all Legal pages to fit on Letter" is automatically unchecked. And visa-versa if the user puts a check in "Shrink all Legal pages to fit on Letter" then "Print All Documents on Legal Size" is automatically unchecked. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-04 01:46:40 UTC (rev 102) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-06 20:27:56 UTC (rev 103) @@ -33,20 +33,22 @@ private PosTreeNode mPrintThisTreeNode = null; private AffineTransform mOrigAffineTransform = null; private AffineTransform mScaleAffineTransform = null; + private AffineTransform mShrinkLegalToLetterAffineTransform = null; private ArrayList<PosTreeNode> mPagesToPrintArrayList = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; private JProgressBar mPrintingProgressBar = null; private static final String sProgressBarBaseString = "Generating page: "; private static final String sCantAllocate = "Can't allocate memory for temporary image used for printing."; private double mPrintScale = 72.0d / 300.0d; // making width and height using 72 / 300 scale - private int mNumberOfPrintPasses = 1; - private int mCurrentPrintPassNumber = 1; + private double mShrinkLegalToLetterScale = mPrintScale * (11.0d / 14.0d); // shrink in both directions height 14" to 11" public PosPrintBufferedImage(PosView pPosView) { super(); mPosView = pPosView; mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); mScaleAffineTransform = AffineTransform.getScaleInstance(mPrintScale, mPrintScale); + mShrinkLegalToLetterAffineTransform = + AffineTransform.getScaleInstance(mShrinkLegalToLetterScale, mShrinkLegalToLetterScale); mBufferedImageToPrintOn = createNewBufferedImageToPrintOn(); // Graphics2D for printing (is 2 color black and white with no rendering hints like anti-aliasing if (mBufferedImageToPrintOn != null) { mGraphics2DToPrintOn = mBufferedImageToPrintOn.createGraphics(); } @@ -57,7 +59,7 @@ } public void setPosPrintSetupDialogChoices(PosPrintSetupDialogChoices pPosPrintSetupDialogChoices) { - mPosPrintSetupDialogChoices = pPosPrintSetupDialogChoices; + mPosPrintSetupDialogChoices = pPosPrintSetupDialogChoices; } public void setPrintingProgressBar(JProgressBar pPrintingProgressBar) { @@ -94,10 +96,17 @@ g2D.setPaint(Color.BLACK); // Save the passed in AffineTransform (to put it back before returning) mOrigAffineTransform = g2D.getTransform(); - // Set the 72/300 = .24 AffineTransform on the current Graphics2D, to scale smaller - // to fit exactly on the printed page - g2D.transform(mScaleAffineTransform); + if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter() && + ( !(mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(mPrintThisTreeNode)) )) { + // The user has a check in the "Shrink All Legal Pages to Fit On Letter" check box so shrink to Legal to fit on Letter + g2D.transform(mShrinkLegalToLetterAffineTransform); + + } else { + // Set the 72/300 = .24 AffineTransform on the current Graphics2D, to scale smaller to fit exactly on the printed page + g2D.transform(mScaleAffineTransform); + } + // Make the BufferedImage from the tree node. // The below uses polymorphism because the method renderImageForPrintingFromTreeNode() is one of the subclassed // methods specified in the interface IPluginHooksOpenPCL Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-04 01:46:40 UTC (rev 102) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-06 20:27:56 UTC (rev 103) @@ -57,12 +57,12 @@ // Letter size portrait with .2 inch margins mLetterPaperPortrait = new Paper(); mLetterPaperPortrait.setSize(8.5d * 72, 11.0d * 72); - mLetterPaperPortrait.setImageableArea(.2d * 72, .2d * 72, 8.1d * 72, 10.6d * 72); + mLetterPaperPortrait.setImageableArea(.18d * 72, .18d * 72, 8.14d * 72, 10.64d * 72); // Legal size portraint with .2 inch margins mLegalPaperPortrait = new Paper(); mLegalPaperPortrait.setSize(8.5d * 72, 14.0d * 72); - mLegalPaperPortrait.setImageableArea(.2d * 72, .2d * 72, 8.1d * 72, 13.6d * 72); + mLegalPaperPortrait.setImageableArea(.18d * 72, .18d * 72, 8.14d * 72, 13.64d * 72); } public int getNumberOfPages() { @@ -80,6 +80,12 @@ // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file tBuiltPageFormat.setPaper(mLegalPaperPortrait); + + } else if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter()) { + // The user has a check in the "Shrink All Legal Pages to Fit On Letter" check box + // so force all pages to Letter size + tBuiltPageFormat.setPaper(mLetterPaperPortrait); + } else { try { mPosTreeNode = mPagesToPrintArrayList.get(pForPageNumber); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-04 01:46:40 UTC (rev 102) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-06 20:27:56 UTC (rev 103) @@ -255,13 +255,23 @@ StringBuffer tMsgStringBuffer = new StringBuffer(); tMsgStringBuffer.append(" to printer selected: "); tMsgStringBuffer.append(mPrintService.getName()); - tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + + tMsgStringBuffer.append("\n Shrink All Legal Pages to Fit On Letter is "); + if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter()) { + tMsgStringBuffer.append("\"True\""); + } else { + tMsgStringBuffer.append("\"False\""); + } + tMsgStringBuffer.append("\n Print all Documents on Legal Size is "); if (mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { tMsgStringBuffer.append("\"True\""); } else { tMsgStringBuffer.append("\"False\""); } + + tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + tMsgStringBuffer.append("\n " + mIndexNumbersStringBuffer); // Console output print type "Use Windows Print" or "Print PCL Direct" Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-04 01:46:40 UTC (rev 102) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-06 20:27:56 UTC (rev 103) @@ -147,6 +147,8 @@ // JCheckBoxes private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Use Windows Print (recommended)"); + private JCheckBox mShrinkLegalToFitOnLetterJCheckBox = new JCheckBox( + "Shrink All Legal Pages to Fit On Letter"); private JCheckBox mPrintAllOnLegalSizeJCheckBox = new JCheckBox("Print All Documents on Legal Size"); // JLists @@ -204,14 +206,15 @@ // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloPref, mTloPref, mTloPref}}; // rows + { mTloFill, mTloPref, mTloPref, mTloPref, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 1, 2, 1"); - mTab1.add(mPrintAllOnLegalSizeJCheckBox, "0, 2, 2, 2"); - mTab1.add(mAddlCopiesJPanel, "0, 3, 2, 3"); + mTab1.add(mShrinkLegalToFitOnLetterJCheckBox, "0, 2, 2, 2"); + mTab1.add(mPrintAllOnLegalSizeJCheckBox, "0, 3, 2, 3"); + mTab1.add(mAddlCopiesJPanel, "0, 4, 2, 4"); // mTab1.add(mPrintBarCodesJPanel, "0, 6"); // mTab1.add(mPrintOrderJPanel, "2, 6"); @@ -284,6 +287,33 @@ } }); + mIsPclPrinterJCheckBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (mIsPclPrinterJCheckBox.isSelected()) { + mShrinkLegalToFitOnLetterJCheckBox.setEnabled(true); + } else { + mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); + mShrinkLegalToFitOnLetterJCheckBox.setEnabled(false); + } + } + }); + + mShrinkLegalToFitOnLetterJCheckBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (mShrinkLegalToFitOnLetterJCheckBox.isSelected()) { + mPrintAllOnLegalSizeJCheckBox.setSelected(false); + } + } + }); + + mPrintAllOnLegalSizeJCheckBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (mPrintAllOnLegalSizeJCheckBox.isSelected()) { + mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); + } + } + }); + mFontSizeDinkyJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mFontSizeDinkyJButton.setText("*D*"); @@ -388,6 +418,7 @@ putPrintChoicesOnScreen(); setHoverHelpOnItems(); grayOutItemsNotImplemented(); + grayOutShrinkToLetterOrForceLegalCheckBoxes(); // Make dialog box outer frame width and height exactly to be all item's preferred sizes pack(); } @@ -516,6 +547,23 @@ panel.add(tGridLayoutJPanel, "1, 0"); return panel; } + + private void grayOutShrinkToLetterOrForceLegalCheckBoxes() { + if (mIsPclPrinterJCheckBox.isSelected()) { + mShrinkLegalToFitOnLetterJCheckBox.setEnabled(true); + } else { + mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); + mShrinkLegalToFitOnLetterJCheckBox.setEnabled(false); + } + + if (mShrinkLegalToFitOnLetterJCheckBox.isSelected()) { + mPrintAllOnLegalSizeJCheckBox.setSelected(false); + } + + if (mPrintAllOnLegalSizeJCheckBox.isSelected()) { + mShrinkLegalToFitOnLetterJCheckBox.setSelected(false); + } + } private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); @@ -529,6 +577,7 @@ mPrintFormNamesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintFormNames()) ); mDuplexYesJRadioButton.setSelected(mPrintChoices.shouldDuplex()); mDuplexNoJRadioButton.setSelected( !(mPrintChoices.shouldDuplex()) ); + mShrinkLegalToFitOnLetterJCheckBox.setSelected(mPrintChoices.shouldShrinkLegalToFitOnLetter()); mPrintAllOnLegalSizeJCheckBox.setSelected(mPrintChoices.shouldPrintAllOnLegalSize()); } @@ -572,6 +621,9 @@ // Duplex mPrintChoices.setShouldDuplex(mDuplexYesJRadioButton.isSelected()); + // Shrink All Legal Pages to Fit On Letter + mPrintChoices.setShouldShrinkLegalToFitOnLetter(mShrinkLegalToFitOnLetterJCheckBox.isSelected()); + // Print all on legal size mPrintChoices.setShouldPrintAllOnLegalSize(mPrintAllOnLegalSizeJCheckBox.isSelected()); } @@ -579,6 +631,7 @@ private void makeArrayListOfDialogItems() { mItemsOnDialogBox.add(mListOfPrintersJList); mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); + mItemsOnDialogBox.add(mShrinkLegalToFitOnLetterJCheckBox); mItemsOnDialogBox.add(mPrintAllOnLegalSizeJCheckBox); mItemsOnDialogBox.add(mAddlCopiesJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); @@ -710,6 +763,8 @@ private void setHoverHelpOnItems() { mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); + mShrinkLegalToFitOnLetterJCheckBox.setToolTipText( + "Shrink Legal pages to Letter not available if \"Use Windows Print\" is unchecked"); mAddlCopiesJTextField.setToolTipText("Allowed values are 0 to 3 additional copies"); mPrintAllOnLegalSizeJCheckBox.setToolTipText("Make all pages print on Legal paper"); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-04 01:46:40 UTC (rev 102) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-06 20:27:56 UTC (rev 103) @@ -23,6 +23,7 @@ private int mPrintOrder = mPrintOrderAsDisplayedOrSelected; private boolean mShouldPrintFormNames = false; private boolean mShouldDuplex = false; + private boolean mShouldShrinkLegalToFitOnLetter = false; private boolean mShouldPrintAllOnLegalSize = false; private boolean mUserHitOk = false; @@ -62,6 +63,9 @@ public boolean shouldDuplex() { return mShouldDuplex; } + public boolean shouldShrinkLegalToFitOnLetter() { + return mShouldShrinkLegalToFitOnLetter; + } public boolean shouldPrintAllOnLegalSize() { return mShouldPrintAllOnLegalSize; } @@ -100,6 +104,9 @@ public void setShouldDuplex(boolean yesOrNo) { mShouldDuplex = yesOrNo; } + public void setShouldShrinkLegalToFitOnLetter(boolean yesOrNo) { + mShouldShrinkLegalToFitOnLetter = yesOrNo; + } public void setShouldPrintAllOnLegalSize(boolean yesOrNo) { mShouldPrintAllOnLegalSize = yesOrNo; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-04 01:46:40
|
Revision: 102 http://openpcl.svn.sourceforge.net/openpcl/?rev=102&view=rev Author: documentsystems Date: 2007-07-03 18:46:40 -0700 (Tue, 03 Jul 2007) Log Message: ----------- Howard Hoagland. Added QuesionMark.gif to show on the button to the right of "User Windows Print" for users to click on and get the dialog that says "Unselect if printer supports PCL (Example HP LaserJet 4050)". Added Paths: ----------- openpcl/src/com/openpcl/viewer/images/QuestionMark.gif Added: openpcl/src/com/openpcl/viewer/images/QuestionMark.gif =================================================================== (Binary files differ) Property changes on: openpcl/src/com/openpcl/viewer/images/QuestionMark.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-04 01:45:14
|
Revision: 101 http://openpcl.svn.sourceforge.net/openpcl/?rev=101&view=rev Author: documentsystems Date: 2007-07-03 18:45:14 -0700 (Tue, 03 Jul 2007) Log Message: ----------- Howard Hoagland. Implemented "Additional Copies" with user input validation checking dialogs for must be numeric, and must be between 0 and 3, and made Additional Copies work with "Print All Documents on Legal Size" for both Windows Print and "Print PCL Direct", and tested many different combination print scenarios. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-03 21:44:07 UTC (rev 100) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-04 01:45:14 UTC (rev 101) @@ -65,12 +65,14 @@ public static final int sProcessPrintChanged = 2; public static final int sProcessPrintRemaining = 3; private int mProcessPrintType = 0; + private int mNumberOfPagesThatWillPrint = 0; private static final String[] mTitleBarTextForPrintDialog = { "Print All", "Print Selected", "Print Changed", "Print Remaining"}; public static byte sbESC = 0x1B; // Escape char public static byte sbFF = 0xC; // Form Feed ( char(12) ) private PriModifyPclBytes mPriModifyPclBytes = null; private PclParser mPclParser = null; + private StringBuffer mIndexNumbersStringBuffer = null; private int mNumberOfPrintPasses = 1; private int mCurrentPrintPassNumber = 1; @@ -131,25 +133,25 @@ // Save the parameter print type (all, selected, changed, or remaining) mProcessPrintType = pProcessPrintType; - StringBuffer tStringBuffer = new StringBuffer(); + mIndexNumbersStringBuffer = new StringBuffer(); mPagesToPrintArrayList = null; // Depending on if print all, print selected, print changed, print remaining, get which pages to print switch (mProcessPrintType) { case sProcessPrintAll: mPagesToPrintArrayList = mPosView.getPosBuildListOfPagesToPrint().makeArrayListofAllPages(); - tStringBuffer.append("\"Print all\""); + mIndexNumbersStringBuffer.append("\"Print all\""); break; case sProcessPrintSelected: mPagesToPrintArrayList = mPosView.getPosBuildListOfPagesToPrint().makeArrayListofSelectedPages(); - tStringBuffer.append("\"Print selected\""); + mIndexNumbersStringBuffer.append("\"Print selected\""); break; case sProcessPrintChanged: mPagesToPrintArrayList = mPosView.getPosBuildListOfPagesToPrint().makeArrayListofChangedPages(); - tStringBuffer.append("\"Print changed\""); + mIndexNumbersStringBuffer.append("\"Print changed\""); break; case sProcessPrintRemaining: mPagesToPrintArrayList = mPosView.getPosBuildListOfPagesToPrint().makeArrayListofRemainingPages(); - tStringBuffer.append("\"Print remaining\""); + mIndexNumbersStringBuffer.append("\"Print remaining\""); break; } @@ -184,21 +186,21 @@ return false; } - int tNumberOfPagesThatWillPrint = mPagesToPrintArrayList.size(); + mNumberOfPagesThatWillPrint = mPagesToPrintArrayList.size(); // Append all the selected page numbers to the StringBuffer - tStringBuffer.append(" " + tNumberOfPagesThatWillPrint + " page"); - if (tNumberOfPagesThatWillPrint == 1) { - tStringBuffer.append(". Index number: "); + mIndexNumbersStringBuffer.append(" " + mNumberOfPagesThatWillPrint + " page"); + if (mNumberOfPagesThatWillPrint == 1) { + mIndexNumbersStringBuffer.append(". Index number: "); } else { - tStringBuffer.append("s. Index numbers are: "); + mIndexNumbersStringBuffer.append("s. Index numbers are: "); } - for (int i = 0; i < tNumberOfPagesThatWillPrint; i++) { + for (int i = 0; i < mNumberOfPagesThatWillPrint; i++) { PosTreeNode eachNode = (PosTreeNode) mPagesToPrintArrayList.get(i); - tStringBuffer.append(eachNode.getNodeNumber()); - if (i < tNumberOfPagesThatWillPrint -1) { - tStringBuffer.append(", "); + mIndexNumbersStringBuffer.append(eachNode.getNodeNumber()); + if (i < mNumberOfPagesThatWillPrint -1) { + mIndexNumbersStringBuffer.append(", "); } } @@ -212,7 +214,7 @@ String tDialogTitleBarString = "Print"; mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, tDialogTitleBarString, - mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, tStringBuffer.toString()); + mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, mIndexNumbersStringBuffer.toString()); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); @@ -234,7 +236,7 @@ return false; } - mPrintingProgressBar.setMaximum(tNumberOfPagesThatWillPrint); + mPrintingProgressBar.setMaximum(mNumberOfPagesThatWillPrint); mPrintingProgressBar.setString("Initializing..."); mPrintingProgressBar.setValue(0); mPrintingProgressJDialog.setLocationRelativeTo(mParentFrame); @@ -250,16 +252,40 @@ // Show the JDialog that has the JProgressBar threadShowProgressBar.start(); - // Depending on the choice in our custom printer setup dialog of PCL Direct or Image Print + StringBuffer tMsgStringBuffer = new StringBuffer(); + tMsgStringBuffer.append(" to printer selected: "); + tMsgStringBuffer.append(mPrintService.getName()); + tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + tMsgStringBuffer.append("\n Print all Documents on Legal Size is "); + if (mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { + tMsgStringBuffer.append("\"True\""); + } else { + tMsgStringBuffer.append("\"False\""); + } + tMsgStringBuffer.append("\n " + mIndexNumbersStringBuffer); + + // Console output print type "Use Windows Print" or "Print PCL Direct" if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { - PriDebug.releaseln("Printing Pcl Direct using printer selected: " + mPrintService.getName()); - mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, - mPrintingProgressBar, mAttributes); + PriDebug.releaseln("\"Print PCL Direct\"" + tMsgStringBuffer.toString()); } else { - PriDebug.releaseln("Image Print using printer selected: " + mPrintService.getName()); - mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, - mPrintingProgressBar, mAttributes); + PriDebug.releaseln("\"Windows Print\"" + tMsgStringBuffer.toString()); } + + // The number of additional copies has already been validated and is guaranteed to be 0 to 3 at this point + mNumberOfPrintPasses = 1 + mPosPrintSetupDialogChoices.getNumAdditionalCopies(); + + // Call the print of the all/selected/remaining/changed pages "N" times depending on Additional Copies field + for (int i = 1; i <= mNumberOfPrintPasses; i++) { + // Call "Use Windows Print" or "Print PCL Direct" + if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { + mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, + mPrintingProgressBar, mAttributes); + } else { + mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, + mPrintingProgressBar, mAttributes); + } + } + return null; } Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-03 21:44:07 UTC (rev 100) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-04 01:45:14 UTC (rev 101) @@ -5,6 +5,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Font; +import java.awt.Frame; import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; @@ -58,6 +59,7 @@ private static final long serialVersionUID = 1L; private PosView mPosView = null; private PosStartupOptions mPosStartupOptions = null; + private Frame mParentFrame = null; private PosPrintSetupDialogChoices mPrintChoices = null; private PrintRequestAttributeSet mAttributes = null; private PrinterJob mPrinterJob = null; @@ -167,6 +169,7 @@ super(pPosView.getOpenPCLViewer().getAppFrame(), pTitleBarText, true); mPosView = pPosView; mPosStartupOptions = mPosView.getOpenPCLViewer().getPosStartupOptions(); + mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); // Set to false the show DSML buttons even if the user said true on the command line mPosStartupOptions.setShowDSMLPrintDialogButtons(false); @@ -208,7 +211,7 @@ mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 1, 2, 1"); mTab1.add(mPrintAllOnLegalSizeJCheckBox, "0, 2, 2, 2"); -// mTab1.add(mAddlCopiesJPanel, "0, 3, 2, 3"); + mTab1.add(mAddlCopiesJPanel, "0, 3, 2, 3"); // mTab1.add(mPrintBarCodesJPanel, "0, 6"); // mTab1.add(mPrintOrderJPanel, "2, 6"); @@ -231,7 +234,7 @@ mPageNumbersThatWillPrintJScrollPane = new JScrollPane(mPageNumbersThatWillPrintJTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // mTab2.add(mPageNumbersThatWillPrintJScrollPane, "0, 2, 1, 2"); - mAdvancedOptionsJDialog = new JDialog(mPosView.getOpenPCLViewer().getAppFrame(), "Advanced Options", true); + mAdvancedOptionsJDialog = new JDialog(mParentFrame, "Advanced Options", true); double tloAdvancedOptionsJDialog[][] = new double[][] { { 10, mTloFill, mTloPref, 10}, // columns { 10, mTloFill, 10, mTloPref, 10} // rows @@ -276,7 +279,7 @@ // ActionListeners mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - JOptionPane.showMessageDialog(mPosView.getOpenPCLViewer().getAppFrame(), sPrinterModeHoverOverString, + JOptionPane.showMessageDialog(mParentFrame, sPrinterModeHoverOverString, "Info for \"Use Windows Print\"", JOptionPane.INFORMATION_MESSAGE); } }); @@ -331,7 +334,7 @@ mAdvancedOptionsJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - mAdvancedOptionsJDialog.setLocationRelativeTo(mPosView.getOpenPCLViewer().getAppFrame()); + mAdvancedOptionsJDialog.setLocationRelativeTo(mParentFrame); mAdvancedOptionsJDialog.setVisible(true); } }); @@ -344,9 +347,11 @@ mOKJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - getPrintChoicesFromScreen(); - mPrintChoices.setUserHitOk(true); - setVisible(false); + if (!hasUserInputErrors()) { + getPrintChoicesFromScreen(); + mPrintChoices.setUserHitOk(true); + setVisible(false); + } } }); @@ -534,9 +539,11 @@ // Additional copies try { - int addlCopies = Integer.parseInt(mAddlCopiesJTextField.getText()); + int addlCopies = Integer.parseInt(mAddlCopiesJTextField.getText().trim()); mPrintChoices.setNumAdditionalCopies(addlCopies); } catch (NumberFormatException e) { + // A blank field will get a NumberFormatException and below it will be set to 0. + // Previous validation in hasUserInputErrors() doesn't allow OK to continue if non numeric or not 0 to 3 is entered mPrintChoices.setNumAdditionalCopies(0); } @@ -745,6 +752,39 @@ } } + private boolean hasUserInputErrors() { + final String tUserInputNumberRequiredString = "A number is required for Additional Copies."; + final String tUserInputValidRange0to3String = "The valid range for Additional Copies is 0 to 3."; + final String tUserInputTitleString = "Problem with Additional Copies field"; + + String tAddlCopiesString = mAddlCopiesJTextField.getText(); + if (tAddlCopiesString.trim().equalsIgnoreCase("")) { + // returning false means the screen passed user input validation (blank is treated as 0) + return false; + } + + int tAddlCopiesInt = 0; + try { + tAddlCopiesInt = Integer.parseInt(tAddlCopiesString); + } catch (NumberFormatException nfe) { + JOptionPane.showMessageDialog(mParentFrame, tUserInputNumberRequiredString, + tUserInputTitleString, JOptionPane.INFORMATION_MESSAGE); + // returning true means the screen didn't pass user input validation + return true; + } + + if (tAddlCopiesInt < 0 || tAddlCopiesInt > 3) { + JOptionPane.showMessageDialog(mParentFrame, tUserInputValidRange0to3String, + tUserInputTitleString, JOptionPane.INFORMATION_MESSAGE); + // returning true means the screen didn't pass user input validation + return true; + + } else { + // returning false means the screen passed user input validation + return false; + } + } + private class ListOfPrintersSelectionListener implements ListSelectionListener { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-03 21:44:08
|
Revision: 100 http://openpcl.svn.sourceforge.net/openpcl/?rev=100&view=rev Author: documentsystems Date: 2007-07-03 14:44:07 -0700 (Tue, 03 Jul 2007) Log Message: ----------- Howard Hoagland. Implemented "Print All Documents on Legal Size" for both Windows Print and PCL Direct print. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-02 23:29:21 UTC (rev 99) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-03 21:44:07 UTC (rev 100) @@ -72,36 +72,36 @@ public PageFormat getPageFormat(int pForPageNumber) throws IndexOutOfBoundsException { PageFormat tBuiltPageFormat = new PageFormat(); - if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { - // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file - tBuiltPageFormat.setPaper(mLegalPaperPortrait); - - } - if (pForPageNumber >= mNumberOfPages) { throw new IndexOutOfBoundsException( makeIndexOutOfBoundsInfoString(pForPageNumber, mNumberOfPages)); + } else { + if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { + // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file + tBuiltPageFormat.setPaper(mLegalPaperPortrait); + } else { + try { + mPosTreeNode = mPagesToPrintArrayList.get(pForPageNumber); + } catch (IndexOutOfBoundsException e) { + mPosTreeNode = null; + throw new IndexOutOfBoundsException( + makeIndexOutOfBoundsInfoString(pForPageNumber, mNumberOfPages)); + } - } else { - try { - mPosTreeNode = mPagesToPrintArrayList.get(pForPageNumber); - } catch (IndexOutOfBoundsException e) { - mPosTreeNode = null; - throw new IndexOutOfBoundsException( - makeIndexOutOfBoundsInfoString(pForPageNumber, mNumberOfPages)); - } - - if (mPosTreeNode != null) { - // Pick the paper size by calling the below method with may be subclassed by a plugin. - // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed - // methods specified in the interface IPluginHooksOpenPCL - if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(mPosTreeNode)) { - // Letter size - tBuiltPageFormat.setPaper(mLetterPaperPortrait); + if (mPosTreeNode == null) { + tBuiltPageFormat.setPaper(mLegalPaperPortrait); // If tree node is null then make paper Legal (shouldn't happen) } else { - // Legal size - tBuiltPageFormat.setPaper(mLegalPaperPortrait); + // Pick the paper size by calling the below method with may be subclassed by a plugin. + // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed + // methods specified in the interface IPluginHooksOpenPCL + if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(mPosTreeNode)) { + // Letter size + tBuiltPageFormat.setPaper(mLetterPaperPortrait); + } else { + // Legal size + tBuiltPageFormat.setPaper(mLegalPaperPortrait); + } } } } Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-02 23:29:21 UTC (rev 99) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-03 21:44:07 UTC (rev 100) @@ -2,7 +2,6 @@ import info.clearthought.layout.TableLayout; -import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -37,6 +36,7 @@ import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; @@ -52,6 +52,7 @@ import com.openpcl.pclrenderimage.util.PriDebug; import com.openpcl.viewer.options.PosStartupOptions; import com.openpcl.viewer.panels.PosView; +import com.openpcl.viewer.util.PosReadImageIcon; public class PosPrintSetupDialog extends JDialog { private static final long serialVersionUID = 1L; @@ -93,7 +94,7 @@ private JPanel mTab1 = new JPanel(); private JPanel mListOfPrintersJPanel = null; private JPanel mAddlCopiesJPanel = null; - private JPanel mPrintAsPclJPanel = null; + private JPanel mWindowsPrintOrPclPrintJPanel = null; private JPanel mPrintBarCodesJPanel = null; private JPanel mPrintOrderJPanel = null; private JPanel mPrintFormNamesJPanel = null; @@ -131,6 +132,7 @@ private JRadioButton mDuplexNoJRadioButton = new JRadioButton("No"); // JButtons + private JButton mPrintModeMoreInfoJButton = new JButton(null, PosReadImageIcon.read("QuestionMark.gif")); private JButton mFontSizeDinkyJButton = new JButton("D"); private JButton mFontSizeSmallJButton = new JButton("*S*"); private JButton mFontSizeMediumJButton = new JButton("M"); @@ -140,7 +142,6 @@ private JButton mOpenJDKPrintDialogJButton = new JButton("Open JDK Print Dialog"); private JButton mAdvancedOptionsJButton = new JButton("Advanced Options"); private JButton mAdvancedOptionsOkJButton = null; - private JButton mPrintModeMoreInfoJButton = new JButton("More Info"); // JCheckBoxes private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Use Windows Print (recommended)"); @@ -189,10 +190,9 @@ mPageNumbersThatWillPrintJTextArea.setForeground(Color.BLACK); mPageNumbersThatWillPrintJTextArea.setFont(mTextAreaFont); - // Make tab 1 items mListOfPrintersJPanel = makeListOfPrintersPanel(); + mWindowsPrintOrPclPrintJPanel = makeWindowsPrintOrPclPrintPanel(); mAddlCopiesJPanel = makeAdditionalCopiesPanel(); - mPrintAsPclJPanel = makePrintAsPclPanel(); mPrintBarCodesJPanel = makePrintBarCodesPanel(); mPrintOrderJPanel = makePrintOrderPanel(); mPrintFormNamesJPanel = makePrintFormNamesPanel(); @@ -201,13 +201,15 @@ // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloVgap, mTloPref, 1, mTloPref, 1, mTloPref, 1, mTloPref}}; // rows + { mTloFill, mTloPref, mTloPref, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); -// mTab1.add(mAddlCopiesJPanel, "0, 2, 2, 2"); - mTab1.add(mPrintAsPclJPanel, "0, 4, 2, 4"); + mTab1.add(mWindowsPrintOrPclPrintJPanel, "0, 1, 2, 1"); + mTab1.add(mPrintAllOnLegalSizeJCheckBox, "0, 2, 2, 2"); +// mTab1.add(mAddlCopiesJPanel, "0, 3, 2, 3"); + // mTab1.add(mPrintBarCodesJPanel, "0, 6"); // mTab1.add(mPrintOrderJPanel, "2, 6"); // mTab1.add(mPrintFormNamesJPanel, "0, 8"); @@ -272,6 +274,13 @@ add(mBottomButtonsJPanel, "1, 4"); // ActionListeners + mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + JOptionPane.showMessageDialog(mPosView.getOpenPCLViewer().getAppFrame(), sPrinterModeHoverOverString, + "Info for \"Use Windows Print\"", JOptionPane.INFORMATION_MESSAGE); + } + }); + mFontSizeDinkyJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mFontSizeDinkyJButton.setText("*D*"); @@ -395,26 +404,27 @@ return panel; } - private JPanel makeAdditionalCopiesPanel() { + private JPanel makeWindowsPrintOrPclPrintPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{mTloPref, 40, mTloFill }, {mTloFill, mTloPref, mTloFill }}; + double tloGridSpec[][] = new double[][] {{ mTloPref, mTloPref, mTloFill}, + { mTloPref}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); - mAddlCopiesJLabel.setHorizontalAlignment(SwingConstants.LEFT); - panel.add(mAddlCopiesJLabel, "0, 1"); - panel.add(mAddlCopiesJTextField, "1, 1"); + panel.add(mIsPclPrinterJCheckBox, "0, 0"); + mPrintModeMoreInfoJButton.setMaximumSize(new Dimension(24,24)); + mPrintModeMoreInfoJButton.setPreferredSize(mPrintModeMoreInfoJButton.getMaximumSize()); + panel.add(mPrintModeMoreInfoJButton, "1, 0"); return panel; } - private JPanel makePrintAsPclPanel() { + private JPanel makeAdditionalCopiesPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloPref, mTloFill}, - { mTloPref}}; + double tloGridSpec[][] = new double[][] {{mTloHgap, mTloPref, 40, mTloFill }, {mTloPref}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); - panel.add(mIsPclPrinterJCheckBox, " 0, 0"); -// panel.add(mPrintModeMoreInfoJButton, "2,0"); -// panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); + mAddlCopiesJLabel.setHorizontalAlignment(SwingConstants.LEFT); + panel.add(mAddlCopiesJLabel, "1, 0"); + panel.add(mAddlCopiesJTextField, "2, 0"); return panel; } @@ -494,7 +504,6 @@ mTloFill, mTloPref, mTloFill}, { mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); -// panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); // panel.add(mAdvancedOptionsJButton, "0, 0"); JPanel tGridLayoutJPanel = new JPanel(new GridLayout(1, 2, 5, 5)); tGridLayoutJPanel.add(mOKJButton); @@ -561,14 +570,11 @@ } private void makeArrayListOfDialogItems() { - - // Tab 1 items mItemsOnDialogBox.add(mListOfPrintersJList); + mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); + mItemsOnDialogBox.add(mPrintAllOnLegalSizeJCheckBox); mItemsOnDialogBox.add(mAddlCopiesJLabel); - mItemsOnDialogBox.add(mFontSizeJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); - mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); - mItemsOnDialogBox.add(mPrintModeMoreInfoJButton); mItemsOnDialogBox.add(mPrintBarCodesYesJRadioButton); mItemsOnDialogBox.add(mPrintBarCodesNoJRadioButton); mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); @@ -579,15 +585,12 @@ mItemsOnDialogBox.add(mDuplexYesJRadioButton); mItemsOnDialogBox.add(mDuplexNoJRadioButton); - // Tab 2 items mItemsOnDialogBox.add(mPageNumbersThatWillPrintJLabel); mItemsOnDialogBox.add(mPageNumbersThatWillPrintJTextArea); - // Tab 3 items mItemsOnDialogBox.add(mOpenJDKPrintDialogJButton); - // not on a tab items - mItemsOnDialogBox.add(mPrintAllOnLegalSizeJCheckBox); + mItemsOnDialogBox.add(mFontSizeJLabel); mItemsOnDialogBox.add(mFontSizeDinkyJButton); mItemsOnDialogBox.add(mFontSizeSmallJButton); mItemsOnDialogBox.add(mFontSizeMediumJButton); @@ -619,8 +622,8 @@ private void makePanelTitledBorders() { // mListOfPrintersJPanel.setBorder(generateTitledBorder("Installed Printers")); mListOfPrintersJPanel.setBorder(generateTitledBorder("Printers")); -// mPrintAsPclJPanel.setBorder(generateTitledBorder("Printer Supports PCL ?")); - mPrintAsPclJPanel.setBorder(BorderFactory.createEmptyBorder()); + mWindowsPrintOrPclPrintJPanel.setBorder(BorderFactory.createEmptyBorder()); + mAddlCopiesJPanel.setBorder(BorderFactory.createEmptyBorder()); mPrintBarCodesJPanel.setBorder(generateTitledBorder("Print Bar Codes")); mPrintOrderJPanel.setBorder(generateTitledBorder("Print Order")); mPrintFormNamesJPanel.setBorder(generateTitledBorder("Print Form Names")); @@ -699,8 +702,10 @@ } private void setHoverHelpOnItems() { - mAddlCopiesJTextField.setToolTipText(sNotImplementedString + "Additional copies"); mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); + mAddlCopiesJTextField.setToolTipText("Allowed values are 0 to 3 additional copies"); + mPrintAllOnLegalSizeJCheckBox.setToolTipText("Make all pages print on Legal paper"); + mPrintBarCodesYesJRadioButton.setToolTipText(sBarCodeHoverString); mPrintBarCodesNoJRadioButton.setToolTipText(sBarCodeHoverString); mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); @@ -710,17 +715,14 @@ mPrintFormNamesNoJRadioButton.setToolTipText("Don't print form names"); mDuplexYesJRadioButton.setToolTipText(sNotImplementedString + "Duplex pages"); mDuplexNoJRadioButton.setToolTipText("Don't duplex pages"); - mPrintAllOnLegalSizeJCheckBox.setToolTipText(sNotImplementedString + "Print all on Legal size"); } private void grayOutItemsNotImplemented() { - mAddlCopiesJTextField.setEnabled(false); mPrintBarCodesYesJRadioButton.setEnabled(false); mPrintOrderLegalFirstThenLetterJRadioButton.setEnabled(false); mPrintOrderLetterFirstThenLegalJRadioButton.setEnabled(false); mPrintFormNamesYesJRadioButton.setEnabled(false); mDuplexYesJRadioButton.setEnabled(false); - mPrintAllOnLegalSizeJCheckBox.setEnabled(false); mOpenJDKPrintDialogJButton.setEnabled(false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-02 23:29:21
|
Revision: 99 http://openpcl.svn.sourceforge.net/openpcl/?rev=99&view=rev Author: documentsystems Date: 2007-07-02 16:29:21 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Howard Hoagland. Deleted lines that show the popup dialog HTML viewer with the long explanation text about if the printer PCL, because of the decision to go with a one line hover help instead that says "Unselect if printer supports PCL (Example: HP LaserJet 4050)" Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-02 18:35:20 UTC (rev 98) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-02 23:29:21 UTC (rev 99) @@ -50,7 +50,6 @@ import javax.swing.event.ListSelectionListener; import com.openpcl.pclrenderimage.util.PriDebug; -import com.openpcl.viewer.dialogs.PosHtmlViewerButtonChoicesDialog; import com.openpcl.viewer.options.PosStartupOptions; import com.openpcl.viewer.panels.PosView; @@ -69,7 +68,6 @@ private double mTloVgap = 5; private String mSelectedPageNumbers = null; private JDialog mAdvancedOptionsJDialog = null; - private PosHtmlViewerButtonChoicesDialog mPrintModeMoreInfoDialog = null; // Adjust to fonts private final Font mAdjustToSmallFont = getFont(); @@ -118,8 +116,6 @@ // JTextAreas private JTextArea mPageNumbersThatWillPrintJTextArea = new JTextArea(); private JScrollPane mPageNumbersThatWillPrintJScrollPane = null; - private JTextArea mPrinterSupportsPclJTextArea = new JTextArea(); - private JScrollPane mPrinterSupportsPclJScrollPane = null; private Color mTextAreaBgColor = new Color(244, 244, 244); // a very light gray private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); @@ -164,21 +160,6 @@ private static final String sPrinterModeHoverOverString = "<html>Unselect if printer supports PCL (Example: HP LaserJet 4050)</html>"; - private static final String sPrinterSupportsNotesString = - "<html><ul>" + - "<li>Windows print means the pages print correctly for all printers (is printer independent)." + - "<li>Unchecking the box requires that your printer be an HP LaserJet XX that supports PCL<br>" + - "and pages print 3 times faster than if checked, but if not an HP LaserJet XX printer<br>" + - "then printouts will not be correct." + - "<li>If pages print wrong then check the box and try printing again." + - "<li>If the printer name starts with \"HP\" but doesn't say \"LaserJet\", then check the box." + - "<li>Some examples of HP LaserJet printers (and you can uncheck the box) are:" + - "<table>" + - "<tr><td>HP LaserJet 1022,<td>HP LaserJet P2015,<td>HP LaserJet 2200,<td>HP LaserJet 2400,</tr>" + - "<tr><td>HP LaserJet P3005,<td>HP LaserJet 4050,<td>HP LaserJet 4250,<td>HP LaserJet 5000,</tr>" + - "<tr><td>HP LaserJet 5200,<td>HP LaserJet 9040,<td>HP LaserJet etc etc<td></tr>" + - "<table></ul></html>"; - public PosPrintSetupDialog(PosView pPosView, String pTitleBarText, PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pAttributes, PrinterJob pPrinterJob, String pSelectedPageNumbers) throws HeadlessException { @@ -204,17 +185,6 @@ setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new DialogWindowListener()); - mPrinterSupportsPclJTextArea.setEditable(false); - mPrinterSupportsPclJTextArea.setFont(mTextAreaFont); - mPrinterSupportsPclJTextArea.setLineWrap(true); - mPrinterSupportsPclJTextArea.setWrapStyleWord(true); - mPrinterSupportsPclJTextArea.setText(sPrinterSupportsNotesString); - mPrinterSupportsPclJTextArea.setBackground(mTextAreaBgColor); - mPrinterSupportsPclJTextArea.setForeground(Color.BLACK); - mPrinterSupportsPclJScrollPane = new JScrollPane(mPrinterSupportsPclJTextArea, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - mPrinterSupportsPclJScrollPane.setPreferredSize(new Dimension(380, 100)); - mPageNumbersThatWillPrintJTextArea.setBackground(mTextAreaBgColor); mPageNumbersThatWillPrintJTextArea.setForeground(Color.BLACK); mPageNumbersThatWillPrintJTextArea.setFont(mTextAreaFont); @@ -301,12 +271,6 @@ add(mTab1, "1, 2"); add(mBottomButtonsJPanel, "1, 4"); - mPrintModeMoreInfoDialog = new PosHtmlViewerButtonChoicesDialog(mPosView.getOpenPCLViewer().getAppFrame(), - "More Info Windows Print check box", true); - mPrintModeMoreInfoDialog.setHtmlPanelAndButtons(sPrinterSupportsNotesString, new String[] {"OK"}); - mPrintModeMoreInfoDialog.pack(); - mPrintModeMoreInfoDialog.setSize(620, 360); - // ActionListeners mFontSizeDinkyJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -369,13 +333,6 @@ } }); - mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent pE) { - mPrintModeMoreInfoDialog.setLocationRelativeTo(mPosView.getOpenPCLViewer().getAppFrame()); - mPrintModeMoreInfoDialog.setVisible(true); - } - }); - mOKJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getPrintChoicesFromScreen(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-02 18:35:17
|
Revision: 98 http://openpcl.svn.sourceforge.net/openpcl/?rev=98&view=rev Author: documentsystems Date: 2007-07-02 11:35:20 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Howard Hoagland. Fixed bug where switching to white text using PCL command "ESC * v 1 T" to intentionally put in data in the PCL that won't show when viewed and printed, the text was correctly white text for viewing and printing but when converted to a PDF Acrobat file, the text was blue instead of white. The bug was happening because the text chars are buffered up and written as one string of chars instead of writing the chars one at a time, to make the PDF file smaller. The trigger to write the buffered up chars is on several PCL commands like any cursor position but wasn't on changing the text color. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java Modified: openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2007-07-02 18:29:48 UTC (rev 97) +++ openpcl/src/com/openpcl/pclrenderimage/PclRenderImage.java 2007-07-02 18:35:20 UTC (rev 98) @@ -348,6 +348,7 @@ } else if (cmdCharArray[1] == 'v') { // *v if (cmdCharArray[2] == ',') { if (cmdCharArray[3] == 'T') { // *v,T + mPriDrawText.drawBufferedUpCharsAs1String(); // Set current Pattern. 0=black, 1=white. White text is put on top of rectangle draws sometimes mPriPageSettings.setPrintPattern(cmdValueInt); } else if (cmdCharArray[3] == 'N') { // *v,N This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-02 18:29:47
|
Revision: 97 http://openpcl.svn.sourceforge.net/openpcl/?rev=97&view=rev Author: documentsystems Date: 2007-07-02 11:29:48 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Changed GridLayout parameters in dialog layout Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-02 18:21:48 UTC (rev 96) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-02 18:29:48 UTC (rev 97) @@ -540,8 +540,8 @@ // panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); // panel.add(mAdvancedOptionsJButton, "0, 0"); JPanel tGridLayoutJPanel = new JPanel(new GridLayout(1, 2, 5, 5)); - tGridLayoutJPanel.add(mOKJButton, "0,0"); - tGridLayoutJPanel.add(mCancelJButton, "0,1"); + tGridLayoutJPanel.add(mOKJButton); + tGridLayoutJPanel.add(mCancelJButton); panel.add(tGridLayoutJPanel, "1, 0"); return panel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-02 18:21:45
|
Revision: 96 http://openpcl.svn.sourceforge.net/openpcl/?rev=96&view=rev Author: documentsystems Date: 2007-07-02 11:21:48 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Changed to reference class instance varialbe mProcessPrintType in several places instead of the passed in variable. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-21 23:43:48 UTC (rev 95) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-02 18:21:48 UTC (rev 96) @@ -132,6 +132,7 @@ mProcessPrintType = pProcessPrintType; StringBuffer tStringBuffer = new StringBuffer(); + mPagesToPrintArrayList = null; // Depending on if print all, print selected, print changed, print remaining, get which pages to print switch (mProcessPrintType) { case sProcessPrintAll: @@ -157,24 +158,24 @@ mPosView.getOpenPCLViewer().setIsDrawingForPrinting(false); // Show error dialog depending on if print all, print selected, print changed, print remaining. - switch (pProcessPrintType) { + switch (mProcessPrintType) { case sProcessPrintAll: - JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[pProcessPrintType] + + JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[mProcessPrintType] + "\" because no pages found to print", "No pages to print", JOptionPane.INFORMATION_MESSAGE); break; case sProcessPrintSelected: - JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[pProcessPrintType] + + JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[mProcessPrintType] + "\" because you need to Left Click on the tree to select one or more pages.", "No pages to print", JOptionPane.INFORMATION_MESSAGE); break; case sProcessPrintChanged: - JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[pProcessPrintType] + + JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[mProcessPrintType] + "\" because no changed pages were found.", "No pages to print", JOptionPane.INFORMATION_MESSAGE); break; case sProcessPrintRemaining: - JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[pProcessPrintType] + + JOptionPane.showMessageDialog(mParentFrame, "Can't \"" + mTitleBarTextForPrintDialog[mProcessPrintType] + "\" because you need to Left Click on the tree to select one or more pages.", "No pages to print", JOptionPane.INFORMATION_MESSAGE); break; @@ -306,8 +307,10 @@ // return if there's no current pages to print if (pPagesToPrintArrayList == null || pPagesToPrintArrayList.size() < 1) { return false; } - // Make a new ByteArrayOutputStream with the Pcl bytes gotten from the BLK page or from the PCL file page - tByteArrayOutputStream = new ByteArrayOutputStream(20000); + // Make a new ByteArrayOutputStream with the Pcl bytes gotten from the BLK page or from the PCL file page, + // and make it 20k bytes. Note that ByteArrayOutputStream automatically grows the storage space if it runs out of room + // by allocating a new bigger byte array then doing a memcopy to the new one. + tByteArrayOutputStream = new ByteArrayOutputStream(20 * 1024); // Get the PCL bytes for each page that the user selected in the tree (could be one page or multi page) for (tPageNumber = 0; tPageNumber < pPagesToPrintArrayList.size(); tPageNumber++) { @@ -340,7 +343,7 @@ tByteArrayOutputStream.write(tLegalSizePaperBytes); } else { - // Pick the paper size by calling the below method with may be subclassed by a plugin. + // Pick the paper size by calling the below method which may be subclassed by a plugin. // The below uses polymorphism because the method isTreeNodePageLetterSize() is one of the subclassed // methods specified in the interface IPluginHooksOpenPCL if (mPosView.getOpenPCLViewer().isTreeNodePageLetterSize(tPrintThisTreeNode)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-21 23:43:51
|
Revision: 95 http://openpcl.svn.sourceforge.net/openpcl/?rev=95&view=rev Author: documentsystems Date: 2007-06-21 16:43:48 -0700 (Thu, 21 Jun 2007) Log Message: ----------- Howard Hoagland. In the Printer Setup dialog, the OK button should be the same width at the Cancel button but wasn't the same width even setting the preferred size of the Ok button the same as the Cancel preferred size, so switched from the TableLayout preferred column width to the GridLayout(1,2,5,5) and that fixed the same widths of the 2 buttons. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 23:10:44 UTC (rev 94) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 23:43:48 UTC (rev 95) @@ -6,6 +6,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Font; +import java.awt.GridLayout; import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -533,15 +534,15 @@ private JPanel makeBottomButtonsPanel() { JPanel panel = new JPanel(); double tloGridSpec[][] = new double[][] {{ - mTloHgap, mTloFill, mTloPref, mTloHgap, mTloPref, mTloFill, mTloHgap}, { mTloPref }}; + mTloFill, mTloPref, mTloFill}, { mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); // panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); // panel.add(mAdvancedOptionsJButton, "0, 0"); - mOKJButton.setPreferredSize(mCancelJButton.getPreferredSize()); // Make Ok button same width as Cancel button - mOKJButton.setMinimumSize(mCancelJButton.getPreferredSize()); - panel.add(mOKJButton, "2, 0"); - panel.add(mCancelJButton, "4, 0"); + JPanel tGridLayoutJPanel = new JPanel(new GridLayout(1, 2, 5, 5)); + tGridLayoutJPanel.add(mOKJButton, "0,0"); + tGridLayoutJPanel.add(mCancelJButton, "0,1"); + panel.add(tGridLayoutJPanel, "1, 0"); return panel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-21 23:10:42
|
Revision: 94 http://openpcl.svn.sourceforge.net/openpcl/?rev=94&view=rev Author: documentsystems Date: 2007-06-21 16:10:44 -0700 (Thu, 21 Jun 2007) Log Message: ----------- Howard Hoagland. Moved the Ok and Cancel buttons up about 10 pixels to take up the blank vertical space, and put 5 more pixels below the Ok and Cancel buttons and the bottom frame edge. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 22:41:24 UTC (rev 93) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 23:10:44 UTC (rev 94) @@ -230,7 +230,7 @@ // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref}}; // rows + { mTloFill, mTloVgap, mTloPref, 1, mTloPref, 1, mTloPref, 1, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); @@ -290,7 +290,7 @@ // Add the Control Panel, JTabbedPane, and buttons panel to the contentPane double tloContentPaneGridSpec[][] = new double[][] { { mTloHgap, mTloFill, mTloHgap }, // columns - { mTloVgap, mTloPref, mTloFill, mTloVgap, mTloPref, mTloVgap }}; // rows + { mTloVgap, mTloPref, mTloFill, 1, mTloPref, mTloVgap, mTloVgap }}; // rows TableLayout tloContentPaneLayout = new TableLayout(tloContentPaneGridSpec); setLayout(tloContentPaneLayout); mControlJPanel = makeControlPanel(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-21 22:41:23
|
Revision: 93 http://openpcl.svn.sourceforge.net/openpcl/?rev=93&view=rev Author: documentsystems Date: 2007-06-21 15:41:24 -0700 (Thu, 21 Jun 2007) Log Message: ----------- Howard Hoagland. Changes to Printer Setup dialog. 1. Change title to say "Print" instead of "Printer Setup" and take off the title bar "Print All" or "Print Selected" or "Print Remaining" and take off the title bar how many pages will print, just say "Print" in the title bar. 2. Remove the Advanced Options button so that the user can't get the dialog that shows what pages will print. 3. Remove the "More Info" button that shows text about checking or unchecking the "Use Windows Print". 4. Center the OK and Cancel buttons on the bottom and make the buttons the same size. 5. Change the hover text on the "Use Windows Print" to say "Unselect if printer supports PCL (Example: HP LaserJet 4050)" instead of the longer instructions text that was there before. 6. Change the border title of the list of installed printers to be "Printers" instead of "Installed Printers". Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-21 19:38:33 UTC (rev 92) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-21 22:41:24 UTC (rev 93) @@ -205,8 +205,10 @@ mPrinterJob = PrinterJob.getPrinterJob(); // Put up our custom printer setup dialog - String tDialogTitleBarString = "Printer Setup. " + mTitleBarTextForPrintDialog[pProcessPrintType] + " (" + - tNumberOfPagesThatWillPrint + (tNumberOfPagesThatWillPrint ==1 ? " page" : " pages") + " will print)"; +// String tDialogTitleBarString = "Print" + mTitleBarTextForPrintDialog[pProcessPrintType] + " (" + +// tNumberOfPagesThatWillPrint + (tNumberOfPagesThatWillPrint ==1 ? " page" : " pages") + " will print)"; + + String tDialogTitleBarString = "Print"; mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, tDialogTitleBarString, mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, tStringBuffer.toString()); @@ -444,7 +446,7 @@ mPrinterJob = PrinterJob.getPrinterJob(); // Put up our custom printer setup dialog - mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, "Printer Setup", + mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, "Print", mPosPrintSetupDialogChoices, mAttributes, mPrinterJob, "No pages will print at this time because this is Printer Setup options only. Make sure to hit OK to save your changes."); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 19:38:33 UTC (rev 92) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 22:41:24 UTC (rev 93) @@ -160,6 +160,9 @@ private static final String sBarCodeHoverString = "Bar codes already in the PCL are printed, but bar codes are not generated on the fly."; + private static final String sPrinterModeHoverOverString = + "<html>Unselect if printer supports PCL (Example: HP LaserJet 4050)</html>"; + private static final String sPrinterSupportsNotesString = "<html><ul>" + "<li>Windows print means the pages print correctly for all printers (is printer independent)." + @@ -447,12 +450,12 @@ private JPanel makePrintAsPclPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloPref, 5, mTloPref, mTloFill}, + double tloGridSpec[][] = new double[][] {{ mTloPref, mTloFill}, { mTloPref}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); panel.add(mIsPclPrinterJCheckBox, " 0, 0"); - panel.add(mPrintModeMoreInfoJButton, "2,0"); +// panel.add(mPrintModeMoreInfoJButton, "2,0"); // panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); return panel; } @@ -530,11 +533,13 @@ private JPanel makeBottomButtonsPanel() { JPanel panel = new JPanel(); double tloGridSpec[][] = new double[][] {{ - mTloPref, mTloFill, mTloPref, mTloHgap, mTloPref}, { mTloPref }}; + mTloHgap, mTloFill, mTloPref, mTloHgap, mTloPref, mTloFill, mTloHgap}, { mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); // panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); - panel.add(mAdvancedOptionsJButton, "0, 0"); +// panel.add(mAdvancedOptionsJButton, "0, 0"); + mOKJButton.setPreferredSize(mCancelJButton.getPreferredSize()); // Make Ok button same width as Cancel button + mOKJButton.setMinimumSize(mCancelJButton.getPreferredSize()); panel.add(mOKJButton, "2, 0"); panel.add(mCancelJButton, "4, 0"); return panel; @@ -654,7 +659,8 @@ } private void makePanelTitledBorders() { - mListOfPrintersJPanel.setBorder(generateTitledBorder("Installed Printers")); +// mListOfPrintersJPanel.setBorder(generateTitledBorder("Installed Printers")); + mListOfPrintersJPanel.setBorder(generateTitledBorder("Printers")); // mPrintAsPclJPanel.setBorder(generateTitledBorder("Printer Supports PCL ?")); mPrintAsPclJPanel.setBorder(BorderFactory.createEmptyBorder()); mPrintBarCodesJPanel.setBorder(generateTitledBorder("Print Bar Codes")); @@ -736,7 +742,7 @@ private void setHoverHelpOnItems() { mAddlCopiesJTextField.setToolTipText(sNotImplementedString + "Additional copies"); - mIsPclPrinterJCheckBox.setToolTipText(sPrinterSupportsNotesString); + mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); mPrintBarCodesYesJRadioButton.setToolTipText(sBarCodeHoverString); mPrintBarCodesNoJRadioButton.setToolTipText(sBarCodeHoverString); mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-21 19:38:33
|
Revision: 92 http://openpcl.svn.sourceforge.net/openpcl/?rev=92&view=rev Author: documentsystems Date: 2007-06-21 12:38:33 -0700 (Thu, 21 Jun 2007) Log Message: ----------- Howard Hoagland. Added a "More Info" button to the right of the "Use Windows Print (recommended)" check box. When the user clicks the "More Info" button, a popup dialog has the info text. For now, this same info text is also the hover help text over the checkbox but can be removed from hover help if that is decided to do. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 18:43:40 UTC (rev 91) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 19:38:33 UTC (rev 92) @@ -49,6 +49,7 @@ import javax.swing.event.ListSelectionListener; import com.openpcl.pclrenderimage.util.PriDebug; +import com.openpcl.viewer.dialogs.PosHtmlViewerButtonChoicesDialog; import com.openpcl.viewer.options.PosStartupOptions; import com.openpcl.viewer.panels.PosView; @@ -67,7 +68,7 @@ private double mTloVgap = 5; private String mSelectedPageNumbers = null; private JDialog mAdvancedOptionsJDialog = null; - private JButton mAdvancedOptionsOkJButton = null; + private PosHtmlViewerButtonChoicesDialog mPrintModeMoreInfoDialog = null; // Adjust to fonts private final Font mAdjustToSmallFont = getFont(); @@ -141,6 +142,8 @@ private JButton mCancelJButton = new JButton("Cancel"); private JButton mOpenJDKPrintDialogJButton = new JButton("Open JDK Print Dialog"); private JButton mAdvancedOptionsJButton = new JButton("Advanced Options"); + private JButton mAdvancedOptionsOkJButton = null; + private JButton mPrintModeMoreInfoJButton = new JButton("More Info"); // JCheckBoxes private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Use Windows Print (recommended)"); @@ -262,11 +265,6 @@ tJPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); tJPanel.add("1, 1, 2, 1", mPageNumbersThatWillPrintJScrollPane); mAdvancedOptionsOkJButton = new JButton("OK"); - mAdvancedOptionsOkJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent pE) { - mAdvancedOptionsJDialog.setVisible(false); - } - }); tJPanel.add("2, 3", mAdvancedOptionsOkJButton); mAdvancedOptionsJDialog.setContentPane(tJPanel); mAdvancedOptionsJDialog.setSize(400, 280); @@ -299,6 +297,12 @@ add(mTab1, "1, 2"); add(mBottomButtonsJPanel, "1, 4"); + mPrintModeMoreInfoDialog = new PosHtmlViewerButtonChoicesDialog(mPosView.getOpenPCLViewer().getAppFrame(), + "More Info Windows Print check box", true); + mPrintModeMoreInfoDialog.setHtmlPanelAndButtons(sPrinterSupportsNotesString, new String[] {"OK"}); + mPrintModeMoreInfoDialog.pack(); + mPrintModeMoreInfoDialog.setSize(620, 360); + // ActionListeners mFontSizeDinkyJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -355,6 +359,19 @@ } }); + mAdvancedOptionsOkJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + mAdvancedOptionsJDialog.setVisible(false); + } + }); + + mPrintModeMoreInfoJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + mPrintModeMoreInfoDialog.setLocationRelativeTo(mPosView.getOpenPCLViewer().getAppFrame()); + mPrintModeMoreInfoDialog.setVisible(true); + } + }); + mOKJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getPrintChoicesFromScreen(); @@ -430,11 +447,12 @@ private JPanel makePrintAsPclPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, 20, mTloPref, mTloFill, mTloHgap }, - { mTloPref, mTloPref, mTloVgap }}; + double tloGridSpec[][] = new double[][] {{ mTloPref, 5, mTloPref, mTloFill}, + { mTloPref}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); - panel.add(mIsPclPrinterJCheckBox," 1, 0, 2, 0"); + panel.add(mIsPclPrinterJCheckBox, " 0, 0"); + panel.add(mPrintModeMoreInfoJButton, "2,0"); // panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); return panel; } @@ -587,6 +605,7 @@ mItemsOnDialogBox.add(mFontSizeJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); + mItemsOnDialogBox.add(mPrintModeMoreInfoJButton); mItemsOnDialogBox.add(mPrintBarCodesYesJRadioButton); mItemsOnDialogBox.add(mPrintBarCodesNoJRadioButton); mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-21 18:43:39
|
Revision: 91 http://openpcl.svn.sourceforge.net/openpcl/?rev=91&view=rev Author: documentsystems Date: 2007-06-21 11:43:40 -0700 (Thu, 21 Jun 2007) Log Message: ----------- Howard Hoagland. On the Printer Setup dialog, commented out the lines of code that added items on the screen that were not implemented yet, but I'll add them back on the Printer Setup dialog after I implement them later: Print Bar Codes, Print Legal pages first then Letter pages, Print Letter pages first then Legal, force Duplex (front and back), Print Form Names, Print all on Legal paper even if Letter size. Moved the "Note that:" 3 items from the Printer Setup dialog to the hover help tooltip text. Changed the print mode check box from "Printer supports PCL (is an HP LaserJet XX)" changed to "Use Windows Print (recommended)". Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-18 21:35:52 UTC (rev 90) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-21 18:43:40 UTC (rev 91) @@ -2,6 +2,7 @@ import info.clearthought.layout.TableLayout; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -65,6 +66,8 @@ private double mTloHgap = 5; private double mTloVgap = 5; private String mSelectedPageNumbers = null; + private JDialog mAdvancedOptionsJDialog = null; + private JButton mAdvancedOptionsOkJButton = null; // Adjust to fonts private final Font mAdjustToSmallFont = getFont(); @@ -137,9 +140,10 @@ private JButton mOKJButton = new JButton("OK"); private JButton mCancelJButton = new JButton("Cancel"); private JButton mOpenJDKPrintDialogJButton = new JButton("Open JDK Print Dialog"); + private JButton mAdvancedOptionsJButton = new JButton("Advanced Options"); // JCheckBoxes - private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Printer supports PCL (is an HP LaserJet XX)"); + private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Use Windows Print (recommended)"); private JCheckBox mPrintAllOnLegalSizeJCheckBox = new JCheckBox("Print All Documents on Legal Size"); // JLists @@ -153,27 +157,20 @@ private static final String sBarCodeHoverString = "Bar codes already in the PCL are printed, but bar codes are not generated on the fly."; - private static final String sPrinterSupportsPclString = - "<html>Examples are:" + - "<ul>" + - "<li>HP LaserJet 1022" + - "<li>HP LaserJet P2015" + - "<li>HP LaserJet 2200" + - "<li>HP LaserJet 2400" + - "<li>HP LaserJet P3005" + - "<li>HP LaserJet 4050" + - "<li>HP LaserJet 4250" + - "<li>HP LaserJet 5000" + - "<li>HP LaserJet 5200" + - "<li>HP LaserJet 9040" + - "<li>HP LaserJet etc etc" + - "</ul></html>"; - private static final String sPrinterSupportsNotesString = - "Note that:\n" + - "1. If checked then pages print 3X faster but if not an HP LaserJet XX printer then printouts will not be correct.\n" + - "2. If pages print wrong then uncheck the box and try printing again.\n" + - "3. If the printer name doesn't say \"LaserJet\" even though it starts with \"HP\", then don't check the box."; + "<html><ul>" + + "<li>Windows print means the pages print correctly for all printers (is printer independent)." + + "<li>Unchecking the box requires that your printer be an HP LaserJet XX that supports PCL<br>" + + "and pages print 3 times faster than if checked, but if not an HP LaserJet XX printer<br>" + + "then printouts will not be correct." + + "<li>If pages print wrong then check the box and try printing again." + + "<li>If the printer name starts with \"HP\" but doesn't say \"LaserJet\", then check the box." + + "<li>Some examples of HP LaserJet printers (and you can uncheck the box) are:" + + "<table>" + + "<tr><td>HP LaserJet 1022,<td>HP LaserJet P2015,<td>HP LaserJet 2200,<td>HP LaserJet 2400,</tr>" + + "<tr><td>HP LaserJet P3005,<td>HP LaserJet 4050,<td>HP LaserJet 4250,<td>HP LaserJet 5000,</tr>" + + "<tr><td>HP LaserJet 5200,<td>HP LaserJet 9040,<td>HP LaserJet etc etc<td></tr>" + + "<table></ul></html>"; public PosPrintSetupDialog(PosView pPosView, String pTitleBarText, PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pAttributes, PrinterJob pPrinterJob, String pSelectedPageNumbers) @@ -181,6 +178,8 @@ super(pPosView.getOpenPCLViewer().getAppFrame(), pTitleBarText, true); mPosView = pPosView; mPosStartupOptions = mPosView.getOpenPCLViewer().getPosStartupOptions(); + // Set to false the show DSML buttons even if the user said true on the command line + mPosStartupOptions.setShowDSMLPrintDialogButtons(false); if (pPrintChoices == null) { mPrintChoices = new PosPrintSetupDialogChoices(); @@ -230,12 +229,12 @@ mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); - mTab1.add(mAddlCopiesJPanel, "0, 2, 2, 2"); +// mTab1.add(mAddlCopiesJPanel, "0, 2, 2, 2"); mTab1.add(mPrintAsPclJPanel, "0, 4, 2, 4"); - mTab1.add(mPrintBarCodesJPanel, "0, 6"); - mTab1.add(mPrintOrderJPanel, "2, 6"); - mTab1.add(mPrintFormNamesJPanel, "0, 8"); - mTab1.add(mDuplexJPanel, "2, 8"); +// mTab1.add(mPrintBarCodesJPanel, "0, 6"); +// mTab1.add(mPrintOrderJPanel, "2, 6"); +// mTab1.add(mPrintFormNamesJPanel, "0, 8"); +// mTab1.add(mDuplexJPanel, "2, 8"); // Lay out tab 2 items double tloTab2GridSpec[][] = new double[][] { @@ -247,11 +246,30 @@ mTab2.add(mPageNumbersThatWillPrintJLabel, "0, 0"); mPageNumbersThatWillPrintJTextArea.setLineWrap(true); mPageNumbersThatWillPrintJTextArea.setWrapStyleWord(true); - mPageNumbersThatWillPrintJTextArea.setText(mSelectedPageNumbers); + mPageNumbersThatWillPrintJTextArea.setText("Page numbers that will print:\n" + mSelectedPageNumbers); mPageNumbersThatWillPrintJTextArea.setEditable(false); + mPageNumbersThatWillPrintJTextArea.setPreferredSize(new Dimension(400, 200)); mPageNumbersThatWillPrintJScrollPane = new JScrollPane(mPageNumbersThatWillPrintJTextArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - mTab2.add(mPageNumbersThatWillPrintJScrollPane, "0, 2, 1, 2"); +// mTab2.add(mPageNumbersThatWillPrintJScrollPane, "0, 2, 1, 2"); + mAdvancedOptionsJDialog = new JDialog(mPosView.getOpenPCLViewer().getAppFrame(), "Advanced Options", true); + double tloAdvancedOptionsJDialog[][] = new double[][] { + { 10, mTloFill, mTloPref, 10}, // columns + { 10, mTloFill, 10, mTloPref, 10} // rows + }; + TableLayout tloAdvancedOptionsLayout = new TableLayout(tloAdvancedOptionsJDialog); + JPanel tJPanel = new JPanel(tloAdvancedOptionsLayout); + tJPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); + tJPanel.add("1, 1, 2, 1", mPageNumbersThatWillPrintJScrollPane); + mAdvancedOptionsOkJButton = new JButton("OK"); + mAdvancedOptionsOkJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + mAdvancedOptionsJDialog.setVisible(false); + } + }); + tJPanel.add("2, 3", mAdvancedOptionsOkJButton); + mAdvancedOptionsJDialog.setContentPane(tJPanel); + mAdvancedOptionsJDialog.setSize(400, 280); // Lay out tab 3 items double tloTab3GridSpec[][] = new double[][] { @@ -264,9 +282,9 @@ mTab3.add(mOpenJDKPrintDialogJButton, "0, 0"); // Add the tab panels to the JTabbedPane - mJTabbedPane.add(mTab1, "View Specific"); - mJTabbedPane.add(mTab2, "Index Numbers That Will Print"); - mJTabbedPane.add(mTab3, "Generic Properties"); +// mJTabbedPane.add(mTab1, "View Specific"); +// mJTabbedPane.add(mTab2, "Index Numbers That Will Print"); +// mJTabbedPane.add(mTab3, "Generic Properties"); // Add the Control Panel, JTabbedPane, and buttons panel to the contentPane double tloContentPaneGridSpec[][] = new double[][] { @@ -277,7 +295,8 @@ mControlJPanel = makeControlPanel(); mBottomButtonsJPanel = makeBottomButtonsPanel(); add(mControlJPanel, "1, 1"); - add(mJTabbedPane, "1, 2"); +// add(mJTabbedPane, "1, 2"); + add(mTab1, "1, 2"); add(mBottomButtonsJPanel, "1, 4"); // ActionListeners @@ -329,6 +348,13 @@ } }); + mAdvancedOptionsJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + mAdvancedOptionsJDialog.setLocationRelativeTo(mPosView.getOpenPCLViewer().getAppFrame()); + mAdvancedOptionsJDialog.setVisible(true); + } + }); + mOKJButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getPrintChoicesFromScreen(); @@ -409,7 +435,7 @@ TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); panel.add(mIsPclPrinterJCheckBox," 1, 0, 2, 0"); - panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); +// panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); return panel; } @@ -489,7 +515,8 @@ mTloPref, mTloFill, mTloPref, mTloHgap, mTloPref}, { mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); - panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); +// panel.add(mPrintAllOnLegalSizeJCheckBox, "0, 0"); + panel.add(mAdvancedOptionsJButton, "0, 0"); panel.add(mOKJButton, "2, 0"); panel.add(mCancelJButton, "4, 0"); return panel; @@ -497,7 +524,7 @@ private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); - mIsPclPrinterJCheckBox.setSelected(mPrintChoices.isPrintFormatPclDirect()); + mIsPclPrinterJCheckBox.setSelected(!(mPrintChoices.isPrintFormatPclDirect())); mPrintBarCodesYesJRadioButton.setSelected(mPrintChoices.shouldPrintBarCodes()); mPrintBarCodesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintBarCodes()) ); mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(mPrintChoices.isPrintOrderAsDisplayedOrSelected()); @@ -525,9 +552,9 @@ // Print format if (mIsPclPrinterJCheckBox.isSelected()) { + mPrintChoices.setPrintFormatIsGdiDriver(); + } else { mPrintChoices.setPrintFormatIsPclDirect(); - } else { - mPrintChoices.setPrintFormatIsGdiDriver(); } // Print bar codes @@ -586,6 +613,8 @@ mItemsOnDialogBox.add(mOKJButton); mItemsOnDialogBox.add(mCancelJButton); mItemsOnDialogBox.add(mJTabbedPane); + mItemsOnDialogBox.add(mAdvancedOptionsOkJButton); + mItemsOnDialogBox.add(mAdvancedOptionsJButton); } private void adjustFontOnDialogItems(Font pFont) { @@ -607,7 +636,8 @@ private void makePanelTitledBorders() { mListOfPrintersJPanel.setBorder(generateTitledBorder("Installed Printers")); - mPrintAsPclJPanel.setBorder(generateTitledBorder("Printer Supports PCL ?")); +// mPrintAsPclJPanel.setBorder(generateTitledBorder("Printer Supports PCL ?")); + mPrintAsPclJPanel.setBorder(BorderFactory.createEmptyBorder()); mPrintBarCodesJPanel.setBorder(generateTitledBorder("Print Bar Codes")); mPrintOrderJPanel.setBorder(generateTitledBorder("Print Order")); mPrintFormNamesJPanel.setBorder(generateTitledBorder("Print Form Names")); @@ -687,8 +717,7 @@ private void setHoverHelpOnItems() { mAddlCopiesJTextField.setToolTipText(sNotImplementedString + "Additional copies"); - mIsPclPrinterJCheckBox.setToolTipText(sPrinterSupportsPclString); - mPrinterSupportsPclJTextArea.setToolTipText(sPrinterSupportsPclString); + mIsPclPrinterJCheckBox.setToolTipText(sPrinterSupportsNotesString); mPrintBarCodesYesJRadioButton.setToolTipText(sBarCodeHoverString); mPrintBarCodesNoJRadioButton.setToolTipText(sBarCodeHoverString); mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-06-18 21:35:52 UTC (rev 90) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-06-21 18:43:40 UTC (rev 91) @@ -18,7 +18,7 @@ // TODO Add code to take the defaults from the user options in the Preferences, instead of the below initializations private PrintService mSelectedPrintService = null; private int mNumAdditionalCopies = 0; - private int mPrintFormat = mPrintFormatIsPclDirect; + private int mPrintFormat = mPrintFormatIsGdiDriver; private boolean mShouldPrintBarCodes = false; private int mPrintOrder = mPrintOrderAsDisplayedOrSelected; private boolean mShouldPrintFormNames = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-18 21:35:54
|
Revision: 90 http://openpcl.svn.sourceforge.net/openpcl/?rev=90&view=rev Author: documentsystems Date: 2007-06-18 14:35:52 -0700 (Mon, 18 Jun 2007) Log Message: ----------- Howard Hoagland. Added 2 ints in 2 classes that will be used for "Print Legal first then Letter" Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-06-15 05:07:43 UTC (rev 89) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-06-18 21:35:52 UTC (rev 90) @@ -39,6 +39,8 @@ private static final String sProgressBarBaseString = "Generating page: "; private static final String sCantAllocate = "Can't allocate memory for temporary image used for printing."; private double mPrintScale = 72.0d / 300.0d; // making width and height using 72 / 300 scale + private int mNumberOfPrintPasses = 1; + private int mCurrentPrintPassNumber = 1; public PosPrintBufferedImage(PosView pPosView) { super(); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-15 05:07:43 UTC (rev 89) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-18 21:35:52 UTC (rev 90) @@ -71,6 +71,8 @@ public static byte sbFF = 0xC; // Form Feed ( char(12) ) private PriModifyPclBytes mPriModifyPclBytes = null; private PclParser mPclParser = null; + private int mNumberOfPrintPasses = 1; + private int mCurrentPrintPassNumber = 1; /** * Constructor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-15 05:07:42
|
Revision: 89 http://openpcl.svn.sourceforge.net/openpcl/?rev=89&view=rev Author: documentsystems Date: 2007-06-14 22:07:43 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Howard Hoagland. On the Printer Setup dialog changed Print "PCL Direct" and "GDI Driver" to "Printer supports PCL (is an HP LaserJet xx):" with a check box instead of 2 radio buttons. Also, added a hover tooltip help text of examples of HP LaserJet printers, and added a JTextArea that says: "Note that: 1. If checked then pages print 3X faster but if not an HP LaserJet XX printer then printouts will not be correct. 2. If pages print wrong then uncheck the box and try printing again. 3. If the printer name doesn't say "LaserJet" even though it starts with "HP", then don't check the box." Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-15 01:32:36 UTC (rev 88) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-15 05:07:43 UTC (rev 89) @@ -245,14 +245,14 @@ // Show the JDialog that has the JProgressBar threadShowProgressBar.start(); - // Depending on the choice in our custom printer setup dialog of PCL Direct or GDI Driver + // Depending on the choice in our custom printer setup dialog of PCL Direct or Image Print if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { PriDebug.releaseln("Printing Pcl Direct using printer selected: " + mPrintService.getName()); mPrintedOkReturn = printPclDirect(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, mPrintingProgressBar, mAttributes); } else { - PriDebug.releaseln("Printing Gdi Driver using printer selected: " + mPrintService.getName()); - mPrintedOkReturn = printGdiDriver(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, + PriDebug.releaseln("Image Print using printer selected: " + mPrintService.getName()); + mPrintedOkReturn = imagePrint(mPagesToPrintArrayList, mPosPrintSetupDialogChoices, mPrintingProgressBar, mAttributes); } return null; @@ -390,7 +390,7 @@ } /** - * print Gdi Driver + * Image print (instead of PCL Direct) * @author Howard 6/1/06. Implemented mult page printing on 8/24/06 * @param pPagesToPrintArrayList * @param pPosPrintSetupDialogChoices @@ -398,7 +398,7 @@ * @param pAttributes * @return boolean */ - private boolean printGdiDriver(ArrayList<PosTreeNode> pPagesToPrintArrayList, + private boolean imagePrint(ArrayList<PosTreeNode> pPagesToPrintArrayList, PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, JProgressBar pPrintingProgressBar, PrintRequestAttributeSet pAttributes) { // Set the pages to print so that when PrinterJob calls Printable.print(), it uses the PosTreeNode values Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-15 01:32:36 UTC (rev 88) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-15 05:07:43 UTC (rev 89) @@ -90,7 +90,7 @@ private JPanel mTab1 = new JPanel(); private JPanel mListOfPrintersJPanel = null; private JPanel mAddlCopiesJPanel = null; - private JPanel mPrintFormatJPanel = null; + private JPanel mPrintAsPclJPanel = null; private JPanel mPrintBarCodesJPanel = null; private JPanel mPrintOrderJPanel = null; private JPanel mPrintFormNamesJPanel = null; @@ -112,10 +112,13 @@ // JTextAreas private JTextArea mPageNumbersThatWillPrintJTextArea = new JTextArea(); + private JScrollPane mPageNumbersThatWillPrintJScrollPane = null; + private JTextArea mPrinterSupportsPclJTextArea = new JTextArea(); + private JScrollPane mPrinterSupportsPclJScrollPane = null; + private Color mTextAreaBgColor = new Color(244, 244, 244); // a very light gray + private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); // JRadioButtons - private JRadioButton mPrintFormatIsPclDirectJRadioButton = new JRadioButton("PCL Direct"); - private JRadioButton mPrintFormatIsGdiDriverJRadioButton = new JRadioButton("GDI Driver"); private JRadioButton mPrintBarCodesYesJRadioButton = new JRadioButton("Yes"); private JRadioButton mPrintBarCodesNoJRadioButton = new JRadioButton("No"); private JRadioButton mPrintOrderAsDisplayedOrSelectedJRadioButton = new JRadioButton("As Displayed/Selected"); @@ -136,6 +139,7 @@ private JButton mOpenJDKPrintDialogJButton = new JButton("Open JDK Print Dialog"); // JCheckBoxes + private JCheckBox mIsPclPrinterJCheckBox = new JCheckBox("Printer supports PCL (is an HP LaserJet XX)"); private JCheckBox mPrintAllOnLegalSizeJCheckBox = new JCheckBox("Print All Documents on Legal Size"); // JLists @@ -149,6 +153,28 @@ private static final String sBarCodeHoverString = "Bar codes already in the PCL are printed, but bar codes are not generated on the fly."; + private static final String sPrinterSupportsPclString = + "<html>Examples are:" + + "<ul>" + + "<li>HP LaserJet 1022" + + "<li>HP LaserJet P2015" + + "<li>HP LaserJet 2200" + + "<li>HP LaserJet 2400" + + "<li>HP LaserJet P3005" + + "<li>HP LaserJet 4050" + + "<li>HP LaserJet 4250" + + "<li>HP LaserJet 5000" + + "<li>HP LaserJet 5200" + + "<li>HP LaserJet 9040" + + "<li>HP LaserJet etc etc" + + "</ul></html>"; + + private static final String sPrinterSupportsNotesString = + "Note that:\n" + + "1. If checked then pages print 3X faster but if not an HP LaserJet XX printer then printouts will not be correct.\n" + + "2. If pages print wrong then uncheck the box and try printing again.\n" + + "3. If the printer name doesn't say \"LaserJet\" even though it starts with \"HP\", then don't check the box."; + public PosPrintSetupDialog(PosView pPosView, String pTitleBarText, PosPrintSetupDialogChoices pPrintChoices, PrintRequestAttributeSet pAttributes, PrinterJob pPrinterJob, String pSelectedPageNumbers) throws HeadlessException { @@ -171,11 +197,26 @@ private void buildUI() { setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new DialogWindowListener()); + + mPrinterSupportsPclJTextArea.setEditable(false); + mPrinterSupportsPclJTextArea.setFont(mTextAreaFont); + mPrinterSupportsPclJTextArea.setLineWrap(true); + mPrinterSupportsPclJTextArea.setWrapStyleWord(true); + mPrinterSupportsPclJTextArea.setText(sPrinterSupportsNotesString); + mPrinterSupportsPclJTextArea.setBackground(mTextAreaBgColor); + mPrinterSupportsPclJTextArea.setForeground(Color.BLACK); + mPrinterSupportsPclJScrollPane = new JScrollPane(mPrinterSupportsPclJTextArea, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + mPrinterSupportsPclJScrollPane.setPreferredSize(new Dimension(380, 100)); + + mPageNumbersThatWillPrintJTextArea.setBackground(mTextAreaBgColor); + mPageNumbersThatWillPrintJTextArea.setForeground(Color.BLACK); + mPageNumbersThatWillPrintJTextArea.setFont(mTextAreaFont); // Make tab 1 items mListOfPrintersJPanel = makeListOfPrintersPanel(); mAddlCopiesJPanel = makeAdditionalCopiesPanel(); - mPrintFormatJPanel = makePrintFormatPanel(); + mPrintAsPclJPanel = makePrintAsPclPanel(); mPrintBarCodesJPanel = makePrintBarCodesPanel(); mPrintOrderJPanel = makePrintOrderPanel(); mPrintFormNamesJPanel = makePrintFormNamesPanel(); @@ -184,17 +225,17 @@ // Lay out tab 1 items double tloTab1GridSpec[][] = new double[][] { { mTloFill, mTloHgap, mTloFill}, // columns - { mTloFill, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref}}; // rows + { mTloFill, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref}}; // rows TableLayout tloTab1Layout = new TableLayout(tloTab1GridSpec); mTab1.setLayout(tloTab1Layout); mTab1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mTab1.add(mListOfPrintersJPanel, "0, 0, 2, 0"); - mTab1.add(mAddlCopiesJPanel, "0, 2"); - mTab1.add(mPrintFormatJPanel, "2, 2"); - mTab1.add(mPrintBarCodesJPanel, "0, 4"); - mTab1.add(mPrintOrderJPanel, "2, 4"); - mTab1.add(mPrintFormNamesJPanel, "0, 6"); - mTab1.add(mDuplexJPanel, "2, 6"); + mTab1.add(mAddlCopiesJPanel, "0, 2, 2, 2"); + mTab1.add(mPrintAsPclJPanel, "0, 4, 2, 4"); + mTab1.add(mPrintBarCodesJPanel, "0, 6"); + mTab1.add(mPrintOrderJPanel, "2, 6"); + mTab1.add(mPrintFormNamesJPanel, "0, 8"); + mTab1.add(mDuplexJPanel, "2, 8"); // Lay out tab 2 items double tloTab2GridSpec[][] = new double[][] { @@ -208,7 +249,9 @@ mPageNumbersThatWillPrintJTextArea.setWrapStyleWord(true); mPageNumbersThatWillPrintJTextArea.setText(mSelectedPageNumbers); mPageNumbersThatWillPrintJTextArea.setEditable(false); - mTab2.add(new JScrollPane(mPageNumbersThatWillPrintJTextArea), "0, 2, 1, 2"); + mPageNumbersThatWillPrintJScrollPane = new JScrollPane(mPageNumbersThatWillPrintJTextArea, + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + mTab2.add(mPageNumbersThatWillPrintJScrollPane, "0, 2, 1, 2"); // Lay out tab 3 items double tloTab3GridSpec[][] = new double[][] { @@ -337,6 +380,9 @@ TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); mListOfPrintersJList = getCurrentInstalledPrinters(); + mListOfPrintersJList.setBackground(mTextAreaBgColor); + mListOfPrintersJList.setForeground(Color.BLACK); + mListOfPrintersJList.setFont(mTextAreaFont); mPrintersListModel = mListOfPrintersJList.getModel(); mListOfPrintersJList.addListSelectionListener(mListOfPrintersSelectionListener); mListOfPrintersJScrollPane = new JScrollPane(mListOfPrintersJList); @@ -356,16 +402,14 @@ return panel; } - private JPanel makePrintFormatPanel() { + private JPanel makePrintAsPclPanel() { JPanel panel = new JPanel(); - double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloPref, mTloHgap, mTloPref, mTloFill }, { mTloPref }}; + double tloGridSpec[][] = new double[][] {{ mTloHgap, 20, mTloPref, mTloFill, mTloHgap }, + { mTloPref, mTloPref, mTloVgap }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); - ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(mPrintFormatIsPclDirectJRadioButton); - buttonGroup.add(mPrintFormatIsGdiDriverJRadioButton); - panel.add(mPrintFormatIsPclDirectJRadioButton," 1, 0"); - panel.add(mPrintFormatIsGdiDriverJRadioButton, "3, 0"); + panel.add(mIsPclPrinterJCheckBox," 1, 0, 2, 0"); + panel.add(mPrinterSupportsPclJScrollPane," 2, 1"); return panel; } @@ -453,8 +497,7 @@ private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); - mPrintFormatIsPclDirectJRadioButton.setSelected(mPrintChoices.isPrintFormatPclDirect()); - mPrintFormatIsGdiDriverJRadioButton.setSelected(mPrintChoices.isPrintFormatGdiDriver()); + mIsPclPrinterJCheckBox.setSelected(mPrintChoices.isPrintFormatPclDirect()); mPrintBarCodesYesJRadioButton.setSelected(mPrintChoices.shouldPrintBarCodes()); mPrintBarCodesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintBarCodes()) ); mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(mPrintChoices.isPrintOrderAsDisplayedOrSelected()); @@ -481,7 +524,7 @@ } // Print format - if (mPrintFormatIsPclDirectJRadioButton.isSelected()) { + if (mIsPclPrinterJCheckBox.isSelected()) { mPrintChoices.setPrintFormatIsPclDirect(); } else { mPrintChoices.setPrintFormatIsGdiDriver(); @@ -516,8 +559,7 @@ mItemsOnDialogBox.add(mAddlCopiesJLabel); mItemsOnDialogBox.add(mFontSizeJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); - mItemsOnDialogBox.add(mPrintFormatIsPclDirectJRadioButton); - mItemsOnDialogBox.add(mPrintFormatIsGdiDriverJRadioButton); + mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); mItemsOnDialogBox.add(mPrintBarCodesYesJRadioButton); mItemsOnDialogBox.add(mPrintBarCodesNoJRadioButton); mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); @@ -565,7 +607,7 @@ private void makePanelTitledBorders() { mListOfPrintersJPanel.setBorder(generateTitledBorder("Installed Printers")); - mPrintFormatJPanel.setBorder(generateTitledBorder("Print Format")); + mPrintAsPclJPanel.setBorder(generateTitledBorder("Printer Supports PCL ?")); mPrintBarCodesJPanel.setBorder(generateTitledBorder("Print Bar Codes")); mPrintOrderJPanel.setBorder(generateTitledBorder("Print Order")); mPrintFormNamesJPanel.setBorder(generateTitledBorder("Print Form Names")); @@ -645,8 +687,8 @@ private void setHoverHelpOnItems() { mAddlCopiesJTextField.setToolTipText(sNotImplementedString + "Additional copies"); - mPrintFormatIsPclDirectJRadioButton.setToolTipText("Print PCL direct"); - mPrintFormatIsGdiDriverJRadioButton.setToolTipText("Print GDI driver"); + mIsPclPrinterJCheckBox.setToolTipText(sPrinterSupportsPclString); + mPrinterSupportsPclJTextArea.setToolTipText(sPrinterSupportsPclString); mPrintBarCodesYesJRadioButton.setToolTipText(sBarCodeHoverString); mPrintBarCodesNoJRadioButton.setToolTipText(sBarCodeHoverString); mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-15 01:37:32
|
Revision: 88 http://openpcl.svn.sourceforge.net/openpcl/?rev=88&view=rev Author: documentsystems Date: 2007-06-14 18:32:36 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Howard Hoagland. Converted the full color BufferedImage bitmap of the printed image to a 2 color black and white only BufferedImage before drawing on the Graphics2D in Java Printing. This makes the printing go faster because the print image in the print queue is 1.28MB per print page instead of 10MB per print page. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-06-14 22:46:28 UTC (rev 87) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-06-15 01:32:36 UTC (rev 88) @@ -1,6 +1,7 @@ package com.openpcl.viewer.printing; import java.awt.Color; +import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; @@ -17,6 +18,7 @@ import javax.swing.JOptionPane; import javax.swing.JProgressBar; +import com.openpcl.pclrenderimage.render.PriPageSettings; import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.tree.PosTreeNode; @@ -24,19 +26,28 @@ private static final long serialVersionUID = 1L; private PosView mPosView = null; private BufferedImage mPrintThisBufferedImage = null; + private BufferedImage mBufferedImageToPrintOn = null; + private Graphics2D mGraphics2DToPrintOn = null; + private Frame mParentFrame = null; + private PosTreeNode mPrintThisTreeNode = null; private AffineTransform mOrigAffineTransform = null; private AffineTransform mScaleAffineTransform = null; private ArrayList<PosTreeNode> mPagesToPrintArrayList = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; private JProgressBar mPrintingProgressBar = null; - private static final String mProgressBarBaseString = "Generating page: "; + private static final String sProgressBarBaseString = "Generating page: "; + private static final String sCantAllocate = "Can't allocate memory for temporary image used for printing."; private double mPrintScale = 72.0d / 300.0d; // making width and height using 72 / 300 scale public PosPrintBufferedImage(PosView pPosView) { super(); mPosView = pPosView; + mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); mScaleAffineTransform = AffineTransform.getScaleInstance(mPrintScale, mPrintScale); + mBufferedImageToPrintOn = createNewBufferedImageToPrintOn(); + // Graphics2D for printing (is 2 color black and white with no rendering hints like anti-aliasing + if (mBufferedImageToPrintOn != null) { mGraphics2DToPrintOn = mBufferedImageToPrintOn.createGraphics(); } } public void setPagesToPrint(ArrayList<PosTreeNode> pPagesToPrintArrayList) { @@ -90,9 +101,12 @@ // methods specified in the interface IPluginHooksOpenPCL mPrintThisBufferedImage = mPosView.getOpenPCLViewer().renderImageForPrintingFromTreeNode(mPrintThisTreeNode); - // Draw the screen image on the printer Graphics2D using the scale down transform - g2D.drawImage(mPrintThisBufferedImage, 0, 0, Color.WHITE, this); + // Convert to 2 color black and white so the print image file sent to the printer is 1.3MB per print page instead of 10MB + mGraphics2DToPrintOn.drawImage(mPrintThisBufferedImage, 0, 0, this); + // Draw the image on the printer Graphics2D using the scale down transform + g2D.drawImage(mBufferedImageToPrintOn, 0, 0, this); + // Revert back to the passed in AffineTransform because the JDK doc for printing says put back the // passed in Graphics object's settings back if you modified it in this print() interface call g2D.transform(mOrigAffineTransform); @@ -100,7 +114,7 @@ // Update the progress bar at each page if (mPrintingProgressBar != null) { mPrintingProgressBar.setValue(pPageNumber + 1); - mPrintingProgressBar.setString(mProgressBarBaseString + (pPageNumber + 1) + " of " + mPagesToPrintArrayList.size()); + mPrintingProgressBar.setString(sProgressBarBaseString + (pPageNumber + 1) + " of " + mPagesToPrintArrayList.size()); } return Printable.PAGE_EXISTS; @@ -138,4 +152,43 @@ } } + /** + * Create a new BufferredImage all ready to print on + * @return BufferedImage + */ + protected BufferedImage createNewBufferedImageToPrintOn() { + BufferedImage tToPrintOnBufferedImage = null; + try { + tToPrintOnBufferedImage = new BufferedImage( + PriPageSettings.sNumPixels85Inches, // make the BufferedImage be 8.5 inches by 14 inches + PriPageSettings.sNumPixels14Inches, + BufferedImage.TYPE_BYTE_BINARY); // 2 color only image is black and white (not full color) for printing not on screen + } catch (OutOfMemoryError e1) { + tToPrintOnBufferedImage = null; + JOptionPane.showMessageDialog(mParentFrame, "Out of heap space memory. " + sCantAllocate , "Heap space memory", + JOptionPane.ERROR_MESSAGE); + + } catch (Error e2) { + tToPrintOnBufferedImage = null; + JOptionPane.showMessageDialog(mParentFrame, "Error. " + sCantAllocate , "Error", + JOptionPane.ERROR_MESSAGE); + + } catch (Exception e3) { + tToPrintOnBufferedImage = null; + JOptionPane.showMessageDialog(mParentFrame, "Exception. " + sCantAllocate , "Exception", + JOptionPane.ERROR_MESSAGE); + } + return tToPrintOnBufferedImage; + } + + /** Blank out the BufferedImage on the screen of the current selected view. */ + public void blankOutBufferedImageToPrintOn() { + if (mBufferedImageToPrintOn != null && mGraphics2DToPrintOn != null) { + mGraphics2DToPrintOn.setPaint(Color.WHITE); + // The blank out is done by drawing a white rectangle on the whole image + mGraphics2DToPrintOn.fillRect(0, 0, mBufferedImageToPrintOn.getWidth(), mBufferedImageToPrintOn.getHeight()); + // Make the initial color for drawing text and rectangles and pixels be in black. Can be set to another color like blue later + mGraphics2DToPrintOn.setPaint(Color.BLACK); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-14 22:46:26
|
Revision: 87 http://openpcl.svn.sourceforge.net/openpcl/?rev=87&view=rev Author: documentsystems Date: 2007-06-14 15:46:28 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Howard Hoagland. Added class PriModifyPclBytes and changed class PosPrintPages for when printing PCL Direct, parse the PCL and remove form feeds (to not get blank pages), remove printer reset commands (ESC E), remove page size, remove paper source tray or manual feed, remove number of copies, remove duplex Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Added Paths: ----------- openpcl/src/com/openpcl/pclrenderimage/util/PriModifyPclBytes.java Added: openpcl/src/com/openpcl/pclrenderimage/util/PriModifyPclBytes.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/util/PriModifyPclBytes.java (rev 0) +++ openpcl/src/com/openpcl/pclrenderimage/util/PriModifyPclBytes.java 2007-06-14 22:46:28 UTC (rev 87) @@ -0,0 +1,113 @@ +package com.openpcl.pclrenderimage.util; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import com.openpcl.pclrenderimage.tools.PclCommandEvent; + +/** + * Modify the PCL bytes. + * 1. Remove form feed chars (FF = ^L = 12) but not FF chars in raster data. + * 2. Remove printer resets (ESC E) + * 3. Remove paper size commands (ESC & l # A) where Letter=2, Legal=3, there's more... + * 4. Remove paper source commands (ESC & l # H) where specific tray=1 and manual feed=2, lower tray=4, there's more... + * 5. Remove duplex commands (ESC & l # S) where Duplex=1,2 and Simplex=0 + * 6. Remove number of copies (ESC & l # X). + * + * @author DocMagic, Document Systems Inc, HowardH 6/13/07 + */ +public class PriModifyPclBytes implements PclCommandEvent { + private ByteArrayOutputStream mByteArrayOutputStream =null; + private static char sESC = 0x1B; // Escape char + private static char sFF = 0xC; // Form-feed + + public PriModifyPclBytes() { + // Make a new ByteArrayOutputStream that grows automatically as parsed Pcl bytes are added + mByteArrayOutputStream = new ByteArrayOutputStream(60 * 1024); // 60k bytes initially, but grows automatically + } + + public void initializeState() { + // Set the byte index to 0 to resuse it's byte array without allocating more memory + mByteArrayOutputStream.reset(); + } + + public byte[] getModifiedPclBytes() { + if (mByteArrayOutputStream != null) { + return mByteArrayOutputStream.toByteArray(); + } else { + return null; + } + } + + public void charFoundEvent(char pNextChar, int pBufferPos) { + if (pNextChar == sFF) { + // Don't add the form feed to the output PCL and return here + // PriDebug.releaseln("PriModifyPclBytes: Removed Form Feed char at input byte " + pBufferPos); + return; + + } else { + mByteArrayOutputStream.write(pNextChar); + } + } + + public void commandFoundEvent( + String pCmdLeadin, String pCmdValue, String pCmdTerminator, byte[] pCmdData, int pBufferPos) { + + String pclCmd = pCmdLeadin + "," + pCmdTerminator; + // Put into char array to not do a lot of String.substring() commands later + char[] tCmdCharArray = pclCmd.toCharArray(); + + if (tCmdCharArray[0] == 'E') { +// PriDebug.releaseln("PriModifyPclBytes: Removed Printer Reset PCL command ESC E"); + return; + } else if (tCmdCharArray[0] == '&') { + if (tCmdCharArray[1] == 'l') { + if (tCmdCharArray[2] == ',') { + if (tCmdCharArray[3] == 'A') { // &l,A is paper size +// PriDebug.releaseln("PriModifyPclBytes: Removed paper size PCL command ESC & l " + +// pCmdValue + " A at input byte " + pBufferPos); + return; + } else if (tCmdCharArray[3] == 'H') { // &l,H is paper source +// PriDebug.releaseln("PriModifyPclBytes: Removed paper source PCL command ESC & l " + +// pCmdValue + " H at input byte " + pBufferPos); + return; + } else if (tCmdCharArray[3] == 'S') { // &l,S is Simplex/Duplex +// PriDebug.releaseln("PriModifyPclBytes: Removed Simplex/Duplex PCL command ESC & l " + +// pCmdValue + " S at input byte " + pBufferPos); + return; + } else if (tCmdCharArray[3] == 'X') { // &l,X is number of copies +// PriDebug.releaseln("PriModifyPclBytes: Removed number of copies PCL command ESC & l " + +// pCmdValue + " X at input byte " + pBufferPos); + return; + } + } + } + } + + mByteArrayOutputStream.write(sESC); + try { + // Write the char after the ESC + if (pCmdLeadin != null && pCmdLeadin.length() > 0) { + mByteArrayOutputStream.write(pCmdLeadin.getBytes()); + } + + // Write the String of numbers + if (pCmdValue != null && pCmdValue.length() > 0) { + mByteArrayOutputStream.write(pCmdValue.getBytes()); + } + + // Write the terminating char + if (pCmdTerminator != null && pCmdTerminator.length() > 0) { + mByteArrayOutputStream.write(pCmdTerminator.getBytes()); + } + + // Write the raster data or soft font data bytes + if (pCmdData != null && pCmdData.length > 0) { + mByteArrayOutputStream.write(pCmdData); + } + + } catch (IOException e) { + e.printStackTrace(); + } + } +} Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-12 20:38:29 UTC (rev 86) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-14 22:46:28 UTC (rev 87) @@ -33,7 +33,9 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; +import com.openpcl.pclrenderimage.tools.PclParser; import com.openpcl.pclrenderimage.util.PriDebug; +import com.openpcl.pclrenderimage.util.PriModifyPclBytes; import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.tree.PosTreeNode; import com.openpcl.viewer.util.SwingWorker; @@ -67,7 +69,9 @@ "Print All", "Print Selected", "Print Changed", "Print Remaining"}; public static byte sbESC = 0x1B; // Escape char public static byte sbFF = 0xC; // Form Feed ( char(12) ) - + private PriModifyPclBytes mPriModifyPclBytes = null; + private PclParser mPclParser = null; + /** * Constructor * @author howard 6/1/06 @@ -79,6 +83,7 @@ mParentFrame = mPosView.getOpenPCLViewer().getAppFrame(); mPosPrintBufferedImage = new PosPrintBufferedImage(mPosView); mPosPrintPageableInterface = new PosPrintPageableInterface(mPosView); + mPriModifyPclBytes = new PriModifyPclBytes(); mAttributes = new HashPrintRequestAttributeSet(); mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); mPrintingProgressBar = new JProgressBar(); @@ -126,7 +131,7 @@ StringBuffer tStringBuffer = new StringBuffer(); // Depending on if print all, print selected, print changed, print remaining, get which pages to print - switch (pProcessPrintType) { + switch (mProcessPrintType) { case sProcessPrintAll: mPagesToPrintArrayList = mPosView.getPosBuildListOfPagesToPrint().makeArrayListofAllPages(); tStringBuffer.append("\"Print all\""); @@ -315,6 +320,15 @@ // If no bytes on this page then continue to the next page if (tPclBytes == null || tPclBytes.length < 1) { continue; } + // Modify the PCL bytes + mPriModifyPclBytes.initializeState(); + mPclParser = new PclParser(tPclBytes, mPriModifyPclBytes); + mPclParser.ParsePCL(); + + byte[] tModifiedPclBytes = mPriModifyPclBytes.getModifiedPclBytes(); + + // PriDebug.releaseln("Pcl page before, after bytes: " + tPclBytes.length + ", " + tModifiedPclBytes.length); + try { if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { // The user has a check in the Print Setup dialog box for "Print all Documents on Legal size" @@ -339,7 +353,7 @@ // Write the current page bytes try { - tByteArrayOutputStream.write(tPclBytes); + tByteArrayOutputStream.write(tModifiedPclBytes); if (mShouldOutputFormFeedBetweenPages) { tByteArrayOutputStream.write(sbFF); } } catch (IOException e) { return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-12 21:05:12
|
Revision: 86 http://openpcl.svn.sourceforge.net/openpcl/?rev=86&view=rev Author: documentsystems Date: 2007-06-12 13:38:29 -0700 (Tue, 12 Jun 2007) Log Message: ----------- Howard Hoagland. Gray out the items that aren't currently implemented that are on the Printer Setup dialog and on the Options dialog. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java Modified: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-06-08 17:18:36 UTC (rev 85) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-06-12 20:38:29 UTC (rev 86) @@ -168,10 +168,13 @@ addActionListeners(); makePanelTitledBorders(); putOptionsOnScreen(); + mShowPrinterSetupEveryPrintJRadioButton.setSelected(true); + mFormFillColorBlueJRadioButton.setSelected(true); setHoverHelpOnItems(); + grayOutItemsNotImplemented(); setContentPane(mOuterJPanel); + // Make dialog box outer frame width and height exactly to be all item's preferred sizes pack(); - // setPreferredSize(new Dimension(200, 300)); } private void addActionListeners() { @@ -375,9 +378,9 @@ mLegalTrayJTextField.setToolTipText(sNotImplementedString + "PCL Esc codes for Legal tray"); // Radio buttons - mShowPrinterSetupEveryPrintJRadioButton.setToolTipText(sNotImplementedString + "Every print"); + mShowPrinterSetupEveryPrintJRadioButton.setToolTipText("Every print"); mShowPrinterSetupFirstPrintOnlyJRadioButton.setToolTipText(sNotImplementedString + "First print only"); - mShowPrinterSetupFromOptionsDialogOnlyJRadioButton.setToolTipText("Only clicking below button"); + mShowPrinterSetupFromOptionsDialogOnlyJRadioButton.setToolTipText(sNotImplementedString + "Only clicking below button"); mFormFillColorBlueJRadioButton.setToolTipText("Form's fill color Blue"); mFormFillColorBlackJRadioButton.setToolTipText(sNotImplementedString + "Form's fill color Black (it's always blue)"); @@ -389,6 +392,32 @@ mCheckForUpdatesDaysJComboBox.setToolTipText(sNotImplementedString + "Doing updates from here"); } + private void grayOutItemsNotImplemented() { + // Buttons + mCreateShortcutJButton.setEnabled(false); + mRegisterFileTypeJButton.setEnabled(false); + mEMailAdvancedSettingsJButton.setEnabled(false); + mScanningSetupJButton.setEnabled(false); + mCheckForUpdatesJButton.setEnabled(false); + + // Text fields + mFooterForOriginalJTextField.setEnabled(false); + mFooterForFirstCopyJTextField.setEnabled(false); + mFooterForSecondCopyJTextField.setEnabled(false); + mFooterForThirdCopyJTextField.setEnabled(false); + mLetterTrayJTextField.setEnabled(false); + mLegalTrayJTextField.setEnabled(false); + + // Radio buttons + mShowPrinterSetupFirstPrintOnlyJRadioButton.setEnabled(false); + mShowPrinterSetupFromOptionsDialogOnlyJRadioButton.setEnabled(false); + mFormFillColorBlackJRadioButton.setEnabled(false); + + // Combo boxes + mEMailClientJComboBox.setEnabled(false); + mCheckForUpdatesDaysJComboBox.setEnabled(false); + } + private void getOptionsFromScreen() { // TODO } Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-08 17:18:36 UTC (rev 85) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-12 20:38:29 UTC (rev 86) @@ -198,7 +198,7 @@ mPrinterJob = PrinterJob.getPrinterJob(); // Put up our custom printer setup dialog - String tDialogTitleBarString = mTitleBarTextForPrintDialog[pProcessPrintType] + " (" + + String tDialogTitleBarString = "Printer Setup. " + mTitleBarTextForPrintDialog[pProcessPrintType] + " (" + tNumberOfPagesThatWillPrint + (tNumberOfPagesThatWillPrint ==1 ? " page" : " pages") + " will print)"; mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, tDialogTitleBarString, Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-08 17:18:36 UTC (rev 85) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-06-12 20:38:29 UTC (rev 86) @@ -326,7 +326,7 @@ adjustFontOnDialogItems(mAdjustToSmallFont); putPrintChoicesOnScreen(); setHoverHelpOnItems(); - + grayOutItemsNotImplemented(); // Make dialog box outer frame width and height exactly to be all item's preferred sizes pack(); } @@ -659,6 +659,17 @@ mPrintAllOnLegalSizeJCheckBox.setToolTipText(sNotImplementedString + "Print all on Legal size"); } + private void grayOutItemsNotImplemented() { + mAddlCopiesJTextField.setEnabled(false); + mPrintBarCodesYesJRadioButton.setEnabled(false); + mPrintOrderLegalFirstThenLetterJRadioButton.setEnabled(false); + mPrintOrderLetterFirstThenLegalJRadioButton.setEnabled(false); + mPrintFormNamesYesJRadioButton.setEnabled(false); + mDuplexYesJRadioButton.setEnabled(false); + mPrintAllOnLegalSizeJCheckBox.setEnabled(false); + mOpenJDKPrintDialogJButton.setEnabled(false); + } + public class DialogWindowListener implements WindowListener { public void windowOpened(WindowEvent e) { } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-08 17:19:50
|
Revision: 85 http://openpcl.svn.sourceforge.net/openpcl/?rev=85&view=rev Author: documentsystems Date: 2007-06-08 10:18:36 -0700 (Fri, 08 Jun 2007) Log Message: ----------- Fixed bug where the "Finished Printing" dialog was very very wide. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-07 05:12:45 UTC (rev 84) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-06-08 17:18:36 UTC (rev 85) @@ -257,7 +257,7 @@ mPosView.getOpenPCLViewer().setIsDrawingForPrinting(false); mPosView.getOpenPCLViewer().renderImageCurrentPageAndZoom(); JOptionPane.showMessageDialog(mPrintingProgressJDialog, - mParentFrame + "\nFinished printing " + + mPosView.getOpenPCLViewer().getAppName() + "\nFinished printing " + mPagesToPrintArrayList.size() + " page" + (mPagesToPrintArrayList.size() > 1 ? "s." : "."), "Finished Printing", JOptionPane.INFORMATION_MESSAGE); mPrintingProgressJDialog.setVisible(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-07 05:12:43
|
Revision: 84 http://openpcl.svn.sourceforge.net/openpcl/?rev=84&view=rev Author: documentsystems Date: 2007-06-06 22:12:45 -0700 (Wed, 06 Jun 2007) Log Message: ----------- Howard Hoagland. Fixed bug where raster dot patterns on the screen look ok zoomed at 100% but as the image is zoomed smaller and smaller, the dot patterns look like checkerboard patterns because the dots get too close together. Added method omitSpecificPixelsByZoomFactor() and changed method drawRasterPixelsOnBitmap() to take away pixels in raster blocks. More pixels are taken away as the image is zoomed smaller. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriRasterDrawing.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriRasterDrawing.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriRasterDrawing.java 2007-06-05 23:41:38 UTC (rev 83) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriRasterDrawing.java 2007-06-07 05:12:45 UTC (rev 84) @@ -97,6 +97,12 @@ protected static final int sColorGreen = new Color (0,91,28).getRGB(); protected static final int sColorBlue = new Color (0,0,255).getRGB(); protected static final int sColorCyan = new Color (0,255,255).getRGB(); + + private int mOmitEveryNPixels = 0; + private int mOmitNPixelsThenDrawOne = 0; + private int mPixelsDrawnCounter = 0; + private int mPixelsOmittedCounter = 0; + private int mPixelStaggerRowBeginLocaction = 0; /** Constructor */ public PriRasterDrawing(PclRenderImage pPclRenderImage, BufferedImage pBufferedImageToDrawOn) { @@ -418,48 +424,116 @@ int offsetX = 0; int arrayLength = pUncompressedDataByteArray.length; double zoomPct = mPclRenderImage.getCurrentZoomFactor(); + + mOmitEveryNPixels = 0; + mOmitNPixelsThenDrawOne = 0; + + // Make the begin pixel be 0, 1, 2 ,3 every 4 rows so that the pixel drawing is staggered vertically every 4 rows + if (mPixelStaggerRowBeginLocaction < 4) { + mPixelsDrawnCounter = mPixelStaggerRowBeginLocaction; + mPixelsOmittedCounter = mPixelStaggerRowBeginLocaction; + mPixelStaggerRowBeginLocaction++; + } else { + mPixelsDrawnCounter = 0; + mPixelsOmittedCounter = 0; + mPixelStaggerRowBeginLocaction = 0; + } + + // Set the omit pixels 2 variables to omit every N pixels or to omit N pixels the draw one pixel + if (zoomPct >= .90d) { mOmitEveryNPixels = 0; + } else if (zoomPct >= .80d) { mOmitEveryNPixels = 0; + } else if (zoomPct >= .70d) { mOmitEveryNPixels = 0; + } else if (zoomPct >= .60d) { mOmitEveryNPixels = 0; + } else if (zoomPct >= .50d) { mOmitEveryNPixels = 8; + } else if (zoomPct >= .40d) { mOmitEveryNPixels = 7; + } else if (zoomPct >= .38d) { mOmitEveryNPixels = 6; + } else if (zoomPct >= .36d) { mOmitEveryNPixels = 5; + } else if (zoomPct >= .34d) { mOmitEveryNPixels = 3; + } else if (zoomPct >= .30d) { mOmitEveryNPixels = 2; + } else if (zoomPct >= .28d) { mOmitNPixelsThenDrawOne = 2; + } else if (zoomPct >= .26d) { mOmitNPixelsThenDrawOne = 3; + } else if (zoomPct >= .24d) { mOmitNPixelsThenDrawOne = 4; + } else if (zoomPct >= .22d) { mOmitNPixelsThenDrawOne = 5; + } else if (zoomPct >= .20d) { mOmitNPixelsThenDrawOne = 6; + } else if (zoomPct >= .18d) { mOmitNPixelsThenDrawOne = 7; + } else if (zoomPct >= .16d) { mOmitNPixelsThenDrawOne = 8; + } else if (zoomPct >= .14d) { mOmitNPixelsThenDrawOne = 9; + } else if (zoomPct >= .12d) { mOmitNPixelsThenDrawOne = 10; + } else { mOmitNPixelsThenDrawOne = 11; } for(int i=0; i < arrayLength; i++) { currByte = pUncompressedDataByteArray[i]; xWalkingRight = i * 8; + if((currByte & 0x80) > 0) { + offsetX = pPosX + (int) Math.round(xWalkingRight * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x40) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 1) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x20) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 2) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x10) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 3) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x08) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 4) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x04) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 5) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x02) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 6) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + if((currByte & 0x01) > 0) { + offsetX = pPosX + (int) Math.round((xWalkingRight + 7) * zoomPct); + omitSpecificPixelsByZoomFactor(offsetX, pPosY, pColorAsInt); + } + } + + } + + private void omitSpecificPixelsByZoomFactor(int pOffsetX, int pPosY, int pColorAsInt) { + boolean tShouldDrawThisPixel = true; + + // Omit every N pixels + if (mOmitEveryNPixels > 0) { + if (mPixelsDrawnCounter < (mOmitEveryNPixels - 1)) { + mPixelsDrawnCounter++; + tShouldDrawThisPixel = true; + } else { + mPixelsDrawnCounter = 0; + tShouldDrawThisPixel = false; + } + + // Omit N pixels, then draw 1 pixel (repeat) + } else if (mOmitNPixelsThenDrawOne > 0) { + if (mPixelsOmittedCounter >= mOmitNPixelsThenDrawOne) { + mPixelsOmittedCounter = 0; + tShouldDrawThisPixel = true; + } else { + mPixelsOmittedCounter++; + tShouldDrawThisPixel = false; + } + } else { + tShouldDrawThisPixel = true; + } + + // Draw the pixel if it hasn't been omitted + if (tShouldDrawThisPixel) { try { - if((currByte & 0x80) > 0) { - offsetX = pPosX + (int) Math.round(xWalkingRight * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x40) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 1) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x20) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 2) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x10) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 3) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x08) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 4) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x04) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 5) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x02) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 6) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } - if((currByte & 0x01) > 0) { - offsetX = pPosX + (int) Math.round((xWalkingRight + 7) * zoomPct); - mBufferedImageToDrawOn.setRGB(offsetX, pPosY, pColorAsInt); - } + mBufferedImageToDrawOn.setRGB(pOffsetX, pPosY, pColorAsInt); } catch (Exception e) { } } - } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-05 23:41:39
|
Revision: 83 http://openpcl.svn.sourceforge.net/openpcl/?rev=83&view=rev Author: documentsystems Date: 2007-06-05 16:41:38 -0700 (Tue, 05 Jun 2007) Log Message: ----------- Howard Hoagland. Changed mPagesJTree.setExpandsSelectedPaths(true) to false. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/tree/PosTree.java Modified: openpcl/src/com/openpcl/viewer/tree/PosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-06-05 21:43:25 UTC (rev 82) +++ openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-06-05 23:41:38 UTC (rev 83) @@ -86,7 +86,7 @@ // Set selection model, shows root handles, expands selected paths mPagesJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); mPagesJTree.setShowsRootHandles(false); - mPagesJTree.setExpandsSelectedPaths(true); + mPagesJTree.setExpandsSelectedPaths(false); // Add the right click mouse listener mPagesJTree.addMouseListener(new RightclickTreeMouseListener()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-05 21:43:29
|
Revision: 82 http://openpcl.svn.sourceforge.net/openpcl/?rev=82&view=rev Author: documentsystems Date: 2007-06-05 14:43:25 -0700 (Tue, 05 Jun 2007) Log Message: ----------- Howard Hoagland. Moved the "Show/Hide Extra Info" right click popup menu item from subclass plugin to PosTree and PosTreeNode and added the code to show and hide the paper size after the page node names. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/panels/PosView.java openpcl/src/com/openpcl/viewer/tree/PosTree.java openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-05 01:02:42 UTC (rev 81) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-05 21:43:25 UTC (rev 82) @@ -62,7 +62,7 @@ private MouseWheelListener[] mMouseWheelListeners = null; // Splitter divider default location - public static final int sDefaultSplitterLocPclFiles = 168; + public static final int sDefaultSplitterLocPclFiles = 130; public static final int sTreatSplitterAsClosedIfLessThan = 10; private int mPixelLocForSplitter = 0; Modified: openpcl/src/com/openpcl/viewer/tree/PosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-06-05 01:02:42 UTC (rev 81) +++ openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-06-05 21:43:25 UTC (rev 82) @@ -18,6 +18,8 @@ import javax.swing.JTree; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; @@ -44,8 +46,9 @@ private DefaultMutableTreeNode mTreeNodeRoot = null; private String mRootNodeName = null; private static String[] sTreePopupMenuItems = new String[] { - "View Selected", "Print All", "Print Selected", "Print Remaining"}; + "View Selected", "Print All", "Print Selected", "Print Remaining", "Show/Hide Extra Info"}; private JPopupMenu mTreeJPopupMenu = null; + private boolean mShowHideExtraInfoOnTree = false; protected static final String sPCL_ICON = "Eye.gif"; protected static final String sPAGE_ICON = "Page.gif"; @@ -72,7 +75,7 @@ mPagesJTree = new JTree(); // Make the root node - PosTreeNode tRootPosTreeNode = new PosTreeNode(mRootNodeName, -1, mRootNodeName); + PosTreeNode tRootPosTreeNode = new PosTreeNode(mRootNodeName, -1, mRootNodeName, this); mTreeNodeRoot = new DefaultMutableTreeNode(tRootPosTreeNode); mTreeNodeRoot.setAllowsChildren(true); @@ -99,6 +102,9 @@ return mPosView; } + /** Get Show/Hide Index Numbers on Tree */ + public boolean getShowHideExtraInfoOnTree() { return mShowHideExtraInfoOnTree; } + /** Add the tree selection listener */ public void addTreeSelectionListener() { mPagesJTree.addTreeSelectionListener(new PosTreeSelectionListener()); @@ -200,7 +206,7 @@ public PosTreeNode makePclPageTreeNode(int pPageNumber) { if (mPagesJTree == null) { return null; } // Put the PCL page as the user object in the tree node - PosTreeNode tPosTreeNode = new PosTreeNode(null, pPageNumber, null); + PosTreeNode tPosTreeNode = new PosTreeNode(null, pPageNumber, null, this); tPosTreeNode.setPclBytes(null); // If the Pcl bytes of this pages is needed later, they can be gotten later tPosTreeNode.setPriRenderCounters(null); // If the render counters are needed later, they can be gotten later DefaultMutableTreeNode child = new DefaultMutableTreeNode(tPosTreeNode); @@ -477,6 +483,17 @@ mRightClickedTreePath = null; }}); pJPopupMenu.add(tJMenuItem); + pJPopupMenu.addSeparator(); + + tJMenuItem = new JMenuItem(sTreePopupMenuItems[4]); // Show/Hide Extra Info + tJMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + toggleShowExtraInfoOnTree(); + mRightClickedNode = null; + mRightClickedTreePath = null; + }}); + pJPopupMenu.add(tJMenuItem); + } /** MouseAdapter class for when the user right clicks on a node in the tree.<br> @@ -524,11 +541,31 @@ buildTreePopupMenu(mTreeJPopupMenu); mTreeJPopupMenu.pack(); + mTreeJPopupMenu.addPopupMenuListener(new TreeNodePopupMenuListener()); + // Show the right click menu mTreeJPopupMenu.show(mPagesJTree, pMouseX, pMouseY); } } + private void toggleShowExtraInfoOnTree() { + // Toggle the Show/Hide extra info on tree + mShowHideExtraInfoOnTree = !mShowHideExtraInfoOnTree; + // The below will call the toString() in PosTreeNode to refresh the node names on the screen + SwingUtilities.updateComponentTreeUI(getPagesJTree()); + } + + private class TreeNodePopupMenuListener implements PopupMenuListener { + public void popupMenuWillBecomeVisible(PopupMenuEvent pE) { } + public void popupMenuWillBecomeInvisible(PopupMenuEvent pE) { } + public void popupMenuCanceled(PopupMenuEvent pE) { + // Need to null the below two variables when the user clicks away from the popup menu + // or else the next clicks on tree nodes won't show those clicked on pages + mRightClickedNode = null; + mRightClickedTreePath = null; + } + } + /** * Tree cell renderer class specifies the icons to use for the different node types: * 1. Pcl page Modified: openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-06-05 01:02:42 UTC (rev 81) +++ openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-06-05 21:43:25 UTC (rev 82) @@ -25,11 +25,14 @@ // For the Root tree node private String mRootNodeName = null; + + // The JTree where this node is in + PosTree mPosTree = null; private int mNodeNumber = 0; private String mPaperSize = "LGL"; - public PosTreeNode(String pNodeName, int pNodeNumber, String pRootNodeName) { + public PosTreeNode(String pNodeName, int pNodeNumber, String pRootNodeName, PosTree pPosTree) { if (pNodeName == null) { mNodeName = "Page: " + pNodeNumber; @@ -39,6 +42,7 @@ mNodeNumber = pNodeNumber; mRootNodeName = pRootNodeName; + mPosTree = pPosTree; mPriRenderCounters = new PriRenderCounters(); } @@ -64,10 +68,14 @@ // toString() here is used to show on the screen the name of the node public String toString() { // This is a Pcl file page node - if (mRootNodeName == null) { - String tPaperSize = "Legal"; - if (getPaperSize().equalsIgnoreCase("LTR")) { tPaperSize = "Letter"; } - return mNodeName + " (" + tPaperSize + ")"; + if (mRootNodeName != null) { + return mRootNodeName; + } + + if (mPosTree.getShowHideExtraInfoOnTree()) { + String tPaperSize = " (Legal)"; + if (mPaperSize.equalsIgnoreCase("LTR")) { tPaperSize = " (Letter)"; } + return mNodeName + tPaperSize ; } else { return mNodeName; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-05 01:02:40
|
Revision: 81 http://openpcl.svn.sourceforge.net/openpcl/?rev=81&view=rev Author: documentsystems Date: 2007-06-04 18:02:42 -0700 (Mon, 04 Jun 2007) Log Message: ----------- Howard Hoagland. Changed the tree panel's width from 150 to 168 to not get the horizontal scroll bar in the tree panel when there are 3 digits in the page number (over 99 pages) and the vertical scoll bar is there. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/panels/PosView.java Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-05 01:00:47 UTC (rev 80) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-05 01:02:42 UTC (rev 81) @@ -62,7 +62,7 @@ private MouseWheelListener[] mMouseWheelListeners = null; // Splitter divider default location - public static final int sDefaultSplitterLocPclFiles = 150; + public static final int sDefaultSplitterLocPclFiles = 168; public static final int sTreatSplitterAsClosedIfLessThan = 10; private int mPixelLocForSplitter = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |