#12462 closed enhancement (fixed)
[patch] Extend Save Layers dialog for more layer types
Reported by: | holgermappt | Owned by: | bastiK |
---|---|---|---|
Priority: | normal | Milestone: | 16.02 |
Component: | Core | Version: | |
Keywords: | Cc: | Klumbumbus |
Description
This patch adds functionality that allows all layers to indicate that they contain modified data. That is done by inheriting from AbstractModifiableLayer
. So far only OsmDataLayer
and NoteLayer
have that capability. A layer with modified data is added to the Unsaved Changes dialog. Layers indicate how they can save data by implementing one or all of the interfaces UploadToServer
and SaveToFile
. Layers that cannot save or upload their data are added to the dialog, but the only way to save their data is to save a session file. The dialog reflects the layer capabilities accordingly.
Changes
- Added interfaces
UploadToServer
andSaveToFile
. They are intended to be used by layers that are able to upload data to a server or to save changes to a file. I added them to document what a layer intends to do, not to enforce the implementation of the interfaces. It is a little bit redundant sinceAbstractModifiableLayer
implements the interfaces and the layers that implement one of the interfaces inherit fromAbstractModifiableLayer
. AbstractModifiableLayer
:- Added method
isUploadable()
. The relatedisSavable()
is defined inLayer
. Not sure if it is better to define both inLayer
because of similarities. ButisUploadable()
is not needed inLayer
, so I defined it here. - Implement interfaces
UploadToServer
andSaveToFile
.
- Added method
NoteLayer
,OsmDataLayer
: Implement interfacesUploadToServer
andSaveToFile
. Declare that the layer can upload.GeoImageLayer
: Inherit fromAbstractModifiableLayer
, added methodisModified()
. None of the interfaces is implemented.Main
: Add layer to dialog if it requires save or upload or if it has no save or upload capability.ActionFlagsTableCell
: Update the panel according to layer save/upload capabilities.LayerNameAndFilePathTableCell
: Add file chooser only if the layer can save to a file.SaveLayerInfo
: Added methodsisSavable()
andisUploadable()
.SaveLayersModel
: Set doSaveToFile only if the layer can be saved to a file.SaveLayersTableColumnModel
: Make addition of empty line that aligns the Recommended Actions cell content with the Actions To Take cell dependent on actions.
Open Issues
- If a layer with geotagged images is part of the dialog, then some table cells turn white if they receive the focus:
- Edit the GPS data of a photo (either correlate with a GPX track or move it with the photoadjust plugin), then delete the layer. In the Unsaved Changes dialog click in the Actions To Take cell of the Geotagged Images layer, then click in the Layer Name and File Path cell. The Layer Name and File Path cell becomes white. What could cause this?
References
- #12075 - Warn user before closing JOSM with unsaved adjusted pictures
- [josm-dev] How to ask for confirmation at layer deletion or exit?
Attachments (5)
Change History (20)
by , 9 years ago
Attachment: | ExtendedSaveLayersDialog.patch added |
---|
comment:1 by , 9 years ago
Milestone: | → 16.02 |
---|
follow-up: 3 comment:2 by , 9 years ago
comment:3 by , 9 years ago
Replying to Don-vip:
Replying to holgermappt:
- If a layer with geotagged images is part of the dialog, then some table cells turn white if they receive the focus
Can you please post a screenshot for this issue?
I added three screen shots. 12462_initial.png is the initial dialog. 12462_geoimage_layer_white.png is after clicking into the Actions To Take cell of the Geotagged Images layer, then click in the Layer Name and File Path cell. 12462_data_layer_white.png is after clicking into the Actions To Take cell of the Geotagged Images layer, then click in the Layer Name and File Path cell of the Data Layer.
by , 9 years ago
Attachment: | 12462_2_data_layers_white.png added |
---|
JOSM 9742 without patch, two data layers, layer name cell white.
follow-up: 7 comment:4 by , 9 years ago
I removed my patch and tried with two data layers. The Unsaved changes dialog shows the same white cell, so this is a general issue and not related to my patch:
.
To reproduce: Create two new data layers with changes, Ctrl+q, click into Data Layer 1 cell, then click into Data Layer 2 cell. Is this a known issue?
follow-up: 6 comment:5 by , 9 years ago
I see you're on Linux (Ubuntu ?). Have you checked that GNOME ATK wrapper is disabled? (see #12022 comments). This component breaks Java applications in every possible way.
comment:6 by , 9 years ago
Replying to Don-vip:
I see you're on Linux (Ubuntu ?). Have you checked that GNOME ATK wrapper is disabled? (see #12022 comments). This component breaks Java applications in every possible way.
I'm on openSUSE Leap, KDE, OpenJDK 8. Package java-atk-wrapper is not installed, there is no /etc/java-8-openjdk
, accessibility.properties
, or a file that contains assistive_technologies
in /etc.
follow-up: 8 comment:7 by , 9 years ago
Replying to holgermappt:
To reproduce: Create two new data layers with changes, Ctrl+q, click into Data Layer 1 cell, then click into Data Layer 2 cell. Is this a known issue?
Not known to me, but I can reproduce on Ubuntu with ATK wrapper turned off. The problem is that LayerNameAndFilePathTableCell
uses the same object as cell renderer and as cell editor. Java will launch the editor on click and afterward continues to render another cell. So during cell rendering JOSM wipes the editor component clean.
comment:8 by , 9 years ago
Replying to bastiK:
The problem is that
LayerNameAndFilePathTableCell
uses the same object as cell renderer and as cell editor. Java will launch the editor on click and afterward continues to render another cell. So during cell rendering JOSM wipes the editor component clean.
Can that be fixed? My Java knowledge is limited, my GUI programming knowledge is close to zero. I can change my patch if I have an example that does it the right way.
comment:9 by , 9 years ago
Owner: | changed from | to
---|
We could apply the patch first, if there are no other issues, Vincent?
comment:13 by , 9 years ago
Cc: | added |
---|
comment:15 by , 9 years ago
Replying to bastiK:
In 9754/josm:
First I thought that it is clever to use the same object for the cell renderer and the cell editor. Turns out it wasn't clever.
The Actions To Take cell has the same issue. For layers with checkboxes in that cell it is very hard to trigger it. But the geo image layer has an empty cell that turns white, e.g. if you click into the cell and then re-size the dialog. This is a very minor issue, though.
Replying to holgermappt:
Can you please post a screenshot for this issue?