username.setWidth(textFieldWidth);
username.setPrompt(MSG.view_remoteAgentInstall_promptUser());
username.setHoverWidth(300);
username.setEndRow(true);
PasswordItem password = new PasswordItem("password", MSG.common_title_password());
password.setRequired(false); // if not specified, the server will attempt to use the default ssh pw defined in system settings
password.setWidth(textFieldWidth);
password.setPrompt(MSG.view_remoteAgentInstall_promptPassword());
password.setHoverWidth(300);
password.setEndRow(true);
password.setAttribute("autocomplete", "off");
rememberMeCheckbox = new CheckboxItem("rememberme", MSG.view_remoteAgentInstall_rememberMe());
rememberMeCheckbox.setRequired(false);
rememberMeCheckbox.setPrompt(MSG.view_remoteAgentInstall_promptRememberMe());
rememberMeCheckbox.setHoverWidth(300);
rememberMeCheckbox.setColSpan(2);
rememberMeCheckbox.setEndRow(true);
agentInstallPath = new TextItem("agentInstallPath", MSG.view_remoteAgentInstall_installPath());
agentInstallPath.setWidth(textFieldWidth);
agentInstallPath.setPrompt(MSG.view_remoteAgentInstall_promptInstallPath());
agentInstallPath.setHoverWidth(300);
agentInstallPath.setStartRow(true);
agentInstallPath.setEndRow(false);
agentInstallPath.setValidators(absPathValidator); // we will "turn this on" when needed - this is to ensure we create paths properly and it doesn't go in places user isn't expecting
findAgentInstallPathButton = new ButtonItem("findAgentInstallPathButton",
MSG.view_remoteAgentInstall_buttonFindAgent());
findAgentInstallPathButton.setStartRow(false);
findAgentInstallPathButton.setEndRow(true);
if (findAgentInstallPathButton.getTitle().length() < 15) { //i18n may prolong the title
findAgentInstallPathButton.setWidth(100);
}
findAgentInstallPathButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
// we only want to validate host
if (connectionForm.getValueAsString("host") == null
|| connectionForm.getValueAsString("host").trim().isEmpty()) {
final HashMap<String, String> errors = new HashMap<String, String>(1);
errors.put("host", CoreGUI.getSmartGwtMessages().validator_requiredField());
connectionForm.setErrors(errors, true);
return;
}
new CheckSSHConnectionCallback() {
@Override
protected void doActualWork() {
findAgentInstallPath();
}
}.execute();
}
});
createAgentStatusTextItem();
statusCheckButton = new ButtonItem("updateStatus", MSG.common_title_updateStatus());
statusCheckButton.setStartRow(false);
statusCheckButton.setEndRow(true);
if (findAgentInstallPathButton.getTitle().length() < 15) { //i18n may prolong the title
statusCheckButton.setWidth(100);
}
statusCheckButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
if (connectionForm.validate()) {
new CheckSSHConnectionCallback() {
@Override
protected void doActualWork() {
agentStatusCheck();
}
}.execute();
}
}
});
if (initialAgentInstall != null) {
host.setValue(initialAgentInstall.getSshHost());
if (initialAgentInstall.getSshPort() != null) {
port.setValue(String.valueOf(initialAgentInstall.getSshPort()));
}
username.setValue(initialAgentInstall.getSshUsername());
password.setValue(initialAgentInstall.getSshPassword());
agentInstallPath.setValue(initialAgentInstall.getInstallLocation());
// if it was already saved, assume they want it to stay remembered
// however, because the uninstall page is getting rid of the agent, we don't need or want to remember the credentials anymore
if (!this.showUninstallButton) {
rememberMeCheckbox.setValue(initialAgentInstall.getSshPassword() != null);