private void installAgent() { disableButtons(true); // FOR TESTING WITHOUT DOING A REAL INSTALL - START // AgentInstallInfo result = new AgentInstallInfo("mypath", "myown", "1.1", "localHOST", // "serverHOST"); // for (int i = 1; i < 20; i++) // result.addStep(new AgentInstallStep("cmd" + i, "desc" + i, i, "result" + i, i * // 10)); // for (Canvas child : agentInfoLayout.getChildren()) // child.destroy(); // buildInstallInfoCanvas(agentInfoLayout, result); // agentInfoLayout.markForRedraw(); // disableButtons(false); // if (true) // return; // FOR TESTING WITHOUT DOING A REAL INSTALL - END // help out the user here - if they selected file(s) but didn't upload them yet, press the // upload button(s) for him // Note that if the user didn't upload yet, we have to wait for it to complete and ask the user // to press install again boolean needToWaitForUpload = false; if (agentConfigXmlUploadForm != null && agentConfigXmlUploadForm.isFileSelected() && agentConfigurationXml == null) { if (!agentConfigXmlUploadForm.isUploadInProgress()) { agentConfigXmlUploadForm.submitForm(); } needToWaitForUpload = true; } if (rhqAgentEnvUploadForm != null && rhqAgentEnvUploadForm.isFileSelected() && rhqAgentEnvSh == null) { if (!rhqAgentEnvUploadForm.isUploadInProgress()) { rhqAgentEnvUploadForm.submitForm(); } needToWaitForUpload = true; } if (!needToWaitForUpload) { reallyInstallAgent(); return; } createWaitingWindow(MSG.view_remoteAgentInstall_waitForUpload(), true); Scheduler.get() .scheduleEntry( new RepeatingCommand() { @Override public boolean execute() { // Make sure the file upload(s) (if there are any) have completed before we do // anything boolean waitForUploadToFinish = false; if (agentConfigXmlUploadForm != null && agentConfigXmlUploadForm.isUploadInProgress()) { waitForUploadToFinish = true; } if (rhqAgentEnvUploadForm != null && rhqAgentEnvUploadForm.isUploadInProgress()) { waitForUploadToFinish = true; } if (waitForUploadToFinish) { return true; // keep waiting, call us back later } dialog.destroy(); reallyInstallAgent(); return false; // upload is done, we can stop calling ourselves } }); }