GateNLP / gate-core

The GATE Embedded core API and GATE Developer application
GNU Lesser General Public License v3.0
75 stars 29 forks source link

Add explicit support to VRs for notification the PR was reinitialized #70

Closed greenwoodma closed 5 years ago

greenwoodma commented 5 years ago

Currently a VR isn't automatically notified when it's associated PR is re-initialised even though it may need to update it's display. Some viewers (jape and groovy) listen for progressFinished events and then call setTarget. While this works it also means that this happens after each document is processed through the VR which is clearly inefficient. Other VRs (such as the gazetteer) listen for custom events on the PR to know when to reload.

A more sensible option would be to add a method to VisualResource targetReinitialized() (or similar) which would be called by NameBearerHandle after it's called reInit on the PR. This would decouple progress reporting from reinitialization and allow PRs to report incremental progress while being initialized without causing the VRs to reload during execution.

greenwoodma commented 5 years ago

Daft question, do we need a new method or would getting NameBearerHandle to call setTarget() after reInit() be just as good a solution? In most cases all we would be doing would be to call setTarget() anyway and this would fix any broken VRs without requiring a code change (would still need to fix those that currently do this via progressFinished() instead).

greenwoodma commented 5 years ago

Turns out it fixes it but is very inefficient, because I'm an idiot!