Spring Roo
  1. Spring Roo
  2. ROO-1102

Extend shell so it can display quick information (flash) messages

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 1.1.0.M3
    • Component/s: @ ROO SHELL
    • Labels:
      None

      Description

      From a usability perspective it is sometimes useful to display incremental progress of long-running operations (eg the progress of downloading a large file). Such messages are only valid for a short period of time and are frequently replaced by an updated message. This is significantly different from Roo's normal shell messages, which list actions actually completed.

      It would be useful for the Shell interface to have a Shell.flash(String message) method, and allow implementations to implement this however they see fit. A default implementation in AbstractShell would simply output the flash message to the console as if it were a normal message.

        Issue Links

          Activity

          Hide
          Ben Alex added a comment -

          Initial commit in Git with ID 31a97f92a64018399eafa67954a3606f10f0ae1c. Tests OK on Linux. Tests problematic on Windows. Asking Joris to take a look, being the expert on JAnsi. Haven't tested on OSX.

          Show
          Ben Alex added a comment - Initial commit in Git with ID 31a97f92a64018399eafa67954a3606f10f0ae1c. Tests OK on Linux. Tests problematic on Windows. Asking Joris to take a look, being the expert on JAnsi. Haven't tested on OSX.
          Hide
          Joris Kuipers added a comment -

          Jansi 1.1 and 1.2 don't support save and restore ANSI escape sequences yet. I've added support for that (http://fusesource.com/forge/gitweb?p=jansi.git;a=commit;h=4afd42ee9d0d7718dbef39478542c5d768df260f) and have asked the project lead to cut a new release soon. This will very likely be a 1.3 version that will also replace JNA with something called HawtJNI, which should provide Roo with a (much) smaller transitive dependency size for Jansi. I've tested this with Roo trunk and a patched Jansi 1.2 version for now and everything seems to work fine.
          I've also fixed a trivial bug in JLineShell#doAnsiFlash, which was reversing row and column for the start position of the flash message.

          Show
          Joris Kuipers added a comment - Jansi 1.1 and 1.2 don't support save and restore ANSI escape sequences yet. I've added support for that ( http://fusesource.com/forge/gitweb?p=jansi.git;a=commit;h=4afd42ee9d0d7718dbef39478542c5d768df260f ) and have asked the project lead to cut a new release soon. This will very likely be a 1.3 version that will also replace JNA with something called HawtJNI, which should provide Roo with a (much) smaller transitive dependency size for Jansi. I've tested this with Roo trunk and a patched Jansi 1.2 version for now and everything seems to work fine. I've also fixed a trivial bug in JLineShell#doAnsiFlash, which was reversing row and column for the start position of the flash message.
          Hide
          Ben Alex added a comment -

          Made further enhancements in Git commit 6a4be4973b832dc13aa5b9e06504f733fae6f88c. This includes separating the display of different message "slots", such that different concurrently-running operations can ensure their status messages are displayed without being overwritten by status messages from a different process.

          Joris, not sure about the cursor position issue. The API docs at http://jline.sourceforge.net/apidocs/jline/ANSIBuffer.ANSICodes.html#gotoxy%28int,%20int%29 indicate the method parameter ordering is row then column. I've put a conditional block in to detect Windows and JLine and present it column then row, but kept it as row then column for other environments. Could you take a closer look into this when you have a chance?

          Show
          Ben Alex added a comment - Made further enhancements in Git commit 6a4be4973b832dc13aa5b9e06504f733fae6f88c. This includes separating the display of different message "slots", such that different concurrently-running operations can ensure their status messages are displayed without being overwritten by status messages from a different process. Joris, not sure about the cursor position issue. The API docs at http://jline.sourceforge.net/apidocs/jline/ANSIBuffer.ANSICodes.html#gotoxy%28int,%20int%29 indicate the method parameter ordering is row then column. I've put a conditional block in to detect Windows and JLine and present it column then row, but kept it as row then column for other environments. Could you take a closer look into this when you have a chance?
          Hide
          Joris Kuipers added a comment -

          This turns out to be a bug in Jansi: like JLine they used (x, y) as param names and apparently the implementor assumed that x stood for column (which is typical in most uses of a 2-dimensional axis system AFAIK). I've changed the parameter names and fixed that code, this will be part of the next Jansi release (see http://fusesource.com/forge/gitweb?p=jansi.git;a=commitdiff;h=987a683340abae6e8b0ae07645bed16eee55617f)

          I've updated the Roo code to remove the conditionals for Jansi: with the released versions of Jansi it won't work in the first place and the fix will be included in the next release, so no point in keeping it.

          Show
          Joris Kuipers added a comment - This turns out to be a bug in Jansi: like JLine they used (x, y) as param names and apparently the implementor assumed that x stood for column (which is typical in most uses of a 2-dimensional axis system AFAIK). I've changed the parameter names and fixed that code, this will be part of the next Jansi release (see http://fusesource.com/forge/gitweb?p=jansi.git;a=commitdiff;h=987a683340abae6e8b0ae07645bed16eee55617f ) I've updated the Roo code to remove the conditionals for Jansi: with the released versions of Jansi it won't work in the first place and the fix will be included in the next release, so no point in keeping it.
          Hide
          Joris Kuipers added a comment -

          Jansi 1.4 was just released: it includes my additions and bugfix and also has built-in JNI support via something called HawtJNI instead of using an external JNA dependency. I've successfully tested the new flash support against this Jansi version on Windows, so I have committed updates to the poms of shell-jline and shell-jline-osgi to depend directly on this jansi version from Maven Central. Wrapping it in a custom bundle isn't necessary, since Jansi is already built using bnd to generate an OSGi compliant manifest with all the required headers, so I've also removed the wrappers for Jansi and JNA (the latter is no longer used).

          Show
          Joris Kuipers added a comment - Jansi 1.4 was just released: it includes my additions and bugfix and also has built-in JNI support via something called HawtJNI instead of using an external JNA dependency. I've successfully tested the new flash support against this Jansi version on Windows, so I have committed updates to the poms of shell-jline and shell-jline-osgi to depend directly on this jansi version from Maven Central. Wrapping it in a custom bundle isn't necessary, since Jansi is already built using bnd to generate an OSGi compliant manifest with all the required headers, so I've also removed the wrappers for Jansi and JNA (the latter is no longer used).
          Hide
          Joris Kuipers added a comment -

          Just discovered a small but annoying remaining issue: the 'clear until end of line' doesn't reset the background color used for the flash messages under Windows. I didn't see this earlier since the default command colors on my WinXP don't actually show a different background color for reversed messages, but with a black-text-on-white-background prompt this does show.
          I haven't found a fix yet (this should really be fixed in Jansi); depending on user feedback we could disable the reverse() for Windows flash messages for now and use some color instead, but OTOH after scrolling one or two lines in the shell you don't notice this anymore anyway. I'll have a closer look at this issue after my vacation.

          Show
          Joris Kuipers added a comment - Just discovered a small but annoying remaining issue: the 'clear until end of line' doesn't reset the background color used for the flash messages under Windows. I didn't see this earlier since the default command colors on my WinXP don't actually show a different background color for reversed messages, but with a black-text-on-white-background prompt this does show. I haven't found a fix yet (this should really be fixed in Jansi); depending on user feedback we could disable the reverse() for Windows flash messages for now and use some color instead, but OTOH after scrolling one or two lines in the shell you don't notice this anymore anyway. I'll have a closer look at this issue after my vacation.

            People

            • Assignee:
              Ben Alex
              Reporter:
              Ben Alex
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: