Hi Folks,
I've gotten myself into an argument with myself that I'm struggling to find the answer to.
I'm developing a B4J application that has an extensive UI based on a single form containing:
The application is carved up as:
The problem is this...I want to ensure that the user is prompted to save the record (if changed) whenever they:
Am I over-thinking this or how/where should code be called that is re-used in different parts of the overall application.
I've gotten myself into an argument with myself that I'm struggling to find the answer to.
I'm developing a B4J application that has an extensive UI based on a single form containing:
- A Border pane containing:
- An Anchor Pane containing an Accordion on the left side
- An Anchor Pane in the center
- The Accordion contains a number of Title Panes that display brief details of records in different tables in a SQLite database. One Title Pane for each different table.
- You click on a record in the Title Pane and it loads a layout containing all the record details for the item chosend
- You can then edit, delete (or insert) a new record.
The application is carved up as:
- a Main module for the application orchestration and controlling the Accordion.
- a Code module for each of the Center Panes that allow record editing.
- a Code module for handling Records and database access for each type of record in the database.
The problem is this...I want to ensure that the user is prompted to save the record (if changed) whenever they:
- Click on a different record in the Title Pane (Accordion); OR
- Close the application; OR
- Click on the 'Update' menu (of the form); OR
- Click on the 'Update' option of a Context menu defined for the Center Pane
- The Record code module handles the DB access but should not display Message Dialogues
- I don't want to duplicate code that displays the
- Confirmation dialogue (and if Yes)
- Asks the Record module to Validate the data entered;
- If Invalid data displays a dialogue with the invalid data and aborts the update
- If valid data
- Asks the Record modules to update the database and displays success or not
Am I over-thinking this or how/where should code be called that is re-used in different parts of the overall application.