class DependentStepStateController extends WizardStepListModelChangeAdapter {

    @Override
    public void stepStateChanged(WizardStepListModel source, int changedStep, String changedStepTitle, StepState state)
    {
        if (myAdjusting)
        {
            return;
        }

        myAdjusting = true;
        try
        {
            // If the finish step is not the current step, set it to DISABLED if
            // any other steps are not VALID. Otherwise set it to INDETERMINATE
            // if it's DISABLED.
            if (!myTargetStepTitle.equals(source.getCurrentStepTitle()))
            {
                boolean forceToDisabled = false;
                Collection<? extends String> stepTitles = myOtherStepTitles == null ? source.getStepTitles() : myOtherStepTitles;
                for (String step : stepTitles)
                {
                    if (!step.equals(myTargetStepTitle) && source.getStepState(step) != StepState.VALID
                            && source.getStepState(step) != StepState.WARNING)
                    {
                        forceToDisabled = true;
                        break;
                    }
                }
                if (forceToDisabled)
                {
                    source.setStepState(myTargetStepTitle, StepState.DISABLED);
                }
                else if (source.getStepState(myTargetStepTitle) == StepState.DISABLED)
                {
                    source.setStepState(myTargetStepTitle, StepState.INDETERMINATE);
                }
            }
        }
        finally
        {
            myAdjusting = false;
        }
    }

    public  DependentStepStateController(String targetStepTitle);
    public  DependentStepStateController(String targetStepTitle, Collection<? extends String> otherStepTitles);

}