All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.protege.editor.owl.ui.ontology.imports.wizard.page.ImportConfirmationPage Maven / Gradle / Ivy

Go to download

OWL ontology editing infrastructure used by the Protege desktop application.

The newest version!
package org.protege.editor.owl.ui.ontology.imports.wizard.page;

import org.protege.editor.core.ui.wizard.WizardPanel;
import org.protege.editor.owl.OWLEditorKit;
import org.protege.editor.owl.ui.AbstractOWLWizardPanel;
import org.protege.editor.owl.ui.ontology.imports.wizard.ImportInfo;
import org.protege.editor.owl.ui.ontology.imports.wizard.OntologyImportWizard;

import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.util.Set;


/**
 * Author: Matthew Horridge
* The University Of Manchester
* Medical Informatics Group
* Date: 13-Jun-2006

* [email protected]
* www.cs.man.ac.uk/~horridgm

*/ public class ImportConfirmationPage extends AbstractOWLWizardPanel { private static final long serialVersionUID = -8146050890918692126L; public static final String ID = "ImportConfirmationPage"; private JComponent importedOntologiesComponent; private TitledBorder titledBorder; private Object backPanelDescriptor; public ImportConfirmationPage(OWLEditorKit owlEditorKit) { super(ID, "Confirm imports", owlEditorKit); } protected void createUI(JComponent parent) { setInstructions("The system will import the following ontologies. Press Finish " + "to import these ontologies, or Cancel to exit the wizard without importing " + "any ontologies."); importedOntologiesComponent = new JPanel(new BorderLayout()); parent.setLayout(new BorderLayout()); parent.add(importedOntologiesComponent, BorderLayout.NORTH); } public void displayingPanel() { super.displayingPanel(); fillImportList(); } private void fillImportList() { importedOntologiesComponent.removeAll(); Box box = new Box(BoxLayout.Y_AXIS); boolean advanced = ((OntologyImportWizard) getWizard()).isCustomizeImports(); Set parameters = ((OntologyImportWizard) getWizard()).getImports(); for (ImportInfo parameter : parameters) { if (parameter.isReady()) { if (advanced) { ImportEntryPanel importPanel = new ImportEntryPanel(parameter); box.add(importPanel); } else { box.add(new JLabel(parameter.getPhysicalLocation().toString())); } } } importedOntologiesComponent.add(box, BorderLayout.NORTH); } public void setBackPanelDescriptor(Object backPanelDescriptor) { this.backPanelDescriptor = backPanelDescriptor; } @Override public Object getBackPanelDescriptor() { if (((OntologyImportWizard) getWizard()).isCustomizeImports()) { return SelectImportLocationPage.ID; } else { return backPanelDescriptor; } } public Object getNextPanelDescriptor() { return WizardPanel.FINISH; } private class ImportEntryPanel extends JPanel { private static final long serialVersionUID = -4945897856195350142L; public ImportEntryPanel(ImportInfo parameter) { setBorder(BorderFactory.createEmptyBorder(1, 0, 4, 0)); setLayout(new BorderLayout(1, 1)); JPanel center = new JPanel(); center.setLayout(new BoxLayout(center, BoxLayout.Y_AXIS)); JLabel physicalLocationLabel = new JLabel("Load import from " + parameter.getPhysicalLocation().toString()); physicalLocationLabel.setFont(physicalLocationLabel.getFont().deriveFont(10.0f)); physicalLocationLabel.setAlignmentX(LEFT_ALIGNMENT); center.add(physicalLocationLabel); if (!parameter.getOntologyID().isAnonymous()) { JLabel ontologyNameLabel = new JLabel("Imported Ontology Name " + parameter.getOntologyID().getOntologyIRI().get().toString()); ontologyNameLabel.setAlignmentX(LEFT_ALIGNMENT); center.add(ontologyNameLabel); if (parameter.getOntologyID().getVersionIRI().isPresent()) { JLabel ontologyVersionLabel = new JLabel("Imported Ontology Version " + parameter.getOntologyID().getVersionIRI()); ontologyVersionLabel.setAlignmentX(LEFT_ALIGNMENT); center.add(ontologyVersionLabel); } } else { JLabel anonymousLabel = new JLabel("Imported Ontology is anonymous."); anonymousLabel.setAlignmentX(LEFT_ALIGNMENT); center.add(anonymousLabel); } center.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0)); Border lineBorder = BorderFactory.createLineBorder(Color.LIGHT_GRAY); titledBorder = BorderFactory.createTitledBorder(lineBorder, "Import Declaration: " + parameter.getImportLocation().toString()); setBorder(titledBorder); add(center, BorderLayout.CENTER); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy