@startuml

' use strict UML mode
skinparam style strictuml

' create actor user
actor "User" as user

' create main adminstration 
participant "Administration" as main <<main>>
main++

' create main menu frame
create "MainMenu" as menu <<frame>>
main -> menu : construct

user -> menu++ : clicks 'Add New Product' button

' create product editor dialog
create "ProductEditor" as editor <<dialog>>
menu -> editor : construct

editor++

' create a DAO
create "ProductListDAO" as dao <<DAO>>
editor -> dao : construct 

' create the simple model list
create "SimpleListModel" as modellist <<gui.helpers>>
editor -> modellist : construct

editor -> dao++ : getCategories() 
dao --> editor : allCategories
dao--

editor -> modellist : updateItems(allCategories)
editor -> editor : setModel(categoryDisplay)

editor--

' user enters product details and clicks the save product button
user -> editor++ : enters product details
editor--

user -> editor++ : clicks 'Save' button

' self interactions to pull text and run conversions
editor -> editor : use getText() to get attributes from GUI
editor -> editor : convert number values to BigDecimal and Integer

' create a Product
create "Product" as product <<domain>>
editor -> product : construct

editor -> product++ : use setters to set product attributes
product-- 

editor -> product++ : System.out.println(product)
product--

editor -> dao++ : save(product)
dao--
editor--

' dispose dialog
user -> editor++ : clicks 'Cancel' button
editor -> editor : dispose()

' show control returning to menu as editor closes
editor --> menu 
destroy editor

menu --> user-- : awaiting next operation

@enduml
