udig plugin development.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

udig plugin development.

gaghi
Hi everybody, I'm developing part of the code to achieve a 'dynamic' view.
I never used eclipse to develop plugin or rcp. At first choice, always in ui, was on forms because they appeare to be fairly simple and aesthetically pleasing, as well as providing a wide range of objects. But from what I could understand from my personal experience there is no way to make these components dynamic. Let me explain better; once I created the form containing the required items I cannot modify it or add other items. I thought to the possibility of calling dispose () and then again createForm () (my function that creates and places the form in the view), but it doesn't seem elegant and doesn't work (the area that was occupied by the form remains " disposed ", coloured grey);anyway, this possibility has been discarded immediately. Now I'm using a tableViewer to represent the data in tabular form, but aesthetically (as well as from a functionally) is certainly not the best choice.
Basically the problem is: When developing an integrated view which must be able to adapt to the choices of the user, about what I should orient? In this case the event is the selection of a layer which update the view with the informations for that layer selected.

Thanks.

Gabriele
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

Andrea Antonello
Hi Gabriele,

> Hi everybody, I'm developing part of the code to achieve a 'dynamic' view.
> I never used eclipse to develop plugin or rcp. At first choice, always in
> ui, was on forms because they appeare to be fairly simple and aesthetically
> pleasing, as well as providing a wide range of objects. But from what I
> could understand from my personal experience there is no way to make these
> components dynamic. Let me explain better; once I created the form
> containing the required items I cannot modify it or add other items. I
> thought to the possibility of calling dispose () and then again createForm
> () (my function that creates and places the form in the view), but it
> doesn't seem elegant and doesn't work (the area that was occupied by the
> form remains " disposed ", coloured grey);anyway, this possibility has been
> discarded immediately.

as my feeling is, forms were not the right choice for you, since you
need some more complex logic and forms are not very flexible for that
purpose.

> Now I'm using a tableViewer to represent the data in
> tabular form, but aesthetically (as well as from a functionally) is
> certainly not the best choice.

What do you mean by that? I used tables and trees in different ways
and outlooks and find them good. What do you don't like?
The functionallity depends on you. Are you extending the jface
viewers, introducing your own behaviour?

> Basically the problem is: When developing an integrated view which must be
> able to adapt to the choices of the user, about what I should orient? In
> this case the event is the selection of a layer which update the view with
> the informations for that layer selected.

From your posts in the udig list I see that you already have the
listeners system that make you trap the events, so am I right in the
assumption that you need a hint on how to make your tables and trees
reload the new data?
Just to be sure.

Andrea





>
> Thanks.
>
> Gabriele
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17667811.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

gaghi
hi,
Andrea Antonello-3 wrote
> Now I'm using a tableViewer to represent the data in
> tabular form, but aesthetically (as well as from a functionally) is
> certainly not the best choice.

What do you mean by that? I used tables and trees in different ways
and outlooks and find them good. What do you don't like?
The functionallity depends on you. Are you extending the jface
viewers, introducing your own behaviour?
This is not our main issue for now.

> Basically the problem is: When developing an integrated view which must be
> able to adapt to the choices of the user, about what I should orient? In
> this case the event is the selection of a layer which update the view with
> the informations for that layer selected.

From your posts in the udig list I see that you already have the
listeners system that make you trap the events, so am I right in the
assumption that you need a hint on how to make your tables and trees
reload the new data?
I am able to capture the events in the workbench. Rather than how to reload i'm interesting in how to create a structure like that in figure able to react to events.
I use tables and trees too. But I need also to use these coupled with something like a classic form (not an eclipse form) to collect/edit/insert data. An example: I select a record from a table, and I have some info related to this record collected in a form. I'm able to build with swt an UI with different input text boxes (org.eclipse.swt.widgets.Text), but I'm not able to reload the data of these on changing of selected records. I need a form like the right one you can see in this video: http://screencast.com/t/0TGtutlrue
 As you can see I select an element in the middle table and the form shows me the info about the selected element.
I hope I have been clear enough.
thanks
Gabriele
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

Andrea Antonello
[...]

>>> Basically the problem is: When developing an integrated view which must
>>> be
>>> able to adapt to the choices of the user, about what I should orient? In
>>> this case the event is the selection of a layer which update the view
>>> with
>>> the informations for that layer selected.
>>
>> From your posts in the udig list I see that you already have the
>> listeners system that make you trap the events, so am I right in the
>> assumption that you need a hint on how to make your tables and trees
>> reload the new data?
>>
> I am able to capture the events in the workbench. Rather than how to reload
> i'm interesting in how to create a structure like that in figure able to
> react to events.
> I use tables and trees too. But I need also to use these coupled with
> something like a classic form (not an eclipse form) to collect/edit/insert
> data. An example: I select a record from a table, and I have some info
> related to this record collected in a form. I'm able to build with swt an UI
> with different input text boxes (org.eclipse.swt.widgets.Text), but I'm not
> able to reload the data of these on changing of selected records. I need a
> form like the right one you can see in this video:
> http://screencast.com/t/0TGtutlrue  http://screencast.com/t/0TGtutlrue
>  As you can see I select an element in the middle table and the form shows
> me the info about the selected element.
> I hope I have been clear enough.

I'm not sure I got the problem properly.
The cascading of the events in the three parts of the window do not
seem a real problem to me.
I have done this in the past, but only with two levels. Find some
example code here:
https://dev.cocos.bz/plugins/scmsvn/viewcvs.php/jgrass3.0/community/moovida/eu.hydrologis.jgrass.hydrocare/src/eu/hydrologis/jgrass/hydrocare/actions/gui/calibrationwizards/W03MonitoringPointViewer.java?rev=1219&root=jgrass&view=markup

In that case I extend a Checkboxviewer and also implement a
SelectionChangeListener. Everytime an event happens, in the panel at
the right the proper panel is triggered to be visible.
Note that disposing in SWT is not a best practice in that case,
instead often a Stacklayout is used and new panels are created and put
on top of the stack to be visible. Already existing panels are updated
and just put on top.

I hope I could touch some point that can be of help. Let me know,
Andrea



> thanks
> Gabriele
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17671256.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

gaghi
Thanks for suggestions. I will try to implement a stackLayout. Looking at part of the code you linked to me

public void selectionChanged( SelectionChangedEvent event ) {
        if (!(event.getSelection() instanceof TreeSelection)) {
            return;
        }
        TreeSelection sel = (TreeSelection) event.getSelection();

        Object selectedItem = sel.getFirstElement();
        if (selectedItem == null) {
            // assumed it is a checkstate change, which is already handled
            return;
        }
        if (selectedItem instanceof MonitoringPoint) {
            MonitoringPoint p = (MonitoringPoint) selectedItem;
            Control propControl = p.getPropertiesWidget(relatedInside);
            stackLayout.topControl = propControl;
        } else {
            Label l = new Label(relatedInside, SWT.SHADOW_ETCHED_IN);
            l.setText("Questo oggetto (" + selectedItem.toString()
                    + ") non ha proprieta' configurabili.");
            stackLayout.topControl = l;
        }
        relatedInside.layout(true);
    }

I was wondering if I can do in the Listener something like  l.setText("new text"), where l is an instance of Label, an swt in my view, created and declared before calling the listener.

Thanks
Gabriele
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

Andrea Antonello
On Thu, Jun 5, 2008 at 7:19 PM, gaghi <[hidden email]> wrote:

>
> Thanks for suggestions. I will try to implement a stackLayout. Looking at
> part of the code you linked to me
>
> public void selectionChanged( SelectionChangedEvent event ) {
>        if (!(event.getSelection() instanceof TreeSelection)) {
>            return;
>        }
>        TreeSelection sel = (TreeSelection) event.getSelection();
>
>        Object selectedItem = sel.getFirstElement();
>        if (selectedItem == null) {
>            // assumed it is a checkstate change, which is already handled
>            return;
>        }
>        if (selectedItem instanceof MonitoringPoint) {
>            MonitoringPoint p = (MonitoringPoint) selectedItem;
>            Control propControl = p.getPropertiesWidget(relatedInside);
>            stackLayout.topControl = propControl;
>        } else {
>            Label l = new Label(relatedInside, SWT.SHADOW_ETCHED_IN);
>            l.setText("Questo oggetto (" + selectedItem.toString()
>                    + ") non ha proprieta' configurabili.");
>            stackLayout.topControl = l;
>        }
>        relatedInside.layout(true);
>    }
>
> I was wondering if I can do in the Listener something like  l.setText("new
> text"), where l is an instance of Label, an swt in my view.

That thing is best handled through the ContentProvider  (in the
example MonitoringPointContentProvider) and LabelProvider
(MonitoringPointLabelProvider), which are kept in my example as inner
classes.
If you keep the variable that supplies the content global to the main
class, whenever you change the content of that variable, the refresh
changes the whole thing as you need it.

In my case that would be the hashmap
private LinkedHashMap<String, List<MonitoringPoint>> itemList = null;
Change that and the reload of the tree/list will set things properly.
I found that the most comfortable way to handle labels changes. Also
since you can have just an array of strings, but also any object, this
will help you, because as I did, a hastable could keep the labels of
the first list in the keyset and objects with informations needed to
fill the second list/table when an item is selected.

Hope I have not been too confusional,
Andrea





> Thanks
> Gabriele
>
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17675321.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

gaghi
hi, at this moment i'm still stuck. by the way, while i'm looking for a solution, i was wondering if somebody can answer to few questions.
-I made my plugin and now i want to customize it putting my own icons in the toolbar.
I wrote this code:

ImageDescriptor img = ImageDescriptor.createFromFile(this.getClass(), "icons/sample.gif");
MyAction.setImageDescriptor(img);

Unfortunally the result is a red squadre instead of the icon. There's something wrong in my code? I also tried "sample.gif", "./icons/sample.gif".

-I would create a menu in the main bar, i mean append a menu after the 'help' for example. How can i do this?

I know they're very simple questions, but i didn't find answer on internet.

thank you
gabriele
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

Andrea Antonello
On Tue, Jun 10, 2008 at 1:09 PM, gaghi <[hidden email]> wrote:

>
> hi, at this moment i'm still stuck. by the way, while i'm looking for a
> solution, i was wondering if somebody can answer to few questions.
> -I made my plugin and now i want to customize it putting my own icons in the
> toolbar.
> I wrote this code:
>
> ImageDescriptor img = ImageDescriptor.createFromFile(this.getClass(),
> "icons/sample.gif");
> MyAction.setImageDescriptor(img);
>
> Unfortunally the result is a red squadre instead of the icon. There's
> something wrong in my code? I also tried "sample.gif", "./icons/sample.gif".

The red square happens when the image is not found.
Have a look here to be sure you are doing it right:
http://jgrasstechtips.blogspot.com/2008/02/how-to-retireve-image-for-action-or.html

> -I would create a menu in the main bar, i mean append a menu after the
> 'help' for example. How can i do this?

This is for sure not an easy one and also not easy to answer in list
because of all the different possibilities depending on your
configuration.

As you have seen, in udig they are talking right now about different
possibilities and I think soon they will release some nice trick to do
so.
The eclipse way to solve this is to work with actionsets extentions.

Andrea


> I know they're very simple questions, but i didn't find answer on internet.
>
> thank you
> gabriele
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17752865.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

gaghi
thank you andrea.

Have someone any kind of experience in Viewer and db? i'm working on them connection, but i found some problems in load rows from a select to the table. I'm using tableViewer.
my getElements method should put the elements in the table, but i cannot do this for all my rows.
public Object[] getElements(Object inputElement) {
                CollectionItem ci = new CollectionItem(Integer.parseInt(inputElement.toString()));
              return ci.getArray();
        }
I though to make CollectionItem returns a vector of array, but anyway I don't know how to continue.
I've already looked for it but without success at this time.

Thank a lot.
Gabriele
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

Andrea Antonello
Hi Gabriele,

> Have someone any kind of experience in Viewer and db? i'm working on them
> connection, but i found some problems in load rows from a select to the
> table. I'm using tableViewer.
> my getElements method should put the elements in the table, but i cannot do
> this for all my rows.
> public Object[] getElements(Object inputElement) {
>                CollectionItem ci = new
> CollectionItem(Integer.parseInt(inputElement.toString()));
>              return ci.getArray();
>        }
> I though to make CollectionItem returns a vector of array, but anyway I
> don't know how to continue.
> I've already looked for it but without success at this time.

It seems to me that you have a more swt/jface issue, not so much a GIS
related problem (correct me if I'm wrong). Have a look at those
examples, they should help you to understand how to go on:
http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet001TableViewer

Andrea


> Thank a lot.
> Gabriele
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17805476.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
Reply | Threaded
Open this post in threaded view
|

Re: udig plugin development.

gaghi
hi andrea, you're right, even if i am switching from one kind of problem to another, so the context often is not strictly gis. Sorry if i'm went of out thread(or forum). anyway thanks for the snippets.
gabriele
Andrea Antonello-3 wrote
Hi Gabriele,

> Have someone any kind of experience in Viewer and db? i'm working on them
> connection, but i found some problems in load rows from a select to the
> table. I'm using tableViewer.
> my getElements method should put the elements in the table, but i cannot do
> this for all my rows.
> public Object[] getElements(Object inputElement) {
>                CollectionItem ci = new
> CollectionItem(Integer.parseInt(inputElement.toString()));
>              return ci.getArray();
>        }
> I though to make CollectionItem returns a vector of array, but anyway I
> don't know how to continue.
> I've already looked for it but without success at this time.

It seems to me that you have a more swt/jface issue, not so much a GIS
related problem (correct me if I'm wrong). Have a look at those
examples, they should help you to understand how to go on:
http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet001TableViewer

Andrea


> Thank a lot.
> Gabriele
> --
> View this message in context: http://www.nabble.com/udig-plugin-development.-tp17667811p17805476.html
> Sent from the JGrass-devel -- Developer list for jgrass mailing list archive at Nabble.com.
>
> _______________________________________________
> JGrass-devel mailing list
> JGrass-devel@dev.fsc.bz.it
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel
>
_______________________________________________
JGrass-devel mailing list
JGrass-devel@dev.fsc.bz.it
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-devel