Opened 13 years ago
Closed 12 years ago
#7846 closed enhancement (fixed)
Harmonize Relation popup menus
Reported by: | simon04 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
Currently, we have (at least) 3 different relation popup menus:
- Properties toggle dialog
- Select relation
- Select in relation list
- Select members
- Download incomplete members
- ----
- Go to OSM wiki for tag help
- Selection toggle dialog
- Zoom to selection
- Zoom to selected elements
- ----
- Select in relation list
- Call relation editor
- ----
- Download incomplete members
- Relation toggle dialog
- Download members
- Download incomplete members
- ----
- Select members
- Select members (add)
- Select relation
- Select relation (add)
- ----
- Add selection to relation
For a more intuitive UI, I am strongly in favour of a single, harmonized popup menu for all 3 toggle dialogs. To achieve this, we may need to disable (grey out) some entries for some dialogs.
Furthermore, the double click behaviour differs as well:
- Properties toggle dialog: open relation editor
- Selection/Relation toggle dialog: select
Attachments (1)
Change History (33)
comment:1 by , 13 years ago
comment:2 by , 12 years ago
I have started to prepare this change.
Many action were copy-pasted or very similar in these dialogs.
I tried to decouple these actions from toggle dialogs and place them into separate package, reducing number of list selection listeners.
comment:4 by , 12 years ago
Please fix the commit or post here in case of any related issues or revert it (if the chosen class structure is bad enough).
follow-up: 8 comment:6 by , 12 years ago
The chosen class structure is very good. Thanks for this code refactorization :) I have applied some code cleanup in r5794 :)
comment:8 by , 12 years ago
Replying to Don-vip:
The chosen class structure is very good. Thanks for this code refactorization :) I have applied some code cleanup in r5794 :)
Thank you :) There are some more changes to check.
In PropertiesDialog only real code change for now is adding multiselect behavior to membership table.
I am also planning to add multi-copy/paste in propertiesTable
(for pasting with Ctrl-Shift-V) later.
Modification of context menus and double-click should be now possible and can be discussed.
P.S. That is all for now from me because of night time and possible clean-up commit with number 5800 :-)
follow-up: 11 comment:10 by , 12 years ago
r5793 broke imagery-xml-bounds plugin, I'm working on a fix.
comment:11 by , 12 years ago
Replying to Don-vip:
r5793 broke imagery-xml-bounds plugin, I'm working on a fix.
I am sorry. I have looked at plugin code before committing, noticed calls like relationListDialog.addPopupMenuAction(relationListAction) but did not notice that many of these actions implement RelationRelated and SelectionChangeListener...
comment:12 by , 12 years ago
To fix ShowBoundsListAction (ListSelectionListener method are not called), most likely we should return ListPopupMenu into RelationListDialog in core.
Before r5793:
957 class RelationDialogPopupMenu extends ListPopupMenu {
958
959 public RelationDialogPopupMenu(JList list) {
960 super(list);
961
Since r5793:
783 class RelationDialogPopupMenu extends JPopupMenu {
and valueChanged() of additional actions is not called automatically...
Replacing RelationRelated action with AbstractRelationAction is simple, but it is not called automatically - maybe we need finder of AbstractRelationAction items in PropertiesDialog instead of long list.
Now: http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java#L396
Was with RelationRelated search: http://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java?rev=5789#L398
I am not touching the code, maybe you'll find more bugs...
comment:13 by , 12 years ago
I have started a significant refactorization, I'll attach a patch for review, probably tonight.
by , 12 years ago
Attachment: | 7846_refactor.patch added |
---|
Refactorization needed for xml-imagery-bounds and tag2link plugins
comment:15 by , 12 years ago
Summary: | Harmonize Relation popup menus → [Patch] Harmonize Relation popup menus |
---|
I plan to merge this patch tomorrow :)
follow-up: 17 comment:16 by , 12 years ago
Wow, the unified context menus!
I have looked at the code (had no time to apply). It looks clear, better than mine :)
It should work as needed, but our NodeAction, WayAction and RelationAction are little bit hard to reuse in other parts of JOSM. If we want to make it universal, maybe all action could be merged together ( OsmPrimitive? )...
There are also a lot of action-creating methods in DataActionPopupMenuHandler. Maybe this can be done automatically too (some arrays maybe..)?
The base class DataActionPopupMenuHandler can be reused too then.
There are more actions left in dialogs that we did not touch because they are not relation-related but node-way-or "primitive-list"-related.
However, these ideas may be non-realizable.
follow-up: 18 comment:17 by , 12 years ago
Replying to akks:
It should work as needed, but our NodeAction, WayAction and RelationAction are little bit hard to reuse in other parts of JOSM. If we want to make it universal, maybe all action could be merged together ( OsmPrimitive? )...
There are more actions left in dialogs that we did not touch because they are not relation-related but node-way-or "primitive-list"-related.
I have maybe an idea to implement a better approach (keep only an OsmPrimitiveAction interface) and move collection filtering from caller to specific actions. I'll try when I will have some time to do it.
comment:18 by , 12 years ago
Replying to Don-vip:
I have maybe an idea to implement a better approach (keep only an OsmPrimitiveAction interface) and move collection filtering from caller to specific actions. I'll try when I will have some time to do it.
Yes, I thought about it too. Main difficulty is that we need the updating of the primitive list to be fast (just copy the recference). Filtering or even checking from every action when selection is changed can slow down the process and increase CPU load... When the action is performed, it is OK.
comment:20 by , 12 years ago
@Don-vip: Have you started to edit the code? If no, I can edit the patch (joining different actions to OsmPrimitiveAction). Then you could check&fix it and apply.
I guess we need to fix plugins before tested release... If the time is short, we can apply it as is and rework later.
follow-up: 22 comment:21 by , 12 years ago
Sorry, I should have told you I was not available this week-end. I think I may be able to finish and commit this patch tonight, before the nightly rolls out :)
comment:22 by , 12 years ago
Replying to Don-vip:
Sorry, I should have told you I was not available this week-end. I think I may be able to finish and commit this patch tonight, before the nightly rolls out :)
I guessed that it was Easter holiday in Europe :)
OK, I'll check the committed code.
comment:25 by , 12 years ago
I have checked the code. It looks and works correctly. Some minor optimizations and universalizations (moving Zoom and Select actions etc.) may be done after Tested is released.
comment:27 by , 12 years ago
I have made the context menus in two dialogs look the same. I hope it does not break anything, but please check...
pre-latest build: https://dl.dropbox.com/u/63393258/josm-custom.jar
By the way, why do not we have auto-generated very-latest-josm.jar rebuilt after each revision for developers?
comment:28 by , 12 years ago
Summary: | [Patch] Harmonize Relation popup menus → Harmonize Relation popup menus |
---|
comment:31 by , 12 years ago
If Selection toggle dialog context menu should not be changed, then the ticket can be closed.
Btw, the corresponding parts in the source code are (r5324):