Class BasicSessionControl
java.lang.Object
com.sun.javatest.exec.BasicSessionControl
- All Implemented Interfaces:
ET_Control, com.sun.javatest.exec.ET_RunTestControl.Observer, ET_SessionControl, InterviewEditor.Observer, Session.Observer
public class BasicSessionControl
extends Object
implements InterviewEditor.Observer, com.sun.javatest.exec.ET_RunTestControl.Observer, ET_SessionControl, Session.Observer
Class that encapsulate logic of user's actions on update session:
operations on configuration and work directory.
Some methods are added to preserve old functionality...
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classEvent to be sent out when Editor become visible/invisibleprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextManagerprotected InterviewEditorprotected JComponentprotected final SessionExtprotected JPanelprotected final TestSuiteprotected UIFactory -
Constructor Summary
ConstructorsConstructorDescriptionBasicSessionControl(JComponent parent, UIFactory uif, TestSuite ts, ContextManager cm) Creates a control over new created session for the passed test suite. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidApplies value of the selected work directory.voidInterviewEditor.Observer method.voidchangedVisibility(boolean isVisible, InterviewEditor editor) InterviewEditor.Observer method.protected voidcheckExcludeListUpdate(JComponent parent, boolean quietIfNoUpdate, Parameters params) static Parametersclone(Parameters p) Clones passed parameters.voidCauses a series of actions to be performed to complete configuration:
If session is already ready - does nothing.
If work directory is not set - suggests creating or opening one
Opens configuration editor.protected SessionExtCreates an empty configuration for the test suite.protected InterviewEditorCreates an InterviewEditor instance.protected ToolActionprotected JPanelprotected ToolActionprotected booleancreateWD()Causes the dialog for new directory creating to appear.voiddispose()voidedit()Causes configuration editor to appear.voidvoidInvoked when runTestHandler completed test executiongetMenu()Returts menu to be added to the menu marprotected booleanReturns the session object under controlReturns list of actions to be added to the tool barprotected UIFactoryMethod returning UIFactory to be used to create InterviewEditor instance.Returns the panel reflecting the current state of the sessionprotected voidprotected booleanInitializes interviewEditor.protected voidbooleanprotected booleanvoidRestores saved state from the mapvoidTries to restore latest available configuration for the session.voidSaves current state to the mapprotected booleansetWD()Causes the dialog for work directory selecting to appear.protected voidprotected voidvoidInvoked when runTestHandler is going to start test executionvoidupdated(Session.Event ev) Invoked when state of config has changedvoidInvoked when some change has happenedvoid
-
Field Details
-
session
-
testSuite
-
uif
-
parent
-
sessionView
-
interviewEditor
-
cm
-
-
Constructor Details
-
BasicSessionControl
public BasicSessionControl(JComponent parent, UIFactory uif, TestSuite ts, ContextManager cm) throws Session.Fault Creates a control over new created session for the passed test suite.- Parameters:
parent-uif-ts-cm-- Throws:
Session.Fault
-
-
Method Details
-
clone
Clones passed parameters. Works only for InterviewParameters instances.- Parameters:
p- instance to clone, might be null.- Returns:
- cloned object obtained for the passed one by performing save/load operations.
- Throws:
Session.Fault
-
getSession
Returns the session object under control- Specified by:
getSessionin interfaceET_SessionControl- Returns:
- The session associated with this instance.
-
getViewComponent
Returns the panel reflecting the current state of the session- Specified by:
getViewComponentin interfaceET_SessionControl
-
getToolBarActionList
Description copied from interface:ET_ControlReturns list of actions to be added to the tool bar- Specified by:
getToolBarActionListin interfaceET_Control
-
save
Description copied from interface:ET_ControlSaves current state to the map- Specified by:
savein interfaceET_Control
-
restore
Description copied from interface:ET_ControlRestores saved state from the map- Specified by:
restorein interfaceET_Control
-
dispose
public void dispose()- Specified by:
disposein interfaceET_Control
-
createEmptySession
Creates an empty configuration for the test suite. By default BasicSession is used. It's supposed for subclasses to override this method.- Returns:
- created session.
- Throws:
Session.Fault
-
ensureInterviewUpToDate
public void ensureInterviewUpToDate() -
startTests
Invoked when runTestHandler is going to start test execution- Specified by:
startTestsin interfacecom.sun.javatest.exec.ET_RunTestControl.Observer
-
finishTests
Invoked when runTestHandler completed test execution- Specified by:
finishTestsin interfacecom.sun.javatest.exec.ET_RunTestControl.Observer
-
whatToDoWhenConfigNotReadyButUserPressedStartButton
-
checkExcludeListUpdate
protected void checkExcludeListUpdate(JComponent parent, boolean quietIfNoUpdate, Parameters params) -
getNeedToAutoCheckExcludeList
-
getMenu
Description copied from interface:ET_ControlReturts menu to be added to the menu mar- Specified by:
getMenuin interfaceET_Control
-
initEditor
protected boolean initEditor()Initializes interviewEditor.- Returns:
- true if initialized successfully, false if failed.
-
createInterviewEditor
Creates an InterviewEditor instance. Subclasses might override this method to create an alternative editor.- Parameters:
ip- parameters to be edited
-
getUIFactory
Method returning UIFactory to be used to create InterviewEditor instance. -
edit
public void edit()Causes configuration editor to appear. If workdir is not set, suggests to create one first.- Specified by:
editin interfaceET_SessionControl
-
configure
public void configure()Causes a series of actions to be performed to complete configuration:
If session is already ready - does nothing.
If work directory is not set - suggests creating or opening one
Opens configuration editor.- Specified by:
configurein interfaceET_SessionControl
-
isConfiguring
public boolean isConfiguring()- Specified by:
isConfiguringin interfaceET_SessionControl- Returns:
- true if configure() method is running or configuration is editing.
-
showWorkDirDialog
protected void showWorkDirDialog() -
showConfigureDialog
protected void showConfigureDialog() -
initActions
protected void initActions() -
createNewWorkDirAction
-
createSetWorkDirAction
-
initHistoryListeners
protected void initHistoryListeners() -
createSessionView
-
updateGUI
public void updateGUI()Description copied from interface:ET_ControlInvoked when some change has happened- Specified by:
updateGUIin interfaceET_Control
-
isEditorVisible
protected boolean isEditorVisible()- Returns:
- true if user has an interview editor open.
-
changed
InterviewEditor.Observer method. Invoked when current session has changed from InterviewEditor- Specified by:
changedin interfaceInterviewEditor.Observer- Parameters:
p-
-
changedVisibility
InterviewEditor.Observer method. Invoked when InterviewEditor is made either visible or invisible. Implementations call updateGUI() to enable/disable actions.- Specified by:
changedVisibilityin interfaceInterviewEditor.Observer- Parameters:
isVisible- - true or falseeditor- editor that changed the state
-
createWD
protected boolean createWD()Causes the dialog for new directory creating to appear. Invoked from createNewWorkDirAction. Subclasses might override this method to perform extra actions associated with creating new work directory, like setting template.- Returns:
- true if configuration editing is required after WorkDir created
-
setWD
protected boolean setWD()Causes the dialog for work directory selecting to appear. Invoked from createSetWorkDirAction. Subclasses might override this method to perform extra actions associated with setting work directory, like setting template.- Returns:
- true if configuration editing is required after WorkDir set
-
applyWorkDir
Applies value of the selected work directory.- Parameters:
wd-
-
restoreConfigFromWD
Tries to restore latest available configuration for the session.- Parameters:
wd-- Throws:
Session.Fault
-
updated
Description copied from interface:Session.ObserverInvoked when state of config has changed- Specified by:
updatedin interfaceSession.Observer- Parameters:
ev- - Event describing the change
-