Showing posts with label SWT. Show all posts
Showing posts with label SWT. Show all posts

Sunday, December 31, 2023

Glimmer DSL for SWT 4.30.0.0

Glimmer DSL for SWT 4.30.0.0 (JRuby Desktop Development Cross-Platform Native GUI Framework) is the quarterly major release that supports a new version of Eclipse SWT (version 4.30, released in December 2023).

Below is a screenshot of the Hello, Code Text! sample, which is written in Ruby using Glimmer DSL for SWT)

Change Log for glimmer-dsl-swt gem version 4.30.0.0:

  • Upgrade to SWT 4.30
  • Upgrade to JDK 21
  • Upgrade to JRuby 9.4.5.0 with Ruby 3.1 support
  • Upgrade to Glimmer 2.7.4
  • Avoid loading the entirety of facets when scaffolding or listing gems (speeding up performance of glimmer list and scaffold commands)
  • Fix Mandelbrot Fractal sample on Windows as it crashes if run from within VirtualBox due to attempting to access Concurrent.physical_processor_count, which has been changed to Concurrent.processor_count
  • Fix dimensions of Weather sample on Linux

More Sample Screenshots:




Happy New Year and Happy Glimmering!


Wednesday, October 18, 2023

Glimmer Wordle 1.1.5 Windows Support

Glimmer Wordle 1.1.5 has just been released with official support for Windows. Although the game worked on Windows before, thanks to the platform-independent Glimmer DSL for SWT GUI Ruby Gem it was built with, styling was not tweaked for Windows till now in version 1.1.5.


For a reminder of how the game flows, here is an animated Gif of the game running on the Mac.




Here is the GUI View Ruby code using the Glimmer DSL for SWT Ruby Gem:


Happy gaming!


Friday, September 22, 2023

Glimmer DSL for SWT 4.29.0.0 Released

Glimmer DSL for SWT (JRuby Desktop Development Cross-Platform Native GUI Framework) version 4.29.0.0 has just been released! It is the quarterly release that happens when a new version of the Eclipse SWT GUI toolkit comes out (SWT 4.29 was released in September of 2023). 

Change Log for 4.29.0.0:

  • Upgrade to SWT 4.29
  • Upgrade to JRuby 9.3.11.0
  • Enable setting properties direclty on main code body styled_text component of code_text by nesting properties underneath the code element (e.g. code_text { code { font font_options } })

Happy Glimmering!

(you may click on the samples below to view their Ruby code)







Monday, August 14, 2023

Every True Rubyist Builds Their Own Code Editor in Ruby!

Gladiator (Glimmer Editor) 0.11.0 has just been released! It is my personal day-to-day code editor that I have built in Ruby using Glimmer DSL for SWT (JRuby Desktop Development Cross-Platform Native GUI Framework). It has syntax highlighting support for 40+ programming languages, split pane support with drag and drop, file look up support, directory tree navigation support, and many smart editing keyboard shortcuts. I use it for professional Ruby on Rails software engineering too.

That said, I am no code editor building expert, so Gladiator looks ugly! But, I love it because I built it 100% myself. Every self respecting Senior Software Engineer out there should build their own code editor, even if just as a toy app to later be discarded in favor of another code editor (though they might grow to prefer their own). And, if they are Rubyists, they should build their code editor in Ruby (whether using MRI Ruby, JRuby or Opal Ruby). If you think of yourself as a Ruby Senior Software Engineer, but cannot build your own code editor in Ruby, there are serious holes in your skillset!! Explore Glimmer libraries for many Ruby options to help you start the code editor building challenge and journey; whether using the Fukuoka Ruby 2022 Award Winning Glimmer DSL for LibUI, the 100% feature-complete JRuby-based Glimmer DSL for SWT, the brand new Glimmer DSL for WX, the Linux-focused Glimmer DSL for GTK, Glimmer DSL for Tcl/Tk, Glimmer DSL for FXRuby, Glimmer DSL for Swing, Glimmer DSL for JavaFX, or Glimmer DSL for Opal.


Nowadays, I see many Software Engineers on the Internet and social media who claim to be "Rubyists", but use non-Ruby code editors and non-Ruby frontend technologies, and that comes across as part hypocrisy and part lost opportunity!! After all, if they truly believed in Ruby, they would be building more things in it. Computer processors are so fast nowadays that many of Ruby's performance trade-offs are negligible in practice, except in some niche programming specialties like numerical computing, realtime systems, low-level programming, and performance-intensive game development. But sadly, in the last decade, many fake "Rubyists" entered the Ruby community just to associate with the "cool" factor of Ruby or to obtain Ruby job salaries without truly believing in Ruby 100% or even fully understanding the Ruby way of doing things. 

Thankfully, there are many litmus tests out there that reveal true Rubyists from fake "Rubyists", and one of them is whether a Ruby Software Engineer has built their own code editor in Ruby or not, or if they at least use a Ruby-based code editor like Redcar, Arcadia, or Gladiator, among others. Personally, I do not just write Ruby code in a web backend using Rails. I also write all my desktop applications in Ruby using Glimmer, including my code editor Gladiator, and I try to even build web frontend in Ruby using Opal Ruby.


Just think of how great it would be if the Ruby community had a feature-rich Ruby-scriptable code editor / IDE that makes it possible to build plug-ins with highly maintainable and productive Ruby code. It does not have to support every programming language out there. It can just be a Ruby community niche thing. With such a Ruby-based code editor, Rubyists would be practicing what they preach regarding the productivity/maintainability of Ruby programming by using Ruby to build the very tools they use in day-to-day Ruby software engineering.

Update: KOTP (keeperotphones) made a code contribution by email right after I posted this article to support missing Ruby file formats: 'rbw', 'gemspec'. Thank you KOTP!

Wednesday, July 12, 2023

Glimmer DSL for SWT 4.28.0.0

Glimmer DSL for SWT 4.28.0.0 (JRuby Desktop Development Cross-Platform Native GUI Framework) is the quarterly major release that happens after a new version of Eclipse SWT (Standard Widget Toolkit) is released. It is wrapping SWT 4.28, which was released on June 5, 2023. Glimmer DSL for SWT enables building robust professional-grade desktop applications by offering a minimalistic Ruby DSL, bidirectional/unidirectional data-binding support, application/component scaffolding, convention over configuration via smart defaults and automation of low-level details, and native executable packaging. Glimmer on!!!

Glimmer DSL for SWT Samples:



Monday, March 20, 2023

Glimmer DSL for SWT 4.27.0.0

Glimmer DSL for SWT 4.27.0.0 has just been released as the latest quarterly major version release with the following changes:

  • Upgrade to Eclipse SWT 4.27
  • Upgrade to JRuby 9.3.10.0







Wednesday, February 01, 2023

Drum Solo Demo of Glimmer Metronome (+ Menus & Shortcuts)

I recorded a drum solo to demo Glimmer Metronome (click to see a video demo with audio). Glimmer Metronome is a Ruby-based metronome GUI app that supports different beat counts, click sounds, and tempos, including tap-based tempo calculation. It was built with Glimmer DSL for SWT using JRuby to help me with my drumming practice. Glimmer Metronome just received a new update in version 1.1.4 that adds menus and keyboard shortcuts, thus becoming more user-friendly when used via the keyboard alone. 

Here is another direct demo of Glimmer Metronome (click to see a video demo with audio).

Below is full documentation of Glimmer Metronome's features, including the new menus and keyboard shortcuts.

Enjoy!


Saturday, January 07, 2023

Using Nebula TextAssist from Glimmer DSL for SWT

Recently, I received a support request concerning Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) and the use of Nebula Custom Widgets, specifically the text_assist widget (auto-complete text field). 

For a quick background about Nebula, it is a collection of 55+ enterprise-grade high-quality SWT (Standard Widget Toolkit) custom widgets, including a progress circle, a password revealer, and an oscilloscope. Thanks to Glimmer DSL for SWT, they are usable from Ruby.




The support request mentioned that the text_assist custom widget was not working. It was because its Nebula implementation does not follow the SWT convention of always supporting a constructor that only takes (parent, style) arguments. This convention is actually universal in all widgets included in SWT out of the box. It is taken advantage of by Glimmer DSL for SWT to automate wiring of widgets between parents and children without having to pass arguments explicitly. The wiring is done automatically by simply nesting a child keyword (e.g. label) under a parent keyword (e.g. composite). Unfortunately, this convention is broken by the text_assist widget API, as documented in the TextAssist Nebula widget page:

“There is a big difference with other SWT widget : there is no constructor TextAssist(Composite parent, int style).

The only constructor available is public TextAssist(final Composite parent, final int style, final TextAssistContentProvider contentProvider)”
As such, nesting text_assist directly under a parent without passing arguments breaks.

The fix is very simple though. Glimmer DSL for SWT follows the 80/20 rule, which is common in Rails. That means, it automates 80% of the cases with convention over configuration for ultra-high productivity, and yet it still supports the remaining 20% of the cases (e.g. SWT widget not following API convention) through direct configuration. 

In the case of the Nebula text_assist custom widget, given that its API deviates from the standard convention, you can still use it by simply passing constructor arguments for text_assist directly in order to have it work as expected by its API. 

Let us demonstrate with an example.



Animated screenshot:




The shell widget (aka window) parent proxy Ruby object (wrapper of SWT Java object) is grabbed from the parent block variable (or any variable the parent is assigned to) before invoking the swt_widget method on it to grab the wrapped SWT Java object and pass it as per the expectation of the text_assist widget API (normally, all of this is done automatically for you with standard convention SWT widgets).   

Remember Shoes (the old Ruby desktop gem)? One of its biggest issues was lack of simple extensibility via high quality custom widgets. On the other hand, Glimmer DSL for SWT not only supports custom widgets written in Ruby, but also supports the entire Eclipse ecosystem and custom widgets written in Java, like Nebula.

Please support the most productive desktop development framework in Ruby (including productivity benefits not found in any web framework) by building applications in Glimmer DSL for SWT (or other Glimmer GUI DSLs)!

Happy Glimmering!

Saturday, December 24, 2022

Glimmer DSL for SWT 4.26.0.0

Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) has just had a major release for the quarterly update of the Eclipse SWT library, which is now up to version 4.26. Glimmer DSL for SWT now matches it with version 4.26.0.0.

Change Log for v4.26.0.0:

  • Upgrade to SWT 4.26
  • Ensure that scaffolded custom widget (red label) uses SWT constants passed to custom widget
  • Update sash form weights in Meta Sample for bigger monitors (give more space to code)
  • Pass border to multi-line lists since it will not be included by default anymore given they are overridden with :multi SWT style


  • Happy Glimmering!

    Saturday, October 15, 2022

    Glimmer DSL for SWT Video Tutorial 35 - Scaffolding and Packaging

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 35 is out! It walks software engineers through Scaffolding and Packaging (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 


    Happy Glimmering!


    P.S. If you have any questions, remarks, or corrections, feel free to share in comments.

    Saturday, September 24, 2022

    Glimmer DSL for SWT Video Tutorial 34 - Hello, Refined Table!

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 34 is out! It walks software engineers through the Hello, Refined Table! sample (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 



    Happy Glimmering!



    P.S. If you have any questions, remarks, or corrections, feel free to share in comments.

    Sunday, September 18, 2022

    Glimmer DSL for SWT Video Tutorial 33 - Tetris

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 33 is out! It walks software engineers through the Tetris sample (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 




    Happy Glimmering!



    P.S. If you have any questions, remarks, or corrections, feel free to share in comments.

    Monday, September 12, 2022

    Presenting at Montreal.rb: Glimmer DSL for SWT - Ruby Desktop Development GUI Framework

    I will be giving a talk at a Montreal.rb meetup with the title: 

    "Glimmer DSL for SWT - Ruby Desktop Development GUI Framework"

    The event will take place on Wednesday, October 5, 2022 at the Lexop office (506 McGill St Suite 400, Montreal, Quebec H2Y 2H6, Canada), starting at 6:30pm (talk starts at 7pm).

    Abstract:

    You may not already know, but it is possible to build native desktop applications for Mac, Windows, and Linux using Ruby, including native packaging as APP/DMG/PKG files on Mac, EXE/MSI files on Windows, and DEB/RPM files on Linux. In fact, Ruby syntax makes developing such applications much quicker with better maintainability than in traditional desktop development languages like C, C++, C#, Objective C, Swift, and Java. That is courtesy of Glimmer DSL for SWT, a JRuby Desktop Development GUI Framework that enables using the robust SWT cross-platform native GUI toolkit the Ruby way, with support for the following:

    • Application Scaffolding
    • Declarative Ruby GUI DSL (Graphical User Interface Domain Specific Language)
    • Declarative Unidirecitonal/Bidirectional Data-Binding
    • Declarative Drag and Drop
    • Custom Components
    • Canvas Graphics
    • Embedded Browser (Web View)
    • Native Executable Packaging (APP/DMG/PKG/EXE/MSI/DEB/RPM)

    This presentation will provide attendees with a broad overview of the features of Glimmer DSL for SWT while demonstrating samples and complete applications along the way.

    Target Audience:

    This talk should be invaluable to web developers in addition to desktop developers as it shows how to apply MVC 100% cleanly in a local app, as opposed to in a cluttered web app with many layers of separation and routing complexity, so it provides a great reference of how to apply MVC optimally, which can transfer to the web in addition to being useful on the desktop.

    RSVP: https://www.meetup.com/montrealrb/events/288312775/

    If you are anywhere in the vicinity of Montreal or neighbouring cities (e.g. Ottawa), come and join us!

    Please inform your colleagues and friends in tech about the event, and post about it on social media!

    Update 2022-10-07: Presentation Video and Slides have been posted.

    Saturday, September 10, 2022

    Glimmer DSL for SWT Video Tutorial 32 - Klondike Solitaire

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 32 is out! It walks software engineers through the Klondike Solitaire sample (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 



    Full-Fledged Glimmer Klondike Solitaire Application with Native Packaging (e.g. DMG on Mac):



    Happy Glimmering!



    P.S. If you have any questions, remarks, or corrections, feel free to share in comments.

    Monday, September 05, 2022

    Glimmer DSL for SWT Refined Table

    A recent blog post mentioned that in Glimmer DSL for SWT you can data-bind a table bidirectionally in a single line of declarative code, and that this same single line of code does more now by also data-binding extra cell properties by convention in addition to their text content, such as background color, foreground color, font, and image. 

    Well, in the latest release of Glimmer DSL for SWT, that single line of code is ever shorter now!

    So, instead of entering the following to do the table data-binding:

    items <=> [@presenter, :contacts, column_attributes: [:first_name, :last_name, :email]]

    You can now just enter the following: 

    items <=> [@presenter, :contacts]

    That does the same work now thanks to Convention Over Configuration. Basically, the data-binding statement will figure out the table column model attribute names automatically by convention from the table column names. That is done by assuming underscored versions of them, so for example, for column names 'First Name', 'Last Name', and 'Email', the assumed model attributes are `first_name`, `last_name`, and `email`. This idea originated in Glimmer DSL for LibUI (the CRuby equivalent of Glimmer DSL for SWT) before it got ported to Glimmer DSL for SWT.

    To give you more context, including the code of the specified table column names, here is the full editable table declaration in the Glimmer GUI DSL:

    table(:editable, :border) {

      table_column {

        text 'First Name'

        width 80

      }

      table_column {

        text 'Last Name'

        width 80

      }

      table_column {

        text 'Email'

        width 200

      } 

      items <=> [@presenter, :contacts]

    }

    Additionally, you can now customize attribute names only for columns that diverge from model attributes by supplying a mapping hash (instead of specifying all column attributes in an array). For example, if the `table_column` `text` is 'Email Address' instead of `Email`, then the table items (rows) data-binding declaration can map that column to the `email` model attribute, but leave the rest of the model attributes normally derived from column names by convention (e.g. `first_name` and `last_name`):

    items <=> [@presenter, :contacts, column_attributes: {'Email Address' => :email}]

    In other big news, Glimmer DSL for SWT 4.24.4.0 now ships with a brand new custom widget called `refined_table`, which enables displaying very large amounts of data by applying pagination, thus providing a more user-friendly experience for bigger tables (filtering support is coming in the future). Also, table data-binding performance has been optimized.


    The idea for this custom widget originated in Glimmer DSL for LibUI (the CRuby equivalent of Glimmer DSL for SWT), and was recently blogged about, including its use in Rubio-Radio.


    However, there are differences in the functionality and syntax of `refined_table` in Glimmer DSL for SWT. The page count is displayed in the same text field that displays the page number. When typing inside the text field, only the page number is needed, but it does not update the table until hitting ENTER or tabbing off / losing focus. Also, it was designed to be intentionally a drop-in replacement for `table`, so its syntax is as close as possible to that of `table`. That means, you simply use the keyword `refined_table` instead of `table`, but then continue to declare `table_column`s within it, and then you perform a data-binding, but on the `model_array` custom property instead of `items` to provide the complete master model collection and leave `refined_table` to do its own data-binding of `items` from the paginated collection of models instead of the master collection.





    Happy Glimmering! 

    P.S. If you have any questions, remarks, or corrections, feel free to share under comments.

    Friday, September 02, 2022

    Glimmer DSL for SWT Video Tutorial 31 - Battleship

    Before I get into today's Glimmer DSL for SWT video tutorial, I would like to mention that I updated the blog post "Glimmer DSL for LibUI Wins Fukuoka Ruby 2022 Special Award" with the certificate of merit and direct letter that I received from Matz (creator of Ruby) about Glimmer DSL for LibUI winning a Fukuoka Ruby 2022 Special Award.

     

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 31 is out! It walks software engineers through the Battleship sample (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 


    Happy Glimmering!


    Sunday, August 28, 2022

    Glimmer DSL for SWT Table Cell Data-Binding of Background/Foreground/Font/Image

    Glimmer was the first software library to enable declarative bidirectional data-binding of a table to a simple Presenter/Model collection with a single line of code (without using a visual designer/GUI)!

    items <=> [@presenter, :contacts, column_properties: [:first_name, :last_name, :email]]

    (table items [rows] are bidirectionally data-bound to the `:contacts` attribute on `@presenter` [every contact represents a row], with the columns mapped to `Contact` model properties: `first_name`, `last_name`, and `email`)

    Well, I am happy to announce that the same single line of code that data-binds a table does even more now as of the latest release made yesterday! In Glimmer DSL for SWT v4.24.3.0, that line of code also data-binds the following additional table cell properties without any change to the view code: 

    • Table cell background color
    • Table cell foreground color
    • Table cell font
    • Table cell image

    Data-bound table row models (or presenters) can now optionally supply this data by implementing methods that match the names of the column properties by convention, but with one of the following suffixes: 

    • `_background`
    • `_foreground`
    • `_font`
    • `_image` 

    For example, for the `first_name` property, the model can additionally implement `first_name_background`, which returns an RGB array (e.g. [24, 148, 240]) in order to set the color of the first_name cell for each model's table row to the specified RGB color. In the same way, `first_name_foreground`, `first_name_font`, and `first_name_image` can optionally be implemented too to specify their extra styling properties if needed. Of course, it would be better to implement presenters that wrap around models to provide these extra details for a cleaner separation of concerns, but I leave that to the discretion of Glimmer DSL for SWT software engineers.

    In any case, the Hello, Table! sample has been updated to reflect the new enhancements to table data-binding by coloring booked baseball game table cells green with a white foreground and an italic font:



    Here is the new and improved Hello, Table! code:

    In other news, Glimmer DSL for SWT v4.24.3.1 ships with `code_text` default behavior support for:

    • Zoom In: Bump font height up by 1 via keyboard shortcut: CMD+= on Mac and CTRL+= on Windows/Linux
    • Zoom Out: Bump font height up by 1 via keyboard shortcut: CMD+- on Mac and CTRL+- on Windows/Linux
    • Restore Original Font Height: Restore font height to original value before performing any zoom ins or outs via keyboard shortcut: CMD+0 on Mac and CTRL+0 on Windows/Linux
    Original Hello, Code Text


    Hello, Code Text with Zoom In 5 Times (via CMD+= Mac Shortcut)


    Hello, Code Text with Zoom Out 5 Times (via CMD+- Mac Shortcut)


    Hello, Code Text with Restore Original Font Height (via CMD+0 Mac Shortcut)


    Hello, Code Text! Sample Code (Unchanged):

    Friday, August 26, 2022

    Glimmer DSL for SWT Video Tutorial 30 - Hello, Custom Shape!

    Desktop development is about 10 times simpler than web development. Learn it and you will become a better web developer as you transfer the simplicity of desktop development to the web!

    Glimmer DSL for SWT Video Tutorial 30 is out! It walks software engineers through the Hello, Custom Shape! sample (make sure to bump up the resolution to HD at least)


    Glimmer DSL for SWT (JRuby Desktop Development GUI Framework - Ruby Gem): 



    Happy Glimmering!


    Monday, August 22, 2022

    Glimmer DSL for SWT Joins The Dark Side w/ Code Text

    In Glimmer DSL for SWT v4.24.2.2, the `code_text` custom widget, which supports syntax highlighting for 204 languages, has been upgraded with support for Dark Mode, utilizing the "glimmer_dark" theme. That said, the `code_text` custom widget can utilize any custom theme built for the Rouge Ruby gem by requiring it and passing its name in the `theme` option. So, users are not limited to the "glimmer_dark" theme for Dark Mode or the "glimmer", "github", and "paiste" themes for Light Mode. However, any Dark Mode custom theme must have the word "dark" in its name or else the `code_text` custom widget will automatically force the "glimmer_dark" theme when the operating system is in Dark Mode to ensure a good look.


    Even the Hello, Code Text! sample gets a different look when the operating system is in Dark Mode (ignoring whatever Light Mode theme is supplied and forcing the "glimmer_dark" theme).




    Check out the Hello, Code Text! code for an example of using `code_text`.

    And, here is an example of how to build a custom Rouge theme ('github' theme):

    Glimmer On!