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. |