Search in sources :

Example 1 with FileRecordStoreFactory

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);
}
Also used : FileRecordStoreFactory(com.revolsys.record.io.FileRecordStoreFactory) RecordStoreFactory(com.revolsys.record.io.RecordStoreFactory) FileRecordStoreFactory(com.revolsys.record.io.FileRecordStoreFactory) FileField(com.revolsys.swing.field.FileField)

Aggregations

FileRecordStoreFactory (com.revolsys.record.io.FileRecordStoreFactory)1 RecordStoreFactory (com.revolsys.record.io.RecordStoreFactory)1 FileField (com.revolsys.swing.field.FileField)1