Can I add programmatically a view in a JFrame? If yes, how?

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

Can I add programmatically a view in a JFrame? If yes, how?

Jen1234

Hello again,

so this time my question is the following:

I have a Protege plug-in and I want to show a popup when the user presses a button. The popup should be a combination of Protege views, for example, a class hierarchy view, an individuals by type view and a datatype view. I want them to interact with each other. That means that when I select a Class, I want the class' individuals to show up in the second column. I also want the case of selecting only a class with no individuals to exist.

The purpose of all the above is the creation of a frame so that when I click on a button, I can relate an instance to another class or individual.

Is there a way to do that?

Thank you in advance,
Jen
Reply | Threaded
Open this post in threaded view
|

Re: Can I add programmatically a view in a JFrame? If yes, how?

Matthew Horridge-2
Administrator
Hi Jen,

This is possible, but it's a bit messy to do at the moment.  While we look into making this easier to do, would you be able to tell us more about why you need or want this functionality?  What do you want to do exactly?  Why won't the basic functionality of being able to position views on an existing tab do?

Cheers,

Matthew



On 31 Oct 2011, at 05:26, Jen1234 wrote:

>
> Hello again,
>
> so this time my question is the following:
>
> I have a Protege plug-in and I want to show a popup when the user presses a
> button. The popup should be a combination of Protege views, for example, a
> class hierarchy view, an individuals by type view and a datatype view. I
> want them to interact with each other. That means that when I select a
> Class, I want the class' individuals to show up in the second column. I also
> want the case of selecting only a class with no individuals to exist.
>
> The purpose of all the above is the creation of a frame so that when I click
> on a button, I can relate an instance to another class or individual.
>
> Is there a way to do that?
>
> Thank you in advance,
> Jen
>
> --
> View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Can-I-add-programmatically-a-view-in-a-JFrame-If-yes-how-tp3955643p3955643.html
> Sent from the Protege 4 Feedback mailing list archive at Nabble.com.
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback

_______________________________________________
p4-feedback mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/p4-feedback
Reply | Threaded
Open this post in threaded view
|

Re: Can I add programmatically a view in a JFrame? If yes, how?

Timothy Redmond
On 11/03/2011 10:53 AM, Matthew Horridge wrote:
> Hi Jen,
>
> This is possible, but it's a bit messy to do at the moment.  While we look into making this easier to do, would you be able to tell us more about why you need or want this functionality?  What do you want to do exactly?  Why won't the basic functionality of being able to position views on an existing tab do?

I have attached some code (the messy code) that will allow you to use a
view in some pop-up dialog.  It was reverse engineered by following how
views are started in the normal Protege code.  We are thinking now of
how to make views more flexible and simpler in future versions of
Protege.  The magic string
"org.protege.editor.owl.OWLAssertedClassHierarchy" in the

             ViewComponentPlugin plugin = viewManager.getViewComponentPlugin("org.protege.editor.owl.OWLAssertedClassHierarchy");


line is the ID of the asserted hierarchy plugin.  The
"org.protege.editor.owl" is the name of the OWL editor plugin which
supplies this view and the OWLAssertedClassHierarchy comes from the
plugin.xml file (http://goo.gl/P5i3h) for the owl editor plugin:

     <extension id="OWLAssertedClassHierarchy"
                point="org.protege.editor.core.application.ViewComponent">
         <label value="Class hierarchy"/>
         <class value="org.protege.editor.owl.ui.view.cls.ToldOWLClassHierarchyViewComponent"/>
         <headerColor value="@org.protege.classcolor"/>
         <category value="@org.protege.classcategory"/>
         <navigates value="@org.protege.classcategory"/>
     </extension>


The disposal code is a bit tricky but I have included a comment in the
code about that.

We plan on making this somewhat easier to use in the future.  The
trickiness of this code is relevant to the problem of how to utilize
Protege components in an application (GForge 3324 -
http://goo.gl/JJNzp).  Matthew has some ideas on how the view code could
be refactored to make this much easier.

-Timothy


> Cheers,
>
> Matthew
>
>
>
> On 31 Oct 2011, at 05:26, Jen1234 wrote:
>
>> Hello again,
>>
>> so this time my question is the following:
>>
>> I have a Protege plug-in and I want to show a popup when the user presses a
>> button. The popup should be a combination of Protege views, for example, a
>> class hierarchy view, an individuals by type view and a datatype view. I
>> want them to interact with each other. That means that when I select a
>> Class, I want the class' individuals to show up in the second column. I also
>> want the case of selecting only a class with no individuals to exist.
>>
>> The purpose of all the above is the creation of a frame so that when I click
>> on a button, I can relate an instance to another class or individual.
>>
>> Is there a way to do that?
>>
>> Thank you in advance,
>> Jen
>>
>> --
>> View this message in context: http://protege-ontology-editor-knowledge-acquisition-system.136.n4.nabble.com/Can-I-add-programmatically-a-view-in-a-JFrame-If-yes-how-tp3955643p3955643.html
>> Sent from the Protege 4 Feedback mailing list archive at Nabble.com.
>> _______________________________________________
>> p4-feedback mailing list
>> [hidden email]
>> https://mailman.stanford.edu/mailman/listinfo/p4-feedback
> _______________________________________________
> p4-feedback mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/p4-feedback

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

Menu.java (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Can I add programmatically a view in a JFrame? If yes, how?

Jen1234
This post was updated on .
Thank you so much! That's exactly what I needed! I removed the last rows of code:

owlEditorKit.put(UUID.randomUUID(), new Disposable() {
    @Override
     public void dispose() throws Exception {
         view.dispose();
     }
});

as there was a problem at the compiling:

        cannot find symbol
[javac] symbol  : method put(java.util.UUID,<anonymous org.protege.editor.core.Disposable>)
[javac] location: class org.protege.editor.owl.OWLEditorKit
[javac]             owlEditorKit.put(UUID.randomUUID(), new Disposable() {
[javac]                         ^
[javac] 1 error

For now, it works. So, thank you again!

Jen