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