com.ptc.windchill.upgrade.tool
Class AbstractStateWithThreadedWork

java.lang.Object
  extended bycom.ptc.windchill.upgrade.util.fsm.State
      extended bycom.ptc.windchill.upgrade.tool.AbstractState
          extended bycom.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
Direct Known Subclasses:
AddConstraintsCompleted, AddConstraintsState, AdvanceToNextStep, CompareSchemaCompleted, CompareSchemaState, ConfirmVersionState, NoIusToBeAppliedState, PhaseCompleted, ProgressViewState, QueueUpgradeEvolvableObjectsState, ReportCanceled, RetrievingState, UpgradeSchemaCompleted, UpgradeSchemaState, VerifySolutionsInstalled

public abstract class AbstractStateWithThreadedWork
extends AbstractState


Nested Class Summary
(package private) static class AbstractState.NonExpressPhaseDone
           
(package private) static class AbstractStateWithThreadedWork.Cancel
           
static class AbstractStateWithThreadedWork.IsStateWithThreadedWorkDone
           
static class AbstractStateWithThreadedWork.IsThreadedWorkRunningAndNotCanceled
           
 class AbstractStateWithThreadedWork.Outcome
          Result object for threaded work.
static class AbstractStateWithThreadedWork.WasThreadedWorkOutcomeSuccessful
           
 
Field Summary
private  ThreadedCancelConfirmPrompt cancelConfirmPrompt_
           
private  AbstractStateWithThreadedWork.Outcome outcome_
           
private  Thread workerThread_
           
 
Fields inherited from class com.ptc.windchill.upgrade.util.fsm.State
 
Constructor Summary
AbstractStateWithThreadedWork(StateMachine sm, StateDefinition def)
           
AbstractStateWithThreadedWork(StateMachine sm, StateDefinition def, String title)
           
 
Method Summary
protected  void activate(Event activating_event)
          IF YOU OVERRIDE, YOU MUST CALL, super.activate(...); Already overwrites due to: extends AbstractState -to- State
protected  void clearStatus()
           
private  void closeCancelPrompt()
           
protected  void deactivate(Event deactivating_event)
          IF YOU OVERRIDE, YOU MUST CALL, super.deactivate(...); Already overwrites due to: extends AbstractState -to- State
protected static UpgradeManager getApplication()
           
private  ThreadedCancelConfirmPrompt getCancelConfirmPrompt()
           
private  ThreadedCancelConfirmPrompt getCancelConfirmPrompt(boolean create_if_null)
           
protected  CancellationMonitor getCancellationMonitor()
          Provide the cancellation monitor to subtypes if they want it(rather than pass it to them).
protected  String getCancelPromptMessage()
          Subtypes MAY override this to provide a cancel prompt message that differs from the default "Are you sure that you'd like to cancel?" Subtypes should not call super.getCancelPromptMessage() if they override.
protected  String getCancelPromptTitle()
          Subtypes MAY override this to provided a cancel prompt title that differs from the default "Cancel &060;title&062;?" Subtypes should not call super.getCancelPromptTitle() if they override.
 String getTitle()
           
(package private) abstract  JComponent getViewComponent()
           
private  boolean isThreadedWorkFinished()
           
private  void markThreadedWorkFinished()
          Once called, cancel confirm prompt may not be opened (even if cancel reaction is invoked.
protected  void onCancelRequested()
          Provided to allow subtypes to do stuff when cancellation has been confirmed.
private  void requestCancel()
           
protected abstract  AbstractStateWithThreadedWork.Outcome runThreadedWork()
          Subtypes must implement to perform work upon state activation.
(package private)  void setApplication(UpgradeManager x)
           
protected  void setStatus(String status_message)
          Displays the messgae provided by some of the phases of what is currently being done.
protected  boolean shouldBeEnclosed()
          Can be overriden by sub-classes.
 String toString()
           
 
Methods inherited from class com.ptc.windchill.upgrade.util.fsm.State
getStateMachine, getStateMachine, isStartState, isStopState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cancelConfirmPrompt_

private ThreadedCancelConfirmPrompt cancelConfirmPrompt_

workerThread_

private Thread workerThread_

outcome_

private AbstractStateWithThreadedWork.Outcome outcome_
Constructor Detail

AbstractStateWithThreadedWork

public AbstractStateWithThreadedWork(StateMachine sm,
                                     StateDefinition def)

AbstractStateWithThreadedWork

public AbstractStateWithThreadedWork(StateMachine sm,
                                     StateDefinition def,
                                     String title)
Method Detail

runThreadedWork

protected abstract AbstractStateWithThreadedWork.Outcome runThreadedWork()
                                                                  throws Throwable
Subtypes must implement to perform work upon state activation.

Returns:
MUST BE NON-NULL
Throws:
Throwable

onCancelRequested

protected void onCancelRequested()
Provided to allow subtypes to do stuff when cancellation has been confirmed. No need to call super.onCancelRequested if overridden


getCancelPromptTitle

protected String getCancelPromptTitle()
Subtypes MAY override this to provided a cancel prompt title that differs from the default "Cancel &060;title&062;?" Subtypes should not call super.getCancelPromptTitle() if they override.


getCancelPromptMessage

protected String getCancelPromptMessage()
Subtypes MAY override this to provide a cancel prompt message that differs from the default "Are you sure that you'd like to cancel?" Subtypes should not call super.getCancelPromptMessage() if they override.


getCancellationMonitor

protected final CancellationMonitor getCancellationMonitor()
Provide the cancellation monitor to subtypes if they want it(rather than pass it to them).


activate

protected void activate(Event activating_event)
IF YOU OVERRIDE, YOU MUST CALL, super.activate(...); Already overwrites due to: extends AbstractState -to- State

Overrides:
activate in class State

deactivate

protected void deactivate(Event deactivating_event)
IF YOU OVERRIDE, YOU MUST CALL, super.deactivate(...); Already overwrites due to: extends AbstractState -to- State

Overrides:
deactivate in class State

isThreadedWorkFinished

private boolean isThreadedWorkFinished()

markThreadedWorkFinished

private void markThreadedWorkFinished()
Once called, cancel confirm prompt may not be opened (even if cancel reaction is invoked. An exception is if the state is recycled and then reactivated.


requestCancel

private void requestCancel()

closeCancelPrompt

private void closeCancelPrompt()

getCancelConfirmPrompt

private final ThreadedCancelConfirmPrompt getCancelConfirmPrompt()

getCancelConfirmPrompt

private ThreadedCancelConfirmPrompt getCancelConfirmPrompt(boolean create_if_null)
Returns:
Possibly null, if create_if_null=false

getViewComponent

abstract JComponent getViewComponent()

setApplication

void setApplication(UpgradeManager x)

getApplication

protected static UpgradeManager getApplication()

setStatus

protected final void setStatus(String status_message)
Displays the messgae provided by some of the phases of what is currently being done. Nice to have when a lot of time is being taken.


clearStatus

protected final void clearStatus()

getTitle

public String getTitle()

toString

public String toString()

shouldBeEnclosed

protected boolean shouldBeEnclosed()
Can be overriden by sub-classes. super does not need to be called because no code in here needs to be executed.