![JAR search and dependency download from the Maven repository](/logo.png)
eu.agrosense.client.io.dbf.DbfImportProcessor Maven / Gradle / Ivy
/**
* Copyright (C) 2008-2013 LimeTri. All rights reserved.
*
* AgroSense is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
* this software, see the FLOSS License Exception
* .
*
* AgroSense is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AgroSense. If not, see .
*/
package eu.agrosense.client.io.dbf;
import eu.agrosense.client.mapping.MappableImportProcessor;
import java.util.logging.Logger;
import javax.swing.Icon;
import eu.agrosense.client.imp.AbstractImportFolderNode;
import eu.agrosense.client.imp.ImportProcessor;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataFolder;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.ImageUtilities;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
/**
*
* @author johan
*/
@NbBundle.Messages("dbf import format description=dbf file (*.dbf)")
@ServiceProvider(service = ImportProcessor.class, position=1)
public class DbfImportProcessor extends MappableImportProcessor {
public static final String IMPORTED_DBF_FOLDER = "DBF";
private static final Logger LOGGER = Logger.getLogger(DbfImportProcessor.class.getName());
static final Icon ICON = ImageUtilities.loadImageIcon(DbfDataObject.ICON_BASE, true);
@Override
public String[] getSupportedExtentions() {
return new String[] {DbfDataObject.PRIMARY_EXT};
}
@Override
public boolean isSupported(FileObject fileObject) {
return DbfDataObject.PRIMARY_EXT.equalsIgnoreCase(fileObject.getExt());
}
@Override
public String getFormatDescription() {
return Bundle.dbf_import_format_description();
}
@Override
public Icon getIcon() {
return ICON;
}
@Override
public Node getImportNode() {
FileObject dbfImportFolder = getMimeTypeImportFolder();
DataFolder dataFolder = DataFolder.findFolder(dbfImportFolder);
assert dataFolder != null;
return new ImportedDbfRootNode(dataFolder.getNodeDelegate());
}
@Override
protected FileObject getMimeTypeImportFolder() {
return getSubFolder(getImportRootFolder(), IMPORTED_DBF_FOLDER);
}
@NbBundle.Messages("ImportedDbfRootNode.name=DBF")
private static final class ImportedDbfRootNode extends AbstractImportFolderNode {
public ImportedDbfRootNode(Node original) {
super(original, new FilterNode.Children(original));
setName(Bundle.ImportedDbfRootNode_name());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy