|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.icesoft.pdf.ri.common.SwingController
SwingController is the meat of a PDF viewing application. It is the Controller
aspect of the Model-View-Controller (MVC) framework.
SwingController acts as a bridge between a Swing user interface, as built by
SwingViewerBuilder; the Document class, which is the root accessor to the PDF content;
and the ViewerModel, which maintains the state of the user's perspective of said Document.
SwingViewBuilder,
Document,
ViewModel| Field Summary | |
static int |
CURSOR_CLOSE_HAND
|
static int |
CURSOR_DEFAULT
|
static int |
CURSOR_OPEN_HAND
|
static int |
CURSOR_SELECT
|
static int |
CURSOR_WAIT
|
static int |
CURSOR_ZOOM_IN
|
static int |
CURSOR_ZOOM_OUT
|
| Constructor Summary | |
SwingController()
Create a SwingController object, and its associated ViewerModel |
|
SwingController(ResourceBundle messageBundle)
|
|
| Method Summary | |
void |
actionPerformed(ActionEvent event)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
closeDocument()
Close the currently opened PDF Document. |
void |
dispose()
Way to dispose of all memory references, and clean up the Document resources Note: If you create several SwingControllers to manipulate a single Document, and each SwingController would be disposed of at a different time, while the others continue to use that same shared Document, then you should not call Document.dispose() inside of here. |
void |
doCommonZoomUIUpdates(boolean becauseOfValidFitMode)
|
void |
dragEnter(DropTargetDragEvent event)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
dragExit(DropTargetEvent event)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
dragOver(DropTargetDragEvent event)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
drop(DropTargetDropEvent event)
Handle drop event when a user drags and drops one or more files onto the viewer frame. |
void |
dropActionChanged(DropTargetDragEvent event)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
exit()
If there is a WindowManagementCallback in place, then this will invoke its quit method |
void |
exportSVG()
Utility method for exporting the current page of the Document to an SVG file. |
void |
exportText()
Utility method for exporting all of a Document's text to a text file. |
void |
focusGained(FocusEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
focusLost(FocusEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
followOutlineItem(OutlineItem o)
When the user selects an OutlineItem from the Outlines (Bookmarks) JTree, this displays the relevant target portion of the PDF Document |
Page |
getCurrentPage()
Gives access to the current Page, as specified by the ViewerModel's current page index |
int |
getCurrentPageNumber()
When viewing a PDF file, one or more pages may be viewed at a single time, but this is the single page which is most predominantly being displayed. |
Document |
getDocument()
A Document is the root of the object hierarchy, giving access to the contents of a PDF file. |
DocumentViewController |
getDocumentViewController()
Gets controller responsible for the page multiple page views. |
int |
getDocumentViewToolMode()
Gets the current display tool value for the display panel. |
ResourceBundle |
getMessageBundle()
Gets the message bundle used by this class. |
PageTree |
getPageTree()
Gives access to the currently openned Document's Catalog's PageTree |
float |
getUserRotation()
Each Page may have its own rotation, but on top of that, the user may select to have the Page further rotated, by 0, 90, 180, 270 degrees |
float |
getUserZoom()
The Page being shown may be zoomed in or out, to show more detail, or provide an overview. |
JFrame |
getViewerFrame()
Not all uses of SwingController would result in there existing a Viewer Frame, so this may well return null. |
ViewModel |
getViewModel()
Gives access to this SwingController's ViewerModel |
WindowManagementCallback |
getWindowManagementCallback()
The WindowManagementCallback is used for creating new Document windows, and quitting the application |
void |
goToDeltaPage(int delta)
Adds delta to the ViewerModel's current page index, and updates the display to show the newly selected page. |
boolean |
isDocumentFitMode(int fitMode)
|
boolean |
isDocumentViewMode(int viewMode)
|
boolean |
isUtilityPaneVisible()
If the utility pane is currently visible |
void |
itemStateChanged(ItemEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
keyPressed(KeyEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
keyReleased(KeyEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
keyTyped(KeyEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
openDocument(byte[] data,
int offset,
int length,
String description,
String pathOrURL)
Opens a Document via the specified byte array. |
void |
openDocument(InputStream inputStream,
String description,
String pathOrURL)
Opens a Document via the specified InputStream. |
void |
openDocument(String pathname)
Open a file specified by the given path name. |
void |
openDocument(URL location)
Open a URL specifed by the location variable. |
void |
openFile()
Utility method for opening a file. |
void |
openURL()
Utility method for opening a URL. |
void |
print(boolean withDialog)
If the withDialog parameter is true, show a print dialog,
defaulted to print all pages. |
void |
propertyChange(PropertyChangeEvent evt)
|
void |
rotateLeft()
Rotates the page visualization by 90 degrees in a counter-clockwise direction. |
void |
rotateRight()
Rotates the page visualization by 90 degrees in a clockwise direction. |
void |
saveFile()
Utility method for saving a copy of the currently opened PDF to a file. |
void |
setAboutMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setBringAllToFrontMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setCloseMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setCompleteToolBar(JToolBar toolbar)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setCurrentPageNumberTextField(JTextField textField)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setDisplayTool(int argToolName)
Sets the display tool used when the document is viewed in interactive mode. |
void |
setDocumentToolMode(int toolType)
|
void |
setExitMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setExportSVGMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setExportTextMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFirstPageButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFirstPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitActualSizeButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitActualSizeMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitHeightButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitWidthButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setFitWidthMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setGoToPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setInformationMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setIsEmbeddedComponent(boolean embeddableComponent)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setLastPageButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setLastPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setMinimiseAllMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setNextPageButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setNextPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setNumberOfPagesLabel(JLabel lbl)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setOpenFileButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setOpenFileMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setOpenURLMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setOutlineComponents(JTree tree,
JScrollPane scroll)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPageFitMode(int fitMode,
boolean refresh)
Set the ViewerModel's fit setting to fit the whole page, and update the display |
void |
setPageViewFacingPageConButton(JToggleButton btn)
|
void |
setPageViewFacingPageNonConButton(JToggleButton btn)
|
void |
setPageViewMode(int viewMode,
boolean refresh)
|
void |
setPageViewSinglePageConButton(JToggleButton btn)
|
void |
setPageViewSinglePageNonConButton(JToggleButton btn)
|
void |
setPanToolButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPermissionsMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPreviousPageButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPreviousPageMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPrintButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPrintMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setPrintSetupMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setRotateLeftButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setRotateLeftMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setRotateRightButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setRotateRightMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setSaveAsFileButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setSaveAsFileMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setSearchButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setSearchMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setSearchPanel(SearchPanel sp)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setShowHideToolBarMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setShowHideUtilityPaneButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setShowHideUtilityPaneMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setStatusLabel(JLabel lbl)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setToolBarVisible(boolean show)
Sets the visibility of the toolbar |
void |
setUtilityAndDocumentSplitPane(JSplitPane splitpane)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setUtilityPaneVisible(boolean visible)
Makes the component visible or invisible. |
void |
setUtilityTabbedPane(JTabbedPane util)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setViewerFrame(JFrame v)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setWindowListMenuItems(List menuItems)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setWindowManagementCallback(WindowManagementCallback wm)
The WindowManagementCallback is used for creating new Document windows, and quitting the application |
void |
setZoom(float zoom)
Zoom to a new zoom level, without centering on any new specific point |
void |
setZoomComboBox(JComboBox zcb,
float[] zl)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomInButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomInMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomInToolButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomOutButton(JButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomOutMenuItem(JMenuItem mi)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
setZoomOutToolButton(JToggleButton btn)
Called by SwingViewerBuilder, so that SwingController can setup event handling |
void |
showAboutDialog()
Show the About dialog. |
void |
showDocumentInformationDialog()
Show information about the PDF file's Document, such as the title, subject, author, keywords, creator, producer, creation date, and last modification date |
void |
showDocumentPermissionsDialog()
Show the permissions set in the PDF file's Document, as relates to encryption, altering, or extracting information from, the Document |
void |
showPage(int nPage)
Sets the ViewerModel's current page index, and updates the display to show the newly selected page |
void |
showPageFromTextField()
Takes the page number that the user has typed into the text field, converts it into a page index, and then displays that page |
void |
showPageSelectionDialog()
Show a dialog, listing every page in the PDF Document, for the user to select which page to show. |
void |
showPrintSetupDialog()
Show a print setup dialog, to alter the ViewerModel's PageFormat |
void |
showSearchPanel()
Make the Search pane visible, and if necessary, the utility pane that encloses it |
void |
toggleToolBarVisibility()
Flips the visibility of the toolbar to the opposite of what it was |
void |
toggleUtilityPaneVisibility()
Flips the visibility of the utility pane to the opposite of what it was |
void |
updateDocumentView()
|
void |
valueChanged(TreeSelectionEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowActivated(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowClosed(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowClosing(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowDeactivated(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowDeiconified(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowIconified(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
windowOpened(WindowEvent e)
SwingController takes AWT/Swing events, and maps them to its own events related to PDF Document manipulation |
void |
zoomIn()
Increases the current page visualization zoom factor by 20%. |
void |
zoomOut()
Decreases the current page visualization zoom factor by 20%. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int CURSOR_OPEN_HAND
public static final int CURSOR_CLOSE_HAND
public static final int CURSOR_ZOOM_IN
public static final int CURSOR_ZOOM_OUT
public static final int CURSOR_WAIT
public static final int CURSOR_SELECT
public static final int CURSOR_DEFAULT
| Constructor Detail |
public SwingController()
ViewModelpublic SwingController(ResourceBundle messageBundle)
| Method Detail |
public DocumentViewController getDocumentViewController()
public ResourceBundle getMessageBundle()
public void setWindowManagementCallback(WindowManagementCallback wm)
wm - The new WindowManagementCallbackgetWindowManagementCallback()public WindowManagementCallback getWindowManagementCallback()
setWindowManagementCallback(com.icesoft.pdf.ri.common.WindowManagementCallback)public void setOpenFileMenuItem(JMenuItem mi)
public void setOpenURLMenuItem(JMenuItem mi)
public void setCloseMenuItem(JMenuItem mi)
public void setSaveAsFileMenuItem(JMenuItem mi)
public void setExportTextMenuItem(JMenuItem mi)
public void setExportSVGMenuItem(JMenuItem mi)
public void setPermissionsMenuItem(JMenuItem mi)
public void setInformationMenuItem(JMenuItem mi)
public void setPrintSetupMenuItem(JMenuItem mi)
public void setPrintMenuItem(JMenuItem mi)
public void setExitMenuItem(JMenuItem mi)
public void setFitActualSizeMenuItem(JMenuItem mi)
public void setFitPageMenuItem(JMenuItem mi)
public void setFitWidthMenuItem(JMenuItem mi)
public void setZoomInMenuItem(JMenuItem mi)
public void setZoomOutMenuItem(JMenuItem mi)
public void setRotateLeftMenuItem(JMenuItem mi)
public void setRotateRightMenuItem(JMenuItem mi)
public void setShowHideToolBarMenuItem(JMenuItem mi)
public void setShowHideUtilityPaneMenuItem(JMenuItem mi)
public void setFirstPageMenuItem(JMenuItem mi)
public void setPreviousPageMenuItem(JMenuItem mi)
public void setNextPageMenuItem(JMenuItem mi)
public void setLastPageMenuItem(JMenuItem mi)
public void setSearchMenuItem(JMenuItem mi)
public void setGoToPageMenuItem(JMenuItem mi)
public void setMinimiseAllMenuItem(JMenuItem mi)
public void setBringAllToFrontMenuItem(JMenuItem mi)
public void setWindowListMenuItems(List menuItems)
public void setAboutMenuItem(JMenuItem mi)
public void setOpenFileButton(JButton btn)
public void setSaveAsFileButton(JButton btn)
public void setPrintButton(JButton btn)
public void setSearchButton(JButton btn)
public void setShowHideUtilityPaneButton(JButton btn)
public void setFirstPageButton(JButton btn)
public void setPreviousPageButton(JButton btn)
public void setNextPageButton(JButton btn)
public void setLastPageButton(JButton btn)
public void setCurrentPageNumberTextField(JTextField textField)
public void setNumberOfPagesLabel(JLabel lbl)
public void setZoomOutButton(JButton btn)
public void setZoomComboBox(JComboBox zcb,
float[] zl)
public void setZoomInButton(JButton btn)
public void setFitActualSizeButton(JToggleButton btn)
public void setFitHeightButton(JToggleButton btn)
public void setFitWidthButton(JToggleButton btn)
public void setRotateLeftButton(JButton btn)
public void setRotateRightButton(JButton btn)
public void setPanToolButton(JToggleButton btn)
public void setZoomInToolButton(JToggleButton btn)
public void setZoomOutToolButton(JToggleButton btn)
public void setCompleteToolBar(JToolBar toolbar)
public void setOutlineComponents(JTree tree,
JScrollPane scroll)
public void setSearchPanel(SearchPanel sp)
public void setUtilityTabbedPane(JTabbedPane util)
public void setIsEmbeddedComponent(boolean embeddableComponent)
public void setUtilityAndDocumentSplitPane(JSplitPane splitpane)
public void setStatusLabel(JLabel lbl)
public void setViewerFrame(JFrame v)
public JFrame getViewerFrame()
public int getDocumentViewToolMode()
setDisplayTool(int)public void setDisplayTool(int argToolName)
getDocumentViewToolMode()public void openFile()
public void openDocument(String pathname)
pathname - String representing a valid file pathpublic void openURL()
public void openDocument(URL location)
location - location of a valid PDF document
public void openDocument(InputStream inputStream,
String description,
String pathOrURL)
Note: This method is less efficient than
openDocument(String pathname) or openDocument(URL location) as it
may have to do intermediary data copying, using more memory.
inputStream - InputStream containing a valid PDF document.description - When in the GUI for describing this document.pathOrURL - Either a file path, or file name, or URL, describing the
origin of the PDF file. This is typically null. If non-null, it is
used to populate the default file name in the File..Save a Copy
dialog summoned in saveFile()
public void openDocument(byte[] data,
int offset,
int length,
String description,
String pathOrURL)
data - Byte array containing a valid PDF document.offset - the index into the byte array where the PDF data beginslength - the number of bytes in the byte array belonging to the PDF datadescription - When in the GUI for describing this document.pathOrURL - Either a file path, or file name, or URL, describing the
origin of the PDF file. This is typically null. If non-null, it is
used to popu