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

org.protege.editor.owl.ui.selector.OWLClassSelectorPanel 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.selector;

import org.protege.editor.core.ui.view.ViewComponent;
import org.protege.editor.core.ui.view.ViewComponentPlugin;
import org.protege.editor.core.ui.view.ViewComponentPluginAdapter;
import org.protege.editor.core.ui.workspace.Workspace;
import org.protege.editor.owl.OWLEditorKit;
import org.protege.editor.owl.model.hierarchy.OWLObjectHierarchyProvider;
import org.protege.editor.owl.ui.renderer.OWLSystemColors;
import org.protege.editor.owl.ui.view.AbstractOWLEntityHierarchyViewComponent;
import org.protege.editor.owl.ui.view.cls.ToldOWLClassHierarchyViewComponent;
import org.semanticweb.owlapi.model.OWLClass;

import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.Set;


/**
 * Author: Matthew Horridge
* The University Of Manchester
* Medical Informatics Group
* Date: May 2, 2006

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

*/ public class OWLClassSelectorPanel extends AbstractHierarchySelectorPanel { private AbstractOWLEntityHierarchyViewComponent vc; public OWLClassSelectorPanel(OWLEditorKit editorKit) { this(editorKit, true); } public OWLClassSelectorPanel(OWLEditorKit editorKit, boolean editable) { this(editorKit, editable, editorKit.getModelManager().getOWLHierarchyManager().getOWLClassHierarchyProvider()); } public OWLClassSelectorPanel(OWLEditorKit editorKit, boolean editable, OWLObjectHierarchyProvider hp) { super(editorKit, editable, hp); } protected ViewComponentPlugin getViewComponentPlugin() { return new ViewComponentPluginAdapter() { public String getLabel() { return "Asserted Class Hierarchy"; } public Workspace getWorkspace() { return getOWLEditorKit().getWorkspace(); } public ViewComponent newInstance() throws ClassNotFoundException, IllegalAccessException, InstantiationException { vc = new ToldOWLClassHierarchyViewComponent(){ public void performExtraInitialisation() throws Exception { if (isEditable()){ super.performExtraInitialisation(); } } protected OWLObjectHierarchyProvider getOWLClassHierarchyProvider() { return getHierarchyProvider(); } }; vc.setup(this); return vc; } public Color getBackgroundColor() { return OWLSystemColors.getOWLClassColor(); } }; } public void setSelection(OWLClass cls) { vc.setSelectedEntity(cls); } public void setSelection(Set clses) { vc.setSelectedEntities(clses); } public OWLClass getSelectedObject() { return vc.getSelectedEntity(); } public Set getSelectedObjects() { return vc.getSelectedEntities(); } public void dispose() { vc.dispose(); } public void addSelectionListener(ChangeListener listener) { vc.addChangeListener(listener); } public void removeSelectionListener(ChangeListener listener) { vc.removeChangeListener(listener); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy