Modify

Opened 13 years ago

Closed 3 years ago

Last modified 2 years ago

#6157 closed defect (fixed)

Problems with combo + editable=false

Reported by: rodo Owned by: team
Priority: normal Milestone: 21.10
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 12 years ago.
editno.png (37.6 KB ) - added by Klumbumbus 9 years ago.
force_larger_height_for_non-editable_combo_boxes.patch (973 bytes ) - added by shr 4 years ago.
here's a quick fix
josm_6157_Preset_Debug.zip (13.8 KB ) - added by skyper 4 years ago.
condensed sample preset derived from /Presets/MastAndTower
josm_6157_screenshot.png (36.0 KB ) - added by skyper 4 years ago.
screenshot

Download all attachments as: .zip

Change History (37)

comment:1 by jttt, 13 years ago

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 by rodo, 13 years ago

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.

by simon04, 12 years ago

Attachment: 6157.patch added

comment:3 by simon04, 12 years ago

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 …

in reply to:  3 comment:4 by bastiK, 12 years ago

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 by simon04, 12 years ago

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 by simon04, 12 years ago

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

comment:7 by skyper, 11 years ago

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 by Don-vip, 11 years ago

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 by Don-vip, 11 years ago

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

by Klumbumbus, 9 years ago

Attachment: editno.png added

comment:10 by Klumbumbus, 9 years ago

also the text is cut off:


Version 0, edited 9 years ago by Klumbumbus (next)

comment:11 by Klumbumbus, 9 years ago

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

comment:12 by Klumbumbus, 4 years ago

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

comment:13 by simon04, 4 years ago

Cc: francois.lacombe KorneySan added

comment:14 by shr, 4 years ago

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.

by shr, 4 years ago

here's a quick fix

comment:15 by skyper, 4 years ago

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

comment:16 by skyper, 4 years ago

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 by skyper, 4 years ago

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

by skyper, 4 years ago

Attachment: josm_6157_Preset_Debug.zip added

condensed sample preset derived from /Presets/MastAndTower

by skyper, 4 years ago

Attachment: josm_6157_screenshot.png added

screenshot

comment:18 by skyper, 4 years ago

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 years ago by skyper (previous) (diff)

comment:19 by shr, 4 years ago

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

in reply to:  19 comment:20 by skyper, 4 years ago

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 by Klumbumbus, 4 years ago

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

comment:22 by simon04, 4 years ago

Resolution: fixed
Status: newclosed

In 16565/josm:

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

comment:23 by simon04, 4 years ago

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

comment:24 by simon04, 4 years ago

Milestone: 20.06

comment:25 by Klumbumbus, 4 years ago

Thx, yes :)

in reply to:  8 comment:26 by skyper, 4 years ago

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.

in reply to:  8 comment:27 by Klumbumbus, 4 years ago

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.

comment:28 by Don-vip, 3 years ago

Milestone: 21.09

should be fixed with #21319

comment:29 by Don-vip, 3 years ago

Resolution: fixed
Status: reopenedclosed

In 18221/josm:

fix #21319 - Refactoring of class hierarchy around JosmComboBox / AutoCompComboBox (patch by marcello):

  • Code reuse: JosmComboBox now uses a JosmTextField as editor
  • Code reuse: AutoCompComboBox now uses AutoCompTextField as editor
  • JosmComboBox uses more of the original L&F
  • JosmComboBox lists now expand all the way to the bottom or the top of the screen
  • Variable height items in combobox lists now work, see #19321
  • Autocomplete uses different algorithm, fix #21290
  • editable="false" comboboxes in Presets now work, fix #6157 see #11024 see #18714
  • The user may toggle LTR-RTL script in JosmTextField (menu and ctrl+space)
  • LTR-RTL automatically toggles according to key in AddTag and EditTag dialogs, fix #16163

comment:30 by Don-vip, 3 years ago

Milestone: 21.0921.10

Milestone renamed

comment:31 by idrizza, 2 years ago

Hello, it seems to me that there's still some bizarre behaviour with this. When I have "editable=false" in a combo, the first value of the list doesn't show up in the field even when clicked on it. Moreover, the value of one field can appear in all the other combo fields of the form. It's only a visual glitch though, because the real values for the keys are still there underneath.

comment:32 by skyper, 2 years ago

@idrizza:
Please, create a new ticket, mentioning this one, with a complete description how to reproduce. Thanks.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.