Thanks for the feedback Stefan and Michael.

I don't like to use ThreadedPlugIn classes, because in my mind large
parts of OpenJUMP are not thread safe.

I'll dig into the source code for the MultiInputDialog with special
attention to the wasOkPresesed method. It sounds like it is a polling
method, which is interesting. In my mind you'd need to add an event
listener from some part of your plug-in to the OK button in the
dialog. It looks like Vivid Solutions found a way around that.

I'll check it out.

I look forward to working with the MultiInputDialog class.

Landon

P.S. - I do have Michael's doc on the MultiInputDialog class. It is
the first place I looked. :]

On Tue, Jun 26, 2012 at 12:01 PM, Michaël Michaud
<michael.mich...@free.fr> wrote:
> Hi,
>
> Stefan is right,
>
> the usual way is to collect data in the execute method (where the dialog
> is defined
> and shown to the user until this one click OK or cancel) and to process
> it in the
> run method (run only if the execute method returned true).
>
> I usually include all the input dialog construction in the execute method,
> but doing it in a separate method, as suggested by Stefan, is probably a
> good advice.
> For me, the only difficult part in the dialog definition is to create
> some interaction
> between components (ex. disable one component if the selected layer is
> not editable)
>
> MultiInputDialog has not changed so much, but I added a few utils (like
> an attribute chooser)
> and make it a bit more flexible.
> Don't know if you checked this document
> http://sourceforge.net/projects/jump-pilot/files/Documentation/PlugIn%20Documentation/
>
> and of course see some plugin implementations in the source.
>
> Michaël
>> I am not sure - but if you look at the example buffer plugin on the wiki...
>> what would be different?
>>
>> maybe that you are using a threaded plugin?
>>
>> there are lots of plugins to look at. But as soon as you use a dialog I
>> would say you should use "extends AbstractThreadedUiPlugIn", do your
>> dialog stuff in "execute()" and do all your computation in the "run()"
>> method that is automatically called after things are done in execute.
>> See below...
>>
>> but maybe I miss a point here too.
>> stefan
>>
>>
>> public boolean execute(PlugInContext context) throws Exception{
>>           //Unlike ValidatePlugIn, here we always call #initDialog
>> because we want
>>           //to update the layer comboboxes.
>>           initDialog(context);
>>           dialog.setVisible(true);
>>           if (!dialog.wasOKPressed()) {
>>               return false;
>>           }
>>           else{
>>               this.getDialogValues(dialog);
>>           }
>>           return true;
>> }
>>
>> public void run(TaskMonitor monitor, PlugInContext context) throws
>> Exception{
>>               System.gc(); //flush garbage collector
>>               this.context = context;
>>               monitor.allowCancellationRequests();
>>               //....you stuff here...
>> }
>>
>> Am 26.06.12 12:47, schrieb Landon Blake:
>>> I'm working on a plug-in for OpenJUMP. Usually I will "roll my own"
>>> plug-in GUI, but this time the GUI was fairly simple, and I wanted to
>>> try out Michael's improvements to the MultiInputDialog class.
>>>
>>> I've been looking over the API for the code, and I've bumped into a
>>> smal challenge:
>>>
>>> Instead of processing the data collected in the dialog using the
>>> AcitonPerformed event of each JTextField, I'd like to do the data
>>> processing when all the data is present, after the OK button is
>>> pressed. This will allow me to do some data validation. I see the
>>> class has a "wasOkButtonPressed" method, but I don't think that is
>>> what I need. What I really need is a way to respond to the OK button
>>> click event.
>>>
>>> I could hack something, but I thought I'd ask if there is a "standard"
>>> way to do this using the MultiInputDialog class or its ancestor
>>> classes. I'd like to learn the "right" way to use the class because I
>>> may prepare a little MultiInputDialog tutorial when I'm done.
>>>
>>> Hopefully this makes sense. I'm probably missing something obvious.
>>>
>>> Thanks in advance for the help.
>>>
>>> Landon (AKA - The Sunburned Surveyor)
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Jump-pilot-devel mailing list
>>> Jump-pilot-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Jump-pilot-devel mailing list
>> Jump-pilot-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>>
>>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to