All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.as400.vaccess.SpooledFileViewer
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----javax.swing.JComponent
|
+----com.ibm.as400.vaccess.SpooledFileViewer
- public class SpooledFileViewer
- extends JComponent
- implements Serializable
The SpooledFileViewer class represents an AS/400 spooled file viewer.
You can create an instance of this class to view an individual
AFPDS or SCS spooled file on the AS/400. Viewer functions such as page forward,
page back, set current page, and so on, are provided.
The following properties can be set directly, but require the
invocation of load() to load the information from the AS/400.
- paper size
- spooled file
- viewing fidelity
The following properties can be set directly, but require the
invocation of loadPage() to load the information from the AS/400.
Most errors are reported as ErrorEvents rather than
throwing exceptions. Users should listen for ErrorEvents
in order to diagnose and recover from error conditions.
SpooledFileViewer objects generate the following events:
- ErrorEvent
- PropertyChangeEvent
- VetoableChangeEvent
- WorkingEvent
(To create new spooled files on the AS/400, use the
SpooledFileOutputStream class.
See Spooled File Attributes for
valid attributes.)
The following example creates a spooled file viewer
to display a spooled file previously created on the AS/400.
// Assume splf is the spooled file.
// Create the spooled file viewer
SpooledFileViewer splfv = new SpooledFileViewer(splf, 1);
splfv.load();
// Add the spooled file viewer to a frame
JFrame frame = new JFrame("My Window");
frame.getContentPane().add(splfv);
- See Also:
- SpooledFile
-
A3
- Represents A3 paper size (297 x 420 mm)
-
A4
- Represents A4 paper size (210 x 297 mm)
-
A5
- Represents A5 paper size (148 x 210 mm)
-
ABSOLUTE_FIDELITY
- Represents *ABSOLUTE viewing fidelity
-
B4
- Represents B4 paper size (257 x 364 mm)
-
B5
- Represents B5 paper size (182 x 257 mm)
-
CONT132
- Represents continuous feed 132 paper size (13.2 x 11 inches)
-
CONT80
- Represents continuous feed 80 paper size (8 x 11 inches)
-
CONTENT_FIDELITY
- Represents *CONTENT viewing fidelity
-
EXECUTIVE
- Represents executive paper size (7.25 x 10.5 inches)
-
LEDGER
- Represents ledger paper size (17 x 11 inches)
-
LEGAL
- Represents legal paper size (8.5 x 14 inches)
-
LETTER
- Represents letter paper size (8.5 x 11 inches)
-
NONE
- Represents no paper size
-
SpooledFileViewer()
- Constructs a SpooledFileViewer object.
-
SpooledFileViewer(SpooledFile)
- Constructs a SpooledFileViewer object.
-
SpooledFileViewer(SpooledFile, int)
- Constructs a SpooledFileViewer object.
-
actualSize()
- Resets the size of the page image to its original size.
-
addErrorListener(ErrorListener)
- Adds a listener to be notified when an error occurs.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener to be notified when the value of any
bound property changes.
-
addStatusBar()
- Adds the status bar.
-
addToolBar()
- Adds the tool bar.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a listener to be notified when the value of any
constrained property changes.
-
addWorkingListener(WorkingListener)
- Adds a listener to be notified of a working state.
-
close()
- Closes the viewer.
-
finalize()
- Closes the viewer.
-
fitHeight()
- Stretches the size of the page image vertically to the edges
of the viewing window.
-
fitPage()
- Stretches the size of the page image horizontally or vertically so the
entire view is contained within the edges of the viewing window.
-
fitWidth()
- Stretches the size of the page image horizontally to the edges of
the viewing window.
-
getCurrentPage()
- Returns the page number of the current page.
-
getNumberOfPages()
- Returns the number of pages in the spooled file.
-
getPaperSize()
- Returns the paper size.
-
getPreferredSize()
- Returns the preferred size of the viewer.
-
getSpooledFile()
- Returns the spooled file being viewed.
-
getViewingFidelity()
- Returns the viewing fidelity.
-
isNumberOfPagesEstimated()
- Indicates if the number of pages associated with the spooled file being viewed
is estimated.
-
load()
- Loads the spooled file for viewing.
-
loadFlashPage()
- Loads the previously viewed page.
-
loadPage()
- Loads the current page for viewing.
-
pageBack()
- Sets the view back one page.
-
pageForward()
- Sets the view forward one page.
-
removeErrorListener(ErrorListener)
- Removes an ErrorListener.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a property change listener.
-
removeStatusBar()
- Removes the status bar.
-
removeToolBar()
- Removes the tool bar.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable change listener.
-
removeWorkingListener(WorkingListener)
- Removes a WorkingListener.
-
setCurrentPage(int)
- Sets the current page.
-
setPaperSize(int)
- Sets the papersize.
-
setSpooledFile(SpooledFile)
- Sets the spooled file.
-
setViewingFidelity(int)
- Sets the viewing fidelity.
ABSOLUTE_FIDELITY
public static final int ABSOLUTE_FIDELITY
- Represents *ABSOLUTE viewing fidelity
CONTENT_FIDELITY
public static final int CONTENT_FIDELITY
- Represents *CONTENT viewing fidelity
LETTER
public static final int LETTER
- Represents letter paper size (8.5 x 11 inches)
LEGAL
public static final int LEGAL
- Represents legal paper size (8.5 x 14 inches)
A3
public static final int A3
- Represents A3 paper size (297 x 420 mm)
A4
public static final int A4
- Represents A4 paper size (210 x 297 mm)
A5
public static final int A5
- Represents A5 paper size (148 x 210 mm)
B4
public static final int B4
- Represents B4 paper size (257 x 364 mm)
B5
public static final int B5
- Represents B5 paper size (182 x 257 mm)
EXECUTIVE
public static final int EXECUTIVE
- Represents executive paper size (7.25 x 10.5 inches)
LEDGER
public static final int LEDGER
- Represents ledger paper size (17 x 11 inches)
CONT80
public static final int CONT80
- Represents continuous feed 80 paper size (8 x 11 inches)
CONT132
public static final int CONT132
- Represents continuous feed 132 paper size (13.2 x 11 inches)
NONE
public static final int NONE
- Represents no paper size
SpooledFileViewer
public SpooledFileViewer()
- Constructs a SpooledFileViewer object. A call to setSpooledFile() must
be done after calling this method in order to set the spooled
file to be viewed.
SpooledFileViewer
public SpooledFileViewer(SpooledFile spooledFile)
- Constructs a SpooledFileViewer object. By default, the current page is set to
the first page of the spooled file. A call to load() must be done
after calling this method in order to load the spooled file.
- Parameters:
- spooledFile - The spooled file to view.
SpooledFileViewer
public SpooledFileViewer(SpooledFile spooledFile,
int page)
- Constructs a SpooledFileViewer object. Page page of the spooled file
is loaded as the initial view. If page is less than 1, an error is thrown.
A call to load() must be done after calling this method in order to
load the spooled file.
- Parameters:
- spooledFile - The spooled file to view.
- page - The initial page to view.
actualSize
public void actualSize()
- Resets the size of the page image to its original size. This method is only
valid after a spooled file has been loaded.
addErrorListener
public void addErrorListener(ErrorListener listener)
- Adds a listener to be notified when an error occurs.
- Parameters:
- listener - The listener.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener to be notified when the value of any
bound property changes.
- Parameters:
- listener - The listener.
- Overrides:
- addPropertyChangeListener in class JComponent
addStatusBar
public void addStatusBar()
- Adds the status bar.
addToolBar
public void addToolBar()
- Adds the tool bar.
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a listener to be notified when the value of any
constrained property changes.
- Parameters:
- listener - The listener.
- Overrides:
- addVetoableChangeListener in class JComponent
addWorkingListener
public void addWorkingListener(WorkingListener listener)
- Adds a listener to be notified of a working state.
- Parameters:
- listener - The listener.
close
public void close()
- Closes the viewer.
finalize
protected void finalize() throws Throwable
- Closes the viewer.
- Throws: Throwable
- If an error occurs during cleanup.
- Overrides:
- finalize in class Object
fitHeight
public void fitHeight()
- Stretches the size of the page image vertically to the edges
of the viewing window. This method is only valid after a spooled
file has been loaded.
fitPage
public void fitPage()
- Stretches the size of the page image horizontally or vertically so the
entire view is contained within the edges of the viewing window. This method
is only valid after a spooled file has been loaded.
fitWidth
public void fitWidth()
- Stretches the size of the page image horizontally to the edges of
the viewing window. This method is only valid after a spooled file
has been loaded.
getCurrentPage
public int getCurrentPage()
- Returns the page number of the current page.
- Returns:
- The current page number.
getNumberOfPages
public int getNumberOfPages()
- Returns the number of pages in the spooled file.
This value may be estimated, depending on the origin of spooled file.
If the spooled file was created natively on an AS/400, the
value is valid. If the spooled file was created on another
type of system, the value may be estimated.
- Returns:
- The number of pages.
- See Also:
- isNumberOfPagesEstimated
getPaperSize
public int getPaperSize()
- Returns the paper size. The paper size is used to determine how to
process pages from the spooled file.
- Returns:
- The paper size.
getPreferredSize
public Dimension getPreferredSize()
- Returns the preferred size of the viewer.
- Returns:
- The preferred size.
- Overrides:
- getPreferredSize in class JComponent
getSpooledFile
public SpooledFile getSpooledFile()
- Returns the spooled file being viewed.
- Returns:
- The spooled file.
getViewingFidelity
public int getViewingFidelity()
- Returns the viewing fidelity. The viewing fidelity is used to determine how to
process pages from the spooled file.
- Returns:
- The viewing fidelity.
isNumberOfPagesEstimated
public boolean isNumberOfPagesEstimated()
- Indicates if the number of pages associated with the spooled file being viewed
is estimated.
- Returns:
- Returns true if the number of pages is estimated; false otherwise.
- See Also:
- getNumberOfPages
load
public void load() throws IOException, PropertyVetoException
- Loads the spooled file for viewing. A call to this method must be made after
the constructor has been invoked or the spooled file has changed
in order to load the spooled file and properly initialize the viewer.
- Throws: IOException
- Thrown if the spooled file cannot be initialized.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
loadFlashPage
public void loadFlashPage() throws PropertyVetoException
- Loads the previously viewed page. If a different page was not previously
viewed (loaded), no action is taken. This method can only be called after
a spooled file has been loaded. If a spooled file has not been successfully
loaded into the viewer previously, an error event is fired.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
loadPage
public void loadPage() throws PropertyVetoException
- Loads the current page for viewing. This method can only be called
after a spooled file has been successfully loaded. If the current page
is not a valid page of the spooled file, the current page is set to the
previously viewed page, and an error event is fired.
If a spooled file has not been successfully loaded into the viewer previously,
an error event is fired.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
pageBack
public void pageBack() throws PropertyVetoException
- Sets the view back one page.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
pageForward
public void pageForward() throws PropertyVetoException
- Sets the view forward one page.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
removeErrorListener
public void removeErrorListener(ErrorListener listener)
- Removes an ErrorListener.
- Parameters:
- listener - The listener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a property change listener.
- Parameters:
- listener - The listener.
- Overrides:
- removePropertyChangeListener in class JComponent
removeToolBar
public void removeToolBar()
- Removes the tool bar.
removeStatusBar
public void removeStatusBar()
- Removes the status bar.
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable change listener.
- Parameters:
- listener - The listener.
- Overrides:
- removeVetoableChangeListener in class JComponent
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
- Removes a WorkingListener.
- Parameters:
- listener - The listener.
setCurrentPage
public synchronized void setCurrentPage(int newPage) throws PropertyVetoException
- Sets the current page.
- Parameters:
- newPage - The page to view.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
setPaperSize
public synchronized void setPaperSize(int paperSize) throws PropertyVetoException
- Sets the papersize. If paper size specified by paperSize is not valid,
no action is taken.
- Parameters:
- size - The paper size to be used for processing spooled file pages.
May be any of the following values:
- LETTER - Letter (8.5 x 11 inches)
- LEGAL - Legal (8.5 x 14 inches)
- A3 - A3 (297 x 420 mm)
- A4 - A4 (210 x 297 mm)
- A5 - A5 (148 x 210 mm)
- B4 - B4 (257 x 364 mm)
- B5 - B5 (182 x 257 mm)
- EXECUTIVE - Executive (7.25 x 10.5 inches)
- LEDGER - Ledger (17 x 11 inches)
- CONT80 - Continuous feed 80 (8 x 11 inches)
- CONT132 - Continuous feed 132 (13.2 x 11 inches)
- NONE - None
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
setSpooledFile
public void setSpooledFile(SpooledFile spooledFile) throws PropertyVetoException
- Sets the spooled file.
- Parameters:
- spooledFile - The spooled file to view.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
setViewingFidelity
public synchronized void setViewingFidelity(int viewingFidelity) throws PropertyVetoException
- Sets the viewing fidelity.
- Parameters:
- viewingFidelity - The viewing fidelity. If viewing fidelity specified
by viewingFidelity is not valid, no action is taken.
May be any of the following values:
- ABSOLUTE - Absolute. When this is specified, the spooled file data
is scanned and all non-raster data is processed up through
the current page.
- CONTENT - Content. When this is specified, the spooled file data is
processed according to datastream type:
- SCS - Process open-time commands and current page commands
only.
- AFPDS - Process the first page without rasterizing, then the
current page.
- Throws: PropertyVetoException
- Thrown if the property change is vetoed.
All Packages Class Hierarchy This Package Previous Next Index