*/
    public void closeDocument() {
        // Clear the SearchPane, but also stop any search in progress
        if (searchPanel != null)
            searchPanel.setDocument(null);

        if (thumbnailsPanel != null)
            thumbnailsPanel.setDocument(null);

        // set the default cursor.  
        documentViewController.closeDocument();

        // clear search controller caches.
        documentSearchController.dispose();

        // free the document
        if (document != null) {
            document.dispose();
            document = null;
        }

        // remove the page numbers in the go to page combo box in the mainToolbar
        if (currentPageNumberTextField != null)
            currentPageNumberTextField.setText("");
        if (numberOfPagesLabel != null)
            numberOfPagesLabel.setText("");
        if (currentPageNumberTextField != null)
            currentPageNumberTextField.setEnabled(false);
        if (statusLabel != null)
            statusLabel.setText(" ");
        // set the scale level back to 100%, default
        if (zoomComboBox != null)
            zoomComboBox.setSelectedItem(NumberFormat.getPercentInstance().format(1.0));
        // update thew view to show no pages in the view
        updateDocumentView();

        TreeModel treeModel = (outlinesTree != null) ? outlinesTree.getModel() : null;
        if (treeModel != null) {
            OutlineItemTreeNode root = (OutlineItemTreeNode) treeModel.getRoot();
            if (root != null)
                root.recursivelyClearOutlineItems();
            outlinesTree.getSelectionModel().clearSelection();
            outlinesTree.getSelectionModel().setSelectionPath(null);
            outlinesTree.setSelectionPath(null);
            outlinesTree.setModel(null);
        }
        setUtilityPaneVisible(false);
        if (viewer != null) {
            viewer.setTitle(messageBundle.getString("viewer.window.title.default"));
            viewer.invalidate();
            viewer.validate();
            viewer.getContentPane().repaint();
        }

        reflectStateInComponents();
    }