com.sun.javatest.exec
Class InterviewEditor

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


Nested Class Summary
static interface InterviewEditor.Observer
          For private communication with SessionControl, not for broadcast outside of core JT.
 
Nested classes/interfaces inherited from class com.sun.javatest.tool.ToolDialog
ToolDialog.Restorer
 
Field Summary
protected  ContextManager contextManager
           
static int DEFAULT_MODE
           
protected  java.lang.String ext
           
static int FULL_MODE
           
protected  InterviewParameters mainConfig
           
static int STD_CONCURRENCY_MODE
           
static int STD_ENVIRONMENT_MODE
           
static int STD_EXCLUDE_LIST_MODE
           
static int STD_KEYWORDS_MODE
           
static int STD_MODE
           
static int STD_PRIOR_STATUS_MODE
           
static int STD_TESTS_MODE
           
static int STD_TIMEOUT_FACTOR_MODE
           
static int TEMPLATE_FULL_MODE
           
protected  boolean templateMode
          Deprecated.  
protected  InterviewParameters viewConfig
           
 
Fields inherited from class com.sun.javatest.tool.ToolDialog
DIALOG, FRAME, FREE, MODAL, MODAL_APPLICATION, MODAL_DOCUMENT, MODAL_TOOLKIT, parent, tool, uif
 
Constructor Summary
InterviewEditor(javax.swing.JComponent parent, UIFactory uif, InterviewParameters ip)
           
InterviewEditor(javax.swing.JComponent parent, UIFactory uif, InterviewParameters ip, ContextManager cm)
           
 
Method Summary
 void addObserver(InterviewEditor.Observer o)
          Registers new observer
static java.io.File checkLoadConfigFileDefaults(ContextManager cm)
          Checks default settings relate to config file load fron the default location
 void close()
           
static void copy(InterviewParameters from, InterviewParameters to)
           
protected  javax.swing.JMenu createFileMenu()
           
 void dispose()
          Dispose of any window system resources used by the dialog.
 void doClose()
           
protected  void doSave(java.io.File file)
          Does actual save work.
 void edit(int mode)
          Show dialog.
static boolean equal(InterviewParameters a, InterviewParameters b)
          Compares two InterviewParameters objects for equivalence.
protected  java.lang.String getExtention()
          Returns extension for files to be saved.
 int getFileChooserMode()
           
protected  java.lang.String getHistoryFileName()
          Returns file name to store history of configuration files.
protected  java.lang.String getRestorerWindowKey(boolean isFullView)
           
protected  void initGUI()
          Initialize the GUI, by calling the various setXXX methods.
 boolean isRunPending()
           
 void loadAndEdit(java.io.File f)
           
 void loadConfig()
          Show choose file dialog and then load new file.
protected  void loadConfig0(boolean ask)
          Show choose file dialog and then load new file.
 void loadConfigFromFile(java.io.File file)
          Updates viewConfig, notifies observers of the change.
 void newConfig()
          Starts editing new config.
protected  void notifyObservers()
          Notifies registered observers of the change happened to viewConfig
protected  void notifyObserversOfVisibility(boolean isVisible)
          Notifies registered observers of setVisible() method has been called.
protected  void perform(java.lang.String cmd)
           
 void removeObserver(InterviewEditor.Observer o)
          Removes observer from the list
 void revert()
           
 void save()
           
 void saveAs()
           
 void setCheckExcludeListListener(java.awt.event.ActionListener l)
           
 void setCustomRenderers(java.util.Map renderersMap)
           
 void setRunPending(boolean b)
           
 void setVisible(boolean isVisible)
          Specify whether the dialog should be made visible on the screen or not.
 void show()
           
 void show(java.awt.event.ActionListener closeListener)
           
 void show(int mode)
           
 void show(int mode, java.awt.event.ActionListener closeListener, boolean isTemplateMode)
           
 void updateMenu()
           
protected  void updateTitle()
           
protected  void windowClosingAction(java.awt.AWTEvent e)
          this method invokes in Window/JInternalFrame listener (depends on dialog variable instance).
 
Methods inherited from class com.sun.javatest.tool.ToolDialog
disableDefaultDisposeHandler, getBody, getButtons, getDefaultButton, getDialogParent, getJMenuBar, getLocation, getRestorer, getSize, getTitle, getTool, isShowing, isVisible, pack, setBody, setButtons, setComponentListener, setDefaultCloseOperation, setHelp, setI18NTitle, setI18NTitle, setI18NTitle, setJMenuBar, setLocation, setLocation, setRestorer, setSize, setSize, setTool, setTool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MODE

public static final int DEFAULT_MODE
See Also:
Constant Field Values

FULL_MODE

public static final int FULL_MODE
See Also:
Constant Field Values

STD_MODE

public static final int STD_MODE
See Also:
Constant Field Values

STD_TESTS_MODE

public static final int STD_TESTS_MODE
See Also:
Constant Field Values

STD_EXCLUDE_LIST_MODE

public static final int STD_EXCLUDE_LIST_MODE
See Also:
Constant Field Values

STD_KEYWORDS_MODE

public static final int STD_KEYWORDS_MODE
See Also:
Constant Field Values

STD_PRIOR_STATUS_MODE

public static final int STD_PRIOR_STATUS_MODE
See Also:
Constant Field Values

STD_ENVIRONMENT_MODE

public static final int STD_ENVIRONMENT_MODE
See Also:
Constant Field Values

STD_CONCURRENCY_MODE

public static final int STD_CONCURRENCY_MODE
See Also:
Constant Field Values

STD_TIMEOUT_FACTOR_MODE

public static final int STD_TIMEOUT_FACTOR_MODE
See Also:
Constant Field Values

TEMPLATE_FULL_MODE

public static final int TEMPLATE_FULL_MODE
See Also:
Constant Field Values

templateMode

@Deprecated
protected boolean templateMode
Deprecated. 
Will be eliminated in the next release.


contextManager

protected ContextManager contextManager

mainConfig

protected InterviewParameters mainConfig

viewConfig

protected InterviewParameters viewConfig

ext

protected java.lang.String ext
Constructor Detail

InterviewEditor

public InterviewEditor(javax.swing.JComponent parent,
                       UIFactory uif,
                       InterviewParameters ip)

InterviewEditor

public InterviewEditor(javax.swing.JComponent parent,
                       UIFactory uif,
                       InterviewParameters ip,
                       ContextManager cm)
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)

copy

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

checkLoadConfigFileDefaults

public static java.io.File checkLoadConfigFileDefaults(ContextManager cm)
Checks default settings relate to config file load fron 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:
ContextManager.setDefaultConfigLoadPath(java.io.File), ContextManager.setAllowConfigLoadOutsideDefault(boolean state), ContextManager.getDefaultConfigLoadPath(), ContextManager.getAllowConfigLoadOutsideDefault()

setCustomRenderers

public void setCustomRenderers(java.util.Map renderersMap)


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.