try {
addSimpleTextFieldForComponent(HOST_ATTR, HOST_ATTR, 70);
addSimpleTextFieldForComponent(PORT_ATTR, PORT_ATTR, 10);
addSimpleTextFieldForComponent(USER_ATTR, USER_ATTR, 10);
{
ModelModifier modifier = new DefaultModelModifier() {
public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
return "";
//return ((FTPDestination) model).getAttribute(PASSWORD_ATTR);
}
public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
String valueStr = (String) value;
if(valueStr != null && valueStr.length() > 0)
((FTPDestination) model).data.setAttribute(PASSWORD_ATTR, valueStr);
}
};
PasswordEditor editor = new PasswordEditor();
editor.setSize(10);
FieldInfo fieldInfo = new FieldInfo(
PASSWORD_ATTR,
PASSWORD_ATTR,
modifier,
editor);
//add the configuration to the context for usage in the http-requests.
addField(PASSWORD_ATTR, fieldInfo);
}
addSimpleTextFieldForComponent(FILENAME_START_ATTR, FILENAME_START_ATTR, 20);
addSimpleTextFieldForComponent(DATE_FORMAT_ATTR, DATE_FORMAT_ATTR, 20);
addSimpleTextFieldForComponent(FILE_EXTENSION_ATTR, FILE_EXTENSION_ATTR, 5);
{
ModelModifier modifier = new DefaultModelModifier() {
public Object getModelValue(Object model) throws FailTransferException, AbortTransferException {
return new Integer(((FTPDestination) model).getFileType());
}
public void setModelValue(Object model, Object value) throws FailTransferException, AbortTransferException {
((FTPDestination) model).setFileType(((Integer) value).intValue());
}
};
SelectEditor editor = new SelectEditor();
for(int i = 0; i < FILE_TYPE_LABELS.length; i++)
editor.addOption(new DefaultSelectOption(
new Integer(i),
FILE_TYPE_LABELS[i]));
editor.setFormatter(new IntegerFormatter());
//and finally create the configurationObject
FieldInfo fieldInfo = new FieldInfo(
FILE_TYPE_ATTR,
FILE_TYPE_ATTR,
modifier,
editor);
//add the configuration to the context for usage in the http-requests.
addField(FILE_TYPE_ATTR, fieldInfo);
}
{
//set unique id and description labelkey
String id = CHARSET_ATTR;
ModelModifier modifier = new DefaultModelModifier() {
public Object getModelValue(Object model) throws FailTransferException,
AbortTransferException {
String value = ((FTPDestination) model).getData().getAttribute(
CHARSET_ATTR);
return value != null ? value : DEFAULT_CHARSET;