OutlineView does not paint read-only properties as disabled
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 13
### What happened
Given
* A property with `canWrite` returning `false`
* Displayed in the `OutlineView` using a `PropertyEditor` that supports a custom editor
The renderer is not set to disabled to display the property as read-only. Editors that do not support a custom editor are rendered disabled.
### How to reproduce
Create an `OutlineView` and display a read-only property using a renderer that supports a custom editor.
### Did this work correctly in an earlier version?
No
### Operating System
Linux
### JDK
Eclipse Adoptium 11.0.14.1
### Apache NetBeans packaging
Apache NetBeans platform
### Anything else
This happens all the time.
The main property sheet gets the renderer is as follows:
1. Create the renderer (if needed) and reset its enabled state to true
2. In `RendererFactory.getRenderer`, set the enabled state based on the `canWrite` value of the property
3. Embed the renderer in a button panel (this shows the ... button) which resets its own enabled state to `true` which in turn sets the enabled state of the nested renderer to `true`
4. In `SheetTable.prepareRenderer`, set the enabled state again based on the `canWrite` value of the property
When called from the `OutlineView`, it goes through the same steps except for the last one. The comparable place to set the enabled state of the renderer would be in `RendererPropertyDisplayer.getRenderer` or `paintComponent`. Adding the logic there to set it enabled based on the value of `canWrite()` would work, but it seems better to simply move the logic in `RendererFactory` after it is nested in the button panel and remove the logic from `SheetTable.prepareRenderer` that probably would no longer be needed.
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
Contributor guide
Research direction
Start by reading RendererFactory and compare its renderer setup with SheetTable.prepareRenderer and the OutlineView path through RendererPropertyDisplayer.getRenderer or paintComponent. Confirm how the button panel resets the nested renderer state; done means a read-only property using a custom-editor renderer is painted disabled in OutlineView without breaking the main property sheet.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100