Class InterviewEditor

java.lang.Object
com.sun.javatest.tool.ToolDialog
com.sun.javatest.exec.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.

  • Field Details

  • Constructor Details

  • Method Details

    • 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.
    • copy

      public static void copy(InterviewParameters from, InterviewParameters to) throws Interview.Fault
      Throws:
      Interview.Fault
    • checkLoadConfigFileDefaults

      public static File checkLoadConfigFileDefaults(ContextManager cm)
      Checks default settings relate to config file load from the default location
      Parameters:
      cm - ContextManager object defining current harness' context. The following methods affect this method functionality:
      • getDefaultConfigLoadPath()
      • getAllowConfigLoadOutsideDefault()
      Throws:
      IllegalArgumentException - if the following configuration errors found:
      • getDefaultConfigLoadPath() returns null when getAllowConfigLoadOutsideDefault() returns false
      • getDefaultConfigLoadPath() returns not absolute path
      • getDefaultConfigLoadPath() returns a file (not a directory)
      See Also:
    • getExtention

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

      protected 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 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(File f)
      Parameters:
      f -
    • loadConfigFromFile

      public void loadConfigFromFile(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(File file) throws Interview.Fault, IOException
      Does actual save work. should be overridden, when needed.
      Throws:
      Interview.Fault
      IOException
    • revert

      public void revert()
    • isRunPending

      public boolean isRunPending()
    • setRunPending

      public void setRunPending(boolean b)
    • show

      public void show()
    • updateMenu

      public void updateMenu()
    • show

      public void show(int mode)
    • show

      public void show(ActionListener closeListener)
    • show

      public void show(int mode, 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:
    • close

      public void close()
    • doClose

      public void doClose()
    • windowClosingAction

      protected void windowClosingAction(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(ActionListener l)
    • 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 JMenu createFileMenu()
    • updateTitle

      protected void updateTitle()
    • perform

      protected void perform(String cmd)
    • setCustomRenderers

      public void setCustomRenderers(Map<Class<? extends Question>,com.sun.interview.wizard.QuestionRenderer> renderersMap)