use of com.revolsys.record.io.FileRecordStoreFactory in project com.revolsys.open by revolsys.
the class RecordStoreConnectionForm method postSetFieldValues.
@Override
protected void postSetFieldValues(final Map<String, Object> newValues) {
String recordStoreType = (String) newValues.get("recordStoreType");
if (Property.hasValue(recordStoreType)) {
if (this.recordStoreTypes.contains(recordStoreType)) {
refreshUrlFromFieldValues(recordStoreType);
}
return;
}
final String url = (String) newValues.get("url");
if (Property.hasValue(url)) {
for (final RecordStoreFactory recordStoreFactory : this.recordStoreFactoryByName.values()) {
final Map<String, Object> urlFieldValues = recordStoreFactory.parseUrl(url);
if (!urlFieldValues.isEmpty()) {
Maps.retainIfNotEqual(urlFieldValues, newValues);
if (recordStoreFactory instanceof FileRecordStoreFactory) {
final FileRecordStoreFactory fileRecordStoreFactory = (FileRecordStoreFactory) recordStoreFactory;
final FileField fileField = getField("file");
if (fileRecordStoreFactory.isDirectory()) {
fileField.setFileSelectionMode(JFileChooser.FILES_ONLY);
} else {
fileField.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
}
}
setFieldValues(urlFieldValues);
return;
}
}
}
recordStoreType = getFieldValue("recordStoreType");
refreshUrlFromFieldValues(recordStoreType);
}
Aggregations