Re: [JPP-Devel] interacting with another application

2010-07-09 Thread Nils Kuhn




Hi Matthias,
thanks for sharnig your code/plugin. Unfortunately I don't have the
time for a deeper insight into it know.
But in august/september I will have to implement my
communication-bridge. So maybe I will contact you again.
Nils

Matthias Scholz schrieb:

  Hi,

you can download my plugin from here: 
http://www.jammerhund.de/downloads/CommunicationPlugin.zip or the JAR: 
http://www.jammerhund.de/downloads/CommunicationPlugIn.jar

This is the complete NetBeans project folder. It's not realy ready for 
publishing, because  I've some things to do(licence texte, docu , 
refactoring...) The  userdocu in the doc/ folder or 
http://www.jammerhund.de/downloads/commplugin.pdf is only in german, 
because at the moment it's only in germany  relevant.

Regards

Matthias
  
  
Hi,
I'm interested, too.
My first approach was like the attached class.
Nils


Sunburned Surveyor schrieb:


  Matthias,

Can you share your code with us?

I'd be interested in seeing how the communication process you
described was coded.

The Sunburned Surveyor

On Wed, Jul 7, 2010 at 5:11 AM, Matthias Scholz m...@jammerhund.de wrote:
  
  
  
Hi Nils!



  Hi Matthias,

I opened another topic for the discussion inside the topic "Select
shape by attribute" because things are mixing a bit, I think.

I want to create an interface between OJ and an external application,
too. I will have to use a xml-file for communication (because the
other application provides this functionality allready for interacting
with other apps than OJ). Did you write a listener-Thread or something
for getting the focus if requests from the external application arrive
per file?
  
  

At the moment the plugin have a "listener thread", wich looks every
2000ms (configurable) for a new file. If you can mail me a XML testfile
and a description, then I will see if it is possible to integrate your
XML file format.



  That was my plan, but I am not yet get around to test that and I'm not
quite sure about the performance...
  
  

In our environment (german government) is that no performance problem
with a file for interacting with OJ, because the users works mostly
with max. 100 objects to show in OJ. With a grater amount it shold no
problem too.

Matthias



  Regards,
Nils



--
Dipl.-Biol. Nils Kuhn
Email: nils.k...@bws-gmbh.de
Fon: +49 (0)40 - 23 16 65-26
Fax: +49 (0)40 - 23 16 65-01

BWS GmbH
Gotenstrae 14
D-20097 Hamburg
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg: HRB 87830
Geschftsfhrer:
Dipl.-Geol. Robert Dsi
Dipl.-Geogr. Hydr. Lutz Krob


*

HINWEIS:
Diese E-Mail und beigefgte Dateien dienen nur der Vorabstimmung und stellen
keine rechtswirksame Willenserklrungen oder Beratungsleistungen dar. Es knnen
keine Haftungsansprche gegenber der BWS GmbH geltend gemacht werden.
Alle rechtswirksamen uerungen (Vertrge, Stellungnahmen, Berechnungen, Vermerke etc.)
erhalten Sie von uns in schriftlicher Form und gegebenenfalls auf separatem Datentrger.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtmlich erhalten haben,
informieren Sie bitte den Absender und vernichten Sie diese E-Mail.
Unerlaubtes Kopieren und Weiterleiten dieser E-Mail sind nicht gestattet.

*



--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

  
  

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



  
  --
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net

Re: [JPP-Devel] Feature collections modified by default

2010-07-09 Thread Andreas Schmitz
Michaël Michaud wrote:

Hi,

  I've noticed that (for quite some time now) newly loaded feature
  collections/layers are now considered modified by default. I've been
  using that check in the WFS plugin to enable the update button only if
  the layer is actually modified. I've added a workaround to set the layer
  unmodified immediately after loading.

 Sorry for the inconvenience

that's no problem. I've shot myself in the foot like that often enough
;-)

  I've also found the place where layers are set to modified after loading
  (in the Layer class, with a comment from Michaël, that's why I'm
  addressing you directly ;-)). I'm not entirely sure why it is done like
  this. Was your intention to have a 'do you really want to close OJ'
  message when closing? If so, I'd like to propose to have a check when
  closing, and show a different message if no layers have been modified,
  asking just that, and only show the modified warning if something has
  actually been modified. I find it confusing for the users to have a
  warning like this, when he did actually not modify anything...

 You probably are right, as it may be important to make the difference 
 between a newly created layer and a modified layer.
 I'll try to make my problem clearer as I'm not sure to get the solution yet.
 
 Some layers are issued from a persistent datasource, and others have 
 been created by the application (ex. a buffer layer).
 How to inform the user  who closes the application that some newly 
 created layers are unsaved to disk (some of my co-workers complained 
 they lost their work without any warning)
 Maybe I missed something simple with the Layer.getDataSourceQuery method.
 I'll try to explore this method (probably after my vacations).
 
 Feel free to get back to the previous state of Layer class if needed. 
 I'm quite confident another way can be found to solve my problem

ah, now I understand the problem. I think in the case of generated
layers it makes perfect sense to have them marked modified at creation
time. I suppose the best solution would then be to proceed as I
suggested (it's still nice to get a confirmation message when exiting
even though nothing is modified I think), and manually set generated
layers to be modified when creating them. I see two options here:

 * by default set new layers to be unmodified, set generated layers to
   be modified when creating them (this must then be done in all plugins
   that generate new layers)
 * by default set new layers to be modified, set layers that are loaded
   from file/database/WFS etc. to be unmodified (this must then be done
   in all plugins which do not generate features)

If we decide on one direction, I can make the changes to the code if
someone can provide me with a list of (core) plugins that need to be
modified.

I'm not sure about the other solution that seems slumbering in your mind
(you certainly know the code better than me). Also no need to rush (you
can enjoy your vacation first!).

What do people think?

Best regards, Andreas
-- 
l a t / l o n  GmbH
Aennchenstrasse 19   53177 Bonn, Germany
phone ++49 +228 18496-0  fax ++49 +228 1849629
http://www.lat-lon.dehttp://www.deegree.org
Follow deegree on Twitter: http://twitter.com/deegree_org


signature.asc
Description: Digital signature
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Plug-in showing change over time

2010-07-09 Thread Stefan Steiniger
Hei Larry,

thanks!
I will do some further testing when I find time. Now I just have use 
thrad.sleep(30) to give it some time...
Probably I will have a look then at SkyJUMPs RenderingManager.

cheers,
stefan

Larry Becker wrote:
 Hi Stefan,
 
   The JUMP rendering architecture was never designed for something like 
 animation.  The only way I have found to make it work is to turn off the 
 RenderManager and do the rendering yourself.  You should be able to find 
 some hints on how to do that in LayerPrinter2, if I remember correctly.  
 Perhaps AbstractZoom too.
 
 I could also make some changes to RenderManager to support notification 
 that rendering is complete as I did in SkyJUMP, but it doesn't 
 completely make the problem go away. 
 
 regards,
 Larry
 
 On Thu, Jul 8, 2010 at 9:16 PM, Stefan Steiniger sst...@geo.uzh.ch 
 mailto:sst...@geo.uzh.ch wrote:
 
 Hei all - esp. Larry who has some experience on rendering
 
 Just by chance I am in need for a plugin that shows changes over time -
 i.e. a movie, too. So I sat down for 2 hours today for a very basic
 plugin.
 
 I realized the movie by creating a new temporary layer and then execute
 a loop that adds and removes features to and from the layer one by one
 (after sorting them). Ok so far, and well, its also not smooth looking.
 However, the problem is that it seems to me like a couple of
 features/sequences are not drawn.
 
 Basically I would need to wait until all features in the layer are drawn
 and would then continue with the loop (to remove the previous and add a
 new feature). So - is there any way to know when the rendering is done?
 (I use a ThreadedBasePlugin - as this even shows in the monitor the step
 nummer).
 I also tried to create a Dummy LayerManager and create a new DummyLayer
 from the featureCollection and to render this one inbetween to have an
 idea when the rendering is done (a bit like for LayerPrinter2) - but it
 seems not to work either.
 
 Another option I tried is using Thread.sleep(100) - i.e. to wait for
 some time - but the the animation seems to be not fluent enough (= just
 takes too long).
 
 I also do not understand what happens if I use Thread.sleep() or
 RenderManager.wait() - i.e. if I just stop all processes instead of my
 hope that the rendering would be continued and finished
 
 I think - we may had this discussion a couple of years ago.. but has
 anyone any pointers/ideas?
 
 cheers
 stefan
 
 
 Sunburned Surveyor schrieb:
   Elton,
  
   I don't think there are.
  
   The Sunburned Surveyor
  
   On Tue, Jun 29, 2010 at 6:59 PM, Elton Chan elton.c...@yahoo.com
 mailto:elton.c...@yahoo.com wrote:
   Hi there,
  
   Are there any plug-in or snippets avaliable to show change of
 attribute over time or time-series of a feature for OpenJump?
  
   Thanks,
   Elton
  
  
  
  
  
 
 --
   This SF.net email is sponsored by Sprint
   What will you do first with EVO, the first 4G phone?
   Visit sprint.com/first http://sprint.com/first --
 http://p.sf.net/sfu/sprint-com-first
   ___
   Jump-pilot-devel mailing list
   Jump-pilot-devel@lists.sourceforge.net
 mailto:Jump-pilot-devel@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
  
  
  
 
 --
   This SF.net email is sponsored by Sprint
   What will you do first with EVO, the first 4G phone?
   Visit sprint.com/first http://sprint.com/first --
 http://p.sf.net/sfu/sprint-com-first
   ___
   Jump-pilot-devel mailing list
   Jump-pilot-devel@lists.sourceforge.net
 mailto:Jump-pilot-devel@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
  
  
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first http://sprint.com/first --
 http://p.sf.net/sfu/sprint-com-first
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 mailto:Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
 
 
 
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- 

Re: [JPP-Devel] Feature collections modified by default

2010-07-09 Thread Larry Becker
I'm not sure it helps, and I haven't tried it on WFS layers, but
theoretically my select all modified features plugin distinguishes between
newly created features and features loaded from a dataset.

Larry

On Fri, Jul 9, 2010 at 3:11 AM, Andreas Schmitz schm...@lat-lon.de wrote:

 Michaël Michaud wrote:

 Hi,

   I've noticed that (for quite some time now) newly loaded feature
   collections/layers are now considered modified by default. I've been
   using that check in the WFS plugin to enable the update button only if
   the layer is actually modified. I've added a workaround to set the
 layer
   unmodified immediately after loading.
  
  Sorry for the inconvenience

 that's no problem. I've shot myself in the foot like that often enough
 ;-)

   I've also found the place where layers are set to modified after
 loading
   (in the Layer class, with a comment from Michaël, that's why I'm
   addressing you directly ;-)). I'm not entirely sure why it is done like
   this. Was your intention to have a 'do you really want to close OJ'
   message when closing? If so, I'd like to propose to have a check when
   closing, and show a different message if no layers have been modified,
   asking just that, and only show the modified warning if something has
   actually been modified. I find it confusing for the users to have a
   warning like this, when he did actually not modify anything...
  
  You probably are right, as it may be important to make the difference
  between a newly created layer and a modified layer.
  I'll try to make my problem clearer as I'm not sure to get the solution
 yet.
 
  Some layers are issued from a persistent datasource, and others have
  been created by the application (ex. a buffer layer).
  How to inform the user  who closes the application that some newly
  created layers are unsaved to disk (some of my co-workers complained
  they lost their work without any warning)
  Maybe I missed something simple with the Layer.getDataSourceQuery method.
  I'll try to explore this method (probably after my vacations).
 
  Feel free to get back to the previous state of Layer class if needed.
  I'm quite confident another way can be found to solve my problem

 ah, now I understand the problem. I think in the case of generated
 layers it makes perfect sense to have them marked modified at creation
 time. I suppose the best solution would then be to proceed as I
 suggested (it's still nice to get a confirmation message when exiting
 even though nothing is modified I think), and manually set generated
 layers to be modified when creating them. I see two options here:

  * by default set new layers to be unmodified, set generated layers to
   be modified when creating them (this must then be done in all plugins
   that generate new layers)
  * by default set new layers to be modified, set layers that are loaded
   from file/database/WFS etc. to be unmodified (this must then be done
   in all plugins which do not generate features)

 If we decide on one direction, I can make the changes to the code if
 someone can provide me with a list of (core) plugins that need to be
 modified.

 I'm not sure about the other solution that seems slumbering in your mind
 (you certainly know the code better than me). Also no need to rush (you
 can enjoy your vacation first!).

 What do people think?

 Best regards, Andreas
 --
 l a t / l o n  GmbH
 Aennchenstrasse 19   53177 Bonn, Germany
 phone ++49 +228 18496-0  fax ++49 +228 1849629
 http://www.lat-lon.dehttp://www.deegree.org
 Follow deegree on Twitter: http://twitter.com/deegree_org

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.9 (GNU/Linux)

 iEYEARECAAYFAkw22ZcACgkQ737OVr+Ru7pZdwCg7JXRzrulKfyOgjrCQ4VGf/IA
 /Y0An0V8zjml7vetBTr1l2HambBLCmJV
 =3hbj
 -END PGP SIGNATURE-


 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Feature collections modified by default

2010-07-09 Thread Stefan Steiniger
Hei Andreas and Michael,

playing save is what we should do.
For creating new layers I am most often using context.addLayer() - so 
why not adding the flagging there instead of changing all plugins?
An option would be to create a second addLayer() method with a boolean 
parameter for flagging if the new layer is modified.

However, this wouldn't work for 
context.getLayerManager().addLayerable(..) - which is used for 
(Sextante) Rasters. I.e. needs changes there too.

my thoughts
stefan

Andreas Schmitz wrote:
 Michaël Michaud wrote:
 
 Hi,
 
 I've noticed that (for quite some time now) newly loaded feature
 collections/layers are now considered modified by default. I've been
 using that check in the WFS plugin to enable the update button only if
 the layer is actually modified. I've added a workaround to set the layer
 unmodified immediately after loading.
   
 Sorry for the inconvenience
 
 that's no problem. I've shot myself in the foot like that often enough
 ;-)
 
 I've also found the place where layers are set to modified after loading
 (in the Layer class, with a comment from Michaël, that's why I'm
 addressing you directly ;-)). I'm not entirely sure why it is done like
 this. Was your intention to have a 'do you really want to close OJ'
 message when closing? If so, I'd like to propose to have a check when
 closing, and show a different message if no layers have been modified,
 asking just that, and only show the modified warning if something has
 actually been modified. I find it confusing for the users to have a
 warning like this, when he did actually not modify anything...
   
 You probably are right, as it may be important to make the difference 
 between a newly created layer and a modified layer.
 I'll try to make my problem clearer as I'm not sure to get the solution yet.

 Some layers are issued from a persistent datasource, and others have 
 been created by the application (ex. a buffer layer).
 How to inform the user  who closes the application that some newly 
 created layers are unsaved to disk (some of my co-workers complained 
 they lost their work without any warning)
 Maybe I missed something simple with the Layer.getDataSourceQuery method.
 I'll try to explore this method (probably after my vacations).

 Feel free to get back to the previous state of Layer class if needed. 
 I'm quite confident another way can be found to solve my problem
 
 ah, now I understand the problem. I think in the case of generated
 layers it makes perfect sense to have them marked modified at creation
 time. I suppose the best solution would then be to proceed as I
 suggested (it's still nice to get a confirmation message when exiting
 even though nothing is modified I think), and manually set generated
 layers to be modified when creating them. I see two options here:
 
  * by default set new layers to be unmodified, set generated layers to
be modified when creating them (this must then be done in all plugins
that generate new layers)
  * by default set new layers to be modified, set layers that are loaded
from file/database/WFS etc. to be unmodified (this must then be done
in all plugins which do not generate features)
 
 If we decide on one direction, I can make the changes to the code if
 someone can provide me with a list of (core) plugins that need to be
 modified.
 
 I'm not sure about the other solution that seems slumbering in your mind
 (you certainly know the code better than me). Also no need to rush (you
 can enjoy your vacation first!).
 
 What do people think?
 
 Best regards, Andreas
 
 
 
 
 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 
 
 
 
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] how to refresh a layer in run time

2010-07-09 Thread Elton Chan
Dear Larry,

Could you tell me how it works? It seems a loop is required for continous 
update an attribute. How can it be replaced by a event handler?

Thanks,
Elton

--- On Fri, 7/2/10, Larry Becker becker.la...@gmail.com wrote:

From: Larry Becker becker.la...@gmail.com
Subject: Re: [JPP-Devel] how to refresh a layer in run time
To: OpenJump develop and use jump-pilot-devel@lists.sourceforge.net
Date: Friday, July 2, 2010, 5:33 PM

Hi Elton,

  I think you are going to have to restructure you code from a loop to be an 
event handler that triggers itself until the end of some counter.  That is the 
only sure way to play nice with the GUI.

Larry


On Fri, Jul 2, 2010 at 12:06 PM, Elton Chan elton.c...@yahoo.com wrote:

Hi Larry,

I've tried the LayerView Panel().repaint() with InvokeAndWait(). However, the 
layerpanel still cannot refesh and the for loop continues until all finishing 
all the Recordset.


The following code is added after attribute update:
if (SwingUtilities.isEventDispatchThread()) {
                context.getLayerViewPanel().repaint();
                System.out.println(repaint!!);  Always hit this line.

            }
            else {
        SwingUtilities.invokeAndWait(new Runnable( ) {
   
     public void run( ) {
            context.getLayerViewPanel().repaint();
            System.out.println(repaint!!!);
       }
        });

            }

Any idea?


--- On Thu, 7/1/10, Larry Becker becker.la...@gmail.com wrote:


From: Larry Becker
 becker.la...@gmail.com
Subject: Re: [JPP-Devel] how to refresh a layer in run time
To: OpenJump develop and use jump-pilot-devel@lists.sourceforge.net

Date: Thursday, July 1, 2010, 2:30 PM

Sorry, Elton, not NIls.  I answered so many questions that I got confused about 
who I was answering.  :-)

On Thu, Jul 1, 2010 at 8:24 AM, Larry Becker becker.la...@gmail.com wrote:


Hi Nils,

  I believe you might be running into problems updating because your loop is 
blocking the GUI thread.  You might try a LayerViewPanel.repaint() using 
invokeAndWait().



Larry


On Thu, Jul 1, 2010 at 6:42 AM, Elton Chan elton.c...@yahoo.com wrote:



Hi there,



I would like to refresh a layer after changing attribute of each feature in the 
layer based on an event table. The event table records attribute assigned to 
each feature at specified stage. Following is the schema of the event table:






Event(

StageID int, // StageID defines sequence of the event

Feature01 int, // value to be assigned to feature 01

Feature02 int, // value to be assigned to feature 02

...

Feature10 int)



Based on the StageID sequence, values for each feature would be retrieved and 
updated to corresponding feature. Finally,  update value would be visualized by 
unique colortheming. However, it seems the layer refreshing can only be 
effective outside the ResultSet loop of the event table.






The following is the program codes:



Inside execute(PlugInContext context)

// get a layer

lyr = context.getLayerManager().getLayer(postgis);

//create a Resultset RS

ResultSet RS stat.executeQuery(select * from Event);

while (RS.next())

{

updatePostgisLayer(lyr, RS);//This function updates feature in the layer

}

 layer refreshes after the looping all the resultset.



My question is how to refresh the layer once attribute values are updated for 
each each row of the RecordSet, i.e. immediately after the updatePostgisLayer 
function.



If I change the query to retrieve specify row (i.e. single row only), layer can 
be refreshed. But it requires to activate it manually for each update.



I tried to add lyr.fireLayerChanged(LayerEventType.APPEARANCE_CHANGED);

or lyr.fireAppearanceChanged() after the updatePostgisLayer function but it 
didn't work.



Anyone can help?



thanks,

Elton









--

This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

___

Jump-pilot-devel mailing list

Jump-pilot-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel






-Inline Attachment Follows-

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?

Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
-Inline Attachment Follows-


___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



  
--

This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/first -- 

Re: [JPP-Devel] how to refresh a layer in run time

2010-07-09 Thread Larry Becker
Hi Elton,

  Make your loop variable a class variable.  Have the loop control and
attribute update inside the event handler.  While the loop is still going
invoke the event handler again, also from within the event handler.  Once
you have set up the event handler and invoked it once, just fall off the end
of the execute routine.  I would give an example,  but I'm away from my
development system.

  It sounds like Stefan also has a need for animation.  Perhaps he will show
you his solution.

Larry

On Fri, Jul 9, 2010 at 10:41 PM, Elton Chan elton.c...@yahoo.com wrote:

 Dear Larry,

 Could you tell me how it works? It seems a loop is required for continous
 update an attribute. How can it be replaced by a event handler?

 Thanks,
 Elton


 --- On *Fri, 7/2/10, Larry Becker becker.la...@gmail.com* wrote:


 From: Larry Becker becker.la...@gmail.com
 Subject: Re: [JPP-Devel] how to refresh a layer in run time
 To: OpenJump develop and use jump-pilot-devel@lists.sourceforge.net
 Date: Friday, July 2, 2010, 5:33 PM


 Hi Elton,

   I think you are going to have to restructure you code from a loop to be
 an event handler that triggers itself until the end of some counter.  That
 is the only sure way to play nice with the GUI.

 Larry

 On Fri, Jul 2, 2010 at 12:06 PM, Elton Chan 
 elton.c...@yahoo.comhttp://mc/compose?to=elton.c...@yahoo.com
  wrote:

 Hi Larry,

 I've tried the LayerView Panel().repaint() with InvokeAndWait(). However,
 the layerpanel still cannot refesh and the for loop continues until all
 finishing all the Recordset.

 The following code is added after attribute update:
 if (SwingUtilities.isEventDispatchThread()) {
 context.getLayerViewPanel().repaint();
 System.out.println(repaint!!);  Always hit this
 line.
 }
 else {
 SwingUtilities.invokeAndWait(new Runnable( ) {
 public void run( ) {
 context.getLayerViewPanel().repaint();
 System.out.println(repaint!!!);
}
 });
 }

 Any idea?


 --- On *Thu, 7/1/10, Larry Becker 
 becker.la...@gmail.comhttp://mc/compose?to=becker.la...@gmail.com
 * wrote:


 From: Larry Becker 
 becker.la...@gmail.comhttp://mc/compose?to=becker.la...@gmail.com
 
 Subject: Re: [JPP-Devel] how to refresh a layer in run time
 To: OpenJump develop and use 
 jump-pilot-devel@lists.sourceforge.nethttp://mc/compose?to=jump-pilot-de...@lists.sourceforge.net
 
 Date: Thursday, July 1, 2010, 2:30 PM


 Sorry, Elton, not NIls.  I answered so many questions that I got confused
 about who I was answering.  :-)

 On Thu, Jul 1, 2010 at 8:24 AM, Larry Becker 
 becker.la...@gmail.comhttp://mc/compose?to=becker.la...@gmail.com
  wrote:

 Hi Nils,

   I believe you might be running into problems updating because your loop
 is blocking the GUI thread.  You might try a LayerViewPanel.repaint() using
 invokeAndWait().

 Larry


 On Thu, Jul 1, 2010 at 6:42 AM, Elton Chan 
 elton.c...@yahoo.comhttp://mc/compose?to=elton.c...@yahoo.com
  wrote:

 Hi there,

 I would like to refresh a layer after changing attribute of each feature
 in the layer based on an event table. The event table records attribute
 assigned to each feature at specified stage. Following is the schema of the
 event table:

 Event(
 StageID int, // StageID defines sequence of the event
 Feature01 int, // value to be assigned to feature 01
 Feature02 int, // value to be assigned to feature 02
 ...
 Feature10 int)

 Based on the StageID sequence, values for each feature would be
 retrieved and updated to corresponding feature. Finally,  update value 
 would
 be visualized by unique colortheming. However, it seems the layer 
 refreshing
 can only be effective outside the ResultSet loop of the event table.

 The following is the program codes:

 Inside execute(PlugInContext context)
 // get a layer
 lyr = context.getLayerManager().getLayer(postgis);
 //create a Resultset RS
 ResultSet RS stat.executeQuery(select * from Event);
 while (RS.next())
 {
 updatePostgisLayer(lyr, RS);//This function updates feature in the layer
 }
  layer refreshes after the looping all the resultset.

 My question is how to refresh the layer once attribute values are
 updated for each each row of the RecordSet, i.e. immediately after the
 updatePostgisLayer function.

 If I change the query to retrieve specify row (i.e. single row only),
 layer can be refreshed. But it requires to activate it manually for each
 update.

 I tried to add lyr.fireLayerChanged(LayerEventType.APPEARANCE_CHANGED);
 or lyr.fireAppearanceChanged() after the updatePostgisLayer function but
 it didn't work.

 Anyone can help?

 thanks,
 Elton





 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first