From: <doc...@us...> - 2007-05-26 00:33:12
|
Revision: 74 http://openpcl.svn.sourceforge.net/openpcl/?rev=74&view=rev Author: documentsystems Date: 2007-05-25 17:33:13 -0700 (Fri, 25 May 2007) Log Message: ----------- Howard Hoagland. Added the options dialog, and a button on the toolbar to bring it up, and made the Printer Setup button on the options dialog bring up the Printer Setup dialog. Changed 6 source files and created the PosUserOptionsDialog and added the new icon Options.png. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java openpcl/src/com/openpcl/viewer/toolbar/PosManageToolBar.java openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java Added Paths: ----------- openpcl/src/com/openpcl/viewer/images/Options.png openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-05-26 00:33:13 UTC (rev 74) @@ -55,6 +55,7 @@ import com.openpcl.viewer.dialogs.PosZoomPopupDialog; import com.openpcl.viewer.jframe.PosSimpleJFrame; import com.openpcl.viewer.options.PosStartupOptions; +import com.openpcl.viewer.options.PosUserOptionsDialog; import com.openpcl.viewer.panels.PosChangeTheLookList; import com.openpcl.viewer.panels.PosHelpChoicesList; import com.openpcl.viewer.panels.PosPrintChoicesList; @@ -62,6 +63,7 @@ import com.openpcl.viewer.panels.PosWindowControlList; import com.openpcl.viewer.panels.PosZoomSlider; import com.openpcl.viewer.printing.PosPrintPages; +import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; import com.openpcl.viewer.statusbar.PosStatusBar; import com.openpcl.viewer.toolbar.PosManageToolBar; import com.openpcl.viewer.toolbar.PosToolBar; @@ -166,6 +168,8 @@ private PosWindowControlList mPosWindowControlList = null; 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; @@ -2240,6 +2244,19 @@ } } + /** 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 + } + /** Toggle show/hide the help choices popup */ public void actionShowHideHelpChoicesPopup() { if (mIsHelpChoicesListShowing) { Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-05-26 00:33:13 UTC (rev 74) @@ -247,6 +247,9 @@ /** Cascade Windows */ public void actionCascadeWindows(); + /** Show the Options dialog */ + public void actionShowOptionsDialog(); + /** Toggle show/hide the print choices popup */ public void actionShowHideHelpChoicesPopup(); Added: openpcl/src/com/openpcl/viewer/images/Options.png =================================================================== (Binary files differ) Property changes on: openpcl/src/com/openpcl/viewer/images/Options.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/options/PosStartupOptions.java 2007-05-26 00:33:13 UTC (rev 74) @@ -97,6 +97,7 @@ private boolean mShowSaveToPclToolbarButton = true; private boolean mShowChangeLookToolbarButton = true; private boolean mShowWindowControlToolbarButton = true; + private boolean mShowOptionsToolbarButton = true; private boolean mShowHelpChoicesToolbarButton = true; // Booleans other than toolbar related @@ -158,6 +159,7 @@ {s1 + "-ShowSaveToPclToolbarButton" + s2, "Show or hide the \"Save one page to Pcl file\" toolbar button.", "yes"}, {s1 + "-ShowChangeLookToolbarButton" + s2, "Show or hide the Change Look toolbar button.", "yes"}, {s1 + "-ShowWindowControlToolbarButton" + s2, "Show or hide the Window Control toolbar button.", "yes"}, + {s1 + "-ShowOptionsToolbarButton" + s2, "Show or hide the Options toolbar button.", "yes"}, {s1 + "-ShowHelpChoicesToolbarButton" + s2, "Show or hide the Help Choices toolbar button.", "yes"}, {"Debug and demo mode:", "", ""}, {s1 + "-ShowEmbeddedDemo" + s2, "Show the viewer embedded in an external demo app.", "no"}, @@ -224,6 +226,7 @@ mShowSaveToPclToolbarButton = false; mShowChangeLookToolbarButton = false; mShowWindowControlToolbarButton = false; + mShowOptionsToolbarButton = false; mShowHelpChoicesToolbarButton = false; } @@ -257,6 +260,8 @@ mShowChangeLookToolbarButton = argTrueFalse; } else if (commandLineArg.startsWith("-showwindowcontroltoolbarbutton")) { mShowWindowControlToolbarButton = argTrueFalse; + } else if (commandLineArg.startsWith("-showoptionstoolbarbutton")) { + mShowOptionsToolbarButton = argTrueFalse; } else if (commandLineArg.startsWith("-showhelpchoicestoolbarbutton")) { mShowHelpChoicesToolbarButton = argTrueFalse; @@ -315,6 +320,7 @@ public boolean getShowSaveToPclToolbarButton() { return mShowSaveToPclToolbarButton; } public boolean getShowChangeLookToolbarButton() { return mShowChangeLookToolbarButton; } public boolean getShowWindowControlToolbarButton() { return mShowWindowControlToolbarButton; } + public boolean getShowOptionsToolbarButton() { return mShowOptionsToolbarButton; } public boolean getShowHelpChoicesToolbarButton() { return mShowHelpChoicesToolbarButton; } // Getters for Booleans other than toolbar related @@ -370,6 +376,8 @@ mShowChangeLookToolbarButton = pShowChangeLookToolbarButton; } public void setShowWindowControlToolbarButton(boolean pShowWindowControlToolbarButton) { mShowWindowControlToolbarButton = pShowWindowControlToolbarButton; } + public void setShowOptionsToolbarButton(boolean pShowOptionsToolbarButton) { + mShowOptionsToolbarButton = pShowOptionsToolbarButton; } public void setShowHelpChoicesToolbarButton(boolean pShowHelpChoicesToolbarButton) { mShowHelpChoicesToolbarButton = pShowHelpChoicesToolbarButton; } Added: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java (rev 0) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-05-26 00:33:13 UTC (rev 74) @@ -0,0 +1,421 @@ +package com.openpcl.viewer.options; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; + +import info.clearthought.layout.TableLayout; + +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; + +import com.openpcl.viewer.OpenPCLViewer; +import com.openpcl.viewer.panels.PosView; +import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; +import com.openpcl.viewer.printing.PosPrintSetupDialog.DialogWindowListener; +import com.openpcl.viewer.util.PosReadImageIcon; + +public class PosUserOptionsDialog extends JDialog { + private static final long serialVersionUID = 1L; + + // Hold constructor passed in parameters + private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; + private OpenPCLViewer mOpenPCLViewer = null; + private Frame mParentFrame = null; + + // Values for laying out panels, buttons, labels, textfields + private double mTloPref = TableLayout.PREFERRED; + private double mTloFill = TableLayout.FILL; + private double mTloHgap = 5; + private double mTloVgap = 5; + + // Fonts + private final Font mUseFont = getFont(); + private final float mFontPointSize = mUseFont.getSize2D(); + private final Font mTitledBorderFont = mUseFont.deriveFont(Font.BOLD, mFontPointSize + 2.0f); + + // Panels + private JPanel mOuterJPanel = null; + private JPanel mTopButtonsJPanel = null; + private JPanel mPrintingOptionsJPanel = null; + private JPanel mPrintingOptionsInsideTopJPanel = null; + private JPanel mPrintingOptionsInsideMiddleJPanel = null; + private JPanel mPrintingOptionsInsideBottomJPanel = null; + private JPanel mEMailJPanel = null; + private JPanel mScanningJPanel = null; + private JPanel mUpdatesJPanel = null; + private JPanel mBottomButtonsJPanel = null; + + // Names of Group Boxes + private String mPrintingGroupBoxString = "Printing"; + private String mEMailGroupBoxString = "EMail"; + private String mScanningGroupBoxString = "Scanning"; + private String mUpdatesGroupBoxString = "Updates"; + + // 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 mEMailAdvancedSettingsJButton = new JButton("Advanced Settings for EMail"); + private JButton mScanningSetupJButton = new JButton("Scanning Setup"); + private JButton mCheckForUpdatesJButton = new JButton("Check for Updates Now"); + private JButton mOKJButton = new JButton("OK"); + private JButton mCancelJButton = new JButton("Cancel"); + + // Labels + private JLabel mCreateShortcutJLabel = new JLabel("Create shortcut on desktop"); + private JLabel mResgisterFileTypeJLabel = new JLabel("Register DSI file types with ViewMagic"); + private JLabel mWhenToShowPrinterSetupJLabel = new JLabel("When to show Printer Setup dialog"); + private JLabel mFormFillColorJLabel = new JLabel("Form's fill color (Courier text)"); + private JLabel mFooterForOriginalJLabel = new JLabel("Footer text for orginal: "); + private JLabel mFooterForFirstCopyJLabel = new JLabel("Footer text for first copy: "); + private JLabel mFooterForSecondCopyJLabel = new JLabel("Footer text for second copy: "); + private JLabel mFooterForThirdCopyJLabel = new JLabel("Footer text for third copy: "); + private JLabel mPclEscCodesJLabel = new JLabel("PCL Esc codes (used for manual tray switching)"); + private JLabel mLetterTrayJLabel = new JLabel("Letter tray: "); + private JLabel mLegalTrayJLabel = new JLabel("Legal tray: "); + private JLabel mEMailClientJLabel = new JLabel("EMail client: "); + private JLabel mScanningDescJLabel = new JLabel("For scanning the bar codes on a printed page."); + private JLabel mCheckForUpdatesEveryJLabel = new JLabel("Check for updates every "); + private JLabel mCheckForUpdatesDaysJLabel = new JLabel("days."); + private JLabel mDateLastUpdateCheckedJLabel = new JLabel("Date last checked: "); + private JLabel mFilledInDateLastCheckedJLabel = new JLabel("__/__/____"); + + // Text fields + private JTextField mFooterForOriginalJTextField = new JTextField(); + private JTextField mFooterForFirstCopyJTextField = new JTextField(); + private JTextField mFooterForSecondCopyJTextField = new JTextField(); + private JTextField mFooterForThirdCopyJTextField = new JTextField(); + private JTextField mLetterTrayJTextField = new JTextField(); + private JTextField mLegalTrayJTextField = new JTextField(); + + // Radio buttons + private JRadioButton mShowPrinterSetupEveryPrintJRadioButton = new JRadioButton("Every print"); + private JRadioButton mShowPrinterSetupFirstPrintOnlyJRadioButton = new JRadioButton("First print only"); + private JRadioButton mShowPrinterSetupFromOptionsDialogOnlyJRadioButton = new JRadioButton("Only clicking below button"); + private ButtonGroup mPrintSetupButtonGroup = new ButtonGroup(); + private JRadioButton mFormFillColorBlueJRadioButton = new JRadioButton("Blue"); + private JRadioButton mFormFillColorBlackJRadioButton = new JRadioButton("Black"); + private ButtonGroup mFormFillColorButtonGroup = new ButtonGroup(); + + // Check boxes + private JCheckBox mAntiAliasJCheckBox = new JCheckBox("Anti-alias image (highest quality)"); + + // ComboBoxes + private JComboBox mEMailClientJComboBox = new JComboBox(); + private JComboBox mCheckForUpdatesDaysJComboBox = new JComboBox(); + + // Strings + private static final String sNotImplementedString = "Not implemented: "; + + // Constructor + + public PosUserOptionsDialog(PosPrintSetupDialogChoices pPosPrintSetupDialogChoices, OpenPCLViewer pOpenPCLViewer, + String pTitleString, boolean pIsModal) { + + // Call JDialog superclass constructor passing the parent frame, title bar text, is modal + super(pOpenPCLViewer.getAppFrame(), pTitleString, pIsModal); + // Save the OpenPCLViewer + mOpenPCLViewer = pOpenPCLViewer; + // Save the parent Frame + mParentFrame = pOpenPCLViewer.getAppFrame(); + // Set the object that will hold the settings of the values from the dialog on the screen + mPosPrintSetupDialogChoices = pPosPrintSetupDialogChoices; + // Build the UI + buildUI(); + } + + private void buildUI() { + setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); + addWindowListener(new DialogWindowListener()); + + // Put the radio buttons in their button group so clicking one automatically unselects the other radio buttons + // that are in the same group + mPrintSetupButtonGroup.add(mShowPrinterSetupEveryPrintJRadioButton); + mPrintSetupButtonGroup.add(mShowPrinterSetupFirstPrintOnlyJRadioButton); + mPrintSetupButtonGroup.add(mShowPrinterSetupFromOptionsDialogOnlyJRadioButton); + mFormFillColorButtonGroup.add(mFormFillColorBlueJRadioButton); + mFormFillColorButtonGroup.add(mFormFillColorBlackJRadioButton); + + // Make the subpanels + mTopButtonsJPanel = makeTopButtonsJPanel(); + mPrintingOptionsInsideTopJPanel = makePrintingOptionsInsideTopJPanel(); + mPrintingOptionsInsideMiddleJPanel = makePrintingOptionsInsideMiddleJPanel(); + mPrintingOptionsInsideBottomJPanel = makePrintingOptionsInsideBottomJPanel(); + mPrintingOptionsJPanel = makePrintingOptionsJPanel(); + mEMailJPanel = makeEMailJPanel(); + mScanningJPanel = makeScanningJPanel(); + mUpdatesJPanel = makeUpdatesJPanel(); + mBottomButtonsJPanel = makeBottomButtonsJPanel(); + + // Make the outer panel + mOuterJPanel = makeOuterJPanel(); + + addActionListeners(); + makePanelTitledBorders(); + putOptionsOnScreen(); + setHoverHelpOnItems(); + setContentPane(mOuterJPanel); + pack(); + // setPreferredSize(new Dimension(200, 300)); + } + + 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); + } + } + }); + + mOKJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + getOptionsFromScreen(); + mPosPrintSetupDialogChoices.setUserHitOk(true); + setVisible(false); + } + }); + + mCancelJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + mPosPrintSetupDialogChoices.setUserHitOk(false); + setVisible(false); + } + }); + } + + private void makePanelTitledBorders() { + mPrintingOptionsJPanel.setBorder(generateTitledBorder(mPrintingGroupBoxString)); + mEMailJPanel.setBorder(generateTitledBorder(mEMailGroupBoxString)); + mScanningJPanel.setBorder(generateTitledBorder(mScanningGroupBoxString)); + mUpdatesJPanel.setBorder(generateTitledBorder(mUpdatesGroupBoxString)); + } + + private TitledBorder generateTitledBorder(String title) { + return(new TitledBorder(BorderFactory.createEtchedBorder(), title, + TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, mTitledBorderFont, Color.BLACK)); + } + + private JPanel makeTopButtonsJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloHgap, mTloPref, mTloHgap, mTloPref, 20, mTloFill, mTloPref, mTloHgap, mTloPref, mTloHgap }, + { mTloPref, mTloVgap }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + mCreateShortcutJButton.setIconTextGap(0); + mCreateShortcutJButton.setPreferredSize(new Dimension(44, 44)); + mRegisterFileTypeJButton.setIconTextGap(0); + mRegisterFileTypeJButton.setPreferredSize(new Dimension(44, 44)); + tPanel.add(mCreateShortcutJButton, "1, 0"); + tPanel.add(mCreateShortcutJLabel, "3, 0"); + tPanel.add(mRegisterFileTypeJButton, "6, 0"); + tPanel.add(mResgisterFileTypeJLabel, "8, 0"); + return tPanel; + } + + private JPanel makePrintingOptionsInsideTopJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloPref, 40, mTloFill, mTloHgap }, + { mTloPref, mTloPref, mTloPref, mTloPref, mTloPref, 10 }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mWhenToShowPrinterSetupJLabel, "0, 0"); + tPanel.add(mShowPrinterSetupEveryPrintJRadioButton, "0, 1"); + tPanel.add(mShowPrinterSetupFirstPrintOnlyJRadioButton, "0, 2"); + tPanel.add(mShowPrinterSetupFromOptionsDialogOnlyJRadioButton, "0, 3"); + mPrinterSetupDefaultsJButton.setMaximumSize(mPrinterSetupDefaultsJButton.getPreferredSize()); + tPanel.add(mPrinterSetupDefaultsJButton, "0, 4"); + tPanel.add(mFormFillColorJLabel, "2, 0"); + tPanel.add(mFormFillColorBlueJRadioButton, "2, 1"); + tPanel.add(mFormFillColorBlackJRadioButton, "2, 2"); + tPanel.add(mAntiAliasJCheckBox, "2, 4"); + return tPanel; + } + + private JPanel makePrintingOptionsInsideMiddleJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloPref, mTloFill, mTloHgap }, + { mTloPref, 2, mTloPref, 2, mTloPref, 2, mTloPref, 10 }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mFooterForOriginalJLabel, "0, 0"); + tPanel.add(mFooterForOriginalJTextField, "1, 0"); + tPanel.add(mFooterForFirstCopyJLabel, "0, 2"); + tPanel.add(mFooterForFirstCopyJTextField, "1, 2"); + tPanel.add(mFooterForSecondCopyJLabel, "0, 4"); + tPanel.add(mFooterForSecondCopyJTextField, "1, 4"); + tPanel.add(mFooterForThirdCopyJLabel, "0, 6"); + tPanel.add(mFooterForThirdCopyJTextField, "1, 6"); + return tPanel; + } + + private JPanel makePrintingOptionsInsideBottomJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloPref, 160, mTloFill, mTloHgap }, + { mTloPref, 2, mTloPref, mTloVgap }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mLetterTrayJLabel, "0, 0"); + tPanel.add(mLetterTrayJTextField, "1, 0"); + tPanel.add(mLegalTrayJLabel, "0, 2"); + tPanel.add(mLegalTrayJTextField, "1, 2"); + return tPanel; + } + + private JPanel makePrintingOptionsJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] {{ mTloHgap, mTloFill }, { mTloPref, mTloPref, mTloPref, mTloPref }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mPrintingOptionsInsideTopJPanel, "1, 0"); + tPanel.add(mPrintingOptionsInsideMiddleJPanel, "1, 1"); + tPanel.add(mPclEscCodesJLabel, "1, 2"); + tPanel.add(mPrintingOptionsInsideBottomJPanel, "1, 3"); + return tPanel; + } + + private JPanel makeEMailJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloHgap, 260, mTloHgap, mTloFill, mTloPref, mTloHgap }, + { mTloPref, mTloVgap, mTloPref, mTloVgap }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mEMailClientJLabel, "1, 0"); + tPanel.add(mEMailClientJComboBox, "1, 2"); + tPanel.add(mEMailAdvancedSettingsJButton, "4, 2"); + return tPanel; + } + + private JPanel makeScanningJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloHgap, mTloPref, mTloHgap, mTloFill, mTloPref, mTloHgap }, + { mTloPref, mTloVgap }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mScanningDescJLabel, "1, 0"); + tPanel.add(mScanningSetupJButton, "4, 0"); + return tPanel; + } + + private JPanel makeUpdatesJPanel() { + JPanel tPanel = new JPanel(); + double tloGridSpec[][] = new double[][] { + { mTloHgap, mTloPref, mTloHgap, 80, mTloHgap, mTloPref, mTloFill, mTloHgap, mTloPref, mTloHgap }, + { mTloPref, mTloVgap, mTloPref, mTloVgap }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mCheckForUpdatesEveryJLabel, "1, 0"); + tPanel.add(mCheckForUpdatesDaysJComboBox, "3, 0"); + tPanel.add(mCheckForUpdatesDaysJLabel, "5, 0"); + tPanel.add(mCheckForUpdatesJButton, "8, 0"); + tPanel.add(mDateLastUpdateCheckedJLabel, "1, 2"); + tPanel.add(mFilledInDateLastCheckedJLabel, "3, 2"); + return tPanel; + } + + private JPanel makeBottomButtonsJPanel() { + JPanel tPanel = new JPanel(); + tPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + double tloGridSpec[][] = new double[][] {{ mTloFill, 80, 10, 80 }, { mTloPref }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mOKJButton, "1, 0"); + tPanel.add(mCancelJButton, "3, 0"); + return tPanel; + } + + private JPanel makeOuterJPanel() { + JPanel tPanel = new JPanel(); + tPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + double tloGridSpec[][] = new double[][] {{ mTloFill }, + { mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref, mTloVgap, mTloPref, + mTloVgap, mTloFill, mTloPref }}; + tPanel.setLayout(new TableLayout(tloGridSpec)); + tPanel.add(mTopButtonsJPanel, "0, 0"); + tPanel.add(mPrintingOptionsJPanel, "0, 2"); + tPanel.add(mEMailJPanel, "0, 4"); + tPanel.add(mScanningJPanel, "0, 6"); + tPanel.add(mUpdatesJPanel, "0, 8"); + tPanel.add(mBottomButtonsJPanel, "0, 11"); + return tPanel; + } + + private void setHoverHelpOnItems() { + // Buttons + mCreateShortcutJButton.setToolTipText(sNotImplementedString + "Create shortcut on desktop"); + mRegisterFileTypeJButton.setToolTipText(sNotImplementedString + "Register DSI file types with ViewMagic"); + mPrinterSetupDefaultsJButton.setToolTipText("Printer Setup dialog"); + mEMailAdvancedSettingsJButton.setToolTipText(sNotImplementedString + "Advanced settings for EMail"); + mScanningSetupJButton.setToolTipText(sNotImplementedString + "Scanning setup"); + mCheckForUpdatesJButton.setToolTipText(sNotImplementedString + "Checking for updates"); + + // Text fields + mFooterForOriginalJTextField.setToolTipText(sNotImplementedString + "Footer for original"); + mFooterForFirstCopyJTextField.setToolTipText(sNotImplementedString + "Footer for first copy"); + mFooterForSecondCopyJTextField.setToolTipText(sNotImplementedString + "Footer for second copy"); + mFooterForThirdCopyJTextField.setToolTipText(sNotImplementedString + "Footer for third copy"); + mLetterTrayJTextField.setToolTipText(sNotImplementedString + "PCL Esc codes for Letter tray"); + mLegalTrayJTextField.setToolTipText(sNotImplementedString + "PCL Esc codes for Legal tray"); + + // Radio buttons + mShowPrinterSetupEveryPrintJRadioButton.setToolTipText(sNotImplementedString + "Every print"); + mShowPrinterSetupFirstPrintOnlyJRadioButton.setToolTipText(sNotImplementedString + "First print only"); + mShowPrinterSetupFromOptionsDialogOnlyJRadioButton.setToolTipText("Only clicking below button"); + mFormFillColorBlueJRadioButton.setToolTipText("Form's fill color Blue"); + mFormFillColorBlackJRadioButton.setToolTipText(sNotImplementedString + "Form's fill color Black (it's always blue)"); + + // Check boxes + mAntiAliasJCheckBox.setToolTipText("Anti-alias is always on and can't be turned off"); + + // Combo boxes + mEMailClientJComboBox.setToolTipText(sNotImplementedString + "Combo box of EMail clients"); + mCheckForUpdatesDaysJComboBox.setToolTipText(sNotImplementedString + "Doing updates from here"); + } + + private void getOptionsFromScreen() { + // TODO + } + + private void putOptionsOnScreen() { + // TODO + } + + public class DialogWindowListener implements WindowListener { + public void windowOpened(WindowEvent e) { + } + public void windowClosing(WindowEvent e) { + mPosPrintSetupDialogChoices.setUserHitOk(false); + setVisible(false); + } + public void windowClosed(WindowEvent e) { + } + public void windowIconified(WindowEvent e) { + } + public void windowDeiconified(WindowEvent e) { + } + public void windowActivated(WindowEvent e) { + } + public void windowDeactivated(WindowEvent e) { + } + } + +} Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-05-26 00:33:13 UTC (rev 74) @@ -398,8 +398,19 @@ } public boolean showPrintDialog() { + // Get a new PrinterJob using its static method mPrinterJob = PrinterJob.getPrinterJob(); - boolean userHitOk = mPrinterJob.printDialog(mAttributes); + + // Put up our custom printer setup dialog + mPosPrintSetupDialog = new PosPrintSetupDialog(mPosView, "Printer Setup", + 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(mPosView.getOpenPCLViewer().getAppFrame()); + mPosPrintSetupDialog.setVisible(true); + + boolean userHitOk = mPosPrintSetupDialogChoices.getDidUserHitOk(); + if (userHitOk) { return true; } else { Modified: openpcl/src/com/openpcl/viewer/toolbar/PosManageToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosManageToolBar.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/toolbar/PosManageToolBar.java 2007-05-26 00:33:13 UTC (rev 74) @@ -35,6 +35,7 @@ private JButton mChangeTheLookButton = null; private JButton mCascadeWindowsButton = null; + private JButton mOptionsButton = null; private JButton mHelpButton = null; // Subclass plugins add their JButtons on the toolbar to this ArrayList to get grayed out along with the named JButtons here, @@ -63,7 +64,7 @@ mSaveOnePageToPclFileButton.setEnabled(false); // mChangeTheLookButton is not grayed out mCascadeWindowsButton.setEnabled(false); - + //mOptionsButton is not grayed out // mHelpButton is not grayed out mPosZoomSlider.setComponentsEnabled(false); @@ -99,7 +100,7 @@ mSaveOnePageToPclFileButton.setEnabled(true); // mChangeTheLookButton is not grayed out mCascadeWindowsButton.setEnabled(true); - + // mOptionsButton is not grayed out // mHelpButton is not grayed out mPosZoomSlider.setComponentsEnabled(true); @@ -131,6 +132,7 @@ public JButton getCascadeWindowsButton() {return mCascadeWindowsButton;} + public JButton getOptionsButton() { return mOptionsButton; } public JButton getHelpButton() {return mHelpButton;} // Setters @@ -159,6 +161,8 @@ public void setCascadeWindowsButton(JButton pCascadeWindowsButton) { mCascadeWindowsButton = pCascadeWindowsButton;} + public void setOptionsButton(JButton pOptionsButton) { + mOptionsButton = pOptionsButton; } public void setHelpAboutButton(JButton pHelpButton) { mHelpButton = pHelpButton;} Modified: openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-05-23 04:27:08 UTC (rev 73) +++ openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-05-26 00:33:13 UTC (rev 74) @@ -123,6 +123,10 @@ if (mPosStartupOptions.getShowWindowControlToolbarButton()) { mJToolBar.add(tJButton); } mPosManageToolBar.setCascadeWindowsButton(tJButton); + tJButton = createOptionsButton(); + if (mPosStartupOptions.getShowOptionsToolbarButton()) { mJToolBar.add(tJButton); } + mPosManageToolBar.setOptionsButton(tJButton); + tJButton = createHelpAboutButton(); if (mPosStartupOptions.getShowHelpChoicesToolbarButton()) { mJToolBar.add(tJButton); } mPosManageToolBar.setHelpAboutButton(tJButton); @@ -260,6 +264,15 @@ return tJButton; } + /** Options toolbar button */ + protected JButton createOptionsButton() { + JButton tJButton = createToolBarButton("Options.png", "Options"); + tJButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) {mOpenPCLViewer.actionShowOptionsDialog();} + }); + return tJButton; + } + /** Help About toolbar button */ protected JButton createHelpAboutButton() { JButton tJButton = createToolBarButton("HelpAbout.jpg", "Help Choices (License Info and About)"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-05-30 22:57:57
|
Revision: 75 http://openpcl.svn.sourceforge.net/openpcl/?rev=75&view=rev Author: documentsystems Date: 2007-05-30 15:57:59 -0700 (Wed, 30 May 2007) Log Message: ----------- Howard Hoagland. Added a right click on tree nodes popup menu that has "View Selected, Print All, Print Selected, Print Remaining. Implemented the View Selected from the right click menu choice to work with multiselected nodes, and with left clicking tree nodes to show pages. Made PosTree implement new interface IPluginHooksPosTree method buildTreePopupMenu that subclass plugins override to add more menu items. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/tree/PosTree.java Added Paths: ----------- openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java Added: openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java (rev 0) +++ openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java 2007-05-30 22:57:59 UTC (rev 75) @@ -0,0 +1,19 @@ +package com.openpcl.viewer.api; + +import javax.swing.JPopupMenu; + +/** + * The methods in this interface are designed to be overridden by a subclass of PosTree + * that is a plugin that adds additional features. + * + * Therefore, it is mandatory to not delete or rename these methods or else you'll break the plugin support + * that adds additional features. + * + * @author DocMagic, Document Systems Inc, HowardH. 5/29/07 + */ +public interface IPluginHooksPosTree { + /** + * Build the JPopupMenu to show when the user right clicks on tree nodes.<br> + * The items on this popup menu are in the String array mTreePopupMenuItems. */ + public void buildTreePopupMenu(JPopupMenu pJPopupMenu); +} Modified: openpcl/src/com/openpcl/viewer/tree/PosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-05-26 00:33:13 UTC (rev 74) +++ openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-05-30 22:57:59 UTC (rev 75) @@ -3,12 +3,18 @@ import java.awt.Color; import java.awt.Component; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.security.InvalidParameterException; import java.util.NoSuchElementException; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JLabel; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.event.TreeSelectionEvent; @@ -23,16 +29,22 @@ import com.openpcl.pclrenderimage.util.PriDebug; import com.openpcl.viewer.OpenPCLViewer; +import com.openpcl.viewer.api.IPluginHooksPosTree; import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.util.PosReadImageIcon; -public class PosTree { +public class PosTree implements IPluginHooksPosTree { private PosView mPosView = null; private JTree mPagesJTree = null; private TreePath mLastSelectedTreePath = null; private PosTreeNode mClickedNode = null; + protected TreePath mRightClickedTreePath = null; + protected PosTreeNode mRightClickedNode = null; private DefaultMutableTreeNode mTreeNodeRoot = null; private String mRootNodeName = null; + private static String[] sTreePopupMenuItems = new String[] { + "View Selected", "Print All", "Print Selected", "Print Remaining"}; + private JPopupMenu mTreeJPopupMenu = null; protected static final String sPCL_ICON = "Eye.gif"; protected static final String sPAGE_ICON = "Page.gif"; @@ -71,6 +83,9 @@ mPagesJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); mPagesJTree.setShowsRootHandles(false); mPagesJTree.setExpandsSelectedPaths(true); + + // Add the right click mouse listener + mPagesJTree.addMouseListener(new RightclickTreeMouseListener()); } /** Get the JTree that is on the screen */ @@ -115,7 +130,7 @@ System.gc(); } - public TreeModel getTreeModel() { + public TreeModel getTreeModel() { if (mPagesJTree == null) { return null; } else { return mPagesJTree.getModel(); } @@ -315,15 +330,21 @@ if (mPagesJTree == null) { return; } - mLastSelectedTreePath = e.getPath(); + if (mRightClickedTreePath == null) { + // Handle left click on tree node + mLastSelectedTreePath = e.getPath(); + } else { + // Handle right click on tree node, then on the popup menu, pick "View Selected". Ignore muti selected nodes. + mLastSelectedTreePath = mRightClickedTreePath; + } + Object tSelectedNode = mLastSelectedTreePath.getLastPathComponent(); DefaultMutableTreeNode tFirstLeafNode = (DefaultMutableTreeNode) tSelectedNode; while (!tFirstLeafNode.isLeaf()) { try { - // If not a Leaf node, then this tree is not showing a normal PCL file because it has multi level tree nodes. - // In this case, this might be a DSI Blocument tree node that might be a Document or Borrower node, - // so keep looking indented to the right to find the first leaf page to view + // If not a Leaf node, then this tree has multi level tree nodes, so keep looking indented to the right + // to find the first leaf page to view tFirstLeafNode = (DefaultMutableTreeNode)tFirstLeafNode.getFirstChild(); } catch (NoSuchElementException nse) { break; // break out of the while, with it set to the last node assigned @@ -388,6 +409,100 @@ } /** + * Build the JPopupMenu to show when the user right clicks on tree nodes.<br> + * The items on this popup menu are in the String array sTreePopupMenuItems.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public void buildTreePopupMenu(JPopupMenu pJPopupMenu) { + JMenuItem tJMenuItem = new JMenuItem(sTreePopupMenuItems[0]); // View Selected + tJMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + // The user clicked "View Selected" on the popup menu. + // The below line causes the right clicked on tree node to be rendered and viewed. + // The mRightClickedTreePath was saved when the JPopupMenu was put on the screen in showTreeNodeMenuPopup() + if (mRightClickedTreePath != null) { mPagesJTree.setSelectionPath(mRightClickedTreePath); } + // After setting the view to the right clicked tree node, set mRightClickedTreePath to null + mRightClickedTreePath = null; + mRightClickedNode = null; + }}); + pJPopupMenu.add(tJMenuItem); + pJPopupMenu.addSeparator(); + + tJMenuItem = new JMenuItem(sTreePopupMenuItems[1]); // Print All + tJMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + // The user clicked "Print All" on the popup menu. + System.out.println("To do: Handle Print All"); + }}); + pJPopupMenu.add(tJMenuItem); + + tJMenuItem = new JMenuItem(sTreePopupMenuItems[2]); // Print Selected + tJMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + // The user clicked "Print Selected" on the popup menu. + System.out.println("To do: Handle Print Selected"); + }}); + pJPopupMenu.add(tJMenuItem); + + tJMenuItem = new JMenuItem(sTreePopupMenuItems[3]); // Print Remaining + tJMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent pE) { + // The user clicked "Print Remaining" on the popup menu. + System.out.println("To do: Handle Print Remaining"); + }}); + pJPopupMenu.add(tJMenuItem); + } + + /** MouseAdapter class for when the user right clicks on a node in the tree.<br> + * This checks for mouse event for popup menu in both mouseReleased() and mousePressed() because:<br> + * <br> + * As stated at http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html + * "The exact gesture that should bring up a popup menu varies by look and feel. In Microsoft Windows, the user + * by convention brings up a popup menu by releasing the right mouse button while the cursor is over a component + * that is popup-enabled."<br> + * <br> + * In that case, the mouseReleased() method will be handling the event. But on other platforms + * and/or look and feel settings, the popup menu should show upon mousePressed() and not upon mouseReleased(). + */ + protected class RightclickTreeMouseListener extends MouseAdapter { + public void mouseReleased(MouseEvent pE) { + if ( pE.isPopupTrigger() ) { + showTreeNodeMenuPopup(pE.getX(), pE.getY()); + } + } + + public void mousePressed(MouseEvent pE) { + if ( pE.isPopupTrigger() ) { + showTreeNodeMenuPopup(pE.getX(), pE.getY()); + } + } + + private void showTreeNodeMenuPopup(int pMouseX, int pMouseY) { + // Get the TreePath at the right clicked mouse (x,y) position in the JTree coordinate space + mRightClickedTreePath = getPagesJTree().getPathForLocation(pMouseX, pMouseY); + if (mRightClickedTreePath == null) { return; } + + // Get the node at that TreePath + DefaultMutableTreeNode node = (DefaultMutableTreeNode)mRightClickedTreePath.getLastPathComponent(); + + // Save the PosTreeNode that was right clicked on, because all the menu items on the right click menu + // work with the right clicked node + mRightClickedNode = (PosTreeNode)node.getUserObject(); + + // Must make a new JPopupMenu each time the user right clicks in case the user changed the Look and Feel, + // so that the JPopupMenu's L&F is the same. + // TODO is track when the user changes the L&F and only make a new JPopupMenu if the user changed the L&F + mTreeJPopupMenu = new JPopupMenu(); + // Right click on tree nodes brings up the pop up menu. Pass in the JPopupMenu because it's passed to subclass plugins + // that can then add more JMenuItems with their action listeners + buildTreePopupMenu(mTreeJPopupMenu); + mTreeJPopupMenu.pack(); + + // Show the right click menu + mTreeJPopupMenu.show(mPagesJTree, pMouseX, pMouseY); + } + } + + /** * Tree cell renderer class specifies the icons to use for the different node types: * 1. Pcl page * 2. Blockument doc with pages under it (icon for open and another icon for closed) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-05-31 23:58:49
|
Revision: 76 http://openpcl.svn.sourceforge.net/openpcl/?rev=76&view=rev Author: documentsystems Date: 2007-05-31 16:58:49 -0700 (Thu, 31 May 2007) Log Message: ----------- Howrard Hoagland. 1. In the event listeners for the right click tree node pop up menu, added a call to the same code that the toolbar executes to do Print All/Selected/Remaining. 2. Added 5 methods and event handling code in PosTree for vmTree to get and clear the right clicked TreePath and node object. 3. Fixed a the bug where View Selected didn't view if one of the 3 prints were clicked on before that. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java openpcl/src/com/openpcl/viewer/tree/PosTree.java Modified: openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java 2007-05-30 22:57:59 UTC (rev 75) +++ openpcl/src/com/openpcl/viewer/api/IPluginHooksPosTree.java 2007-05-31 23:58:49 UTC (rev 76) @@ -1,7 +1,10 @@ package com.openpcl.viewer.api; import javax.swing.JPopupMenu; +import javax.swing.tree.TreePath; +import com.openpcl.viewer.tree.PosTreeNode; + /** * The methods in this interface are designed to be overridden by a subclass of PosTree * that is a plugin that adds additional features. @@ -12,8 +15,23 @@ * @author DocMagic, Document Systems Inc, HowardH. 5/29/07 */ public interface IPluginHooksPosTree { - /** - * Build the JPopupMenu to show when the user right clicks on tree nodes.<br> + + /** Get the left clicked PosTreeNode. */ + public PosTreeNode getClickedNode(); + + /** Get the right clicked PosTreeNode. */ + public PosTreeNode getRightClickedNode(); + + /** Get the right clicked TreePath. */ + public TreePath getRightClickedTreePath(); + + /** Clear the right clicked PosTreeNode. */ + public void clearRightClickedNode(); + + /** Clear the right clicked TreePath. */ + public void clearRightClickedTreePath(); + + /** Build the JPopupMenu to show when the user right clicks on tree nodes.<br> * The items on this popup menu are in the String array mTreePopupMenuItems. */ public void buildTreePopupMenu(JPopupMenu pJPopupMenu); } Modified: openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-05-30 22:57:59 UTC (rev 75) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-05-31 23:58:49 UTC (rev 76) @@ -12,7 +12,6 @@ import info.clearthought.layout.TableLayout; import javax.swing.BorderFactory; -import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -28,7 +27,6 @@ import com.openpcl.viewer.OpenPCLViewer; import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; -import com.openpcl.viewer.printing.PosPrintSetupDialog.DialogWindowListener; import com.openpcl.viewer.util.PosReadImageIcon; public class PosUserOptionsDialog extends JDialog { Modified: openpcl/src/com/openpcl/viewer/tree/PosTree.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-05-30 22:57:59 UTC (rev 75) +++ openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-05-31 23:58:49 UTC (rev 76) @@ -38,8 +38,8 @@ private JTree mPagesJTree = null; private TreePath mLastSelectedTreePath = null; private PosTreeNode mClickedNode = null; - protected TreePath mRightClickedTreePath = null; - protected PosTreeNode mRightClickedNode = null; + private TreePath mRightClickedTreePath = null; + private PosTreeNode mRightClickedNode = null; private DefaultMutableTreeNode mTreeNodeRoot = null; private String mRootNodeName = null; private static String[] sTreePopupMenuItems = new String[] { @@ -115,8 +115,27 @@ } public TreePath getLastSelectedTreePath() { return mLastSelectedTreePath; } + + /** Get the left clicked PosTreeNode.<br> + * Subclass plugins override this method so do not delete or rename this method. */ public PosTreeNode getClickedNode() { return mClickedNode; } + /** Get the right clicked PosTreeNode.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public PosTreeNode getRightClickedNode() { return mRightClickedNode; } + + /** Get the right clicked TreePath.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public TreePath getRightClickedTreePath() { return mRightClickedTreePath; } + + /** Clear the right clicked PosTreeNode.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public void clearRightClickedNode() { mRightClickedNode = null; } + + /** Clear the right clicked TreePath.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public void clearRightClickedTreePath() { mRightClickedTreePath = null; } + public void setLastSelectedTreePath(TreePath pLastSelectedTreePath) { mLastSelectedTreePath = pLastSelectedTreePath; } public void setClickedNode(PosTreeNode pClickedNode) { mClickedNode = pClickedNode; } @@ -431,7 +450,9 @@ tJMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent pE) { // The user clicked "Print All" on the popup menu. - System.out.println("To do: Handle Print All"); + mPosView.getOpenPCLViewer().actionPrintAll(); + mRightClickedNode = null; + mRightClickedTreePath = null; }}); pJPopupMenu.add(tJMenuItem); @@ -439,7 +460,9 @@ tJMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent pE) { // The user clicked "Print Selected" on the popup menu. - System.out.println("To do: Handle Print Selected"); + mPosView.getOpenPCLViewer().actionPrintSelected(); + mRightClickedNode = null; + mRightClickedTreePath = null; }}); pJPopupMenu.add(tJMenuItem); @@ -447,7 +470,9 @@ tJMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent pE) { // The user clicked "Print Remaining" on the popup menu. - System.out.println("To do: Handle Print Remaining"); + mPosView.getOpenPCLViewer().actionPrintRemaining(); + mRightClickedNode = null; + mRightClickedTreePath = null; }}); pJPopupMenu.add(tJMenuItem); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-06-04 23:42:36
|
Revision: 79 http://openpcl.svn.sourceforge.net/openpcl/?rev=79&view=rev Author: documentsystems Date: 2007-06-04 16:42:37 -0700 (Mon, 04 Jun 2007) Log Message: ----------- Howard Hoagland. 1. Re-draw node names on the tree because sometimes node names have ... and the last 5 to 10 chars chopped off. 2. Upon adding each node to the tree, set the PCL bytes paper size in the tree PosTreeNode. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 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/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-06-02 00:25:06 UTC (rev 78) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-06-04 23:42:37 UTC (rev 79) @@ -936,6 +936,8 @@ * Subclass plugins override this method so do not delete or rename this method. */ public void applySelectedLookAndFeel() { SwingUtilities.updateComponentTreeUI(mParentFrame); + // Re-draw node names on the tree because sometimes node names have ... and the last 5 to 10 chars chopped off + SwingUtilities.updateComponentTreeUI(mPosViewSelected.getPosTree().getPagesJTree()); SwingUtilities.updateComponentTreeUI(mPosPrintChoicesPopupDialog); SwingUtilities.updateComponentTreeUI(mPosZoomPopupDialog); SwingUtilities.updateComponentTreeUI(mPosChangeTheLookPopupDialog); @@ -1400,11 +1402,15 @@ for (int i = 0; i < tNumPages; i++) { // Add node to the tree for this viewable page. The page number is 1 based while the ArrayList is 0 based, so add 1 here - mPosViewSelected.getPosTree().makePclPageTreeNode(i + 1); + PosTreeNode tPosTreeNode =mPosViewSelected.getPosTree().makePclPageTreeNode(i + 1); + tPosTreeNode.setPaperSize(getPaperSizeForPage(i + 1)); } // Signal new view is shown so if it's the first view open then it ungrays out buttons in the toolbar mPosManageToolBar.setAViewIsOpen(); + + // Re-draw node names on the tree because sometimes node names have ... and the last 5 to 10 chars chopped off + SwingUtilities.updateComponentTreeUI(mPosViewSelected.getPosTree().getPagesJTree()); return null; // If no error then it returns a null String } Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-02 00:25:06 UTC (rev 78) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-06-04 23:42:37 UTC (rev 79) @@ -62,7 +62,7 @@ private MouseWheelListener[] mMouseWheelListeners = null; // Splitter divider default location - public static final int sDefaultSplitterLocPclFiles = 110; + public static final int sDefaultSplitterLocPclFiles = 150; 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-02 00:25:06 UTC (rev 78) +++ openpcl/src/com/openpcl/viewer/tree/PosTree.java 2007-06-04 23:42:37 UTC (rev 79) @@ -16,6 +16,7 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JTree; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; @@ -196,8 +197,8 @@ * If a 1 page PCL file, then there will end up 1 node saying "Page 1". * else, if a multi page PCL file, then there will be several nodes saying "Page 1", then "Page 2", "Page 3" */ - public void makePclPageTreeNode(int pPageNumber) { - if (mPagesJTree == null) { return; } + 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); tPosTreeNode.setPclBytes(null); // If the Pcl bytes of this pages is needed later, they can be gotten later @@ -206,6 +207,7 @@ // Add to tree under the root node addChildNodeToTree(child, getTreeNodeRoot(), true); + return tPosTreeNode; } /** Modified: openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java =================================================================== --- openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-06-02 00:25:06 UTC (rev 78) +++ openpcl/src/com/openpcl/viewer/tree/PosTreeNode.java 2007-06-04 23:42:37 UTC (rev 79) @@ -64,7 +64,13 @@ // toString() here is used to show on the screen the name of the node public String toString() { // This is a Pcl file page node - return mNodeName; + if (mRootNodeName == null) { + String tPaperSize = "Legal"; + if (getPaperSize().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 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-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-07-20 23:53:39
|
Revision: 110 http://openpcl.svn.sourceforge.net/openpcl/?rev=110&view=rev Author: documentsystems Date: 2007-07-20 16:53:33 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Howard Hoagland. Changed the PosPrintSetupChoices getter and setter method names and class variable names to match what is on the print setup dialog when the "Print Order" was changed to "Paper Size" and the "Print all on Legal" and the "Print all on Letter (shrinks Legal)" check boxes were moved into the "Print Order" group box and change to radio buttons in the radio button set with the "Legal first, then Letter" and "Letter first, then Legal". This caused the need to fix all those getter/setter method calls and radio button names in the 5 other classes checked in at this time. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 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/options/PosUserOptionsDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/options/PosUserOptionsDialog.java 2007-07-20 23:53:33 UTC (rev 110) @@ -20,14 +20,12 @@ import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JLabel; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.TitledBorder; 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; @@ -216,7 +214,7 @@ private void showPrintSetupDefaultsDialog() { mPosPrintSetupDialog = new PosPrintSetupDialog(mParentFrame, "Print Setup Defaults", mOpenPCLViewer.getPosStartupOptions(), mPosPrintSetupDialogChoices, - mPrintRequestAttributeSet, mPrinterJob, "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 Defaults."); mPosPrintSetupDialog.setLocationRelativeTo(mParentFrame); mPosPrintSetupDialog.setVisible(true); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintBufferedImage.java 2007-07-20 23:53:33 UTC (rev 110) @@ -98,9 +98,9 @@ // Save the passed in AffineTransform (to put it back before returning) mOrigAffineTransform = g2D.getTransform(); - if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter() && + if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal() && ( !(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 + // The user has clicked the "Print all on Letter paper (shrinks Legal)" radio button so shrink Legal to fit on Letter g2D.transform(mShrinkLegalToLetterAffineTransform); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPageableInterface.java 2007-07-20 23:53:33 UTC (rev 110) @@ -76,14 +76,14 @@ 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 + if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command 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 + } else if (mPosPrintSetupDialogChoices != null && mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + // The user has clicked the "Print all on Letter paper (shrinks Legal)" radio button so force all pages to Letter size tBuiltPageFormat.setPaper(mLetterPaperPortrait); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintPages.java 2007-07-20 23:53:33 UTC (rev 110) @@ -236,33 +236,46 @@ threadShowProgressBar.start(); StringBuffer tMsgStringBuffer = new StringBuffer(); - tMsgStringBuffer.append(" to printer selected: "); - tMsgStringBuffer.append(mPrintService.getName()); - tMsgStringBuffer.append("\n Shrink All Legal Pages to Fit On Letter is "); - if (mPosPrintSetupDialogChoices.shouldShrinkLegalToFitOnLetter()) { - tMsgStringBuffer.append("\"True\""); + // Java Console output window will show all the below: + // "Windows Print" or "Print PCL Direct" + if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { + tMsgStringBuffer.append("\"Print PCL Direct\""); } else { - tMsgStringBuffer.append("\"False\""); + tMsgStringBuffer.append("\"Windows Print\""); } - - tMsgStringBuffer.append("\n Print all Documents on Legal Size is "); - if (mPosPrintSetupDialogChoices.shouldPrintAllOnLegalSize()) { - tMsgStringBuffer.append("\"True\""); - } else { - tMsgStringBuffer.append("\"False\""); + + // to printer selected + tMsgStringBuffer.append(" to printer selected: "); + tMsgStringBuffer.append(mPrintService.getName()); + + // The 5 radio buttons in the "Paper Size" group box + if (mPosPrintSetupDialogChoices.isPaperSizeAsDisplayedOrSelected()) { + tMsgStringBuffer.append("\n Print as displayed/selected."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter()) { + tMsgStringBuffer.append("\n Print Legal first, then Letter."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal()) { + tMsgStringBuffer.append("\n Print Letter first, then Legal."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + tMsgStringBuffer.append("\n Print all on Legal paper."); + + } else if (mPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal()) { + tMsgStringBuffer.append("\n Print all on Letter paper (shrinks Legal). "); } - + + // Additional copies tMsgStringBuffer.append("\n Additional Copies is " + mPosPrintSetupDialogChoices.getNumAdditionalCopies()); + // "Print All" or "Print Selected" or "Print Remaining" or "Print Changed" + // N pages + // Index numbers are: n, n, n, ... n tMsgStringBuffer.append("\n " + mIndexNumbersStringBuffer); - // Console output print type "Use Windows Print" or "Print PCL Direct" - if (mPosPrintSetupDialogChoices.isPrintFormatPclDirect()) { - PriDebug.releaseln("\"Print PCL Direct\"" + tMsgStringBuffer.toString()); - } else { - PriDebug.releaseln("\"Windows Print\"" + tMsgStringBuffer.toString()); - } + // Send the built multi line string to the Java Console + PriDebug.releaseln(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(); @@ -356,9 +369,10 @@ // 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" - // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the DSP values or no matter if this is a PCL file + if (pPosPrintSetupDialogChoices != null && pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal()) { + // The user has a check in the Print Setup dialog box for "Print all on Legal paper" + // so FORCE ALL PAGES TO LEGAL SIZE no matter if LTR in the Blockument DSP values + // or if this is a PCL file with a letter size PCL command tByteArrayOutputStream.write(tLegalSizePaperBytes); } else { Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialog.java 2007-07-20 23:53:33 UTC (rev 110) @@ -58,7 +58,6 @@ private static final long serialVersionUID = 1L; private PosPrintSetupDialog mThisPosPrintSetupDialog = null; private PosStartupOptions mPosStartupOptions = null; - private Frame mParentFrame = null; private PosPrintSetupDialogChoices mPrintChoices = null; private PrintRequestAttributeSet mPrintRequestAttributeSet = null; private PrinterJob mPrinterJob = null; @@ -121,11 +120,11 @@ private Font mTextAreaFont = new Font("Arial", Font.PLAIN, 12); // JRadioButtons - private JRadioButton mPrintOrderAsDisplayedOrSelectedJRadioButton = new JRadioButton("As displayed / selected"); - private JRadioButton mPrintOrderLegalFirstThenLetterJRadioButton = new JRadioButton("Legal first, then Letter"); - private JRadioButton mPrintOrderLetterFirstThenLegalJRadioButton = new JRadioButton("Letter first, then Legal"); - private JRadioButton mAllOnLegalJRadioButton = new JRadioButton("Print all on Legal paper"); - private JRadioButton mAllOnLetterShrinkLegalJRadioButton = new JRadioButton("Print all on Letter paper (shrinks Legal)"); + private JRadioButton mPaperSizeAsDisplayedOrSelected = new JRadioButton("As displayed / selected"); + private JRadioButton mPaperSizeLegalFirstThenLetter = new JRadioButton("Legal first, then Letter"); + private JRadioButton mPaperSizeLetterFirstThenLegal = new JRadioButton("Letter first, then Legal"); + private JRadioButton mPaperSizePrintAllOnLegal = new JRadioButton("Print all on Legal paper"); + private JRadioButton mPaperSizePrintAllOnLetterShrinksLegal = new JRadioButton("Print all on Letter paper (shrinks Legal)"); private JRadioButton mPrintFormNamesYesJRadioButton = new JRadioButton("Yes"); private JRadioButton mPrintFormNamesNoJRadioButton = new JRadioButton("No"); private JRadioButton mDuplexYesJRadioButton = new JRadioButton("Yes (If Supported by Printer)"); @@ -162,7 +161,6 @@ super(pParentFrame, pTitleBarText, true); mThisPosPrintSetupDialog = this; // needed for the ActionListeners to put up the JOptionPane info dialogs mPosStartupOptions = pPosStartupOptions; - mParentFrame = pParentFrame; // Set to false the show DSML buttons even if the user said true on the command line mPosStartupOptions.setShowDSMLPrintDialogButtons(false); @@ -279,12 +277,12 @@ mIsPclPrinterJCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mIsPclPrinterJCheckBox.isSelected()) { - mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(true); } else { - if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPaperSizeAsDisplayedOrSelected.setSelected(true); } - mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(false); } } }); @@ -399,12 +397,12 @@ private void checkforGrayOutShrinkToLetter() { if (mIsPclPrinterJCheckBox.isSelected()) { - mAllOnLetterShrinkLegalJRadioButton.setEnabled(true); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(true); } else { - if (mAllOnLetterShrinkLegalJRadioButton.isSelected()) { - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(true); + if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPaperSizeAsDisplayedOrSelected.setSelected(true); } - mAllOnLetterShrinkLegalJRadioButton.setEnabled(false); + mPaperSizePrintAllOnLetterShrinksLegal.setEnabled(false); } } @@ -451,31 +449,31 @@ private JPanel makePaperSizePanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref}, { tTextHeight, tTextHeight, tTextHeight, tTextHeight, tTextHeight}}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); ButtonGroup buttonGroup = new ButtonGroup(); - buttonGroup.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); - buttonGroup.add(mPrintOrderLegalFirstThenLetterJRadioButton); - buttonGroup.add(mPrintOrderLetterFirstThenLegalJRadioButton); - buttonGroup.add(mAllOnLegalJRadioButton); - buttonGroup.add(mAllOnLetterShrinkLegalJRadioButton); + buttonGroup.add(mPaperSizeAsDisplayedOrSelected); + buttonGroup.add(mPaperSizeLegalFirstThenLetter); + buttonGroup.add(mPaperSizeLetterFirstThenLegal); + buttonGroup.add(mPaperSizePrintAllOnLegal); + buttonGroup.add(mPaperSizePrintAllOnLetterShrinksLegal); - panel.add(makeFillerOnRightPanel(mPrintOrderAsDisplayedOrSelectedJRadioButton), "0, 0"); - panel.add(makeFillerOnRightPanel(mPrintOrderLegalFirstThenLetterJRadioButton), "0, 1"); - panel.add(makeFillerOnRightPanel(mPrintOrderLetterFirstThenLegalJRadioButton), "0, 2"); - panel.add(makeFillerOnRightPanel(mAllOnLegalJRadioButton), "0, 3"); - panel.add(makeFillerOnRightPanel(mAllOnLetterShrinkLegalJRadioButton), "0, 4"); + panel.add(makeFillerOnRightPanel(mPaperSizeAsDisplayedOrSelected), "0, 0"); + panel.add(makeFillerOnRightPanel(mPaperSizeLegalFirstThenLetter), "0, 1"); + panel.add(makeFillerOnRightPanel(mPaperSizeLetterFirstThenLegal), "0, 2"); + panel.add(makeFillerOnRightPanel(mPaperSizePrintAllOnLegal), "0, 3"); + panel.add(makeFillerOnRightPanel(mPaperSizePrintAllOnLetterShrinksLegal), "0, 4"); return panel; } private JPanel makePrintFormNamesPanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -491,7 +489,7 @@ private JPanel makeDuplexPanel() { JPanel panel = new JPanel(); - int tTextHeight = mPrintOrderAsDisplayedOrSelectedJRadioButton.getPreferredSize().height - 6; + int tTextHeight = mPaperSizeAsDisplayedOrSelected.getPreferredSize().height - 6; double tloGridSpec[][] = new double[][] {{ mTloPref }, { tTextHeight, tTextHeight }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -550,15 +548,24 @@ private void putPrintChoicesOnScreen() { mAddlCopiesJTextField.setText(Integer.toString(mPrintChoices.getNumAdditionalCopies())); mIsPclPrinterJCheckBox.setSelected(!(mPrintChoices.isPrintFormatPclDirect())); - mPrintOrderAsDisplayedOrSelectedJRadioButton.setSelected(mPrintChoices.isPrintOrderAsDisplayedOrSelected()); - mPrintOrderLegalFirstThenLetterJRadioButton.setSelected(mPrintChoices.isPrintOrderLegalFirstThenLetter()); - mPrintOrderLetterFirstThenLegalJRadioButton.setSelected(mPrintChoices.isPrintOrderLetterFirstThenLegal()); - mPrintFormNamesYesJRadioButton.setSelected(mPrintChoices.shouldPrintFormNames()); - mPrintFormNamesNoJRadioButton.setSelected( !(mPrintChoices.shouldPrintFormNames()) ); - mDuplexYesJRadioButton.setSelected(mPrintChoices.shouldDuplex()); - mDuplexNoJRadioButton.setSelected( !(mPrintChoices.shouldDuplex()) ); - mAllOnLetterShrinkLegalJRadioButton.setSelected(mPrintChoices.shouldShrinkLegalToFitOnLetter()); - mAllOnLegalJRadioButton.setSelected(mPrintChoices.shouldPrintAllOnLegalSize()); + + mPaperSizeAsDisplayedOrSelected.setSelected(mPrintChoices.isPaperSizeAsDisplayedOrSelected()); + mPaperSizeLegalFirstThenLetter.setSelected(mPrintChoices.isPaperSizeLegalFirstThenLetter()); + mPaperSizeLetterFirstThenLegal.setSelected(mPrintChoices.isPaperSizeLetterFirstThenLegal()); + mPaperSizePrintAllOnLegal.setSelected(mPrintChoices.isPaperSizePrintAllOnLegal()); + mPaperSizePrintAllOnLetterShrinksLegal.setSelected(mPrintChoices.isPaperSizePrintAllOnLetterShrinksLegal()); + + if (mPrintChoices.shouldPrintFormNames()) { + mPrintFormNamesYesJRadioButton.setSelected(true); + } else { + mPrintFormNamesYesJRadioButton.setSelected(false); + } + + if (mPrintChoices.shouldDuplex()) { + mDuplexYesJRadioButton.setSelected(true); + } else { + mDuplexYesJRadioButton.setSelected(false); + } } private void getPrintChoicesFromScreen() { @@ -583,21 +590,23 @@ mPrintChoices.setPrintFormatIsPclDirect(); } - // Print order - if (mPrintOrderAsDisplayedOrSelectedJRadioButton.isSelected()) { - mPrintChoices.setPrintOrderAsDisplayedOrSelected(); - } else if (mPrintOrderLegalFirstThenLetterJRadioButton.isSelected()) { - mPrintChoices.setPrintOrderLegalFirstThenLetter(); - } else { - mPrintChoices.setPrintOrderLetterFirstThenLegal(); + // Paper Size + if (mPaperSizeAsDisplayedOrSelected.isSelected()) { + mPrintChoices.setPaperSizeAsDisplayedSelected(); + + } else if (mPaperSizeLegalFirstThenLetter.isSelected()) { + mPrintChoices.setPaperSizeLegalFirstThenLetter(); + + } else if (mPaperSizeLetterFirstThenLegal.isSelected()) { + mPrintChoices.setPaperSizeLetterFirstThenLegal(); + + } else if (mPaperSizePrintAllOnLegal.isSelected()) { + mPrintChoices.setPaperSizePrintAllOnLegal(); + + } else if (mPaperSizePrintAllOnLetterShrinksLegal.isSelected()) { + mPrintChoices.setPaperSizePrintAllOnLetterShrinksLegal(); } - // Shrink All Legal Pages to Fit On Letter - mPrintChoices.setShouldShrinkLegalToFitOnLetter(mAllOnLetterShrinkLegalJRadioButton.isSelected()); - - // Print all on legal size - mPrintChoices.setShouldPrintAllOnLegalSize(mAllOnLegalJRadioButton.isSelected()); - // Print form names mPrintChoices.setShouldPrintFormNames(mPrintFormNamesYesJRadioButton.isSelected()); @@ -609,13 +618,15 @@ private void makeArrayListOfDialogItems() { mItemsOnDialogBox.add(mListOfPrintersJList); mItemsOnDialogBox.add(mIsPclPrinterJCheckBox); - mItemsOnDialogBox.add(mAllOnLetterShrinkLegalJRadioButton); - mItemsOnDialogBox.add(mAllOnLegalJRadioButton); mItemsOnDialogBox.add(mAddlCopiesJLabel); mItemsOnDialogBox.add(mAddlCopiesJTextField); - mItemsOnDialogBox.add(mPrintOrderAsDisplayedOrSelectedJRadioButton); - mItemsOnDialogBox.add(mPrintOrderLegalFirstThenLetterJRadioButton); - mItemsOnDialogBox.add(mPrintOrderLetterFirstThenLegalJRadioButton); + + mItemsOnDialogBox.add(mPaperSizeAsDisplayedOrSelected); + mItemsOnDialogBox.add(mPaperSizeLegalFirstThenLetter); + mItemsOnDialogBox.add(mPaperSizeLetterFirstThenLegal); + mItemsOnDialogBox.add(mPaperSizePrintAllOnLegal); + mItemsOnDialogBox.add(mPaperSizePrintAllOnLetterShrinksLegal); + mItemsOnDialogBox.add(mPrintFormNamesYesJRadioButton); mItemsOnDialogBox.add(mPrintFormNamesNoJRadioButton); mItemsOnDialogBox.add(mDuplexYesJRadioButton); @@ -740,12 +751,12 @@ mIsPclPrinterJCheckBox.setToolTipText(sPrinterModeHoverOverString); mAddlCopiesJTextField.setToolTipText("Allowed values are 0 to 3 additional copies"); - mAllOnLegalJRadioButton.setToolTipText("Print all pages on Legal paper"); - mAllOnLetterShrinkLegalJRadioButton.setToolTipText( + mPaperSizeAsDisplayedOrSelected.setToolTipText("Print pages in the order shown on the screen"); + mPaperSizeLegalFirstThenLetter.setToolTipText("Print Legal first then Letter"); + mPaperSizeLetterFirstThenLegal.setToolTipText("Print Letter first then Legal"); + mPaperSizePrintAllOnLegal.setToolTipText("Print all pages on Legal paper"); + mPaperSizePrintAllOnLetterShrinksLegal.setToolTipText( "Print all pages on Letter paper. This is grayed out if \"Use Windows Print\" is unchecked"); - mPrintOrderAsDisplayedOrSelectedJRadioButton.setToolTipText("Print pages in the order shown in the tree"); - mPrintOrderLegalFirstThenLetterJRadioButton.setToolTipText("Print Legal first then Letter"); - mPrintOrderLetterFirstThenLegalJRadioButton.setToolTipText("Print Letter first then Legal"); mPrintFormNamesYesJRadioButton.setToolTipText("Print form names"); mPrintFormNamesNoJRadioButton.setToolTipText("Don't print form names"); Modified: openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java =================================================================== --- openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-17 01:53:21 UTC (rev 109) +++ openpcl/src/com/openpcl/viewer/printing/PosPrintSetupDialogChoices.java 2007-07-20 23:53:33 UTC (rev 110) @@ -8,22 +8,22 @@ */ public class PosPrintSetupDialogChoices { - public static final int mPrintFormatIsPclDirect = 1; - public static final int mPrintFormatIsGdiDriver = 2; + public static final int sPrintFormatIsPclDirect = 1; + public static final int sPrintFormatIsGdiDriver = 2; - public static final int mPrintOrderAsDisplayedOrSelected = 1; - public static final int mPrintOrderLegalFirstThenLetter = 2; - public static final int mPrintOrderLetterFirstThenLegal = 3; + public static final int sPaperSizeAsDisplayedSelected = 1; + public static final int sPaperSizeLegalFirstThenLetter = 2; + public static final int sPaperSizeLetterFirstThenLegal = 3; + public static final int sPaperSizePrintAllOnLegal = 4; + public static final int sPaperSizePrintAllOnLetterShrinksLegal = 5; // 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 = mPrintFormatIsGdiDriver; - private int mPrintOrder = mPrintOrderAsDisplayedOrSelected; + private int mPrintFormat = sPrintFormatIsGdiDriver; + private int mPaperSize = sPaperSizeAsDisplayedSelected; private boolean mShouldPrintFormNames = false; private boolean mShouldDuplex = false; - private boolean mShouldShrinkLegalToFitOnLetter = false; - private boolean mShouldPrintAllOnLegalSize = false; private boolean mUserHitOk = false; @@ -39,32 +39,32 @@ return mNumAdditionalCopies; } public boolean isPrintFormatPclDirect() { - return (mPrintFormat == mPrintFormatIsPclDirect); + return (mPrintFormat == sPrintFormatIsPclDirect); } public boolean isPrintFormatGdiDriver() { - return (mPrintFormat == mPrintFormatIsGdiDriver); + return (mPrintFormat == sPrintFormatIsGdiDriver); } - public boolean isPrintOrderAsDisplayedOrSelected() { - return (mPrintOrder == mPrintOrderAsDisplayedOrSelected); + public boolean isPaperSizeAsDisplayedOrSelected() { + return (mPaperSize == sPaperSizeAsDisplayedSelected); } - public boolean isPrintOrderLegalFirstThenLetter() { - return (mPrintOrder == mPrintOrderLegalFirstThenLetter); + public boolean isPaperSizeLegalFirstThenLetter() { + return (mPaperSize == sPaperSizeLegalFirstThenLetter); } - public boolean isPrintOrderLetterFirstThenLegal() { - return (mPrintOrder == mPrintOrderLetterFirstThenLegal); + public boolean isPaperSizeLetterFirstThenLegal() { + return (mPaperSize == sPaperSizeLetterFirstThenLegal); } + public boolean isPaperSizePrintAllOnLegal() { + return (mPaperSize == sPaperSizePrintAllOnLegal); + } + public boolean isPaperSizePrintAllOnLetterShrinksLegal() { + return (mPaperSize == sPaperSizePrintAllOnLetterShrinksLegal); + } public boolean shouldPrintFormNames() { return mShouldPrintFormNames; } public boolean shouldDuplex() { return mShouldDuplex; } - public boolean shouldShrinkLegalToFitOnLetter() { - return mShouldShrinkLegalToFitOnLetter; - } - public boolean shouldPrintAllOnLegalSize() { - return mShouldPrintAllOnLegalSize; - } public boolean getDidUserHitOk() { return mUserHitOk; } @@ -77,32 +77,32 @@ mNumAdditionalCopies = numCopies; } public void setPrintFormatIsPclDirect() { - mPrintFormat = mPrintFormatIsPclDirect; + mPrintFormat = sPrintFormatIsPclDirect; } public void setPrintFormatIsGdiDriver() { - mPrintFormat = mPrintFormatIsGdiDriver; + mPrintFormat = sPrintFormatIsGdiDriver; } - public void setPrintOrderAsDisplayedOrSelected() { - mPrintOrder = mPrintOrderAsDisplayedOrSelected; + public void setPaperSizeAsDisplayedSelected() { + mPaperSize = sPaperSizeAsDisplayedSelected; } - public void setPrintOrderLegalFirstThenLetter() { - mPrintOrder = mPrintOrderLegalFirstThenLetter; + public void setPaperSizeLegalFirstThenLetter() { + mPaperSize = sPaperSizeLegalFirstThenLetter; } - public void setPrintOrderLetterFirstThenLegal() { - mPrintOrder = mPrintOrderLetterFirstThenLegal; + public void setPaperSizeLetterFirstThenLegal() { + mPaperSize = sPaperSizeLetterFirstThenLegal; } + public void setPaperSizePrintAllOnLegal() { + mPaperSize = sPaperSizePrintAllOnLegal; + } + public void setPaperSizePrintAllOnLetterShrinksLegal() { + mPaperSize = sPaperSizePrintAllOnLetterShrinksLegal; + } public void setShouldPrintFormNames(boolean yesOrNo) { mShouldPrintFormNames = yesOrNo; } public void setShouldDuplex(boolean yesOrNo) { mShouldDuplex = yesOrNo; } - public void setShouldShrinkLegalToFitOnLetter(boolean yesOrNo) { - mShouldShrinkLegalToFitOnLetter = yesOrNo; - } - public void setShouldPrintAllOnLegalSize(boolean yesOrNo) { - mShouldPrintAllOnLegalSize = yesOrNo; - } public void setUserHitOk(boolean yesOrNo) { mUserHitOk = yesOrNo; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 23:58:16
|
Revision: 122 http://openpcl.svn.sourceforge.net/openpcl/?rev=122&view=rev Author: documentsystems Date: 2007-07-25 16:58:18 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In 3 files, changed the actionShowHideTree toolbar button to pass a boolean whether the user did a Ctrl-click and if the control key was down when the user clicked the toggle show hide the tree panel, then do the hidden feature action which draws an underline under each char that was bumped to the right or left to center each character in its char cell. A red underline means the char was bumped to the right to center it. A cyan color underline means the char was bumped to the left to center it. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 23:58:18 UTC (rev 122) @@ -1505,6 +1505,9 @@ int tPageNumber = mPosViewSelected.getCurrentPageNumberSelected(); String tPaperSize = getPaperSizeForPage(tPageNumber); + // Save the (x,y) scrolled to point + Rectangle tScrollBarPosition = mPosViewSelected.getCurrentViewRectangle(); + // Show the "Updating Image" message on the currently selected PosView mPosViewSelected.showUpdatingImageVisualCue(); @@ -1524,6 +1527,9 @@ // Make the JTree panel scroll left all the way mPosViewSelected.getTreeJScrollPane().getHorizontalScrollBar().setValue(0); + // Scroll the view to where it was before updating the image + mPosViewSelected.scrollViewToPosition(tScrollBarPosition); + if (tBufferedImage == null) { // PclRenderImage returned null for the BufferedImage, so here return the last error string from the // currently selected PosView's PclRenderImage @@ -2066,14 +2072,25 @@ } /** Toggle show/hide the pages tree */ - public void actionShowHideTree() { - if (mPosViewSelected != null) { - if (mPosViewSelected.getIsTreePanelShowing()) { - actionHideTree(); + public void actionShowHideTree(boolean pControlKeyPressed) { + if (mPosViewSelected == null) { return; } + + if (!pControlKeyPressed) { + if (mPosViewSelected.getIsTreePanelShowing()) { + actionHideTree(); + } else { + actionShowTree(); + } + } else { - actionShowTree(); + // Hidden feature. If the Control key is pressed when clicking this button, then do the below + // that draws an underline under each char that was bumped to the right or left to center each character in its char cell. + // A red underline means the char was bumped to the right to center it. + // A cyan color underline means the char was bumped to the left to center it. + boolean tToggleCenterCharInCharCellBox = mPosViewSelected.getPclRenderImage().getWantToCenterCharInCharCellBox(); + mPosViewSelected.getPclRenderImage().setWantToCenterCharInCharCellBox(!tToggleCenterCharInCharCellBox); + renderImageCurrentPageAndZoom(); } - } } /** Show the pages tree */ Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-07-25 23:58:18 UTC (rev 122) @@ -194,7 +194,7 @@ public void actionNextPage(); /** Toggle show/hide the pages tree */ - public void actionShowHideTree(); + public void actionShowHideTree(boolean pControlKeyPressed); /** Show the pages tree */ public void actionShowTree(); Modified: openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-07-25 19:57:45 UTC (rev 121) +++ openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-07-25 23:58:18 UTC (rev 122) @@ -204,7 +204,13 @@ protected JButton createShowHideTreeButton() { JButton tJButton = createToolBarButton("TogglePane.gif", "Show/Hide Tree (Ctrl T)"); tJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) {mOpenPCLViewer.actionShowHideTree();} + public void actionPerformed(ActionEvent e) { + if ((e.getModifiers() & ActionEvent.CTRL_MASK) > 1) { + mOpenPCLViewer.actionShowHideTree(true); + } else { + mOpenPCLViewer.actionShowHideTree(false); + } + } }); return tJButton; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-21 20:22:38
|
Revision: 158 http://openpcl.svn.sourceforge.net/openpcl/?rev=158&view=rev Author: documentsystems Date: 2007-08-21 13:22:41 -0700 (Tue, 21 Aug 2007) Log Message: ----------- Howard Hoagland. Changed 5 classes that are for showing the drop down JLists when the user clicks toolbar buttons for Print, Change the Look, Window layout and selection, Help About and License. The code changes set the PosToolbarDropdownItemRenderer on the JLists that to changes the background color on JLabels in JLists by which one the mouse is hovering over, which was set in PosHoverColorMouseMotionAdapter that was added to the JLists, so the user has visual confirmation of which item in the drop down will be seleced if clicked there. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/panels/PosChangeTheLookList.java openpcl/src/com/openpcl/viewer/panels/PosHelpChoicesList.java openpcl/src/com/openpcl/viewer/panels/PosPrintChoicesList.java openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java openpcl/src/com/openpcl/viewer/util/PosPickAppLook.java Modified: openpcl/src/com/openpcl/viewer/panels/PosChangeTheLookList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosChangeTheLookList.java 2007-08-21 20:14:39 UTC (rev 157) +++ openpcl/src/com/openpcl/viewer/panels/PosChangeTheLookList.java 2007-08-21 20:22:41 UTC (rev 158) @@ -5,13 +5,17 @@ import java.awt.Dimension; import javax.swing.BorderFactory; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; import javax.swing.event.ListSelectionListener; +import com.openpcl.viewer.util.PosHoverColorMouseMotionAdapter; import com.openpcl.viewer.util.PosPickAppLook; +import com.openpcl.viewer.util.PosToolbarDropdownItemRenderer; public class PosChangeTheLookList extends JPanel { private static final long serialVersionUID = 1L; @@ -28,9 +32,11 @@ private void buildUI() { mLookJList = new JList(mPickAppLook.getLookChoicesArray()); + mLookJList.setCellRenderer(new PosToolbarDropdownItemRenderer()); mLookJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (mListSelectionListener != null) {mLookJList.addListSelectionListener(mListSelectionListener);} - + mLookJList.addMouseMotionListener(new PosHoverColorMouseMotionAdapter(mLookJList)); + mJScrollPane = new JScrollPane(mLookJList); mJScrollPane.setBorder(BorderFactory.createLineBorder(Color.BLUE)); mJScrollPane.setPreferredSize(new Dimension(240, 116)); // was (250,200) using JGoodies Looks @@ -41,5 +47,14 @@ } public int getSelectedIndex() {return mLookJList.getSelectedIndex();} - public void unSelectRows() { mLookJList.clearSelection(); } + + public void unSelectRows() { + mLookJList.clearSelection(); + int tSize = mLookJList.getModel().getSize(); + for (int i = 0; i < tSize; i++) { + // Set vertical alignment of the JLabel in the JList to Center because Top is a doing double duty trick for changing + // the hover over background color in the PosToolbarDropdownItemRenderer + ((JLabel)mLookJList.getModel().getElementAt((i))).setVerticalAlignment(SwingConstants.CENTER); + } + } } Modified: openpcl/src/com/openpcl/viewer/panels/PosHelpChoicesList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosHelpChoicesList.java 2007-08-21 20:14:39 UTC (rev 157) +++ openpcl/src/com/openpcl/viewer/panels/PosHelpChoicesList.java 2007-08-21 20:22:41 UTC (rev 158) @@ -14,29 +14,29 @@ import javax.swing.SwingConstants; import javax.swing.event.ListSelectionListener; +import com.openpcl.viewer.util.PosHoverColorMouseMotionAdapter; +import com.openpcl.viewer.util.PosToolbarDropdownItemRenderer; + public class PosHelpChoicesList extends JPanel { private static final long serialVersionUID = 1L; protected JList mHelpChoicesJList = null; protected JScrollPane mJScrollPane = null; protected ListSelectionListener mListSelectionListener = null; - protected Vector<String> mChoicesStrings = new Vector<String>(2); protected Vector<JLabel> mChoicesVector = new Vector<JLabel>(2); public PosHelpChoicesList(ListSelectionListener pListSelectionListener, String pAppName) { mListSelectionListener = pListSelectionListener; - mChoicesStrings.add("Show License Info"); - mChoicesStrings.add("About " + pAppName); + mChoicesVector.add(new JLabel("Show License Info", SwingConstants.LEFT)); + mChoicesVector.add(new JLabel("About " + pAppName, SwingConstants.LEFT)); buildUI(); } private void buildUI() { - for (String tEachString : mChoicesStrings) { - mChoicesVector.add(new JLabel(tEachString, SwingConstants.LEFT)); - } - - mHelpChoicesJList = new JList(mChoicesStrings); + mHelpChoicesJList = new JList(mChoicesVector); + mHelpChoicesJList.setCellRenderer(new PosToolbarDropdownItemRenderer()); mHelpChoicesJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); if (mListSelectionListener != null) {mHelpChoicesJList.addListSelectionListener(mListSelectionListener);} + mHelpChoicesJList.addMouseMotionListener(new PosHoverColorMouseMotionAdapter(mHelpChoicesJList)); mJScrollPane = new JScrollPane(); mJScrollPane.setBorder(BorderFactory.createLineBorder(Color.BLUE)); @@ -57,13 +57,21 @@ int tHeightOfItem = ((JLabel)(mChoicesVector.elementAt(0))).getPreferredSize().height + 2; setPreferredSize(new Dimension((tBorderAdjustment + tWidestPixelWidth), - tBorderAdjustment + (mChoicesStrings.size() * tHeightOfItem))); + tBorderAdjustment + (mChoicesVector.size() * tHeightOfItem))); setLayout(new BorderLayout()); add(mJScrollPane, BorderLayout.CENTER); } public int getSelectedIndex() { return mHelpChoicesJList.getSelectedIndex(); } - public void unSelectRows() { mHelpChoicesJList.clearSelection(); } + public void unSelectRows() { + mHelpChoicesJList.clearSelection(); + int tSize = mHelpChoicesJList.getModel().getSize(); + for (int i = 0; i < tSize; i++) { + // Set vertical alignment of the JLabel in the JList to Center because Top is a doing double duty trick for changing + // the hover over background color in the PosToolbarDropdownItemRenderer + ((JLabel)mHelpChoicesJList.getModel().getElementAt((i))).setVerticalAlignment(SwingConstants.CENTER); + } + } } Modified: openpcl/src/com/openpcl/viewer/panels/PosPrintChoicesList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosPrintChoicesList.java 2007-08-21 20:14:39 UTC (rev 157) +++ openpcl/src/com/openpcl/viewer/panels/PosPrintChoicesList.java 2007-08-21 20:22:41 UTC (rev 158) @@ -3,30 +3,42 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.util.Vector; import javax.swing.BorderFactory; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; import javax.swing.event.ListSelectionListener; +import com.openpcl.viewer.util.PosHoverColorMouseMotionAdapter; +import com.openpcl.viewer.util.PosToolbarDropdownItemRenderer; + public class PosPrintChoicesList extends JPanel { private static final long serialVersionUID = 1L; protected JList mPrintChoicesJList = null; protected JScrollPane mJScrollPane = null; protected ListSelectionListener mListSelectionListener = null; - protected String[] mPrintChoices = {"Print All", "Print Selected", "Print Remaining", "Print Changed"}; + protected Vector<JLabel> mPrintChoicesVector = new Vector<JLabel> (4); public PosPrintChoicesList(ListSelectionListener pListSelectionListener) { mListSelectionListener = pListSelectionListener; + mPrintChoicesVector.add(new JLabel("Print All", SwingConstants.LEFT)); + mPrintChoicesVector.add(new JLabel("Print Selected", SwingConstants.LEFT)); + mPrintChoicesVector.add(new JLabel("Print Remaining", SwingConstants.LEFT)); + mPrintChoicesVector.add(new JLabel("Print Changed", SwingConstants.LEFT)); buildUI(); } private void buildUI() { - mPrintChoicesJList = new JList(mPrintChoices); + mPrintChoicesJList = new JList(mPrintChoicesVector); + mPrintChoicesJList.setCellRenderer(new PosToolbarDropdownItemRenderer()); mPrintChoicesJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - if (mListSelectionListener != null) {mPrintChoicesJList.addListSelectionListener(mListSelectionListener);} + if (mListSelectionListener != null) { mPrintChoicesJList.addListSelectionListener(mListSelectionListener); } + mPrintChoicesJList.addMouseMotionListener(new PosHoverColorMouseMotionAdapter(mPrintChoicesJList)); mJScrollPane = new JScrollPane(mPrintChoicesJList); mJScrollPane.setBorder(BorderFactory.createLineBorder(Color.BLUE)); @@ -38,5 +50,13 @@ } public int getSelectedIndex() { return mPrintChoicesJList.getSelectedIndex(); } - public void unSelectRows() { mPrintChoicesJList.clearSelection(); } + public void unSelectRows() { + mPrintChoicesJList.clearSelection(); + int tSize = mPrintChoicesJList.getModel().getSize(); + for (int i = 0; i < tSize; i++) { + // Set vertical alignment of the JLabel in the JList to Center because Top is a doing double duty trick for changing + // the hover over background color in the PosToolbarDropdownItemRenderer + ((JLabel)mPrintChoicesJList.getModel().getElementAt((i))).setVerticalAlignment(SwingConstants.CENTER); + } + } } Modified: openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-08-21 20:14:39 UTC (rev 157) +++ openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-08-21 20:22:41 UTC (rev 158) @@ -15,6 +15,7 @@ import javax.swing.SwingConstants; import javax.swing.event.ListSelectionListener; +import com.openpcl.viewer.util.PosHoverColorMouseMotionAdapter; import com.openpcl.viewer.util.PosReadImageIcon; import com.openpcl.viewer.util.PosToolbarDropdownItemRenderer; @@ -50,6 +51,7 @@ mBaseVector.add(new JLabel("Tile Horizontal", mTileHorizontalIcon, SwingConstants.LEFT)); mBaseVector.add(new JLabel("Tile Vertical", mTileVerticalIcon, SwingConstants.LEFT)); mBaseVector.add(new JLabel("Cascade", mCascadeIcon, SwingConstants.LEFT)); + mBaseVector.add(new JLabel("<html>___________</html>", null, SwingConstants.LEFT)); mJScrollPane = new JScrollPane(); mJScrollPane.setBorder(BorderFactory.createLineBorder(Color.BLUE)); setLayout(new BorderLayout()); @@ -58,13 +60,21 @@ } public Object getSelectedValue() { return mWindowControlJList.getSelectedValue(); } - public void unSelectRows() { mWindowControlJList.clearSelection(); } + public void unSelectRows() { + mWindowControlJList.clearSelection(); + for (int i = 0; i < 4; i++) { + // Set vertical alignment of the JLabel in the JList to Center because Top is a doing double duty trick for changing + // the hover over background color in the PosToolbarDropdownItemRenderer + ((JLabel)mWindowControlJList.getModel().getElementAt((i))).setVerticalAlignment(SwingConstants.CENTER); + } + } + public void putViewsInWindowDropdown(Vector<JLabel> pVector, int pCurrentViewNumber) { if (pVector == null || pVector.size() < 1) { - mChoicesVector = new Vector<JLabel>(3); + mChoicesVector = new Vector<JLabel>(4); } else { - mChoicesVector = new Vector<JLabel>(pVector.size() + 3); + mChoicesVector = new Vector<JLabel>(pVector.size() + 4); } // Add the Tile Horizontal, Tile Vertical, Cascade @@ -76,7 +86,7 @@ if (pCurrentViewNumber == getViewNumberFromString(eachJLabel.getText())) { eachJLabel.setIcon(mWindowSelectedIcon); // This view is the currently selected one, so make it's icon be a check mark } else { - eachJLabel.setIcon(mWindowUnselectedIcon); // Not the currently selected view, so make its icon be a little dot + eachJLabel.setIcon(mWindowUnselectedIcon); // Not the currently selected view, so make its icon be the unselected window } // Add this JLabel to see on the screen in the Window control dropdown @@ -98,6 +108,7 @@ if (mListSelectionListener != null) {mWindowControlJList.addListSelectionListener(mListSelectionListener);} mWindowControlJList.setCellRenderer(new PosToolbarDropdownItemRenderer()); mWindowControlJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + mWindowControlJList.addMouseMotionListener(new PosHoverColorMouseMotionAdapter(mWindowControlJList)); // Put the JList in the JScrollPane mJScrollPane.setViewportView(mWindowControlJList); @@ -116,7 +127,7 @@ /** Parse the String that looks like "View# 1. filename.ext" to the int which is the view number */ public int getViewNumberClicked() { int tRowClicked = mWindowControlJList.getSelectedIndex(); - if ( tRowClicked > 2) { + if ( tRowClicked > 3) { JLabel tSelectedJLabel = (JLabel)mWindowControlJList.getModel().getElementAt(tRowClicked); if (tSelectedJLabel != null) { String tSelectedRowString = tSelectedJLabel.getText(); Modified: openpcl/src/com/openpcl/viewer/util/PosPickAppLook.java =================================================================== --- openpcl/src/com/openpcl/viewer/util/PosPickAppLook.java 2007-08-21 20:14:39 UTC (rev 157) +++ openpcl/src/com/openpcl/viewer/util/PosPickAppLook.java 2007-08-21 20:22:41 UTC (rev 158) @@ -1,5 +1,6 @@ package com.openpcl.viewer.util; +import javax.swing.JLabel; import javax.swing.LookAndFeel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; @@ -12,7 +13,7 @@ import com.openpcl.viewer.OpenPCLViewer; /** - * JComboBox choices for the user to change the LookAndFeel at run time while using the UI + * Choices for the user to change the LookAndFeel at run time while using the UI * @author howard 9/14/06 */ public class PosPickAppLook { @@ -23,13 +24,13 @@ // and added the below in place of the JGoodies Looks ExperienceBlue() private DefaultMetalTheme mMetalNonOceanTheme = new DefaultMetalTheme(); - private String[] mLookChoicesArray = { - "Look: Client JVM Startup Default", - "Look: Client Native System", - "Look: Windows XP (SunJava)", - "Look: Windows Classic (SunJava)", - "Look: Metal OceanTheme (Javax)", - "Look: Metal Non OceanTheme (Javax)" + private JLabel[] mLookChoicesArray = { + new JLabel("Look: Client JVM Startup Default"), + new JLabel("Look: Client Native System"), + new JLabel("Look: Windows XP (SunJava)"), + new JLabel("Look: Windows Classic (SunJava)"), + new JLabel("Look: Metal OceanTheme (Javax)"), + new JLabel("Look: Metal Non OceanTheme (Javax)") }; /* JGoodies Looks Commented out 11/17/06 HowardH. @@ -94,7 +95,7 @@ mLookArray[5] = null; // was 9 using JGoodies Looks } - public String[] getLookChoicesArray() { return mLookChoicesArray; } + public JLabel[] getLookChoicesArray() { return mLookChoicesArray; } public LookAndFeel[] getLookArray() { return mLookArray; } public void changeLookListSelection(int pItemIndex) { 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-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-09-14 00:17:28
|
Revision: 170 http://openpcl.svn.sourceforge.net/openpcl/?rev=170&view=rev Author: documentsystems Date: 2007-09-13 17:17:27 -0700 (Thu, 13 Sep 2007) Log Message: ----------- Howard Hoagland. I changed 4 classes (OpenPCLViewer, PosView, PosWindowControlList, PosStatusBar) to move the full file path and file name from the JInternalFrame title bar to a subpanel in the status bar. Since there is only one status bar for several possible open files, I added code to update the file path and file name in the status bar every time the user clicks to a differernt open file or uses the toolbar icon to switch views. Also I changed 3 classes (IOpenPCL, PosToolBar, OpenPCLViewer) to include a hidden feature to execute code to show hidden white text "Signer Tags" that are in the PCL bytes to view, and draw the hidden text in black instead of in white to show the hidden text on the screen, upon a Control-Click on the Options button in the toolbar. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java openpcl/src/com/openpcl/viewer/api/IOpenPCL.java openpcl/src/com/openpcl/viewer/panels/PosView.java openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-14 00:17:27 UTC (rev 170) @@ -1227,7 +1227,8 @@ mPosViewSelected = pPosView; double tZoomFactor = mPosViewSelected.getPosZoomLogic().getCurrentZoomFactor(); showZoomFactorOnToolbarButton(tZoomFactor); - PriDebug.releaseln(mPosViewSelected.getPageNameForTitleBar()); + mPosStatusBar.setFileNameText(mPosViewSelected.getFilePathAndFileName()); + PriDebug.releaseln(mPosViewSelected.getPageNameForTitleBar() + ", " + mPosViewSelected.getFilePathAndFileName()); } } @@ -1244,6 +1245,8 @@ // There is only one JInternalFrame showing now and when this one closes, then none will be showing // so write the JInternalFrame's (x,y) and (width, height) and last opened file to the local client platform savePersistedViewValues(pPosView.getJInternalFrame(), mPackagePreferences, mPosPersistViewValues); + mPosStatusBar.setFileNameText("File name"); + mPosStatusBar.setCursorPixelLocationText(""); mPosManageToolBar.setNoViewsOpen(); } } @@ -1330,7 +1333,7 @@ // Update the zoom slider and pass false to not allow recursive event screen updating mPosZoomSlider.setZoomSliderLocationFromZoomFactor(pZoomFactor, false); } - + /** Get the current view window width */ public int getCurrentViewWindowWidth() { if (mPosViewSelected != null && mPosViewSelected.getIsMultiPageParseFinished()) { @@ -1423,7 +1426,7 @@ public String getFormNameForTreeNode(PosTreeNode pPosTreeNode) { if (pPosTreeNode == null) { return null; } // Important: Subclasses that override this method will have more complex code than just the one line below. - return getPosViewSelected().getBaseNameOnJInternalFrameTitleBar() + ", " + pPosTreeNode.toString(); + return pPosTreeNode.toString() + ", " + getPosViewSelected().getFilePathAndFileName(); } /** Returns true if this tree node page must print on the front side (not on the back of a page) when duplexing. @@ -1454,7 +1457,7 @@ tErrorString = tPosView.getPclRenderImage().getLastRenderErrorString(); if (tErrorString != null) { return tErrorString ; } - tPosView.setBaseNameOnJInternalFrameTitleBar(pLongName); + tPosView.setFilePathAndFileName(pLongName); // Make sure max views hasn't been reached int tLowestIndex = findLowestIndexAvailableView(); @@ -2440,9 +2443,14 @@ } /** Show the Options dialog */ - public void actionShowOptionsDialog() { - mPosUserOptionsDialog.setLocationRelativeTo(getAppFrame()); - mPosUserOptionsDialog.setVisible(true); + public void actionShowOptionsDialog(boolean pControlKeyPressed) { + if (!pControlKeyPressed) { + mPosUserOptionsDialog.setLocationRelativeTo(getAppFrame()); + mPosUserOptionsDialog.setVisible(true); + } else { + // Hidden feature. If the Control key is pressed when clicking this button, then toggle show/hide to see white text + // by redrawing the text in black, only if the text starts with the specified text. Also draw a box around the now visible txt. + } } /** Toggle show/hide the help choices popup */ Modified: openpcl/src/com/openpcl/viewer/api/IOpenPCL.java =================================================================== --- openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/api/IOpenPCL.java 2007-09-14 00:17:27 UTC (rev 170) @@ -250,7 +250,7 @@ public void actionCascadeWindows(); /** Show the Options dialog */ - public void actionShowOptionsDialog(); + public void actionShowOptionsDialog(boolean pControlKeyPressed); /** Toggle show/hide the print choices popup */ public void actionShowHideHelpChoicesPopup(); Modified: openpcl/src/com/openpcl/viewer/panels/PosView.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/panels/PosView.java 2007-09-14 00:17:27 UTC (rev 170) @@ -55,7 +55,7 @@ private PosPrintPages mPosPrintPages =null; private PosBuildListOfPagesToPrint mPosBuildListOfPagesToPrint = null; private String mShortName = null; - private String mBaseNameOnJInternalFrameTitleBar = null; + private String mFilePathAndFileName = null; private String mChangingPartNameOnJInternalFrameTitleBar = null; private StringBuffer mToStringStringBuffer = null; private PosTreeNode mCurrentTreeNode = null; @@ -362,35 +362,24 @@ return PosView.sDefaultSplitterLocPclFiles; } - public String getBaseNameOnJInternalFrameTitleBar() { return mBaseNameOnJInternalFrameTitleBar; } - - public void setBaseNameOnJInternalFrameTitleBar(String pBaseNameOnJInternalFrameTitleBar) { - mBaseNameOnJInternalFrameTitleBar = pBaseNameOnJInternalFrameTitleBar; - } + public String getFilePathAndFileName() { return mFilePathAndFileName; } + public void setFilePathAndFileName(String pFilePathAndFileName) { mFilePathAndFileName = pFilePathAndFileName; } public String toString() { mToStringStringBuffer = new StringBuffer(100); - mToStringStringBuffer.append("View #" + mViewNumber + "."); + mToStringStringBuffer.append("View #" + mViewNumber); if (mShortName != null && mShortName.length() > 0) { - mToStringStringBuffer.append(" " + mShortName); + mToStringStringBuffer.append(", " + mShortName); } return mToStringStringBuffer.toString(); } public String getPageNameForTitleBar() { mToStringStringBuffer = new StringBuffer(100); - if (mOpenPCLViewer.getPosStartupOptions().getShowFileNameOnViewTitleBar()) { - mToStringStringBuffer.append("View #" + mViewNumber + "."); - if (mBaseNameOnJInternalFrameTitleBar != null && mBaseNameOnJInternalFrameTitleBar.length() > 0) { - mToStringStringBuffer.append(" " + mBaseNameOnJInternalFrameTitleBar); - } - } + mToStringStringBuffer.append("View #" + mViewNumber); if (mChangingPartNameOnJInternalFrameTitleBar != null && mChangingPartNameOnJInternalFrameTitleBar.length() > 0) { - if (mOpenPCLViewer.getPosStartupOptions().getShowFileNameOnViewTitleBar()) { - mToStringStringBuffer.append(", "); - } - mToStringStringBuffer.append(mChangingPartNameOnJInternalFrameTitleBar); + mToStringStringBuffer.append(", " + mChangingPartNameOnJInternalFrameTitleBar); } return mToStringStringBuffer.toString(); } Modified: openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java =================================================================== --- openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/panels/PosWindowControlList.java 2007-09-14 00:17:27 UTC (rev 170) @@ -141,16 +141,16 @@ return -1; } - /* Parse the String that looks like "View# 1. filename.ext" to the int which is the view number */ + /* Parse the String that looks like "View# 1, filename.ext" to the int which is the view number */ private int getViewNumberFromString(String pViewString) { if (pViewString == null) { return -1; } // if null passed then return -1 meaning view number not found int tLocOfPoundsign = pViewString.indexOf("#"); // Find the # in the string if (tLocOfPoundsign >= 0) { - int tLocOfPeriod = pViewString.indexOf(".", tLocOfPoundsign); // Find the . after the # - if (tLocOfPeriod >= 0) { + int tLocEnd = pViewString.indexOf(",", tLocOfPoundsign); // Find the , after the # + if (tLocEnd >= 0) { // Pull out the substring that is only the view number - String tViewNumberString = pViewString.substring( tLocOfPoundsign + 1, tLocOfPeriod); + String tViewNumberString = pViewString.substring( tLocOfPoundsign + 1, tLocEnd); try { int tViewNumber = Integer.parseInt(tViewNumberString); // Convert to int if (tViewNumber > 0) { Modified: openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/statusbar/PosStatusBar.java 2007-09-14 00:17:27 UTC (rev 170) @@ -21,12 +21,14 @@ // Panels private JPanel mStatusBarMsgsJPanel = null; private JPanel mZoomSliderJPanel = null; + private JPanel mOnScreenZoomSliderJPanel = new JPanel(); + private JPanel mFileNameJPanel = null; private JPanel mCursorPixelLocationJPanel = null; - private JPanel mOnScreenZoomSliderJPanel = new JPanel(); // Text labels private JLabel mStatusTextLineJLabel = null; private JLabel mCursorLocationJLabel = null; + private JLabel mFileNameJLabel = null; // TableLayout private double mTloPref = TableLayout.PREFERRED; @@ -52,16 +54,27 @@ // One liner getters public String getStatusBarText() { return mStatusTextLineJLabel.getText(); } + public String getFileNameJLabelText() { return mFileNameJLabel.getText(); } public String getCursorPixelLocationText() { return mCursorLocationJLabel.getText(); } public JPanel getOnScreenZoomSliderJPanel() { return mOnScreenZoomSliderJPanel; } // One liner setters public void setStatusBarText(String pText) { mStatusTextLineJLabel.setText(pText); } - public void setCursorPixelLocationText(String pText) { mCursorLocationJLabel.setText(pText); } + public void setFileNameJLabel(String pText) { mFileNameJLabel.setText(pText); } + + public void setCursorPixelLocationText(String pText) { + mCursorLocationJLabel.setText(pText); + adjustCursorPixelLocationPanelSize(); + } public void setDefaultStatusBarMsg() { mStatusTextLineJLabel.setText(""); } + + public void setFileNameText(String pFileNameString) { + setFileNameJLabel(pFileNameString); + adjustFileNamePanelSize(); + } public void setMouseMoveLocation(int pViewNum, int pXPixel, int pYPixel, double pXInches, double pYInches) { String tPixelLocationString = "View #" + pViewNum + ". " + @@ -75,7 +88,8 @@ private void buildUI() { mStatusTextLineJLabel = new JLabel(""); setDefaultStatusBarMsg(); - + + mFileNameJLabel = new JLabel("File name"); mCursorLocationJLabel = new JLabel(""); mStatusBarMsgsJPanel = makeStatusLineMsgsPanel(); @@ -84,23 +98,29 @@ } mCursorPixelLocationJPanel = makeCursorPixelLocationPanel(); + mFileNameJPanel = makeFileNamePanel(); TableLayout tloLayout = null; - double tloGridSpecWithZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref}, {mTloFill }}; - double tloGridSpecWithoutZoomPanel[][] = new double[][] {{mTloFill, mTloPref}, {mTloFill }}; + double tloGridSpecWithZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref, mTloPref}, {mTloFill }}; + double tloGridSpecWithoutZoomPanel[][] = new double[][] {{mTloFill, mTloPref, mTloPref}, {mTloFill }}; if (mWantZoomSliderPanel) { tloLayout = new TableLayout(tloGridSpecWithZoomPanel); setLayout(tloLayout); add("0,0", mStatusBarMsgsJPanel); add("1,0", mZoomSliderJPanel); - add("2,0", mCursorPixelLocationJPanel); + add("2,0", mFileNameJPanel); + add("3,0", mCursorPixelLocationJPanel); } else { tloLayout = new TableLayout(tloGridSpecWithoutZoomPanel); setLayout(tloLayout); add("0,0", mStatusBarMsgsJPanel); - add("1,0", mCursorPixelLocationJPanel); + add("1,0", mFileNameJPanel); + add("2,0", mCursorPixelLocationJPanel); } + + adjustFileNamePanelSize(); + adjustCursorPixelLocationPanelSize(); } private JPanel makeStatusLineMsgsPanel() { @@ -122,11 +142,21 @@ panel.add("0,0", mOnScreenZoomSliderJPanel); return panel; } + + private JPanel makeFileNamePanel() { + JPanel panel = new JPanel(); + setStatusBarSectionAttributes(panel); + double tloGridSpec[][] = new double[][] {{mTloPref}, {mTloPref }}; + TableLayout tloLayout = new TableLayout(tloGridSpec); + panel.setLayout(tloLayout); + panel.add("0,0", mFileNameJLabel); + return panel; + } + private JPanel makeCursorPixelLocationPanel() { JPanel panel = new JPanel(); setStatusBarSectionAttributes(panel); - adjustCursorPixelLocationPanelSize(); double tloGridSpec[][] = new double[][] {{mTloPref}, {mTloPref }}; TableLayout tloLayout = new TableLayout(tloGridSpec); panel.setLayout(tloLayout); @@ -143,12 +173,23 @@ BorderFactory.createEmptyBorder(1, 2, 0, 2))); } + private void adjustFileNamePanelSize() { + Font tJLabelFont = mFileNameJLabel.getFont(); + FontMetrics tJLabelFontMetrics = mFileNameJLabel.getFontMetrics(tJLabelFont); + mCursorLocationJLabel.setPreferredSize(new Dimension( + tJLabelFontMetrics.stringWidth(mFileNameJLabel.getText()), tJLabelFontMetrics.getHeight())); + } + public void adjustCursorPixelLocationPanelSize() { Font tJLabelFont = mCursorLocationJLabel.getFont(); FontMetrics tJLabelFontMetrics = mCursorLocationJLabel.getFontMetrics(tJLabelFont); - mCalculatedMaxWidthOfMouseLocationString = tJLabelFontMetrics.stringWidth( - "View #9. 9.99 x 99.99 inches (9999,9999)"); - mCursorLocationJLabel.setPreferredSize( - new Dimension(mCalculatedMaxWidthOfMouseLocationString, tJLabelFontMetrics.getHeight())); + if (mCursorLocationJLabel.getText().length() < 1) { + mCursorLocationJLabel.setPreferredSize(new Dimension(20, tJLabelFontMetrics.getHeight())); + } else { + mCalculatedMaxWidthOfMouseLocationString = tJLabelFontMetrics.stringWidth( + "View #9. 9.99 x 99.99 inches (9999,9999)"); + mCursorLocationJLabel.setPreferredSize( + new Dimension(mCalculatedMaxWidthOfMouseLocationString, tJLabelFontMetrics.getHeight())); + } } } Modified: openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java =================================================================== --- openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-09-12 21:48:54 UTC (rev 169) +++ openpcl/src/com/openpcl/viewer/toolbar/PosToolBar.java 2007-09-14 00:17:27 UTC (rev 170) @@ -274,7 +274,13 @@ protected JButton createOptionsButton() { JButton tJButton = createToolBarButton("V221Options.png", "Options"); tJButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) {mOpenPCLViewer.actionShowOptionsDialog();} + public void actionPerformed(ActionEvent e) { + if ((e.getModifiers() & ActionEvent.CTRL_MASK) > 1) { + mOpenPCLViewer.actionShowOptionsDialog(true); + } else { + mOpenPCLViewer.actionShowOptionsDialog(false); + } + } }); return tJButton; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |