Class InfoWindow

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
AppInfoWindow, ModuleInfoWindow, ViewWindow

public abstract class InfoWindow extends JFrame
An abstract superclass for windows that display information and can be saved to a file.
Author:
Gary McGath
See Also:
  • Field Details

  • Constructor Details

    • InfoWindow

      public InfoWindow(String title, App app, JhoveBase base) throws HeadlessException
      Constructor. The window is created with a File menu that has "Save as" and "Close" items.
      Parameters:
      title - Window title. Will be truncated to 32 characters.
      app - The associated App object.
      base - The associated JhoveBase object.
      Throws:
      HeadlessException
  • Method Details

    • setSaveActionListener

      protected void setSaveActionListener(ActionListener listener)
      Sets the ActionListener for the "Save as" menu item. Subclasses need to call this with an appropriate ActionListener in order to make the menu item functional.
    • doSaveDialog

      protected PrintWriter doSaveDialog()
      Puts up a dialog to save the file. If the user requests a file, deletes any old file with the same name, creates the new file, and returns a PrintWriter to the file. The save dialog is customized with two JComboBoxes. One lets the user select a character encoding, which is used by the PrintWriter; the other lets the user choose an OutputHandler to control the output format (e.g., text or HTML). The encodings shown in a JComboBox are UTF-8, ISO-8859-1, Cp1252, MacRoman, and the default encoding for the locale (if different from the above), but the user can type in other encodings. If an unknown encoding is selected, an error dialog will be displayed. OutputHandlers other than the ones known to the application can't be specified (what would the application do with them?)
    • selectHandler

      protected OutputHandler selectHandler()
      Sets up the OutputHandler from the JComboBox and returns it. Subclasses should call selectHandler to obtain an OutputHandler with which to produce data.
    • closeFromMenu

      protected void closeFromMenu()
      Handler for the "Close" menu item. Simply hides the window without deleting it.