From: <doc...@us...> - 2007-07-16 21:46:39
|
Revision: 108 http://openpcl.svn.sourceforge.net/openpcl/?rev=108&view=rev Author: documentsystems Date: 2007-07-16 14:46:41 -0700 (Mon, 16 Jul 2007) Log Message: ----------- Howard Hoagland. Added more PrintRequestAttributeSet items Chromaticity, PrinterResolution. Changed PrintQuallity from HIGH to DRAFT. When printing the force legal size image on letter paper, the left edge was missing vertical lines, so changed MediaPrintableArea from (0.2f, 0.2f, 8.1f 13.6f) to (0.18f, 0.18f, 8.14f, 13.64f). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-16 21:39:24 UTC (rev 107) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-16 21:46:41 UTC (rev 108) @@ -27,12 +27,16 @@ import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.ResolutionSyntax; import javax.print.attribute.Size2DSyntax; +import javax.print.attribute.standard.Chromaticity; +import javax.print.attribute.standard.JobKOctets; 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.PrinterResolution; import javax.print.attribute.standard.Sides; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -658,11 +662,14 @@ // 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(PrintQuality.DRAFT); // (before this was "HIGH") mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); mPrintRequestAttributeSet.add(Sides.ONE_SIDED); + mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME); + mPrintRequestAttributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI)); + mPrintRequestAttributeSet.add(new JobKOctets((int)(1.3 * 1024))); // each page is 1.3 MB mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); - mPrintRequestAttributeSet.add(new MediaPrintableArea(0.20f, 0.20f, 8.1f, 13.6f, MediaPrintableArea.INCH)); + mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH)); // Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-25 19:14:14
|
Revision: 116 http://openpcl.svn.sourceforge.net/openpcl/?rev=116&view=rev Author: documentsystems Date: 2007-07-25 12:14:16 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer, added getFormNameForTreeNode() to implement "Print Form Names" on the print setup dialog. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-24 20:25:46 UTC (rev 115) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-25 19:14:16 UTC (rev 116) @@ -1307,6 +1307,14 @@ return getPclBytesForPage(pPosTreeNode.getNodeNumber()); } + /** Get the Form Name for a tree node page. Used for both print "PCL Direct" and for "Windows Print". + * Subclass plugins override this method so do not delete or rename this method. */ + 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(); + } + /** Create a new view panel * Subclass plugins override this method so do not delete or rename this method. */ public PosView createNewViewPanel(String pShortName) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-26 18:24:20
|
Revision: 127 http://openpcl.svn.sourceforge.net/openpcl/?rev=127&view=rev Author: documentsystems Date: 2007-07-26 11:24:22 -0700 (Thu, 26 Jul 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer in the methods renderImageForPrintingFromPageNumber() and getImageForPage(), added the parameter byte[] pPrintTimePclBytes and code in the methods to implement the "Print Form Names" for Windows Print (PCL Direct print was already implemented previously). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-26 18:20:14 UTC (rev 126) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-26 18:24:22 UTC (rev 127) @@ -1513,7 +1513,7 @@ // Get the image for the one selected Pcl page in the currently selected PosView its current zoom factor double tZoomFactor = mPosViewSelected.getPosZoomLogic().getCurrentZoomFactor(); - BufferedImage tBufferedImage = getImageForPage(tPageNumber, false, tPaperSize, tZoomFactor); + BufferedImage tBufferedImage = getImageForPage(tPageNumber, null, false, tPaperSize, tZoomFactor); PriDebug.infoln("OpenPCLViewer> returned from getImageForPage(tPageNumber, false, tPaperSize, tZoomFactor)"); // Pass the returned BufferedImage from above here to put it on the screen. @@ -1544,18 +1544,20 @@ public BufferedImage renderImageForPrintingFromTreeNode(PosTreeNode pPosTreeNode) { if (pPosTreeNode == null) { return null; } - // Pass only the page number of the tree node to PclRenderImage to render the BufferedImage. - // Important: Subclasses that override this method will have more complex code than just the one line below, - // so that's why there is only this one line is in this one method, so this method can be overridden in subclasses. - BufferedImage tBufferedImage = renderImageForPrintingFromPageNumber(pPosTreeNode.getNodeNumber()); + // Pass the page number of the tree node and the print time only additional PCL bytes to draw + // to PclRenderImage to render the BufferedImage. + // Important: Subclasses that override this method will have more complex code than just the below. + BufferedImage tBufferedImage = renderImageForPrintingFromPageNumber( + pPosTreeNode.getNodeNumber(), pPosTreeNode.getPrintTimePclBytes()); + return tBufferedImage; } - /** Render the BufferedImage from the page number. */ - public BufferedImage renderImageForPrintingFromPageNumber(int pPageNumber) { + /** Render the BufferedImage from the page number and the print time only additional PCL bytes to draw */ + public BufferedImage renderImageForPrintingFromPageNumber(int pPageNumber, byte[] pPrintTimePclBytes) { String tPaperSize = getPaperSizeForPage(pPageNumber); // Get the image for the one selected Pcl page in the currently selected PosView its current zoom factor - BufferedImage tBufferedImage = getImageForPage(pPageNumber, true, tPaperSize, 1.0d); + BufferedImage tBufferedImage = getImageForPage(pPageNumber, pPrintTimePclBytes, true, tPaperSize, 1.0d); return tBufferedImage; } @@ -1612,18 +1614,21 @@ * In DocMaster, this is getImage(). * * @param pPageNumber. The Pcl page number to render to the image. + * @param pPrintTimePclBytes. Draw these additional PCL bytes on the print image. * @param pIsForPrinting. If true non printing items like signature blocks won't be rendered. * @param pPaperSize. If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL". * @param pZoomFactor. This is mandatory (see note for why). - * @return returnserror String from PclRenderImage.getLastErrorString() + * @return BufferedImage. If null, then get the return String from PclRenderImage.getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { + public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { if (mPosViewSelected != null) { PriDebug.infoln("OpenPCLViewer> getImageForPage(page=" + pPageNumber + ", boolean printing=" + pIsForPrinting + "String paperSize=" + pPaperSize + ", double zoom=" + pZoomFactor + ")"); - return mPosViewSelected.getPclRenderImage().getImageForPage( - pPageNumber, pIsForPrinting, pPaperSize, pZoomFactor); + return mPosViewSelected.getPclRenderImage().getImageForPage(pPageNumber, pPrintTimePclBytes, + pIsForPrinting, pPaperSize, pZoomFactor); + } else { return null; } @@ -1676,7 +1681,7 @@ * Convenience method that calls PclRenderImage.getBufferedImageToDrawOn(). * Get the BufferedImage to draw on for purposes of an external app can call methods on the * BufferedImage object so the external app can directly draw on the image if wanted. - * @return BufferedImage or if error returns null in which case call getLastErrorString() + * @return BufferedImage. If null, then get the return String from PclRenderImage.getLastErrorString() */ public BufferedImage getBufferedImageToDrawOn() { if (mPosViewSelected != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-07-30 22:16:12
|
Revision: 133 http://openpcl.svn.sourceforge.net/openpcl/?rev=133&view=rev Author: documentsystems Date: 2007-07-30 15:16:14 -0700 (Mon, 30 Jul 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer, added method forceFrontSideWhenDuplexing() to return true if tree node page must print on the front side (not on the back of a page) when duplexing. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-30 22:15:01 UTC (rev 132) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-30 22:16:14 UTC (rev 133) @@ -1315,6 +1315,12 @@ return getPosViewSelected().getBaseNameOnJInternalFrameTitleBar() + ", " + pPosTreeNode.toString(); } + /** Returns true if this tree node page must print on the front side (not on the back of a page) when duplexing. + * Subclass plugins override this method so do not delete or rename this method. */ + public boolean forceFrontSideWhenDuplexing(PosTreeNode pPosTreeNode) { + return false; + } + /** Create a new view panel * Subclass plugins override this method so do not delete or rename this method. */ public PosView createNewViewPanel(String pShortName) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-02 18:31:09
|
Revision: 135 http://openpcl.svn.sourceforge.net/openpcl/?rev=135&view=rev Author: documentsystems Date: 2007-08-02 11:26:07 -0700 (Thu, 02 Aug 2007) Log Message: ----------- Howard Hoagland. Changed release mode msg to be a debug mode msg in the catch block in actionCascadeWindows() that shows at program startup time when no view frame has been opened yet, so that users won't see it in the Java Console window and call tech support to report a run time error that isn't a problem but users will think it is. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-07-30 22:20:21 UTC (rev 134) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-02 18:26:07 UTC (rev 135) @@ -2324,7 +2324,7 @@ try { mPosMdiDesktopPane.cascadeFrames(); } catch (NullPointerException e) { - PriDebug.releaseln("Trapped NPE exception upon file open due to first time using program."); + PriDebug.info("View frame arrangement."); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-06 17:51:15
|
Revision: 143 http://openpcl.svn.sourceforge.net/openpcl/?rev=143&view=rev Author: documentsystems Date: 2007-08-06 10:51:17 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Howard Hoagland. In OpenPCLViewer, at program startup time, and at program exit time, using the new class PosPersistPrintOptionsValues, read and write all the print setup dialog options the user clicked on (Use Windows Print or print PCL Direct, Print as displayed, Legal first then Letter, Letter first then Legal, All on Legal, All on Letter (shrinks Legal), Print Form Names, Duplex), to the local persisted storage using the java.util.prefs.Preferences in a platform independent way. For Windows, it will write to the Registry at "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\openpcl\viewer". For Macintosh, the Preferences object in the local running JVM writes the settings in a Macintosh specific way. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-06 17:43:28 UTC (rev 142) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-06 17:51:17 UTC (rev 143) @@ -76,6 +76,7 @@ import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.panels.PosWindowControlList; import com.openpcl.viewer.panels.PosZoomSlider; +import com.openpcl.viewer.printing.PosPersistPrintOptionsValues; import com.openpcl.viewer.printing.PosPrintPages; import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; import com.openpcl.viewer.statusbar.PosStatusBar; @@ -187,6 +188,7 @@ private String mFilePathAndFileName = "C:\\"; private Preferences mPackagePreferences = null; private PosPersistViewValues mPosPersistViewValues = null; + private PosPersistPrintOptionsValues mPosPersistPrintOptionsValues = null; private PosStartupOptions mPosStartupOptions = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; private PrintRequestAttributeSet mPrintRequestAttributeSet = null; @@ -198,7 +200,6 @@ public static final int sMinIndexImages = 1; public static final int sMaxNumImages = 9; public static final double sDefaultZoomFactor = 0.3d; - private int mCurrentViewIndex = sMinIndexImages; private PosView mPosViewSelected = null; private PosView[] mPosViewArray = new PosView[sMaxNumImages + 1]; private String mPackagePathLicenseInfo = "com/openpcl/viewer/htmlfiles/LicenseInfo.html"; @@ -568,17 +569,28 @@ showStatusBar(); // Show the status bar now so the user doesn't have to wait longer while the rest of the items are built validate(); + // Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later + buildPopupDialogs(); - // Read the last one closed before exited last time JInternalFrame (x,y) and (width,height) and last opened file directory - if (mCanWriteToLocalClient) { readPersistedViewValues(); } + // Get a Preferences object that is platform independent. The running JVM will store these values to the user's + // PC or Macintish in a platform specific way. For Windows, the values are written to the Windows registry at: + // "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\com\openpcl\viewer" + // For Macintosh, the JVM on the Macintosh will write the Preferences object's values in a Macintosh platform specific way. + mPackagePreferences = Preferences.userNodeForPackage(OpenPCLViewer.class); + + // Read the (x,y) and (width,height) and last opened file directory, of the last JInternalFrame closed before exiting last time + // from local persisted storage + readPersistedViewValues(mPackagePreferences); + // Read all the print setup dialog options from local persisted storage into the PosPrintSetupDialogChoices object + // that the print setup dialog has a reference to + readPrintOptionsValues(mPackagePreferences, mPosPrintSetupDialogChoices); + // Build the MDI Desktop Pane mPosMdiDesktopPane = buildPosMdiDesktopPane(); add(mPosMdiDesktopPane, BorderLayout.CENTER); // Need to force screen update to show the tree and image panel revalidate(); - // Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later - buildPopupDialogs(); mPosManageToolBar.setNoViewsOpen(); } @@ -739,21 +751,21 @@ } /** - * Read the persisted view frame's (x,y) location and (width,height), and window state (maximized/iconified) + * Read the locally persisted view frame's (x,y) location and (width,height), and window state (maximized/iconified) * and full path and filename of last file opened * @author howard 10/9/06 */ - protected void readPersistedViewValues() { + protected void readPersistedViewValues(Preferences pPrefs) { // If the JAR files are not signed, don't try to read from the client platform if ( !mCanWriteToLocalClient ) { return; } + // Must have a reference to the Preferences object + if (pPrefs == null) { return; } - // Read the persistent view settings from the platform independent Perferences class but the JVM will store - // these values to the user's PC registry for Windows at "HKEY_CURRENT_USER\Software\JavaSoft\Prefs" - mPackagePreferences = Preferences.userNodeForPackage(OpenPCLViewer.class); + // Read the persisted view settings from the platform independent Perferences class mPosPersistViewValues = new PosPersistViewValues(); - mPosPersistViewValues.readViewValues(mPackagePreferences); + mPosPersistViewValues.readViewValues(pPrefs); - // Get the persistent app settings for window (x,y) location and (width, height) and window state + // Get the persisted app settings for window (x,y) location and (width, height) and window state // to be able to show the app's JFrame in the same locating and width and window state as last time // the app was run mViewframeX = mPosPersistViewValues.getViewframeX(); @@ -765,20 +777,84 @@ } /** - * Save the persisted view frame's (x,y) location and (width,height), and window state (maximized/iconified) + * Read the locally persisted print setup dialog options + * @param pPrefs + * @param pPosPrintSetupDialogChoices + * @author DocMagic, Document Systems Inc, Howard H 8/3/07 + */ + protected void readPrintOptionsValues(Preferences pPrefs, PosPrintSetupDialogChoices pPosPrintSetupDialogChoices) { + // If the JAR files are not signed, don't try to read from the client platform + if ( !mCanWriteToLocalClient ) { return; } + // Must have a reference to the Preferences object and PosPrintSetupDialogChoices + if ( (pPrefs == null) || (pPosPrintSetupDialogChoices == null) ) { return; } + + // Read the persisted print options settings from the platform independent Perferences class + mPosPersistPrintOptionsValues = new PosPersistPrintOptionsValues(); + mPosPersistPrintOptionsValues.readPrintOptionsValues(pPrefs); + + // Windows Print or Pcl Direct + if (mPosPersistPrintOptionsValues.getPrintOptionsUseWindowsPrint().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPrintFormatIsWindowsPrint(); + } else if (mPosPersistPrintOptionsValues.getPrintOptionsPclDirect().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPrintFormatIsPclDirect(); + } + + // Paper size and print order + if (mPosPersistPrintOptionsValues.getPrintOptionsAsDisplayed().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPaperSizeAsDisplayedSelected(); + } else if (mPosPersistPrintOptionsValues.getPrintOptionsLegalThenLetter().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPaperSizeLegalFirstThenLetter(); + } else if (mPosPersistPrintOptionsValues.getPrintOptionsLetterThenLegal().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPaperSizeLetterFirstThenLegal(); + } else if (mPosPersistPrintOptionsValues.getPrintOptionsAllOnLegal().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPaperSizePrintAllOnLegal(); + } else if (mPosPersistPrintOptionsValues.getPrintOptionsAllOnLetter().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setPaperSizePrintAllOnLetterShrinksLegal(); + } + + // Additional copies + int tNumAdditionalCopies = 0; + try { + tNumAdditionalCopies = Integer.parseInt(mPosPersistPrintOptionsValues.getPrintOptionsAdditionalCopies()); + } catch (NumberFormatException npe) { + } + + pPosPrintSetupDialogChoices.setNumAdditionalCopies(tNumAdditionalCopies); + + // Print Form Names + if (mPosPersistPrintOptionsValues.getPrintOptionsPrintFormNames().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setShouldPrintFormNames(true); + } else { + pPosPrintSetupDialogChoices.setShouldPrintFormNames(false); + } + + // Duplex + if (mPosPersistPrintOptionsValues.getPrintOptionsDuplex().equalsIgnoreCase("Y")) { + pPosPrintSetupDialogChoices.setShouldDuplex(true); + } else { + pPosPrintSetupDialogChoices.setShouldDuplex(false); + } + } + + /** + * Save to local persisted storage the view frame's (x,y) location and (width,height), and window state (maximized/iconified) * and full path and filename of last file opened * @author howard 10/9/06 */ - protected void savePersistedViewValues(JInternalFrame pJInternalFrame) { + protected void savePersistedViewValues( + JInternalFrame pJInternalFrame, Preferences pPrefs, PosPersistViewValues pPosPersistViewValues) { + // If the JAR files are not signed, don't try to write to the client platform if ( !mCanWriteToLocalClient ) { return; } + // Must have a reference to the Preferences object and PosPersistViewValues + if ( (pPrefs == null) || (pPosPersistViewValues == null) ) { return; } Rectangle tRect = null; if ( !(pJInternalFrame.isMaximum()) ) { // At the moment the user closes the app, the JFrame is not maximized and is not iconified/minimized, so // save the current JFrame location (x,y) and (width,height) as current window on screen now tRect = pJInternalFrame.getBounds(); - mPosPersistViewValues.saveViewValues(mPackagePreferences, tRect.x, tRect.y, + pPosPersistViewValues.saveViewValues(pPrefs, tRect.x, tRect.y, tRect.width, tRect.height, JFrame.NORMAL, mFilePathAndFileName); } else { @@ -787,7 +863,7 @@ // the user un maximizes it (aka hits the "Restore" button), it will go to the last (x,y) and (width,height) // instead of staying at the (0,0) location and maximized (width,height) size tRect = pJInternalFrame.getNormalBounds(); - mPosPersistViewValues.saveViewValues(mPackagePreferences, tRect.x, tRect.y, + pPosPersistViewValues.saveViewValues(pPrefs, tRect.x, tRect.y, tRect.width, tRect.height, JFrame.MAXIMIZED_BOTH, mFilePathAndFileName); } @@ -802,6 +878,34 @@ mViewframeState = JFrame.NORMAL; } } + + /** + * Save to local persisted storate the print setup dialog options + * @param pPrefs + * @param pPosPersistPrintOptionsValues + * @param pPosPrintSetupDialogChoices + * @author DocMagic, Document Systems Inc, Howard H 8/3/07 + */ + protected void savePersistedPrintOptionsValues(Preferences pPrefs, + PosPersistPrintOptionsValues pPosPersistPrintOptionsValues, PosPrintSetupDialogChoices pPosPrintSetupDialogChoices) { + + // If the JAR files are not signed, don't try to write to the client platform + if ( !mCanWriteToLocalClient ) { return; } + // Must have a reference to the Preferences object and PosPersistPrintOptionsValues and PosPrintSetupDialogChoices + if ( (pPrefs == null) || (pPosPersistPrintOptionsValues == null) || (pPosPrintSetupDialogChoices == null)) { return; } + + pPosPersistPrintOptionsValues.savePrintOptionsValues(pPrefs, + (pPosPrintSetupDialogChoices.isPrintFormatWindowsPrint() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPrintFormatPclDirect() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPaperSizeAsDisplayedOrSelected() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPaperSizeLegalFirstThenLetter() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPaperSizeLetterFirstThenLegal() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLegal() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.isPaperSizePrintAllOnLetterShrinksLegal() ? "Y" : "N"), + String.valueOf(pPosPrintSetupDialogChoices.getNumAdditionalCopies()), + (pPosPrintSetupDialogChoices.shouldPrintFormNames() ? "Y" : "N"), + (pPosPrintSetupDialogChoices.shouldDuplex() ? "Y" : "N") ); + } // One line getters public PosManageToolBar getPosManageToolBar() {return mPosManageToolBar;} @@ -1132,7 +1236,7 @@ if (tAllFrames.length <= 1) { // 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 - if (mCanWriteToLocalClient) { savePersistedViewValues(pPosView.getJInternalFrame()); } + savePersistedViewValues(pPosView.getJInternalFrame(), mPackagePreferences, mPosPersistViewValues); mPosManageToolBar.setNoViewsOpen(); } } @@ -1375,7 +1479,7 @@ mPosMdiDesktopPane.add(tJInternalFrame); // After adding the JInternalFrame in the MDI JDesktopPane, position the just added JInternalFrame - // depending on if the first view showing, then use the persistent store (x,y) and (width,height) + // depending on if the first view showing, then use the persisted store (x,y) and (width,height) if (tIsFirstJInternalFrame) { // Make the below "true" to see the problem of the last (x,y) and (width,height) was placed OK last time but now @@ -2332,7 +2436,6 @@ public void actionShowOptionsDialog() { 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 */ @@ -2375,12 +2478,13 @@ /** Action "App is Exiting". This will call the CloseAllFiles operation and remove the JFrame listeners */ public void actionAppIsExiting() { - PriDebug.infoln("App is exiting"); // Remove the component listener that was put on the parent JFrame, which is used to close any showing // popup dialog mParentFrame.removeComponentListener(mFrameComponentListener); // Call the CloseAllFiles actionCloseAllFiles(); + // Save the print setup dialog options to persisted local storage so that next time the app is run, those will be read + savePersistedPrintOptionsValues(mPackagePreferences, mPosPersistPrintOptionsValues, mPosPrintSetupDialogChoices); } /** Get the app's Frame */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-17 19:20:07
|
Revision: 148 http://openpcl.svn.sourceforge.net/openpcl/?rev=148&view=rev Author: documentsystems Date: 2007-08-17 12:19:59 -0700 (Fri, 17 Aug 2007) Log Message: ----------- Howard Hoagland. Keep the PCL drawiing coordinates at 300DPI but tell the printer driver to go into 600DPI mode, then scale the image for a print driver setting of 600 dpi because there are some new printers (HP LaserJet 9000, Samsung ML2510, newer Xerox printers) that don't do 300 DPI. Most printers now a days have 600 DPI. This fixes the problem where the page image prints at 1/2 the size width and height taking up 1/4th the printed paper when the image is supposed to take up the whole paper page. This was happening for printers that don't have 300 DPI. But now if you pick a printer that has 300dpi but not 600dpi then the page image will print too big (like the HP LaserJet III from 1991 if anybody still uses a 16 year old printer). For those printers that don't have 600dpi, a fix still needs to be done to detect the dpi that the printer driver picked at run time. I opened 11082648 help ticket with Sun and Jose.Paul to try to find a way to get the print driver selected printer dpi at run time in code, because currently, the PrinterJob class doesn't have a getter for the print driver selected dpi. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-17 19:11:04 UTC (rev 147) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-17 19:19:59 UTC (rev 148) @@ -678,7 +678,7 @@ mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); mPrintRequestAttributeSet.add(Sides.ONE_SIDED); mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME); - mPrintRequestAttributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI)); + mPrintRequestAttributeSet.add(new PrinterResolution(600, 600, ResolutionSyntax.DPI)); mPrintRequestAttributeSet.add(new JobKOctets((int)(1.3 * 1024))); // each page is 1.3 MB mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-22 00:08:08
|
Revision: 160 http://openpcl.svn.sourceforge.net/openpcl/?rev=160&view=rev Author: documentsystems Date: 2007-08-21 17:08:10 -0700 (Tue, 21 Aug 2007) Log Message: ----------- Howard Hoagland. In the OpenPCLViewer class, changed the setPreferredSize on the status bar to be 1 line of text high instead of 2 lines of text for the status bar. Also, don't initially put the app name and version and description on the status bar at app startup time. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-21 21:03:25 UTC (rev 159) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-22 00:08:10 UTC (rev 160) @@ -632,9 +632,8 @@ mPosStatusBar = new PosStatusBar(); FontMetrics tFm = getFontMetrics((new JLabel("H")).getFont()); // Make the height of the status bar from the current font for JLabels - mPosStatusBar.setPreferredSize(new Dimension(1, (tFm.getHeight() * 2) + 12)); - mPosStatusBar.setStatusBarText(getAppName() + getAppDescription()); - mPosStatusBar.setStatusBarTextLine2(getAppVersion()); + mPosStatusBar.setPreferredSize(new Dimension(1, tFm.getHeight() + 6)); + mPosStatusBar.setStatusBarText(""); // If startup options allows, add the status bar if (mPosStartupOptions.getShowStatusbar()) { add(mPosStatusBar, BorderLayout.SOUTH); @@ -1065,7 +1064,8 @@ FontMetrics tFm = getFontMetrics((new JLabel("H")).getFont()); // Adjust the height of the status bar - mPosStatusBar.setPreferredSize(new Dimension(1, (tFm.getHeight() * 2) + 12)); + mPosStatusBar.adjustCursorPixelLocationPanelSize(); + mPosStatusBar.setPreferredSize(new Dimension(1, tFm.getHeight() + 6)); revalidate(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-08-29 02:34:02
|
Revision: 164 http://openpcl.svn.sourceforge.net/openpcl/?rev=164&view=rev Author: documentsystems Date: 2007-08-28 19:34:00 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Howard Hoagland. Fixed problem where printers that don't do 300 dpi but do 600 dpi were printing the page image 1/2 the size width and height, making the page image be on the upper left corner of the paper. Now the page image prints at the right size no matter if the printer's max resolution is 300 dpi or is a printer that doesn't have 300 dpi but has 600 or 1200 dpi, buy not setting any particular printer resolution by commenting out the line: mPrintRequestAttributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI));, and specifying mPrintRequestAttributeSet.add(PrintQuality.HIGH) instead of mPrintRequestAttributeSet.add(PrintQuality.DRAFT). Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-29 02:26:53 UTC (rev 163) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-08-29 02:34:00 UTC (rev 164) @@ -27,7 +27,6 @@ import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.ResolutionSyntax; import javax.print.attribute.Size2DSyntax; import javax.print.attribute.standard.Chromaticity; import javax.print.attribute.standard.JobKOctets; @@ -36,7 +35,6 @@ import javax.print.attribute.standard.MediaSize; import javax.print.attribute.standard.OrientationRequested; import javax.print.attribute.standard.PrintQuality; -import javax.print.attribute.standard.PrinterResolution; import javax.print.attribute.standard.Sides; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -673,15 +671,24 @@ // 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.DRAFT); // (before this was "HIGH") + + // Don't set to "DRAFT" or else the print driver picks the lowest resolution the printer can do. + mPrintRequestAttributeSet.add(PrintQuality.HIGH); + mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); mPrintRequestAttributeSet.add(Sides.ONE_SIDED); mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME); - mPrintRequestAttributeSet.add(new PrinterResolution(600, 600, ResolutionSyntax.DPI)); - mPrintRequestAttributeSet.add(new JobKOctets((int)(1.3 * 1024))); // each page is 1.3 MB + mPrintRequestAttributeSet.add(new JobKOctets((int)(256))); // each page image bytes max mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH)); + // 8/22/07 HowardH. Commented out the below line. Don't set the DPI here, let the print driver set the DPI and + // the printing framework will auto scale the image to the print driver's DPI setting. + // If you set the DPI here, you're forcing it to that exact resolution which will result in + // too small an image on paper for for printers that do 600dpi but can't do 300dpi, and if you set this to 600dpi then + // the image on paper is too big for printers that do 300dpi but can't do 600dpi. + // Commented out: mPrintRequestAttributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI)); + // Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); mPosUserOptionsDialog = new PosUserOptionsDialog( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-09-25 23:45:57
|
Revision: 176 http://openpcl.svn.sourceforge.net/openpcl/?rev=176&view=rev Author: documentsystems Date: 2007-09-25 16:46:00 -0700 (Tue, 25 Sep 2007) Log Message: ----------- Howard Hoagland. 1. Instantiate the new PCLPrintJob class. 2. Moved all the PrintRequestAttributes to the PCLPrintJob class. 3. Set and Get for the PrintRequestAttributes in the PCLPrintJob class. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-25 23:41:08 UTC (rev 175) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-09-25 23:46:00 UTC (rev 176) @@ -21,21 +21,10 @@ 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.Chromaticity; -import javax.print.attribute.standard.JobKOctets; -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; @@ -74,6 +63,7 @@ import com.openpcl.viewer.panels.PosView; import com.openpcl.viewer.panels.PosWindowControlList; import com.openpcl.viewer.panels.PosZoomSlider; +import com.openpcl.viewer.printing.PCLPrintJob; import com.openpcl.viewer.printing.PosPersistPrintOptionsValues; import com.openpcl.viewer.printing.PosPrintPages; import com.openpcl.viewer.printing.PosPrintSetupDialogChoices; @@ -189,7 +179,7 @@ private PosPersistPrintOptionsValues mPosPersistPrintOptionsValues = null; private PosStartupOptions mPosStartupOptions = null; private PosPrintSetupDialogChoices mPosPrintSetupDialogChoices = null; - private PrintRequestAttributeSet mPrintRequestAttributeSet = null; + private PCLPrintJob mPCLPrintJob = null; private int mViewframeX = 0; private int mViewframeY = 0; private int mViewframeWidth = 100; @@ -570,6 +560,8 @@ showStatusBar(); // Show the status bar now so the user doesn't have to wait longer while the rest of the items are built validate(); + // Instantiate the PCLPrintJob class + buildPrintingSupport(); // Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later buildPopupDialogs(); @@ -648,6 +640,11 @@ return tPosMdiDesktopPane; } + // Instantiate the PCLPrintJob class + protected void buildPrintingSupport() { + mPCLPrintJob = new PCLPrintJob(); + } + // Build popup dialogs but don't show them at startup time. They get shown only when the user clicks later protected void buildPopupDialogs() { @@ -671,20 +668,6 @@ mHelpAboutDialog.pack(); } - // 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); - - // Don't set to "DRAFT" or else the print driver picks the lowest resolution the printer can do. - mPrintRequestAttributeSet.add(PrintQuality.HIGH); - - mPrintRequestAttributeSet.add(MediaSize.findMedia(8.5f, 14.0f, Size2DSyntax.INCH)); - mPrintRequestAttributeSet.add(Sides.ONE_SIDED); - mPrintRequestAttributeSet.add(Chromaticity.MONOCHROME); - mPrintRequestAttributeSet.add(new JobKOctets((int)(256))); // each page image bytes max - mPrintRequestAttributeSet.add(new JobName(getAppName() + " print", Locale.getDefault())); - mPrintRequestAttributeSet.add(new MediaPrintableArea(0.18f, 0.18f, 8.14f, 13.64f, MediaPrintableArea.INCH)); - // 8/22/07 HowardH. Commented out the below line. Don't set the DPI here, let the print driver set the DPI and // the printing framework will auto scale the image to the print driver's DPI setting. // If you set the DPI here, you're forcing it to that exact resolution which will result in @@ -695,7 +678,7 @@ // Print Setup Defaults dialog and Print dialog (same dialog for both defaults and per print) mPosPrintSetupDialogChoices = new PosPrintSetupDialogChoices(); mPosUserOptionsDialog = new PosUserOptionsDialog( - mPosPrintSetupDialogChoices, mPrintRequestAttributeSet, this, "Options Dialog", true); + mPosPrintSetupDialogChoices, this.getPrintRequestAttributeSet(), this, "Options Dialog", true); //----- Print choices list mPosPrintChoicesList = new PosPrintChoicesList(createPrintChoicesListSelectionListener()); @@ -927,7 +910,16 @@ public String getFilePathAndFileName() { return mFilePathAndFileName; } public PosStartupOptions getPosStartupOptions() { return mPosStartupOptions; } public PosPrintSetupDialogChoices getPosPrintSetupDialogChoices() { return mPosPrintSetupDialogChoices; } - public PrintRequestAttributeSet getPrintRequestAttributeSet() { return mPrintRequestAttributeSet; } + public PCLPrintJob getPCLPrintJob() { return mPCLPrintJob; } + + // Get the PrintRequestAttributeSet out of the PCLPrintJob object + public PrintRequestAttributeSet getPrintRequestAttributeSet() { + if (mPCLPrintJob != null) { + return mPCLPrintJob.getPrintRequestAttributeSet(); + } else { + return null; + } + } // One line setters public void setIsDrawingForPrinting(boolean pIsDrawingForPrinting) { mIsDrawingForPrinting = pIsDrawingForPrinting; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-11-05 19:43:55
|
Revision: 184 http://openpcl.svn.sourceforge.net/openpcl/?rev=184&view=rev Author: documentsystems Date: 2007-11-05 11:43:59 -0800 (Mon, 05 Nov 2007) Log Message: ----------- Howard Hoagland. Added the actionSaveAs() method that now gets called when the user clicks the Save icon in the toolbar, then made it call the actionSaveOnePageToPclFile() so that subclass plugins can override actionSaveAs() to allow the user to pick which of many output file formats to save to (example: Save all pages to a .ZIP file) and not be limited to saving only the current page's PCL bytes to a file. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-11-05 19:39:46 UTC (rev 183) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-11-05 19:43:59 UTC (rev 184) @@ -2311,6 +2311,12 @@ PriDebug.infoln("Zoom To " + pZoomFactor); } + /** This gets executed when the user clicks the Save As icon on the toolbar.<br> + * Subclass plugins override this method so do not delete or rename this method. */ + public void actionSaveAs() { + actionSaveOnePageToPclFile(); + } + /** Save one page only as PCL file */ public void actionSaveOnePageToPclFile() { byte[] tCurrentPageBytes = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-12-05 05:32:12
|
Revision: 201 http://openpcl.svn.sourceforge.net/openpcl/?rev=201&view=rev Author: documentsystems Date: 2007-12-04 21:32:17 -0800 (Tue, 04 Dec 2007) Log Message: ----------- Howard Hoagland. Changed the executeAfterUiIsShowing() method to do an additional force to redraw the PCL page at very end of the startup sequence if run from an applet. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-12-05 05:30:13 UTC (rev 200) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-12-05 05:32:17 UTC (rev 201) @@ -89,7 +89,7 @@ * 1. As a PCL viewer. This is the normal user mode.<br> *<br> * or<br> - * 2. As a JPanel imbedded in your Java app's layout anywhere you wish. Your app can call the methods shown + * 2. As a JPanel embedded in your Java app's layout anywhere you wish. Your app can call the methods shown * in the Interface IOpenPCL to control how the OpenPCLViewer JPanel looks on screen and to control * its behavior. OpenPCLViewer's own toolbar buttons and events call these same Interface methods to control * it that and external app can call. You can hide the toolbar and/or JTree of PCL page nodes and call all the @@ -103,7 +103,7 @@ *<br> * More details about it:<br> * For (1), when OpenPCLViewer is run as the main app, its main() method runs which calls it's constructor. - * In this case, it will instantiate and show the JFrame PosSimpleJFrame, then imbed itself as a JPanel into + * In this case, it will instantiate and show the JFrame PosSimpleJFrame, then embed itself as a JPanel into * PosSimpleJFrame's layout. This requires no user programming and it does this as the ready to run PCL viewer.<br> *<br> * For (2), if you've written a Java app already and you want to put a JPanel in your app that is a PCL viewer, @@ -112,7 +112,7 @@ * and pass your app's JFrame in the constructor. Doing it this way, the OpenPCLViewer main() is never run * because your app's main() is the main(). Since OpenPCLViewer is a subclass of JPanel, it needs a reference to * the JFrame where this JPanel will be contained so that JDialogs and JOptionPanes can be modal on the - * passed in JFrame as the parent frame. For the 2nd paramater which is the "String pArgs[]" you can pass + * passed in JFrame as the parent frame. For the 2nd parameter which is the "String pArgs[]" you can pass * null if you don't want to specify any command line options or the name of a PCL file to open and view * at program startup time. Then you would add the OpenPCLViewer panel into your app's layout in any place you wish. * If you don't want the JTree or toolbar or status bar, you can turn those off independently by calling public @@ -120,7 +120,7 @@ * you have in your app that you want to control the PCL Viewer JPanel with, then hide OpenPCLViewer's toolbar * and make your event listener code call the OpenPCLViewer's public api interface methods that are in IOpenPCL.<br> * <br> - * For (3), If you want to *not* imbed the OpenPCLViewer JPanel in your app, and instead the only thing you want + * For (3), If you want to *not* embed the OpenPCLViewer JPanel in your app, and instead the only thing you want * is the BufferedImage bitmap that PclRenderImage draws from the PCL bytes, then you can use the classed in the * pclrenderimage.jar file directly and not have the openpcl.jar file there at run time. In this case, your app * needs to have all the UI code since you're going the bare bones route and not using any classes in the @@ -133,7 +133,9 @@ * 3c. Put the java.awt.image.BufferedImage (that is returned from the renderImage...() methods) on the screen, * or pass it along to a client who is in charge of putting it on the client's screen.<br> * - * @author DocMagic, Document Systems Inc, Howard H 9/20/06 + * @author DocMagic, Document Systems Inc, Howard Hoagland.<br> + * The major viewing and printing functionality written 5/13/06 to 9/20/06.<br> + * Added more printing variations and more features and command line options after that. */ public class OpenPCLViewer extends JPanel implements IOpenPCL, IPluginHooksOpenPCL { private static final long serialVersionUID = 1L; @@ -141,7 +143,7 @@ // Instance variables protected String mAppName = "OpenPCL Viewer"; protected String mAppDescription = " - Free Open Source PCL Viewer for the World"; - protected String mAppVersion = "Version 0.08 September 7, 2007"; + protected String mAppVersion = "Version 0.08 December 7, 2007"; private Frame mParentFrame = null; private JApplet mJApplet = null; @@ -510,7 +512,11 @@ // After the JFrame is visible, if the user had put a file to open on the command line, then open the file now, // and any other code that must be executed after the UI is showing on the screen - executeAfterUiIsShowing(); + if (mPosStartupOptions.getModeToRun() != PosStartupOptions.sModeToRunApplet) { + // Don't call the below if this JPanel is in an applet because the applet will call the below method + // after the applet puts this JPanel in the applet on the screen + executeAfterUiIsShowing(); + } } // Find the Frame of the Browser that the applet is running in, or else make a new not visible Frame @@ -591,12 +597,23 @@ * Code that needs to execute after the UI is showing on the screen upon app startup. * @author howard 9/20/06 */ - protected void executeAfterUiIsShowing() { + public void executeAfterUiIsShowing() { String tOpenFile = mPosStartupOptions.getCommandLineFileToOpen(); // If there is a file name on the command line then open the file to view if (tOpenFile != null && tOpenFile.length() > 0) { actionOpenLocalFileSpecified(tOpenFile); - if (mPosViewSelected != null) { mPosViewSelected.getPosTree().selectPage1(); } + if (mPosViewSelected != null) { + mPosViewSelected.getPosTree().selectPage1(); + + if (mPosStartupOptions.getModeToRun() == PosStartupOptions.sModeToRunApplet) { + // When this app is put in an applet, the initial file to automatically open and show doesn't show unless the below is done + // so that the automatic drawing of the PCL page is kicked off again doing the "force zoom to width" + int tParentFrameWidth = mParentFrame.getWidth(); + int tParentFrameHeight = mParentFrame.getHeight(); + mParentFrame.setSize(tParentFrameWidth - 2, tParentFrameHeight); + mParentFrame.setSize(tParentFrameWidth, tParentFrameHeight); + } + } } } @@ -1996,9 +2013,16 @@ String tLoadFileErrorString = loadFromFileSplitIntoSeparatePclPages(pFilePathAndFileName); if (tLoadFileErrorString != null) { + mPosViewSelected.freeUpMemory(); + mPosViewSelected = null; // Success on creating the new Mdi view but error on splitting the Pcl bytes into separate pages. // Could be file not found or no bytes in the file when opened - JOptionPane.showMessageDialog(mParentFrame, tLoadFileErrorString, "Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(mParentFrame, tLoadFileErrorString + + "\nA full absolute directory path is required. No default directory is assumed.\n" + + "Example if the file is to be read from c:/temp\n" + + " 1. Copy the file to c:/temp\n" + + " 2. For the file to open at startup time, specify c:/temp/filename.ext instead of filename.ext", + "Error", JOptionPane.ERROR_MESSAGE); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <doc...@us...> - 2007-12-07 23:09:35
|
Revision: 213 http://openpcl.svn.sourceforge.net/openpcl/?rev=213&view=rev Author: documentsystems Date: 2007-12-07 15:09:37 -0800 (Fri, 07 Dec 2007) Log Message: ----------- Howard Hoagland. Added "synchronized" to the getImageForPage() method because the synchronized had to be taken off of the PclRenderImage.parseAndRender() method, because PclRenderImage is doing double duty as the render engine for OpenPCLViewer and also is being used as the render engine in a J2EE container running many threads at once. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java Modified: openpcl/src/com/openpcl/viewer/OpenPCLViewer.java =================================================================== --- openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-12-07 22:12:12 UTC (rev 212) +++ openpcl/src/com/openpcl/viewer/OpenPCLViewer.java 2007-12-07 23:09:37 UTC (rev 213) @@ -1752,7 +1752,7 @@ * @param pZoomFactor. This is mandatory (see note for why). * @return BufferedImage. If null, then get the return String from PclRenderImage.getLastErrorString() */ - public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, + public synchronized BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, boolean pIsForPrinting, String pPaperSize, double pZoomFactor) { if (mPosViewSelected != null) { PriDebug.infoln("OpenPCLViewer> getImageForPage(page=" + pPageNumber + ", boolean printing=" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |