Modify

Opened 9 years ago

Last modified 2 months ago

#6157 reopened defect

Problems with combo + editable=false

Reported by: rodo Owned by: team
Priority: normal Milestone:
Component: Core Version:
Keywords: preset read only combo Cc: francois.lacombe, KorneySan

Description (last modified by simon04)

As previously discussed in #409 and #6156 it'll be usefull to have a readonly attribute on combo fields.

These feature is clearly described in TaggingPresets and will be very interesting for external presets in some project like HOT.

Attachments (5)

6157.patch (1.4 KB) - added by simon04 9 years ago.
editno.png (37.6 KB) - added by Klumbumbus 6 years ago.
force_larger_height_for_non-editable_combo_boxes.patch (973 bytes) - added by shr 6 months ago.
here's a quick fix
josm_6157_Preset_Debug.zip (13.8 KB) - added by skyper 4 months ago.
condensed sample preset derived from /Presets/MastAndTower
josm_6157_screenshot.png (36.0 KB) - added by skyper 4 months ago.
screenshot

Download all attachments as: .zip

Change History (32)

comment:1 Changed 9 years ago by jttt

Isn't editable property what you're looking for? I didn't actually try it but it's there and it should allow to only select value from list, not enter your own value in edit box.

comment:2 Changed 9 years ago by rodo

I've try these attribute, it works, but the value is not shown and I'm afraid it's not enough user-friendly for non techies people.

Changed 9 years ago by simon04

Attachment: 6157.patch added

comment:3 Changed 9 years ago by simon04

Description: modified (diff)
Summary: Add a readonly attribute in combo fields[Patch] Add a readonly attribute in combo fields

Patch attached. I don't see a reason why to use a custom ListCellRenderer for combo boxes …

comment:4 in reply to:  3 Changed 9 years ago by bastiK

Replying to simon04:

I don't see a reason why to use a custom ListCellRenderer for combo boxes …

It is for extended description e.g. for SAC_scale. This feature seems to be broken ([4340] ?).

comment:5 Changed 9 years ago by simon04

There seems to be some problem when using a <combo> element with editable="false". This is somehow related to the dummy entry which is returned on index -1.

comment:6 Changed 9 years ago by simon04

Summary: [Patch] Add a readonly attribute in combo fieldsAdd a readonly attribute in combo fields

comment:7 Changed 7 years ago by skyper

Component: External presetCore
Keywords: preset read only combo added

What is the status of this ticket ?

editable=* is available for combo. Is it still broken ?

comment:8 Changed 7 years ago by Don-vip

Yes. There are some weird problems with combo + editable=false, like incorrect values displayed, correct value displayed only when clicking on the combo...

comment:9 Changed 7 years ago by Don-vip

Summary: Add a readonly attribute in combo fieldsProblems with combo + editable=false
Type: enhancementdefect

Changed 6 years ago by Klumbumbus

Attachment: editno.png added

comment:10 Changed 6 years ago by Klumbumbus

also the text is cut off:



Last edited 6 years ago by Don-vip (previous) (diff)

comment:11 Changed 6 years ago by Klumbumbus

Ticket #11024 has been marked as a duplicate of this ticket.

comment:12 Changed 6 months ago by Klumbumbus

Ticket #18714 has been marked as a duplicate of this ticket.

comment:13 Changed 6 months ago by simon04

Cc: francois.lacombe KorneySan added

comment:14 Changed 6 months ago by shr

JComboBox height for an editable combobox is max(max(element_height), editor_height).
You can see that by diving down into combobox.reinitialize() > combobox.getPreferredSize() with IntelliJ IDEA.
On my machine this evaluates to max(14, 20) -> 20 for an editable combobox
But for a non-editable combobox this is just max(element_height) -> 14
That's why a non-editable combobox looks squashed.

Changed 6 months ago by shr

here's a quick fix

comment:15 Changed 6 months ago by skyper

Summary: Problems with combo + editable=false[Patch] Problems with combo + editable=false

comment:16 Changed 4 months ago by skyper

Cannot reproduce the cut off. Probably, different "look and feel".

But I can reproduce the wrong display of values, probably, one reason editable is not present in defaultpresets.

comment:17 Changed 4 months ago by skyper

I added the broken status and a link to the wiki, please, remove when fixed: wiki:TaggingPresets?action=diff&version=157

Changed 4 months ago by skyper

Attachment: josm_6157_Preset_Debug.zip added

condensed sample preset derived from /Presets/MastAndTower

Changed 4 months ago by skyper

Attachment: josm_6157_screenshot.png added

screenshot

comment:18 Changed 4 months ago by skyper

screenshot

See attached example preset where the screenshot was taken of.

OS: Debian 10 (buster)

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-03-30 07:18:28 +0200 (Mon, 30 Mar 2020)
Revision:16220
Build-Date:2020-03-30 23:25:33
URL:https://josm.openstreetmap.de/svn/trunk

Last edited 4 months ago by skyper (previous) (diff)

comment:19 Changed 4 months ago by shr

That's a different OS. When the cut off issue is present, height is calculated with JosmComboBox.getPreferredSize() which calls to this.ui.getPreferredSize() and this.ui is an instance of WindowsComboBoxUI

comment:20 in reply to:  19 Changed 4 months ago by skyper

Replying to shr:

That's a different OS. When the cut off issue is present, height is calculated with JosmComboBox.getPreferredSize() which calls to this.ui.getPreferredSize() and this.ui is an instance of WindowsComboBoxUI

Right, I have added the information.

comment:21 Changed 2 months ago by Klumbumbus

@simon04: While you are in the flow ;) could you have a look at the small patch after comment:14?

comment:22 Changed 2 months ago by simon04

Resolution: fixed
Status: newclosed

In 16565/josm:

fix #6157 - Presets: UI problems with combo + editable=false (patch by shr, modified)

comment:23 Changed 2 months ago by simon04

@Klumbumbus: There is some way to go, still, see report/8.

comment:24 Changed 2 months ago by simon04

Milestone: 20.06

comment:25 Changed 2 months ago by Klumbumbus

Thx, yes :)

comment:26 in reply to:  8 Changed 2 months ago by skyper

Milestone: 20.06
Priority: minornormal
Resolution: fixed
Status: closedreopened
Summary: [Patch] Problems with combo + editable=falseProblems with combo + editable=false

The patch did address only one problem but there is at least one more, see my comment (comment 18):

Donvip in comment 8:

Yes. There are some weird problems with combo + editable=false, like incorrect values displayed, correct value displayed only when clicking on the combo...

skyper in comment 16:

Cannot reproduce the cut off. Probably, different "look and feel".

But I can reproduce the wrong display of values, probably, one reason editable is not present in defaultpresets.

comment:27 in reply to:  8 Changed 2 months ago by Klumbumbus

I can confirm the height is fixed and the other problems (comment:8) are still there.
Also the text in the combo is bold when closed, which is not the case for "normal" combos and even for the ones with extended description.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as reopened The owner will remain team.
as The resolution will be set.
to The owner will be changed from team to the specified user.
The owner will change to rodo
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.