Automatically select class from class hierarchy view

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Automatically select class from class hierarchy view

Daniel Schober
Dear Protege developers,

I am developing a tab plugin for Protege 4. In the tab I have 2 views:
Class hierarchy view (the standard one) and my view. I want to be able
to comunnicate between this 2 ones so that when a class name is selected
from a list on my view, that particular class is automatically selected
in the hierarchy view. Pretty much like it happens when searching a
concept. My class extends AbstractOWLClassViewComponent.

I hope this is trivial enough to get fast answers :P.
Thank you in advance!


Ilinca Tudose and Daniel Schober.


---------------------------------------------------------------
   Dr. Daniel Schober
   Universitätsklinikum
   Institut für Medizinische Biometrie und Medizinische Informatik
   Stefan-Meier-Strasse  26 Raum 6
   D-79104 Freiburg Germany
   Tel: +49 (0)761 2036807 FAX: +49 (0)761 2036711


Freiburg   ...     wo die Babys mit Fahrradhelm zur Welt kommen.










_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
Reply | Threaded
Open this post in threaded view
|

Re: Automatically select class from class hierarchy view

Timothy Redmond
On 07/08/2011 09:11 AM, Daniel Schober wrote:
Dear Protege developers,

I am developing a tab plugin for Protege 4. In the tab I have 2 views: Class hierarchy view (the standard one) and my view. I want to be able to comunnicate between this 2 ones so that when a class name is selected from a list on my view, that particular class is automatically selected in the hierarchy view. Pretty much like it happens when searching a concept. My class extends AbstractOWLClassViewComponent.


The solution is to use the OWL selection model.  As you have observed the Protege OWL plugins all present a coherent view by reacting to the current selection.

In your case the easiest thing to do is to modify your view class to extend AbstractOWLSelectionViewComponent.  This class arranges that the updateView is called when you need it.  In particular updateView is called when the selection changes.  To determine what class was most recently selected you use the OWL selection model class:

		OWLSelectionModel selectionModel = getOWLWorkspace().getOWLSelectionModel();
		OWLClass selectedClass = selectionModel.getLastSelectedClass();

The selection model gives you many methods for accessing the current selection and it also allows you to set up listeners when needed.

-Timothy



I hope this is trivial enough to get fast answers :P.
Thank you in advance!


Ilinca Tudose and Daniel Schober.


---------------------------------------------------------------
  Dr. Daniel Schober
  Universitätsklinikum
  Institut für Medizinische Biometrie und Medizinische Informatik
  Stefan-Meier-Strasse  26    Raum 6
  D-79104 Freiburg        Germany
  Tel: +49 (0)761 2036807    FAX: +49 (0)761 2036711


Freiburg   ...     wo die Babys mit Fahrradhelm zur Welt kommen.










_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03


_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owl

Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03