apply steps at the end, add ability to cancel wizard
This commit is contained in:
@ -36,7 +36,17 @@ class WizardController {
|
||||
|
||||
@ControllerAction
|
||||
void finish() {
|
||||
|
||||
model.steps.each {
|
||||
it.apply(model.muSettings, model.i2pProps)
|
||||
}
|
||||
model.finished['applied'] = true
|
||||
view.hide()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void cancel() {
|
||||
model.finished['applied'] = false
|
||||
view.hide()
|
||||
}
|
||||
|
||||
private void recalcButtons() {
|
||||
|
@ -64,8 +64,15 @@ class Ready extends AbstractLifecycleHandler {
|
||||
params['embeddedRouterAvailable'] = embeddedRouterAvailable
|
||||
params['muSettings'] = props
|
||||
params['i2pProps'] = i2pProps
|
||||
def finished = [:]
|
||||
params['finished'] = finished
|
||||
|
||||
application.mvcGroupManager.createMVCGroup("wizard", params)
|
||||
|
||||
if (!finished['applied']) {
|
||||
JOptionPane.showMessageDialog(parent, "MuWire will now exit")
|
||||
System.exit(0)
|
||||
}
|
||||
|
||||
|
||||
// props.incompleteLocation = new File(home, "incompletes")
|
||||
|
@ -14,6 +14,7 @@ class WizardModel {
|
||||
boolean embeddedRouterAvailable
|
||||
MuWireSettings muSettings
|
||||
Properties i2pProps
|
||||
def finished
|
||||
|
||||
final List<WizardStep> steps = [new NicknameStep(),
|
||||
new DirectoriesStep()]
|
||||
|
@ -35,9 +35,15 @@ class WizardView {
|
||||
}
|
||||
}
|
||||
panel (constraints : BorderLayout.SOUTH) {
|
||||
button(text : "Previous", enabled : bind {model.previousButtonEnabled}, previousAction)
|
||||
button(text : "Next", enabled : bind {model.nextButtonEnabled}, nextAction)
|
||||
button(text : "Finish", enabled : bind {model.finishButtonEnabled}, finishAction)
|
||||
gridLayout(rows:1, cols:2)
|
||||
panel {
|
||||
button(text : "Cancel", cancelAction)
|
||||
}
|
||||
panel {
|
||||
button(text : "Previous", enabled : bind {model.previousButtonEnabled}, previousAction)
|
||||
button(text : "Next", enabled : bind {model.nextButtonEnabled}, nextAction)
|
||||
button(text : "Finish", enabled : bind {model.finishButtonEnabled}, finishAction)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -60,4 +66,9 @@ class WizardView {
|
||||
})
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
void hide() {
|
||||
dialog.setVisible(false)
|
||||
mvcGroup.destroy()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user