}
public WOComponent stopAllClicked() {
final NSArray instances = selectedInstances().immutableClone();
final MApplication application = myApplication();
return ConfirmationPage.create(context(), new ConfirmationPage.Delegate() {
public WOComponent cancel() {
return AppDetailPage.create(context(), application, instances);
}
public WOComponent confirm() {
handler().startReading();
try {
if (application.hostArray().count() != 0) {
handler().sendStopInstancesToWotaskds(instances, application.hostArray());
}
for (int i = 0; i < instances.count(); i++) {
MInstance anInst = (MInstance) instances.objectAtIndex(i);
if (anInst.state != MObject.DEAD) {
anInst.state = MObject.STOPPING;
}
}
} finally {
handler().endReading();
}
return AppDetailPage.create(context(), application, instances);
}
public String explaination() {
return "Selecting 'Yes' will shutdown the selected instances of this application.";
}
public int pageType() {
return APP_PAGE;
}
public String question() {
return "Are you sure you want to stop the " + instances.count() + " instances of " + application.name() + "?";
}
});
}