Commit Graph

227 Commits

Author SHA1 Message Date
Janne Valkealahti
2d29050c34 Make Catalog browsers focusable with shortcuts
- Category and scenario list views can now be focused with
  ctrl+a/ctrl+s.
- Bind all keys with ctrl modifier
- Add "shortcut" concept to views which currently hooks to
  hot keys.
- In a catalog app by using a "shortcut" then takes the key
  event as a hot key, as it consumes resulting behaviour
  is to focus.
- Move view initInternal away from constructor call to
  require user to call init() which is not in a
  View interface
- Relates #826
2023-11-12 16:43:11 +00:00
Janne Valkealahti
ccf6d771d9 Add multiinput scenario
- InputView using viewcommands and has event for text change.
- Experimental way to handle tab navigation in a layout views.
- New viewcommands for tab navigation and moving cursor.
- Mouse click takes focus in AbstractView if no view command
  binding.
- MultiInputViewScenario now shows tab navigation.
- Fixes #917
2023-11-07 08:26:43 +00:00
Janne Valkealahti
bba7a82ab4 Make StatusBarView work with hotkeys
- StatusItem can now define a hotkey which is then
  bound to its action.
- In catalog app replace use of raw key event to
  item's hotkey for status bar visibility.
- Various doc updates.
- Relates #826
2023-10-30 09:31:03 +00:00
Janne Valkealahti
82df453cc0 Autoconfigure TerminalUI
- Add TerminalUIBuilder which can be used to build TerminalUI
- Add TerminalUICustomizer which can customize TerminalUI
- What is autoconfigured is TerminalUIBuilder.
- In TerminalUI add configure for views which now allows
  easier way to set needed stuff in views.
- Various changes in a catalog app
- Fixes #900
2023-10-25 09:10:42 +01:00
Janne Valkealahti
eacd6c3df4 Make DefaultEventLoopTests more reliable
- Temp workaround for letting tests pass
- Relates #898
2023-10-21 09:02:52 +01:00
Janne Valkealahti
4871b19c58 Polish 2023-10-20 09:03:08 +01:00
Janne Valkealahti
92eb7dd2b7 Relocate message package from view
- Relates #813
2023-10-20 08:48:36 +01:00
Janne Valkealahti
433c1f96f0 Relocate geom package from view
- Relates #813
2023-10-20 08:38:01 +01:00
Janne Valkealahti
8de0ef47df Better background handling in themes
- Modify view structures so that we're able to
  control background drawing better
- Remove transparent concept from box view
- Add background styles for dialog, menu/status bars
- Relates #824
2023-10-19 13:12:42 +01:00
Janne Valkealahti
b6d1958949 HotKey can set focus
- Fix AbstractView to return focus info for hotkey handler
- TerminalUI sets focus from returned key handling
  for hotkeys
- Fixes #881
2023-10-08 09:19:47 +01:00
Janne Valkealahti
8716774236 Enhance TerminalUI eventing
- New methods in an eventloop and message builder
- Generic polish to use these methods
- Relates #761
2023-10-07 14:56:54 +01:00
Janne Valkealahti
585125d2e3 TerminalUI can define rootView rect
- Add functions to calculate Rectangle for fullscreen/nonfullscreen modes.
- Fixes for rendering so that nonfullscreen works better with views.
- Add some basic samples
- isEmpty method for Rectangle
- Fixes #872
2023-09-22 09:00:22 +01:00
Janne Valkealahti
d58293e700 Support view commands in view
- Setup facilities in view system to register commands
  with a Runnable to get dispatched into an event loop.
- As first commands, setup ListView with lineDown and
  lineUp.
- Expose needed functions into View itself.
- Relates #867
2023-09-21 09:03:58 +01:00
Janne Valkealahti
51c250608b Overhaul ListView to support checked states
- ListView can be defined to use nocheck, checked or radio
- List can now scroll through up/down
- Actual visual is handled in a DefaultListCell
- Modify/add scenarios and catalog app
- Relates #865
2023-09-09 08:59:37 +03:00
Janne Valkealahti
a679de0067 Add missing ascii keys to KeyEvent
- Relates #823
2023-09-09 08:48:17 +03:00
Janne Valkealahti
aa3c580220 Move interrupt message to ShellMessageBuilder
- Relates #761
2023-08-30 09:19:35 +03:00
Janne Valkealahti
a3ca69bc72 Non-fullscreen view
- ViewComponent can take view and drive it as non-fullscreen
- ViewDoneEvent which InputView now uses
- ComponentUiCommands is a sample where we add ideas for
  views in flow components
- Allow View to set eventloop
- Relates #850
2023-08-30 08:38:46 +03:00
Janne Valkealahti
ba5ab1a463 Dialog should float
- New WindowView which can be partially atop of background.
- DialogView now extends WindowView
- Change dialog in Catalog sample and Dialog scenario
- Relates #825
- Relates #855
2023-08-24 20:02:53 +03:00
Janne Valkealahti
b271c4493c Fix InputView position and deletion
- Fixes #856
2023-08-22 15:05:20 +03:00
Janne Valkealahti
29417d495b Initial modal integration
- Integrate TerminalUI to ViewService and modals
- New Dialog scenario
- Relates #825
2023-08-21 09:37:05 +03:00
Janne Valkealahti
f9283ae83b Fix tests for ButtonView
- Relates #854
2023-08-21 09:27:18 +03:00
Janne Valkealahti
75765fc1ea Add missing changes for tests
- Relates #854
2023-08-21 09:07:42 +03:00
Janne Valkealahti
c667b8e7b2 Initial DialogView
- Relates #855
2023-08-21 09:05:35 +03:00
Janne Valkealahti
50806589bc Add ViewService interface
- Service interface with holds access to modal
  methods. To get used by views which i.e.
  want to show modal dialogs.
- Relates #825
2023-08-21 09:01:37 +03:00
Janne Valkealahti
55096a5d77 Initial ButtonView
- Relates #854
2023-08-21 08:56:52 +03:00
Janne Valkealahti
8363c953ed Fix screen text align
- Better calculation of center with horizontal
  and vertical positions.
- Fixes #853
2023-08-19 08:19:07 +03:00
Janne Valkealahti
7391d0d24f Initial hotkey infra
- Duplicate keyhandler into hotkeyhandler
- Define some view to handle hot keys, like AppView and MenuBarView
- Catalog app binds some menus to hot keys
- Bind all normal keys a-z with alt
- Relates #823
- Relates #826
2023-08-10 08:27:49 +01:00
Janne Valkealahti
5e40ac3815 Move AbstractControl one level up
- Relates #813
2023-08-06 12:57:34 +01:00
Janne Valkealahti
e447826a93 Polish 2023-08-06 12:37:59 +01:00
Janne Valkealahti
3704933d1e Better unicode handling
- Pass raw input into KeyEvent if it comes as unicode from jline
- Fixes in InputView to handle wide chars and cursor position
- Fixes #845
2023-08-06 07:22:09 +01:00
Janne Valkealahti
ef713638b2 Base theming for views
- Control is now aware of active theme name and resolver.
- Theme some settings in BoxView, ListView and MenuView.
- Overhaul scenario system to make it work with themes.
- Add new "background" StyleSetting.
- Relates #824
2023-08-04 14:19:33 +01:00
Janne Valkealahti
0dbe51056d Polish 2023-08-02 09:05:23 +01:00
Janne Valkealahti
4a56d2a886 Support initial checked state
- In MenuView initial check state can be set.
- Relates #832
2023-08-02 07:42:25 +01:00
Janne Valkealahti
e149dfaf14 Add better checked support in MenuView
- Keeping checked states outside of items.
- Revamp generic structure
- Can toggle item checked states
- Relates #832
2023-07-30 08:25:33 +01:00
MJ Gallego
b9180ba899 Completion proposal support for complete jline parameter
- to allow completing single argument with multiple tab clicks,
  for example file paths.
- Fixes #512
2023-07-25 09:11:34 +01:00
Janne Valkealahti
a4edc4e16f Polish 2023-07-23 14:19:48 +01:00
Janne Valkealahti
fe8c8646a1 Mouse click selects in ListView
- Add binding to click and select item from index
  if it's in bounds.
- Relates #806
2023-07-23 14:05:09 +01:00
Janne Valkealahti
d4bfe610a9 Fix key handling in AppView
- Now offering to menu if it has focus so that it
  can do its things. Essentially if menu is visible
  it take keys.
- Relates #807
2023-07-23 09:04:29 +01:00
Janne Valkealahti
4b927be807 Hide statusbar in a catalog app
- Can clear items from a GridView
- Full refactor for AppView now using GridView internally
  and can hide/show menu/status.
- Add function key bindings f1-f10
- Modify catalog app to use new features in an AppView, listen
  F10 key to toggle statusbar visibility.
- Relates #805
- Relates #807
- Relates #811
2023-07-22 14:21:10 +01:00
Janne Valkealahti
cd77272091 Add test for GridView row layout
- Relates #805
2023-07-22 07:52:42 +01:00
Janne Valkealahti
a19a50b3f3 Polish GridView
- Add some new tests
- Add javadocs
- Relates #805
2023-07-21 18:06:57 +01:00
Janne Valkealahti
c074af314b Add focused color and style for BoxView title
- May define focused color and style for title
  which overrides normal color and style if set.
- Use these in a catalog app.
- Relates #804
2023-07-21 09:26:31 +01:00
Janne Valkealahti
eab938af8a Polish error messages
- Polish mandatory option message by using
  same format as in 3.0.x. (old parser)
- Remove prefixed code/position parts from
  all messages coming from a parser. (new parser)
- Fixes #815
2023-07-19 08:11:58 +01:00
Janne Valkealahti
d053fab383 Expose column and row min setting in GridView
- Add method setMinSize for setting minimum width for columns
  and minimum height for rows.
- Relates #805
2023-07-16 18:13:39 +01:00
Janne Valkealahti
3ac48bf15a Add missing GridView tests
- Add some new tests and reorg into nested model.
- Relates #805
2023-07-16 13:33:21 +01:00
Janne Valkealahti
a0bdbfc033 Initial terminal ui implementation
- This commit adds proof of concept work for terminal ui as is.
- Some things work, some don't but we need to start from somewhere.
  Further development continues in a main.
- Essentially we are starting to have enough so that it merits to
  move all this work into a main repo.
- Everything new is kept under org.springframework.shell.component.view
  and will get revisiter later to find correct locations for some classes.
- Catalog sample has been modified to provide "showcase" app for
  terminal ui features. This is a start while it already contains
  some usefull scenarios.
- Relates #800
- Relates #801
- Relates #802
- Relates #803
- Relates #804
- Relates #805
- Relates #806
- Relates #807
- Relates #808
- Relates #809
- Relates #810
- Relates #811
2023-07-15 16:42:39 +01:00
Janne Valkealahti
32675c5e73 Add primary command feature
- NonInteractiveShellRunner can now shortcircuit into primary command
  just running it and passing args.
- Add hooks into autoconfig so that this is easy to configure.
- Relates #755
2023-07-05 10:33:55 +01:00
Janne Valkealahti
cdd703efa4 Fix alias usage with Command annotation
- Fix alias command extraction from existing @Command
  annotations so that we actually get multiple aliases
  defined if more than one defined on a method level.
- Fix rendering issue in a help stg template when
  multiple aliases exists.
- Fixes #796
2023-06-22 16:00:00 +01:00
Janne Valkealahti
811f1f9a55 Fix parser handling of positional args
- Change to have better support for args like:

    "--arg1 a --arg2 b"
    "--arg1 a --arg2 b c"
    "--arg1 a c --arg2 b c"
    "c --arg1 a --arg2 b"

  where option can have default values and position of
  positional args doesn't matter that much.
- Make parser to be aware of if it's handling last option
  so that we can differentiate if error can be given i.e.
  with too many args, etc.
- Fixes #795
2023-06-22 09:46:01 +01:00
Janne Valkealahti
9ef509a4da Make command not found configurable
- New CommandNotFoundResultHandler which handles
  CommandNotFound to be able to customize error shown.
- New CommandNotFoundMessageProvider which is a plain
  function given a "context" and returns a string.
  Context contains common info to provide better
  error messages.
- Default provider gives same message but
  removes long stacktrace(which previously originated
  from a common ThrowableResultHandler.
- Relates #778
2023-06-20 11:31:19 +01:00