[go: up one dir, main page]

0% found this document useful (0 votes)
7 views4 pages

InfantProgressiveNoteForm Documentation

Uploaded by

anebek555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

InfantProgressiveNoteForm Documentation

Uploaded by

anebek555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

InfantProgressiveNoteForm Documentation

Package
package vms.system;

 Contains the forms and classes for Vaccine Management System (VMS).

Class: InfantProgressiveNoteForm
Description

A Swing-based form that allows users to register new infant progressive notes.
It collects infant information, diagnosis, progress notes, treatment plans, follow-up date, and
doctor information.

Attributes

Attribute Type Description


txtMRN JTextField
Displays infant Medical Record Number (non-
editable).
txtName JTextField Displays infant name (non-editable).
txtDOB JTextField Displays infant date of birth (non-editable).
txtGender JTextField Displays infant gender (non-editable).
txtAge JTextField Field to input the infant’s current age in months.
txtPrimaryDiag JTextField Field to input primary diagnosis.
txtSecondaryDiag JTextField Field to input secondary diagnosis.
progressArea JTextArea Text area for progress notes.
treatmentArea JTextArea Text area for treatment plan.
txtFollowUp JFormattedTextField Field to input/select follow-up date.
txtDoctor JTextField Field to input doctor’s name.
infantMRN String Holds the MRN of the infant.
con Connect Database connection and helper class.
onSaveSuccess Runnable Callback executed when saving is successful.

Constructor
public InfantProgressiveNoteForm(String infantMRN)
 Initializes the form with the specified infant MRN.
 Loads infant details (Name, DOB, Gender) using Connect class.
 Calls initializeUI() to set up the GUI.

Methods

1. setOnSaveSuccess

public void setOnSaveSuccess(Runnable onSaveSuccess)

 Sets a callback to notify the manager or parent form when a progressive note is
successfully saved.

2. initializeUI

private void initializeUI()

 Builds the entire form UI:


o Header section with title.
o Infant information panel.
o Diagnosis panel.
o Progress notes and treatment plan panels.
o Follow-up date and doctor information panel.
o Buttons panel (Save, Clear).
o Scrollable main panel for usability.
 Attaches action listeners for buttons and date picker.

3. showDatePicker

private void showDatePicker()

 Opens a modal dialog with a custom calendar (JMonthCalendar).


 User can double-click a day to select follow-up date.
 Updates txtFollowUp with the selected date in dd/MM/yyyy format.

4. handleSave

private void handleSave()


 Validates all required fields:
o MRN, Name, DOB, Gender, Age
o Primary and secondary diagnosis
o Progress note, treatment plan
o Follow-up date, doctor name
 Creates a InfantProgressiveNoteModel object with form data.
 Saves data to the database using Connect.saveInfantProgressiveNote(note).
 Displays success message and clears form.
 Executes onSaveSuccess callback if set.

5. clearForm

private void clearForm()

 Resets the form to its initial state:


o Preserves infant info fields (MRN, Name, DOB, Gender).
o Clears all other inputs (age, diagnosis, progress, treatment, follow-up, doctor).

6. createSectionPanel

private JPanel createSectionPanel(String title)

 Utility method to create titled sections with custom borders and background.
 Used for structuring panels (Infant Info, Diagnosis, Notes, etc.)

Main Method
public static void main(String[] args)

 Launches the form independently for testing.


 Opens InfantProgressiveNoteForm in a Swing window.

Nested Class: JMonthCalendar

Description

 A custom calendar component for selecting dates.


 Displays a month/year selector and a table of days.
 User can double-click a date to select it.

Key Methods

 getDate() – Returns the selected Date.


 stateChanged(ChangeEvent e) – Updates calendar when month/year changes.
 addActionListener(ActionListener listener) – Allows parent form to listen for
date selection.
 fireActionPerformed() – Fires an action event when a date is selected.

Usage Example
InfantProgressiveNoteForm form = new InfantProgressiveNoteForm("MRN12345");
form.setOnSaveSuccess(() -> System.out.println("Note saved successfully!"));
form.setVisible(true);

 Opens a form for infant MRN MRN12345.


 Executes callback after saving the note.

Validation

 Ensures all required fields are filled.


 Prevents empty or invalid data entry.
 Optional: Numeric validation for age can be added.

UI Features

 Read-only infant fields: MRN, Name, DOB, Gender


 Scrollable form for long notes.
 Custom date picker.
 Colored buttons for Save (green) and Clear (red).
 Sections with borders and headers for clear organization.

You might also like