Skip to content

CAMEL-23512: Fix TamboUI API misuse in camel-jbang-plugin-tui#23200

Merged
davsclaus merged 10 commits into
mainfrom
CAMEL-23512-fix-tui-tamboui-api
May 14, 2026
Merged

CAMEL-23512: Fix TamboUI API misuse in camel-jbang-plugin-tui#23200
davsclaus merged 10 commits into
mainfrom
CAMEL-23512-fix-tui-tamboui-api

Conversation

@davsclaus
Copy link
Copy Markdown
Contributor

Summary

  • Replace deprecated KeyEvent.character() with ke.string() for proper Unicode support
  • Use CharWidth for display width calculations instead of String.length() (fixes CJK/emoji display)
  • Use TamboUI semantic key bindings (isPageUp(), isCancel(), isFocusNext(), etc.) instead of raw KeyCode checks, enabling vim/emacs key binding support
  • Enable mouse capture in CamelMonitor for diagram scrolling
  • Move TableState for processors and route header to class fields (fixes lost selection state)
  • Use Style.EMPTY constant instead of Style.create() (219 occurrences)
  • Use Block with Borders.TOP_ONLY for catalog separator instead of manual character repetition
  • Use Paragraph's built-in scroll() and Overflow.WRAP_WORD instead of manual line slicing and custom wrapText() method
  • Replace vim g/G keys with Home/End in Log tab for consistency
  • Deduplicate footer rendering with hint() helper methods (-27 lines)

Test plan

  • Module builds successfully (mvn clean install -pl dsl/camel-jbang/camel-jbang-plugin-tui -Dquickly)
  • Code formatting passes (mvn formatter:format impsort:sort)
  • Run camel tui monitor and verify all 6 tabs render correctly
  • Run camel tui catalog and verify component browsing, filtering, and description scrolling
  • Verify keyboard navigation works (arrows, Tab, Enter, Escape, Home/End, PgUp/PgDn)
  • Verify mouse scroll works in diagram view

🤖 Generated with Claude Code

Claude Code on behalf of Claus Ibsen

davsclaus and others added 7 commits May 13, 2026 21:58
- Replace deprecated KeyEvent.character() with ke.string() for proper Unicode support
- Use CharWidth for display width calculations instead of String.length()
- Fix TuiHelper.truncate() to use CharWidth.truncateWithEllipsis()
- Fix CamelCatalogTui.wrapText() and flowFields() to use CharWidth
- Fix CamelMonitor diagram width calculation to use CharWidth
- Enable mouse capture in CamelMonitor for diagram scrolling
- Move TableState for processors and route header to class fields

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… checks

Replace raw KeyCode checks with semantic binding methods so vim/emacs
key bindings are respected automatically via TamboUI's binding system.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use standard Home/End keys for jump-to-top and jump-to-end in the
log viewer instead of vim-style g/G for consistency with normal users.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual Unicode box-drawing character repetition with TamboUI's
Block widget using Borders.TOP_ONLY for idiomatic separator rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoid unnecessary method call overhead by using the Style.EMPTY
constant directly instead of the Style.create() factory method
which just returns EMPTY.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual line slicing and custom wrapText() method with
Paragraph's built-in scroll() and Overflow.WRAP_WORD support.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract hint(), hintLast(), and hintRefresh() helpers to eliminate
repeated Span.styled/Span.raw patterns across all six tab footers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davsclaus davsclaus requested a review from gnodet May 13, 2026 21:04
@github-actions
Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions github-actions Bot added the dsl label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

🧪 CI tested the following changed modules:

  • dsl/camel-jbang/camel-jbang-plugin-tui
All tested modules (2 modules)
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: Launcher :: Container

⚙️ View full build and test results

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements, LGTM !

davsclaus and others added 3 commits May 14, 2026 07:40
Move refreshData() and loadDiagramForSelectedRoute() to background
threads using TuiRunner.scheduler() to prevent UI freezes.

- refreshData() now runs on the scheduler thread with AtomicBoolean
  guard against overlapping refreshes; results swapped to render thread
- loadDiagramForSelectedRoute() shows loading state immediately, then
  runs file I/O, polling, and diagram rendering on the scheduler thread;
  diagram state applied atomically via runOnRenderThread()
- Convert logLines/filteredLogEntries to swap-on-write pattern for
  thread-safe reads from the render thread
- pollJsonResponse() Thread.sleep loop no longer blocks the render thread

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove custom orange thumb color from vertical scrollbar so both
vertical and horizontal scrollbars use the same default style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Place PgUp/PgDn and Home/End next to each other in the Log tab
footer for consistent grouping of navigation keys.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davsclaus davsclaus merged commit 2c53ecd into main May 14, 2026
6 checks passed
@davsclaus davsclaus deleted the CAMEL-23512-fix-tui-tamboui-api branch May 14, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants