org.protege.editor.owl.ui.ontology.imports.missing.SpecifyFilePathPanel Maven / Gradle / Ivy
The newest version!
package org.protege.editor.owl.ui.ontology.imports.missing;
import org.protege.editor.core.ui.util.FilePathPanel;
import org.protege.editor.owl.OWLEditorKit;
import org.protege.editor.owl.ui.AbstractOWLWizardPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.HashSet;
/**
* Author: Matthew Horridge
* The University Of Manchester
* Medical Informatics Group
* Date: 17-Oct-2006
* [email protected]
* www.cs.man.ac.uk/~horridgm
*/
public class SpecifyFilePathPanel extends AbstractOWLWizardPanel {
public static final String ID = "SpecifyFilePathPanel";
private FilePathPanel filePathPanel;
public SpecifyFilePathPanel(OWLEditorKit owlEditorKit) {
super(ID, "Specify file", owlEditorKit);
}
protected void createUI(JComponent parent) {
parent.setLayout(new BorderLayout());
setInstructions("Please specify the path to the file containing the ontology");
filePathPanel = new FilePathPanel("Specify ontology file", new HashSet<>());
parent.add(filePathPanel, BorderLayout.NORTH);
filePathPanel.addChangeListener(e -> {
updateState();
});
}
public void displayingPanel() {
super.displayingPanel();
filePathPanel.requestFocus();
updateState();
}
private void updateState() {
getWizard().setNextFinishButtonEnabled(filePathPanel.getFile() != null && filePathPanel.getFile().exists());
}
public Object getBackPanelDescriptor() {
return ResolutionTypePanel.ID;
}
public Object getNextPanelDescriptor() {
return CopyOptionPanel.ID;
}
}