mirror of https://github.com/zlatinb/muwire
apply steps at the end, add ability to cancel wizard
parent
c041f6baaa
commit
cb54b30967
|
@ -36,7 +36,17 @@ class WizardController {
|
||||||
|
|
||||||
@ControllerAction
|
@ControllerAction
|
||||||
void finish() {
|
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() {
|
private void recalcButtons() {
|
||||||
|
|
|
@ -64,9 +64,16 @@ class Ready extends AbstractLifecycleHandler {
|
||||||
params['embeddedRouterAvailable'] = embeddedRouterAvailable
|
params['embeddedRouterAvailable'] = embeddedRouterAvailable
|
||||||
params['muSettings'] = props
|
params['muSettings'] = props
|
||||||
params['i2pProps'] = i2pProps
|
params['i2pProps'] = i2pProps
|
||||||
|
def finished = [:]
|
||||||
|
params['finished'] = finished
|
||||||
|
|
||||||
application.mvcGroupManager.createMVCGroup("wizard", params)
|
application.mvcGroupManager.createMVCGroup("wizard", params)
|
||||||
|
|
||||||
|
if (!finished['applied']) {
|
||||||
|
JOptionPane.showMessageDialog(parent, "MuWire will now exit")
|
||||||
|
System.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// props.incompleteLocation = new File(home, "incompletes")
|
// props.incompleteLocation = new File(home, "incompletes")
|
||||||
// props.embeddedRouter = Boolean.parseBoolean(System.getProperties().getProperty("embeddedRouter"))
|
// props.embeddedRouter = Boolean.parseBoolean(System.getProperties().getProperty("embeddedRouter"))
|
||||||
|
|
|
@ -14,6 +14,7 @@ class WizardModel {
|
||||||
boolean embeddedRouterAvailable
|
boolean embeddedRouterAvailable
|
||||||
MuWireSettings muSettings
|
MuWireSettings muSettings
|
||||||
Properties i2pProps
|
Properties i2pProps
|
||||||
|
def finished
|
||||||
|
|
||||||
final List<WizardStep> steps = [new NicknameStep(),
|
final List<WizardStep> steps = [new NicknameStep(),
|
||||||
new DirectoriesStep()]
|
new DirectoriesStep()]
|
||||||
|
|
|
@ -35,9 +35,15 @@ class WizardView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel (constraints : BorderLayout.SOUTH) {
|
panel (constraints : BorderLayout.SOUTH) {
|
||||||
button(text : "Previous", enabled : bind {model.previousButtonEnabled}, previousAction)
|
gridLayout(rows:1, cols:2)
|
||||||
button(text : "Next", enabled : bind {model.nextButtonEnabled}, nextAction)
|
panel {
|
||||||
button(text : "Finish", enabled : bind {model.finishButtonEnabled}, finishAction)
|
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()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hide() {
|
||||||
|
dialog.setVisible(false)
|
||||||
|
mvcGroup.destroy()
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue