Monday, November 09, 2020

Glimmer DSL for SWT 4.17.10.0 Hello, Table! / Hello, Spinner! / Hello, Date Time!

Glimmer DSL for SWT (JRuby Desktop Development GUI Library) 4.17.10.0 and 4.17.9.0 ship with the following changes, including the new samples Hello, Table!, Hello, Spinner!, and Hello, Date Time! shown below:

v4.17.10.0

  • Support table editing via `date_time` for date/time values
  • Support table default sort configuration via sort_property
  • Support table default sort configuration via sort block
  • Support table default sort configuration via sort_by block
  • Hello, Table! Sample editor :date_time, property: :date_time in
  • Hello, Table! Sample label for  (Baseball Game Schedule)
  • Hello, Table! Sample combo for selecting nlds, nlcs, alds, alcs, world series
  • Hello, Table! Sample promotion field that indicates things like Free Bobblehead, Free Towel, Free Umbrella, etc...
  • ShellProxy#include_focus_control?
  • Fix issue with table selection data-binding when in single selection mode vs multi
  • Hello, Spinner! Sample

v4.17.9.0

  • Add table style :editable to hook editing listener on mouse click automatically (instead of manually via on_widget_selected)
  • Support table editing via `spinner` for integer values
  • date_time widget official data-binding support of date_time, date, time, year, month, day, hours, minutes, and seconds
  • date widget alias for date_time(:date)
  • time widget alias for date_time(:time)
  • calendar widget alias for date_time(:calendar)
  • date_drop_down widget alias for date_time(:date, :drop_down)
  • Hello, Date Time! Sample


# Excerpt From: https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_table.rb
table(:editable) { |table_proxy|
layout_data :fill, :fill, true, true
table_column {
text 'Game Date'
width 150
sort_property :date # ensure sorting by real date value (not `game_date` string specified in items below)
editor :date_drop_down, property: :date_time
}
table_column {
text 'Game Time'
width 150
sort_property :time # ensure sorting by real time value (not `game_time` string specified in items below)
editor :time, property: :date_time
}
table_column {
text 'Ballpark'
width 180
editor :none
}
table_column {
text 'Home Team'
width 150
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
}
table_column {
text 'Away Team'
width 150
editor :combo, :read_only # read_only is simply an SWT style passed to combo widget
}
table_column {
text 'Promotion'
width 150
# default text editor is used here
}
# Data-bind table items (rows) to a model collection property, specifying column properties ordering per nested model
items bind(BaseballGame, :schedule), column_properties(:game_date, :game_time, :ballpark, :home_team, :away_team, :promotion)
# Data-bind table selection
selection bind(BaseballGame, :selected_game)
# Default initial sort property
sort_property :date
# Sort by these additional properties after handling sort by the column the user clicked
additional_sort_properties :date, :time, :home_team, :away_team, :ballpark, :promotion
menu {
menu_item {
text 'Book'
on_widget_selected {
book_selected_game
}
}
}
}




# Excerpt From: https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_date_time.rb
shell {
row_layout :vertical
text 'Hello, Date Time!'
minimum_size 180, 180
label {
text 'Date of Birth'
font height: 16, style: :bold
}
date { # alias for date_time(:date)
date_time bind(person, :date_of_birth)
}
date_drop_down { # alias for date_time(:date, :drop_down)
date_time bind(person, :date_of_birth)
}
time { # alias for date_time(:time)
date_time bind(person, :date_of_birth)
}
calendar { # alias for date_time(:calendar)
date_time bind(person, :date_of_birth)
}
}.open




# From: https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/docs/reference/GLIMMER_SAMPLES.md#hello-spinner
class HelloSpinner
class Person
attr_accessor :donation
end
include Glimmer::UI::CustomShell
before_body do
@person = Person.new
@person.donation = 500 # in cents
end
body {
shell {
grid_layout
text 'Hello, Spinner!'
label {
text 'Please select the amount you would like to donate to the poor:'
}
composite {
grid_layout 3, false
label {
layout_data {
width_hint 240
}
text 'Amount:'
font style: :bold
}
label {
text '$'
}
spinner {
digits 2 # digits after the decimal point
minimum 100 # minimum value (including digits after the decimal point)
maximum 15000 # maximum value (including digits after the decimal point)
increment 500 # increment on up and down (including digits after the decimal point)
page_increment 5000 # page increment on page up and page down (including digits after the decimal point)
selection <=> [@person, :donation] # selection must be set last if other properties are configured to ensure value is within bounds
}
label {
layout_data(:fill, :center, true, false)
text <=> [@person, :donation, on_read: ->(value) { "Thank you for your donation of $#{"%.2f" % (value.to_f / 100.0)}"}]
}
}
}
}
end
HelloSpinner.launch

Happy Glimmering!






No comments: