-
- All Superinterfaces:
EventListener,PropertyChangeListener
- All Known Implementing Classes:
SwingController
public interface Controller extends PropertyChangeListener
A Controller is the glue between the model and view components. These methods allow the different parts of the view to remain in lock-step with each other and have access to the model, as necessary- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classController.SaveMode
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddispose()Dispose the controller and all associated resources.voidfollowDestinationItem(NameTreeNode node)Interprets the NameTreeNode loading ans displaying any associated Destination values.voidfollowOutlineItem(OutlineItemTreeNode node)Interprets the OutlineItemTreeNode loading ans displaying any associated Destination values.intgetCurrentPageNumber()When viewing a PDF file, one or more pages may be viewed at a single time, but this page is the single page which is most predominantly being displayed.DocumentgetDocument()A Document is the root of the object hierarchy, giving access to the contents of a PDF file.DocumentSearchControllergetDocumentSearchController()Gets controller responsible for the document text searches.DocumentViewControllergetDocumentViewController()Gets controller responsible for Page view UI interaction.ResourceBundlegetMessageBundle()Gets the message bundle used by this class.PrintHelperFactorygetPrintHelperFactory()ViewerPropertiesManagergetPropertiesManager()Gets the properties manager used to build a dynamically created UI.FramegetViewerFrame()Not all uses of Controller would result in there existing a Viewer Frame, so this may well return null.ViewModelgetViewModel()Gets the model for the controller.WindowManagementCallbackgetWindowManagementCallback()Gets the window manager callback.voidgoToDeltaPage(int delta)Adds delta to the ViewerModel's current page index, and updates the display to show the newly selected page.booleanhavePermissionToExtractContent()Check to see if document has permission to extract content.booleanhavePermissionToModifyDocument()Check to see if document can be modified.booleanhavePermissionToPrint()Check to see if document has permission to be printed.voidopenDocument(byte[] data, int offset, int length, String description, String pathOrURL)Opens a Document via the specified byte array.voidopenDocument(InputStream inputStream, String description, String pathOrURL)Opens a Document via the specified InputStream.voidopenDocument(String pathname)Open a file specified by the given path name.voidopenDocument(URL location)Open a URL specified by the location variable.voidopenDocument(Document embeddedDocument, String fileName)Load the specified file in a new Viewer RI window.voidopenFileInSomeViewer(String filename)Opens the specified file in a new window if the window manager is present.voidprint(boolean showDialog)Print the given documentvoidprintAndExit(boolean showDialog, String printer)Prints the document with the given printer, assuming we're exiting after thatvoidsaveFile()Save the filevoidsaveFileAs()Save the file with a new namevoidsetAnnotationEditMode(boolean enabled)Sets visibility of the form highlight functionality ot hte opposite of what it was.voidsetDocumentToolMode(int toolType)Sets the tool mode used for the controller view.voidsetWindowManagementCallback(WindowManagementCallback wm)Set the window manager callback for multi window support.voidshowAnnotationProperties(AnnotationComponent annotationComponent)Show tabbed pane interface for annotation properties.voidshowAnnotationProperties(AnnotationComponent annotationComponent, Frame frame)Show tabbed pane interface for annotation properties.voidshowViewerPreferences(String selectedTab)Show tabbed pane interface for viewer preferences, info, security and fonts.-
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
-
-
-
-
Method Detail
-
getPrintHelperFactory
PrintHelperFactory getPrintHelperFactory()
- Returns:
- The PrintHelperFactory used to create print helpers
-
getDocument
Document getDocument()
A Document is the root of the object hierarchy, giving access to the contents of a PDF file. Significantly, getDocument().getCatalog().getPageTree().getPage(int pageNumber) gives access to each Page, so that it might be drawn.- Returns:
- Document root of the PDF file.
-
getViewModel
ViewModel getViewModel()
Gets the model for the controller. Most data is actually stored in the documentViewModel.- Returns:
- controller model
-
getCurrentPageNumber
int getCurrentPageNumber()
When viewing a PDF file, one or more pages may be viewed at a single time, but this page is the single page which is most predominantly being displayed.- Returns:
- The zero-based index of the current Page being displayed
-
getDocumentViewController
DocumentViewController getDocumentViewController()
Gets controller responsible for Page view UI interaction.- Returns:
- document view controller.
-
getDocumentSearchController
DocumentSearchController getDocumentSearchController()
Gets controller responsible for the document text searches.- Returns:
- page view controller.
-
setDocumentToolMode
void setDocumentToolMode(int toolType)
Sets the tool mode used for the controller view. Tools such as text selection, panning and annotation selection can be used.- Parameters:
toolType- tool mode constants defined in DocumentViewModel
-
getMessageBundle
ResourceBundle getMessageBundle()
Gets the message bundle used by this class. Message bundle resources are loaded via the JVM default locale.- Returns:
- message bundle used by this class.
-
getPropertiesManager
ViewerPropertiesManager getPropertiesManager()
Gets the properties manager used to build a dynamically created UI.- Returns:
- currently properties manager instance.
-
showAnnotationProperties
void showAnnotationProperties(AnnotationComponent annotationComponent)
Show tabbed pane interface for annotation properties.- Parameters:
annotationComponent- annotation to show properties of.
-
setAnnotationEditMode
void setAnnotationEditMode(boolean enabled)
Sets visibility of the form highlight functionality ot hte opposite of what it was.- Parameters:
enabled- true to enable mode; otherwise, false;
-
showAnnotationProperties
void showAnnotationProperties(AnnotationComponent annotationComponent, Frame frame)
Show tabbed pane interface for annotation properties.- Parameters:
annotationComponent- annotation to show properties of.frame- parent frame for centering dialog.
-
getViewerFrame
Frame getViewerFrame()
Not all uses of Controller would result in there existing a Viewer Frame, so this may well return null.- Returns:
- parent frame if one.
-
goToDeltaPage
void goToDeltaPage(int delta)
Adds delta to the ViewerModel's current page index, and updates the display to show the newly selected page. A positive delta indicates moving to later pages, and a negative delta would move to a previous page- Parameters:
delta- Signed integer that's added to the current page index- See Also:
DocumentViewControllerImpl.getCurrentPageIndex(),DocumentViewControllerImpl.setCurrentPageIndex(int)
-
showViewerPreferences
void showViewerPreferences(String selectedTab)
Show tabbed pane interface for viewer preferences, info, security and fonts.- Parameters:
selectedTab- tab to select, PropertiesManager.PROPERTY_SHOW_PREFERENCES_GENERAL
-
havePermissionToExtractContent
boolean havePermissionToExtractContent()
Check to see if document has permission to extract content.- Returns:
- true if content extraction should be limited.
-
havePermissionToPrint
boolean havePermissionToPrint()
Check to see if document has permission to be printed.- Returns:
- true if content printing should be allowed.
-
havePermissionToModifyDocument
boolean havePermissionToModifyDocument()
Check to see if document can be modified.- Returns:
- true if content editing is allowed.
-
print
void print(boolean showDialog)
Print the given document- Parameters:
showDialog- If true show a print dialog before starting to print
-
printAndExit
void printAndExit(boolean showDialog, String printer)Prints the document with the given printer, assuming we're exiting after that- Parameters:
showDialog- If true show a print dialog before starting to printprinter- The name of the printer
-
saveFile
void saveFile()
Save the file
-
saveFileAs
void saveFileAs()
Save the file with a new name
-
dispose
void dispose()
Dispose the controller and all associated resources.
-
openDocument
void openDocument(byte[] data, int offset, int length, String description, String pathOrURL)Opens a Document via the specified byte array.- Parameters:
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 populate the default file name in the File..Save a Copy dialog summoned in saveFile()
-
openDocument
void openDocument(InputStream inputStream, String description, String pathOrURL)
Opens a Document via the specified InputStream. This method is a convenience method provided for backwards compatibility.
Note: This method is less efficient than
openDocument(String)oropenDocument(URL)as it may have to do intermediary data copying, using more memory.- Parameters:
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()
-
openDocument
void openDocument(String pathname)
Open a file specified by the given path name.- Parameters:
pathname- String representing a valid file path
-
openDocument
void openDocument(URL location)
Open a URL specified by the location variable.- Parameters:
location- location of a valid PDF document
-
openDocument
void openDocument(Document embeddedDocument, String fileName)
Load the specified file in a new Viewer RI window.- Parameters:
embeddedDocument- document to load in ne windowfileName- file name of the document in question
-
openFileInSomeViewer
void openFileInSomeViewer(String filename)
Opens the specified file in a new window if the window manager is present. If not the current document is closed and this path opened.- Parameters:
filename- file name to open.
-
setWindowManagementCallback
void setWindowManagementCallback(WindowManagementCallback wm)
Set the window manager callback for multi window support.- Parameters:
wm- windows callback
-
getWindowManagementCallback
WindowManagementCallback getWindowManagementCallback()
Gets the window manager callback.- Returns:
- current window manager call back, can be null.
-
followOutlineItem
void followOutlineItem(OutlineItemTreeNode node)
Interprets the OutlineItemTreeNode loading ans displaying any associated Destination values.- Parameters:
node- node to interpret and navigate to.
-
followDestinationItem
void followDestinationItem(NameTreeNode node)
Interprets the NameTreeNode loading ans displaying any associated Destination values.- Parameters:
node- node to interpret and navigate to.
-
-