com.ptc.windchill.upgrade.tool
Class PhaseCompleted

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
              extended bycom.ptc.windchill.upgrade.tool.PhaseCompleted

public class PhaseCompleted
extends AbstractStateWithThreadedWork


Nested Class Summary
static class PhaseCompleted.PhaseCanceled
          An inner class used by UpgradeToolStateMachineDefinition to determine which buttons should be enabled.
static class PhaseCompleted.ReportNumberOfFailures
          An inner class used by UpgradeToolStateMachineDefinition to determine the next state or which buttons to enable.
 
Nested classes inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
AbstractState.NonExpressPhaseDone, AbstractStateWithThreadedWork.Cancel, AbstractStateWithThreadedWork.IsStateWithThreadedWorkDone, AbstractStateWithThreadedWork.IsThreadedWorkRunningAndNotCanceled, AbstractStateWithThreadedWork.Outcome, AbstractStateWithThreadedWork.WasThreadedWorkOutcomeSuccessful
 
Field Summary
private  Color background_color
           
private  SimpleAttributeSet bold_step
           
private  CancellationMonitor cancellationMonitor_
           
private  UpgradeContext context_
           
private  JTextPane creating_
           
private  int executed_
           
private  int failed_
           
private static String LINE_SEPARATOR
           
private  UpgradePhaseType phaseJustExecuted_
           
private  ReportStyler reportStyler_
           
private  int skipped_
           
private  Document status_message
           
private  String stringPhaseJustExecuted_
           
private  int successful_
           
private  URL updateReportURL_
           
private  UpdateRunnerResults updateRunnerResults_
           
private  UpgradeToolStateMachine upgToolStateMachine_
           
private  JComponent viewComponent_
           
 
Fields inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
 
Fields inherited from class com.ptc.windchill.upgrade.util.fsm.State
 
Constructor Summary
PhaseCompleted(StateMachine sm, StateDefinition def)
          Creates a new PhaseCompleted object.
 
Method Summary
protected  void activate(Event activating_event)
          A method that is available to classes that implement AbstractStateWithThreadedWork.
private  void checkForCancellation()
           
 boolean getCanceled()
          Checks if the phase the report is being generated for was canceled
private  int getNumberOfFailedMigrators()
           
private  int getNumberOfSkippedMigrators()
           
private  int getNumberOfSuccessfulMigrators()
           
private  File getPhaseReportDirectory()
           
private  String getReportName()
           
 UpgradePhaseType getTheUpgradePhaseType()
           
 URL getTheURL()
           
private  int getTotalSize()
           
private  String getUpgradePhaseValue()
           
private  UpgradeToolStateMachine getUpgradeToolStateMachine()
           
 JComponent getViewComponent()
          This is displayed when the user first comes to this state.
protected  AbstractStateWithThreadedWork.Outcome runThreadedWork()
          Other methods are executed in a different thread.
private  void setValues(UpdateRunnerResults update_runner_results)
          Setting values to variables that are needed through out PhaseCompleted that were mainly retrieved from updateRunnerResults_.
protected  boolean shouldBeEnclosed()
          Can be overriden by sub-classes.
private  JComponent updateViewWithResults()
          Once the report for the phase has been completely generated the viewComponent_ is updated and displayed to the user.
 
Methods inherited from class com.ptc.windchill.upgrade.tool.AbstractStateWithThreadedWork
clearStatus, deactivate, getApplication, getCancellationMonitor, getCancelPromptMessage, getCancelPromptTitle, getTitle, onCancelRequested, setApplication, setStatus, 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

creating_

private JTextPane creating_

executed_

private int executed_

failed_

private int failed_

skipped_

private int skipped_

successful_

private int successful_

stringPhaseJustExecuted_

private String stringPhaseJustExecuted_

updateReportURL_

private URL updateReportURL_

viewComponent_

private JComponent viewComponent_

LINE_SEPARATOR

private static String LINE_SEPARATOR

context_

private UpgradeContext context_

reportStyler_

private ReportStyler reportStyler_

updateRunnerResults_

private UpdateRunnerResults updateRunnerResults_

phaseJustExecuted_

private UpgradePhaseType phaseJustExecuted_

upgToolStateMachine_

private UpgradeToolStateMachine upgToolStateMachine_

cancellationMonitor_

private CancellationMonitor cancellationMonitor_

bold_step

private SimpleAttributeSet bold_step

status_message

private Document status_message

background_color

private Color background_color
Constructor Detail

PhaseCompleted

public PhaseCompleted(StateMachine sm,
                      StateDefinition def)
Creates a new PhaseCompleted object.

Parameters:
sm - StateMachine - Required because it implements AbstractStateWithThreadedWork
def - StateDefinition - Required because it implements AbstractStateWithThreadedWork
Method Detail

shouldBeEnclosed

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

Overrides:
shouldBeEnclosed in class AbstractState

getViewComponent

public JComponent getViewComponent()
This is displayed when the user first comes to this state. The step name is included because if the user is in Express Mode they will not see the updated view that is created in the method updateViewWithResults().

Specified by:
getViewComponent in class AbstractState
Returns:
viewComponent_ JComponent

activate

protected void activate(Event activating_event)
A method that is available to classes that implement AbstractStateWithThreadedWork. Used when retrieving an Object or value created in the state immediately preceeding this one. Retrieving UpdateRunnerResults

Overrides:
activate in class AbstractStateWithThreadedWork
Parameters:
activating_event -

setValues

private void setValues(UpdateRunnerResults update_runner_results)
                throws Throwable
Setting values to variables that are needed through out PhaseCompleted that were mainly retrieved from updateRunnerResults_.

Throws:
Throwable

updateViewWithResults

private JComponent updateViewWithResults()
                                  throws IUHException,
                                         DirectiveExecutionException,
                                         BadLocationException
Once the report for the phase has been completely generated the viewComponent_ is updated and displayed to the user. If the user is in Express Mode this will not be seen.

Throws:
IUHException
DirectiveExecutionException
BadLocationException

getTheUpgradePhaseType

public UpgradePhaseType getTheUpgradePhaseType()
Returns:
phaseJustExecuted_ UpgradePhaseType

getPhaseReportDirectory

private File getPhaseReportDirectory()
Returns:
the path to the directory the report is saved in

getReportName

private String getReportName()
Returns:
just the name of the report

getTheURL

public URL getTheURL()
Returns:
updateReportURL

getCanceled

public boolean getCanceled()
Checks if the phase the report is being generated for was canceled

Returns:
boolean

getNumberOfFailedMigrators

private int getNumberOfFailedMigrators()
Returns:
failed_ int value of the number of migrators that failed

getNumberOfSkippedMigrators

private int getNumberOfSkippedMigrators()
Returns:
skipped_ int value of the number of migrators that skipped

getNumberOfSuccessfulMigrators

private int getNumberOfSuccessfulMigrators()
Returns:
successful_ int value of the number of migrators that succeeded

getUpgradeToolStateMachine

private UpgradeToolStateMachine getUpgradeToolStateMachine()

getTotalSize

private int getTotalSize()
Returns:
int the number of migrators the total of migrators that need to be executed for this phase

getUpgradePhaseValue

private String getUpgradePhaseValue()
Returns:
stringPhaseJustExecuted The string value of the phase that the report is being generated for.

runThreadedWork

protected AbstractStateWithThreadedWork.Outcome runThreadedWork()
                                                         throws CanceledException,
                                                                Throwable
Other methods are executed in a different thread. Once all the methods are executed the viewComponent_ is updated.

Specified by:
runThreadedWork in class AbstractStateWithThreadedWork
Returns:
Outcome true of false depending on if it was successful or not
Throws:
CanceledException - If the user clicks "Cancel" button
Throwable - If an unexpected error occurs

checkForCancellation

private void checkForCancellation()
                           throws CanceledException
Throws:
CanceledException