-
Notifications
You must be signed in to change notification settings - Fork 5
UIEXT-3206: SimpleButtonWidget to be disable-able via a StateProvider #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends the SimpleButtonWidget to support being disabled via a StateProvider, preventing long-running actions from being triggered multiple times. The implementation adds a runFinishedProvider parameter that re-enables buttons once their actions complete.
Changes:
- Added
runFinishedProviderparameter toSimpleButtonWidgetannotation for controlling button enable/disable state - Integrated the new provider into the UI schema generation and state provider registration
- Provided a comprehensive example implementation (
ExampleCancelableButton) demonstrating cancelable long-running actions
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SimpleButtonWidget.java | Added runFinishedProvider parameter to the annotation |
| WidgetTreesToRefsAndStateProviders.java | Registered the new runFinishedProvider as a UI state provider |
| UiSchemaOptionsGenerator.java | Added logic to include the provider in UI schema options when specified |
| JsonFormsConsts.java | Added TAG_RUN_FINISHED constant for the frontend integration |
| ExampleCancelableButton.java | Complete example implementation of a cancelable button with UUID-based state management |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| synchronized (threadPerNode) { | ||
| Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> { | ||
| thread.interrupt(); | ||
| threadPerNode.remove(nodeID); | ||
| }); | ||
| } |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nested synchronization on the same object threadPerNode creates redundant locking. The outer synchronized block at line 258 already locks this object, making the inner synchronized block at line 261 unnecessary and potentially confusing.
| synchronized (threadPerNode) { | |
| Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> { | |
| thread.interrupt(); | |
| threadPerNode.remove(nodeID); | |
| }); | |
| } | |
| Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> { | |
| thread.interrupt(); | |
| threadPerNode.remove(nodeID); | |
| }); |
| * re-enabled once the provider provides a new uuid. | ||
| * | ||
| * @return provide a unique uuid once the button action has finished which lets frontend know the button can be | ||
| * re-enabled |
Copilot
AI
Jan 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states the provider should return a 'unique uuid', but any value change would trigger re-enablement. Consider clarifying that the provider returns a String value that changes when the action completes, rather than specifically requiring a UUID format.
| * re-enabled once the provider provides a new uuid. | |
| * | |
| * @return provide a unique uuid once the button action has finished which lets frontend know the button can be | |
| * re-enabled | |
| * re-enabled once the provider returns a new value. | |
| * | |
| * @return a {@link String} token whose value changes once the button action has finished, informing the frontend | |
| * that the button can be re-enabled |
692ab0b to
c6dc6bb
Compare
|
c6dc6bb to
78b30b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
UIEXT-3206 (WebUI-Migration SDF Reader)
This is a precursor to allowing frontend button to be disabled on click until the action has finished. UIEXT-3206 (WebUI-Migration SDF Reader)
78b30b5 to
853f416
Compare

Extend SimpleButtonWidget to be disable-able via a StateProvider
This is important to prevent long running actions from being triggered multiple times.
@PaulBrnrther contributed the functional code
@tcrundall-tng contributed the example implementation