Lines 609-630
Link Here
|
609 |
boolean prev = panels.hasPrevious(); |
609 |
boolean prev = panels.hasPrevious(); |
610 |
boolean valid = p.isValid(); |
610 |
boolean valid = p.isValid(); |
611 |
|
611 |
|
612 |
nextButton.setEnabled(next && valid); |
612 |
// AWT sensitive code |
613 |
previousButton.setEnabled(prev); |
613 |
if (SwingUtilities.isEventDispatchThread ()) { |
614 |
|
614 |
updateStateInAWT (); |
615 |
if (current instanceof FinishablePanel) { |
|
|
616 |
// check if isFinishPanel |
617 |
if (((FinishablePanel) current).isFinishPanel()) { |
618 |
finishButton.setEnabled(valid); |
619 |
} else { |
620 |
// XXX What if the last panel is not FinishPanel ??? enable ? |
621 |
finishButton.setEnabled(valid && !next); |
622 |
} |
623 |
} else { |
615 |
} else { |
624 |
// original way |
616 |
SwingUtilities.invokeLater (new Runnable () { |
625 |
finishButton.setEnabled(valid && (!next || (current instanceof FinishPanel))); |
617 |
public void run () { |
|
|
618 |
updateStateInAWT (); |
619 |
} |
620 |
}); |
626 |
} |
621 |
} |
627 |
|
622 |
// end of AWT sensitive code |
|
|
623 |
|
628 |
// nextButton.setVisible (next); |
624 |
// nextButton.setVisible (next); |
629 |
// finishButton.setVisible (!next || (current instanceof FinishPanel)); |
625 |
// finishButton.setVisible (!next || (current instanceof FinishPanel)); |
630 |
// XXX Why setValue on Next ? |
626 |
// XXX Why setValue on Next ? |
Lines 721-726
Link Here
|
721 |
} |
717 |
} |
722 |
} |
718 |
} |
723 |
|
719 |
|
|
|
720 |
private void updateStateInAWT () { |
721 |
Panel p = panels.current (); |
722 |
boolean next = panels.hasNext (); |
723 |
boolean prev = panels.hasPrevious (); |
724 |
boolean valid = p.isValid (); |
725 |
|
726 |
nextButton.setEnabled (next && valid); |
727 |
previousButton.setEnabled (prev); |
728 |
|
729 |
if (current instanceof FinishablePanel) { |
730 |
// check if isFinishPanel |
731 |
if (((FinishablePanel)current).isFinishPanel ()) { |
732 |
finishButton.setEnabled (valid); |
733 |
} else { |
734 |
// XXX What if the last panel is not FinishPanel ??? enable ? |
735 |
finishButton.setEnabled (valid && !next); |
736 |
} |
737 |
} else { |
738 |
// original way |
739 |
finishButton.setEnabled ( |
740 |
valid && |
741 |
(!next || (current instanceof FinishPanel)) |
742 |
); |
743 |
} |
744 |
} |
745 |
|
746 |
|
724 |
/** Shows blocking wait cursor during updateState run */ |
747 |
/** Shows blocking wait cursor during updateState run */ |
725 |
private void updateStateWithFeedback() { |
748 |
private void updateStateWithFeedback() { |
726 |
try { |
749 |
try { |