Contact Manager is a Glimmer DSL for SWT sample leveraging SQLite DB via ActiveRecord.
Learn more in the blog post: Using ActiveRecord with SQLite DB in a JRuby Desktop App.
Requirements
- Store contacts having the following attributes:
- First Name
- Last Name
- Phone
- Street
- City
- State/Province
- Zip/Postal Code
- Country
- List stored contacts
- Search stored contacts by any of the contact attributes.
- Sort contacts by First Name, Last Name, Email, Phone, or Full Address
- Edit a stored contact
- Delete a stored contact
- Delete all stored contacts
Setup
Option 1: Install Native Executable Package
Contact Manager 1.0.1 (Mac Catalina 10.15.7 x86_64 DMG)
Contact Manager 1.0.1 (Windows 10.0.19043 x86_64 MSI)
Contact Manager 1.0.1 (Linux x86_64 DEB)
Contact Manager 1.0.1 (Linux x86_64 RPM)
Option 2: Install Ruby Gem
Start by setting up JDK 18 & JRuby 9.3.7.0 (+ RVM on Mac/Linux) just as per Glimmer DSL for SWT prerequisites.
Install Ruby gem:
gem install contact_manager -v1.0.2
Run:
contact_manager
Option 3: Clone Project Locally
Start by setting up JDK 18 & JRuby 9.3.7.0 (+ RVM on Mac/Linux) just as per Glimmer DSL for SWT prerequisites.
Clone:
git clone https://github.com/AndyObtiva/contact_manager.git
Change directory:
cd contact_manager
Bundle:
bundle
Run:
glimmer run
Or run with the binary script:
bin/contact_manager
You can package a native executable DMG on Mac:
glimmer "package[dmg]"
You can package a native executable MSI on Windows (assuming you followed MSI related setup instructions):
glimmer "package[msi]"
You can package a native executable DEB on debian-based Linux distros:
glimmer "package[deb]"
You can package a native executable RPM on redhat-based Linux distros:
glimmer "package[rpm]"
Software Architecture & Design
Contact Manager follows the Model-View-Presenter flavor of MVC, so the View communicates to the Model via a Presenter, which is an enhanced Controller that enables bidirectional attribute data-binding between the Model and the View.
The View uses contact_form
, contact_table
, and contact_manager_menu_bar
custom widgets (components).
The Contact Manager graphical user interface leverages the Master-Detail Interface Pattern by displaying a master list via contact_table
and allowing navigation by selecting a Contact
and displaying its details for editing in contact_form
.
contact_table
leverages the table
widget, which has automatic in-memory sort support. contact_table
also comes with a 'Delete...' right-click menu item (aka contextual pop up menu item) for deleting a selected Contact
row.
contact_manager_menu_bar
provides top menu bar actions like 'New', 'Save', 'Delete...', and 'Delete All...'
The Model layer includes a Contact
and ContactRepository
(DDD Repository Pattern) in addition to ContactPresenter
(which is both a Controller and a Model at a higher level).
Contact
follows the Active Record Pattern for Object Relational Mapping to store objects in a SQLite relational database table called contacts
via a migration. It also implements ActiveRecord Validations for first_name
, last_name
, email
, phone
, and zip_or_postal_code
fields.
ContactRepository
provides the ability to search through all Contact
s using the ActiveRecord Query Interface, triggered indirectly by ContactPresenter
when typing into a text
field that is on top of the contact_table
.
The database is stored at File.join(Dir.home, 'db/contact_manager.sqlite3')
TODO
Change Log
Contributing
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
- Fork the project.
- Start a feature/bugfix branch.
- Commit and push until you are happy with your contribution.
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright (c) 2022 Andy Maleh. See LICENSE.txt for further details.
--
Built with Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
Contact Manager logo was made by Freepik from www.flaticon.com