Class InterviewEditor


  • public class InterviewEditor
    extends ToolDialog
    Dialog to edit InterviewParameters object. InterviewEditor keeps reference to the main InterviewParameters object, but never change it.
    Before editing interview the main InterviewParameters object is synced with the view object.
    When view object is loaded or saved, all registered observers are notified.
    • Method Detail

      • getExtention

        protected java.lang.String getExtention()
        Returns extension for files to be saved. Subclasses like TemplateEditor might override this method.
        Returns:
        default extension
      • getHistoryFileName

        protected java.lang.String getHistoryFileName()
        Returns file name to store history of configuration files. This implementation returns "configHistory.jtl". Subclasses might override this method to return alternative value.
      • getRestorerWindowKey

        protected java.lang.String getRestorerWindowKey​(boolean isFullView)
      • newConfig

        public void newConfig()
        Starts editing new config. Supposed to be called outside.
      • edit

        public void edit​(int mode)
        Show dialog.
      • getFileChooserMode

        public int getFileChooserMode()
        Returns:
        mode that will be used by WorkDirChooseTool to select file.
      • loadConfig

        public void loadConfig()
        Show choose file dialog and then load new file. Supposed to be invoked from outside of editor. Doesn't expect that viewConfig can be changed.
      • loadConfig0

        protected void loadConfig0​(boolean ask)
        Show choose file dialog and then load new file. The dialog depends on fileChooserMode setting. It can be either simple JFileChooser or "advanced" home made file chooser.
        Parameters:
        ask - if true, dialog asking whether to save changes will appear in case of unsaved changes.
      • loadAndEdit

        public void loadAndEdit​(java.io.File f)
        Parameters:
        f -
      • loadConfigFromFile

        public void loadConfigFromFile​(java.io.File file)
        Updates viewConfig, notifies observers of the change.
        Parameters:
        file - File to load.
      • save

        public void save()
      • saveAs

        public void saveAs()
      • doSave

        protected void doSave​(java.io.File file)
                       throws Interview.Fault,
                              java.io.IOException
        Does actual save work. should be overriden, when needed.
        Throws:
        Interview.Fault
        java.io.IOException
      • revert

        public void revert()
      • setRunPending

        public void setRunPending​(boolean b)
      • isRunPending

        public boolean isRunPending()
      • show

        public void show()
      • updateMenu

        public void updateMenu()
      • show

        public void show​(int mode)
      • show

        public void show​(java.awt.event.ActionListener closeListener)
      • show

        public void show​(int mode,
                         java.awt.event.ActionListener closeListener,
                         boolean isTemplateMode)
      • setVisible

        public void setVisible​(boolean isVisible)
        Description copied from class: ToolDialog
        Specify whether the dialog should be made visible on the screen or not.
        Overrides:
        setVisible in class ToolDialog
        Parameters:
        isVisible - True if the dialog should be made visible, false if is should be made invisible.
        See Also:
        ToolDialog.isVisible()
      • close

        public void close()
      • doClose

        public void doClose()
      • windowClosingAction

        protected void windowClosingAction​(java.awt.AWTEvent e)
        Description copied from class: ToolDialog
        this method invokes in Window/JInternalFrame listener (depends on dialog variable instance). Should be overwritten in subclass if you want to handle window closing event. You may need to change default close operation first for this event to be fired
        Overrides:
        windowClosingAction in class ToolDialog
      • setCheckExcludeListListener

        public void setCheckExcludeListListener​(java.awt.event.ActionListener l)
      • equal

        public static boolean equal​(InterviewParameters a,
                                    InterviewParameters b)
        Compares two InterviewParameters objects for equivalence. Two interview are equivalent when they both provide the same set of questions and all corresponding questions have the same values.
        Parameters:
        a - first interview
        b - second interview
        Returns:
        true, iff two interviews are equivalent.
      • addObserver

        public void addObserver​(InterviewEditor.Observer o)
        Registers new observer
        Parameters:
        o - - observer to be added to the list
      • removeObserver

        public void removeObserver​(InterviewEditor.Observer o)
        Removes observer from the list
        Parameters:
        o - - observer to be removed from the list
      • notifyObservers

        protected void notifyObservers()
        Notifies registered observers of the change happened to viewConfig
      • notifyObserversOfVisibility

        protected void notifyObserversOfVisibility​(boolean isVisible)
        Notifies registered observers of setVisible() method has been called.
      • dispose

        public void dispose()
        Description copied from class: ToolDialog
        Dispose of any window system resources used by the dialog. The client-supplied components (menu bar, body, buttons) are not disposed, meaning the dialog can be made visible again, if desired. To dispose the client components, subtype this method.
        Overrides:
        dispose in class ToolDialog
      • initGUI

        protected void initGUI()
        Description copied from class: ToolDialog
        Initialize the GUI, by calling the various setXXX methods.
        Specified by:
        initGUI in class ToolDialog
      • createFileMenu

        protected javax.swing.JMenu createFileMenu()
      • updateTitle

        protected void updateTitle()
      • perform

        protected void perform​(java.lang.String cmd)
      • setCustomRenderers

        public void setCustomRenderers​(java.util.Map renderersMap)