#13516 closed defect (fixed)
Layers dialog buttons remains enabled even if no layer is selected
Reported by: | Don-vip | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 16.10 |
Component: | Core | Version: | |
Keywords: | template_report gsoc-core regression layer | Cc: | michael2402 |
Description
What steps will reproduce the problem?
- Create two empty data layers (Ctrl-N twice)
- Delete the first one
- Note that the second layer is not selected, but the buttons of layers dialog (move up, delete, etc.) remain enabled and inoperant (as no layer is selected)
What is the expected result?
- buttons should all be disabled if no layer is selected
- second layer should become selected when the first one is deleted
Build-Date:2016-09-02 23:21:42 Revision:10932 Is-Local-Build:true Identification: JOSM/1.5 (10932 SVN en) Windows 10 64-Bit Memory Usage: 796 MB / 3634 MB (547 MB allocated, but free) Java version: 1.8.0_102-b14, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Screen: \Display0 1920x1080, \Display1 1920x1080, \Display2 1280x1024, Maximum Screen Size: 1920x1080 VM arguments: [-Dfile.encoding=UTF-8] Program arguments: [--debug] Dataset consistency test: No problems found Plugins: + apache-commons (32699) + ejml (32680) + geotools (32813) + jts (32699) + opendata (32898) + pbf (32865) + pointInfo (32870) + utilsplugin2 (32815) Map paint styles: + %UserProfile%\Desktop\test.mapcss Last errors/warnings: - W: Failed to load Mappaint styles from '%UserProfile%\Desktop\test.mapcss'. Exception was: java.io.FileNotFoundException: %UserProfile%\Desktop\test.mapcss (Le fichier spécifié est introuvable) - E: java.io.FileNotFoundException: %UserProfile%\Desktop\test.mapcss (Le fichier spécifié est introuvable) - W: Initializing map style %UserProfile%\Desktop\test.mapcss completed in 97 ms (1 errors, 0 warnings) - E: <josm.pref>\plugins\opendata\resources\org\openstreetmap\josm\plugins\opendata\modules\fr\datagouvfr\datasets\agriculture\RegistreParcellaire.mapcss (Le chemin d’accès spécifié est introuvable)
Attachments (2)
Change History (12)
by , 8 years ago
comment:1 by , 8 years ago
by , 8 years ago
Attachment: | delete_layers.gif added |
---|
comment:2 by , 8 years ago
comment:3 by , 8 years ago
comment:4 by , 8 years ago
Keywords: | layer added |
---|
comment:5 by , 8 years ago
Michael, I think the best way to handle it is to restore the old event logic: trigger an event after a layer has been removed.
comment:6 by , 8 years ago
Milestone: | 16.08 → 16.09 |
---|
comment:7 by , 8 years ago
Yes, we could do this.
The problem I had with it is that the remove event should not even depend on the active layer. Some layers called remove() for an other layer during the remove listener. This makes such behavior unpredictable.
I now added the option to schedule events for later removal to the remove event which avoids this problem, so we can change the event back to fire after the layer was removed.
comment:9 by , 8 years ago
I checked the places where listeners may access other layers. There are no more dependencies of the removed layer being in the list other than the validator layer (which was my main concern in the first place). The validator layer uses scheduleRemoval
now, so we should be fine.
By the way, we should consider it bad practice to modify the layer list inside the listeners. This causes inconsistencies in the order the listeners are fired.
... and it only works if there is only 1 layer remaining. If you have 2 remaining layers, the selection is changed correctly.