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