[go: up one dir, main page]

Showing posts with label JRuby. Show all posts
Showing posts with label JRuby. 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 RubyJRuby 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 GTKGlimmer DSL for Tcl/TkGlimmer 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 RedcarArcadia, 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:



Thursday, June 22, 2023

If You Liked Shoes, You'll Love Glimmer!

A new Glimmer FAQ (Frequently Asked Questions) section has been added to the Glimmer project README on GitHub in order to answer questions like "How do Glimmer GUI DSLs compare to Shoes?" and "What is the difference between Glimmer and Glimmer DSL for SWT?", among others.



I am including the Glimmer FAQ below for your convenience. If you have other questions that are not answered in the Glimmer FAQ, please submit via the comments page.


How do Glimmer GUI DSLs compare to Shoes?

If you liked Shoes, you'll love Glimmer!

That is because Glimmer does everything that Shoes did, but with a lighter and better GUI DSL (Graphical User Interface Domain Specific Language) that addresses all the issues that Shoes suffered from, such as:

  • Shoes does not allow code in Shoes blocks to use variables defined outside of Shoes blocks in a straightforward manner as it changes self inside Shoes blocks, breaking Ruby expectations and producing confusing behavior. On the other hand, Glimmer DSL blocks are 100% standard Ruby blocks that represent real closures, so they enable usage of variables defined outside the blocks in a 100% standard Ruby way.
  • Shoes lacks support for high-quality business widget controls (View components) like table and tree. Glimmer GUI DSLs that are feature complete like Glimmer DSL for SWT do support table and tree widgets. Some non-final Glimmer GUI DSLs like Glimmer DSL for LibUI support the table control too.
  • Shoes does not encourage proper separation of concerns with a correct MVC architecture (Model-View-Controller), resulting in a lot of non-presentation logic mixed with View code. Glimmer GUI DSLs do support proper separation of concerns 100% following the MVC or MVP (Model-View-Presenter) architecture by default.
  • Shoes does not provide a simple way for connecting View components to Model data. Glimmer GUI DSLs provide full bidirectional/unidirectional data-binding support out of the box that provides the terest code syntax for connecting Views to Models and keeping them in sync.
  • Shoes does not support a native mechanism for building custom View components. Glimmer GUI DSLs do support the ability to build custom widgets (aka controls or View components), custom windows (aka shells), and custom shapes (canvas graphics), enabling software engineers to expand a Glimmer DSL’s vocabulary with new keywords representing brand new visual concepts. That results in much higher productivity by enabling the reuse of higher visual concepts as their own self-encapsulated components.
  • Shoes does not expose native features of its wrapped GUI toolkit. Glimmer GUI DSLs do expose all native features of their wrapped GUI toolkits, thus enabling developers to use a GUI toolkit like SWT directly when needed on top of using Glimmer DSL for SWT (a widget initialized via SWT directly could be passed to Glimmer DSL for SWT to wrap as a Glimmer `WidgetProxy` object and integrate with other Glimmer initialized `WidgetProxy` objects). That facilitates the 80/20 rule of having Glimmer GUI DSLs automate 80% of the work while still enabling software engineers to reach down to the low-level GUI toolkit API in 20% of the cases when needed (though in practice, it's probably more like 1% of the cases).

It is great that Shoes paved the way for creating desktop GUI DSLs in Ruby. Glimmer took that approach to its maximum and produced the ultimate evolution of Shoes.


What is the difference between Glimmer and Glimmer DSL for SWT?

Glimmer DSL for SWT was the first GUI DSL created as part of the Glimmer project to enable building desktop applications, and it was originally just called Glimmer. It relied on the Eclipse SWT library to render native GUI (Graphical User Interface) widget controls (View components) on every platform (Mac, Windows, and Linux). Eventually, the idea of a Glimmer DSL proved itself so successful and viable for building desktop apps with a fraction of the effort needed in other programming languages/technologies that it was expanded to support other GUI toolkits. So, Glimmer got renamed to Glimmer DSL for SWT, and the core Glimmer DSL engine got extracted to Glimmer (becoming a DSL framework), which then got reused to build other Glimmer GUI DSLs such as Glimmer DSL for LibUI and Glimmer DSL for GTK, among many others.


What is the difference between Glimmer DSL for SWT and Glimmer DSL for LibUI?

Both Glimmer DSL for SWT and Glimmer DSL for LibUI support rendering platform native widgets/controls, which enable building native desktop apps that look 100% native on every platform (Mac, Windows, and Linux).

However, Glimmer DSL for SWT runs in JRuby (Ruby running in the JVM [Java Virtual Machine]) whereas Glimmer DSL for LibUI runs in standard Ruby (aka MRI Ruby or CRuby).

Glimmer DSL for SWT is 100% feature-complete and has a final release. Glimmer DSL for LibUI is 100% complete as far as covering the LibUI features, but LibUI itself is still a mid-alpha library, so it is missing a few features that will get added eventually.


What is the difference between Glimmer DSL for LibUI, Glimmer DSL for GTK, Glimmer DSL for Tk, Glimmer DSL for FX, and Glimmer DSL for WX?

All of Glimmer DSL for LibUIGlimmer DSL for GTK, Glimmer DSL for Tk, Glimmer DSL for FX, and Glimmer DSL for WX run in standard Ruby (aka MRI Ruby or CRuby).

However, only Glimmer DSL for LibUI and Glimmer DSL for WX render native controls on every platform. The other libraries do not render native controls on every platform, albeit Glimmer DSL for GTK renders native controls on Linux distributions utilizing Gnome.

Also, Glimmer DSL for LibUI does not require any prerequisites beyond installing the Ruby gem, so you can install it and get instant GUI with very little effort, whereas Glimmer DSL for GTKGlimmer DSL for TkGlimmer DSL for FX, and Glimmer DSL for WX do require extra dependencies in general, albeit Glimmer DSL for GTK has everything it needs in Linux Gnome flavors and both Glimmer DSL for FX and Glimmer DSL for WX have everything they need on Windows by including pre-built binaries.

You may learn more about the differences between various Glimmer DSLs by checking out the Glimmer DSL Comparison Table.


What is the difference between Glimmer DSL for SWT, Glimmer DSL for Swing, and Glimmer DSL for JFX?

Glimmer DSL for SWT relies on the Eclipse SWT library, which renders native widgets on every platform (Mac, Windows, and Linux) to build desktop apps that look 100% native on every platform (Mac, Windows, and Linux).

Glimmer DSL for Swing relies on Swing, which does not render native widgets on every platform. Glimmer DSL for JFX relies on JavaFX, which also does not render native widgets on every platform.

Also, SWT initializes native widgets in memory using non-Java code (e.g. C/C++), thus ensuring native OS high performance for rendering native widgets without being prone to Java garbage collection pauses. On the other hand, Swing and JavaFX initialize non-native widgets in memory using Java code, thus depend on the performance of the Java Virtual Machine while being prone to Java garbage collection pauses. As a result, SWT provides a better user experience than Swing and JavaFX.

You may learn more about the differences between various Glimmer DSLs by checking out the Glimmer DSL Comparison Table.


Why not just use SWT, LibUI, GTK, Tk, FOX Toolkit, wxWidgets, Swing, or JavaFX from Ruby directly?

GUI Toolkits implement low-level GUI rendering concerns. And, while some of them do offer object-oriented APIs, their APIs are very verbose and imperative by design due to being low-level APIs. As such, they require software engineers to write a lot more low-level code that does not map intuitively to the structure of the GUI visually, slowing down productivity and making maintainability more expensive.

Glimmer GUI DSLs on the other hand are fully declarative and follow Rails' Convention Over Configuration maxim by including smart defaults and automation of low-level details, so they enable software engineers to write the simplest most minimalistic code that maps to the actual visual GUI concepts, maximizing productivity and resulting in code that is very maintainable and intuitive to reason about.

Furthermore, Glimmer GUI DSLs offer advanced Bidirectional/Unidirectional Data-Binding Support, which enables syncing View data with Model attributes with the tersest code syntax possible to greatly simplify reasoning about the code while supporting proper separation of concerns through correct adherence to MVC (Model-View-Controller) and MVP (Model-View-Presenter). 

That's in addition to scaffolding and native executable packaging in some Glimmer GUI DSLs. As a result, productivity increases even further and maintainability becomes even less expensive, thus enabling software engineers to deliver pieces of software in a matter of minutes or hours for desktop application MVPs (Minimal Viable Products). As such, Glimmer GUI DSLs significantly shorten the feedback cycle and enable incrementally releasing features at a very fast pace, not possible with GUI toolkit low-level APIs.

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.26Glimmer 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!