package de.visone.nlpext;

import java.io.IOException;
import java.util.Properties;

import de.visone.base.Mediator;
import de.visone.ext.AbstractExtension;
import de.visone.gui.tabs.AbstractTabCard;
import de.visone.nlpext.gui.NLPCard;

/**
 * The Natural Language Processing package is an visone extension to allow for
 * text network analysis.
 * 
 * @author nick
 */
public class NLPExtension extends AbstractExtension {
	private AbstractTabCard nlpCard;
	private final String requiredVersion;

	public NLPExtension(final Mediator mediator) throws IOException {
		super(mediator);
		final Properties properties = new Properties();
		// don't bother to catch possible IOException here. the ExtensionManager
		// catches it anyway, and if loading of the version numbers fails, the
		// extension wasn't properly built and probably will not work in any
		// case.
		properties.load(NLPExtension.class
				.getResourceAsStream("versions.properties"));
		requiredVersion = properties.getProperty("visone.version");
	}

	@Override
	public String getID() {
		return "nlpControl";
	}

	@Override
	public AbstractTabCard getPanel() {
		if (nlpCard == null)
			nlpCard = new NLPCard(mediator);
		return nlpCard;
	}

	@Override
	public String getFriendlyName() {
		return "text network creation";
	}

	@Override
	public String getRequiredVisoneVersion() {
		return requiredVersion;
	}
}
