UserInterface.DonorRole.DonorWorkAreaJPanel.java Source code

Java tutorial

Introduction

Here is the source code for UserInterface.DonorRole.DonorWorkAreaJPanel.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package UserInterface.DonorRole;

import Business.Helper.CardLayoutContainer;
import Business.Helper.EmailNotification;
import Business.Helper.GenerateReports;
import Business.Helper.MobileNotification;
import Business.Helper.Validation;
import Business.Organization.Organization;
import Business.Person.Person;
import Business.Transaction.Transaction;
import Business.UserAccount.UserAccount;
import Business.WorldEnterprise;
import UserInterface.ChangePasswordJPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.math.BigDecimal;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

/**
 *
 * @author "Smit Shah, NUID: 001748537, AED - Final Project"
 */
public class DonorWorkAreaJPanel extends javax.swing.JPanel {

    /**
     * Creates new form DonorWorkAreaJPanel
     */
    private JPanel userProcessContainer;
    private UserAccount objUserAccount;
    private WorldEnterprise objWorldEnterprise;
    private Organization objOrganization;
    private Person objPerson;
    private BigDecimal donationAmount;

    public DonorWorkAreaJPanel(JPanel userProcessContainerPassed, UserAccount objUserAccountPassed,
            WorldEnterprise objWorldEnterprisePassed, Organization objOrganizationPassed) {
        initComponents();
        this.userProcessContainer = userProcessContainerPassed;
        this.objUserAccount = objUserAccountPassed;
        this.objWorldEnterprise = objWorldEnterprisePassed;
        this.objOrganization = objOrganizationPassed;
        this.objPerson = this.objUserAccount.getObjPerson();

        populateDonationTable();
        calculateTotalDonation();
        generateDonationAnalysis();
        loadForm();
    }

    private void loadForm() {

        nameDisplayJLabel.setText(objUserAccount.getObjPerson().toString());
        roleDisplayJLabel.setText(objUserAccount.getObjRole().toString());
    }

    private void populateDonationTable() {

        DefaultTableModel dtm = (DefaultTableModel) donationJTable.getModel();
        dtm.setRowCount(0);

        for (Transaction objTransaction : objPerson.getObjDonorTransactionDirectory().getTransactionList()) {

            Object row[] = new Object[3];
            row[0] = objTransaction;
            row[1] = objTransaction.getTransactionDateToDisplay();
            row[2] = "$ " + String.valueOf(objTransaction.getTransactionBDAmount());
            dtm.addRow(row);
        }
    }

    private void calculateTotalDonation() {

        objPerson.getObjDonorTransactionDirectory().updateTransactionAccount();
        totalDonationJTextField
                .setText(String.valueOf(objPerson.getObjDonorTransactionDirectory().getTotalRealDebitAmount()));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        titleJLabel = new javax.swing.JLabel();
        donateJLabel = new javax.swing.JLabel();
        donationAmountJTextField = new javax.swing.JTextField();
        dollarJLabel = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        donateJButton = new javax.swing.JButton();
        title1JLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        donationJTable = new javax.swing.JTable();
        title3JLabel = new javax.swing.JLabel();
        dollar2JLabel = new javax.swing.JLabel();
        totalDonationJTextField = new javax.swing.JTextField();
        donationOverviewJPanel = new javax.swing.JPanel();
        myDonationJButton = new javax.swing.JButton();
        analysisJButton = new javax.swing.JButton();
        nameJLabel = new javax.swing.JLabel();
        nameDisplayJLabel = new javax.swing.JLabel();
        roleJLabel = new javax.swing.JLabel();
        roleDisplayJLabel = new javax.swing.JLabel();
        changePasswordJButton = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));

        titleJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        titleJLabel.setText("Donation");

        donateJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        donateJLabel.setText("Donate Money");

        donationAmountJTextField.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N

        dollarJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        dollarJLabel.setText("$");

        donateJButton.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        donateJButton.setText("Donate");
        donateJButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                donateJButtonActionPerformed(evt);
            }
        });

        title1JLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        title1JLabel.setText("Donation History");

        donationJTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Donation ID", "Donation Date", "Donation Amount ( in USD $ )" }) {
            boolean[] canEdit = new boolean[] { false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        jScrollPane1.setViewportView(donationJTable);
        if (donationJTable.getColumnModel().getColumnCount() > 0) {
            donationJTable.getColumnModel().getColumn(0).setResizable(false);
            donationJTable.getColumnModel().getColumn(1).setResizable(false);
            donationJTable.getColumnModel().getColumn(2).setResizable(false);
        }

        title3JLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        title3JLabel.setText("Total contribution by you:");

        dollar2JLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        dollar2JLabel.setText("$");

        totalDonationJTextField.setEditable(false);
        totalDonationJTextField.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N

        javax.swing.GroupLayout donationOverviewJPanelLayout = new javax.swing.GroupLayout(donationOverviewJPanel);
        donationOverviewJPanel.setLayout(donationOverviewJPanelLayout);
        donationOverviewJPanelLayout.setHorizontalGroup(donationOverviewJPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 812, Short.MAX_VALUE));
        donationOverviewJPanelLayout.setVerticalGroup(donationOverviewJPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 313, Short.MAX_VALUE));

        myDonationJButton.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        myDonationJButton.setText("My Donation");
        myDonationJButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                myDonationJButtonActionPerformed(evt);
            }
        });

        analysisJButton.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        analysisJButton.setText("Organization donation analysis");
        analysisJButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                analysisJButtonActionPerformed(evt);
            }
        });

        nameJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        nameJLabel.setText("Welcome:");

        nameDisplayJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N

        roleJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        roleJLabel.setText("Role:");

        roleDisplayJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N

        changePasswordJButton.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        changePasswordJButton.setText("Change Password >>");
        changePasswordJButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                changePasswordJButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addGroup(layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 812,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGroup(layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(layout.createSequentialGroup().addContainerGap()
                                                        .addGroup(layout
                                                                .createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                .addGroup(layout.createSequentialGroup()
                                                                        .addComponent(roleJLabel,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                107,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addGap(18, 18, 18)
                                                                        .addComponent(roleDisplayJLabel,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                158,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                                .addGroup(layout.createSequentialGroup()
                                                                        .addComponent(nameJLabel,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                107,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addGap(18, 18, 18)
                                                                        .addComponent(nameDisplayJLabel,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                158,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))))
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addGroup(layout.createSequentialGroup().addContainerGap()
                                                                .addComponent(title3JLabel)
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                .addComponent(dollar2JLabel).addGap(27, 27, 27)
                                                                .addComponent(totalDonationJTextField,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 137,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout
                                                                .createSequentialGroup().addGap(34, 34, 34)
                                                                .addGroup(layout.createParallelGroup(
                                                                        javax.swing.GroupLayout.Alignment.LEADING)
                                                                        .addGroup(layout.createSequentialGroup()
                                                                                .addComponent(myDonationJButton)
                                                                                .addGap(392, 392, 392)
                                                                                .addComponent(analysisJButton))
                                                                        .addComponent(donationOverviewJPanel,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))))))
                                .addGroup(layout.createSequentialGroup().addGap(376, 376, 376)
                                        .addComponent(title1JLabel)))
                                .addGap(0, 66, Short.MAX_VALUE))
                        .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jSeparator1)))
                        .addContainerGap())
                .addGroup(layout.createSequentialGroup().addGap(241, 241, 241).addComponent(donateJLabel)
                        .addGap(40, 40, 40).addComponent(dollarJLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(titleJLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 192,
                                        Short.MAX_VALUE)
                                .addComponent(donationAmountJTextField).addComponent(donateJButton,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addComponent(changePasswordJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 211,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(nameJLabel).addComponent(nameDisplayJLabel,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 16,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup().addGap(21, 21, 21)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(titleJLabel).addComponent(changePasswordJButton))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(roleJLabel)
                                .addComponent(roleDisplayJLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(donateJLabel)
                                .addComponent(donationAmountJTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(dollarJLabel))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(donateJButton).addGap(25, 25, 25)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(title1JLabel).addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(title3JLabel).addComponent(dollar2JLabel)
                                .addComponent(totalDonationJTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(45, 45, 45)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(analysisJButton).addComponent(myDonationJButton))
                        .addGap(18, 18, 18)
                        .addComponent(donationOverviewJPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(50, 50, 50)));
    }// </editor-fold>//GEN-END:initComponents

    private void donateJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_donateJButtonActionPerformed

        //Validation
        boolean validationSuccess;
        validationSuccess = validation();

        if (validationSuccess) {

            //Add Donation to Donor Transaction Directory
            Transaction objDonorTransaction = (Transaction) objPerson.getObjDonorTransactionDirectory()
                    .addNewTransaction();
            //objDonorTransaction.setTransactionAmount(Float.valueOf(donationAmountJTextField.getText()));
            objDonorTransaction.setTransactionBDAmount(new BigDecimal(donationAmountJTextField.getText()));//( donationAmountJTextField.getText()); //setTransactionAmount(Float.valueOf(donationAmountJTextField.getText()));
            System.out.println(objDonorTransaction.getTransactionBDAmount());
            objDonorTransaction.setObjUserAccountSource(objUserAccount);
            objDonorTransaction.setObjUserAccountDestination(null);
            objDonorTransaction.setTransactionSource(Transaction.TransactionSourceType.FromDonor.getValue());
            objDonorTransaction
                    .setTransactionDestination(Transaction.TransactionSourceType.ToWorldEnterprise.getValue());
            objDonorTransaction.setTransactionType(Transaction.TransactionType.Debit.getValue());
            objDonorTransaction.setTransactionMode(Transaction.TransactionModeType.Real.getValue());

            //Add Dontaion to World Enterprise Transaction Directory
            //Real
            Transaction objEnterpriseRealTransaction = (Transaction) objWorldEnterprise.getObjTransactionDirectory()
                    .addNewTransaction();
            objEnterpriseRealTransaction.setTransactionBDAmount(new BigDecimal(donationAmountJTextField.getText())); //setTransactionAmount(Float.valueOf(donationAmountJTextField.getText()));
            objEnterpriseRealTransaction.setObjUserAccountSource(objUserAccount);
            objEnterpriseRealTransaction.setObjUserAccountDestination(null);
            objEnterpriseRealTransaction
                    .setTransactionSource(Transaction.TransactionSourceType.FromDonor.getValue());
            objEnterpriseRealTransaction
                    .setTransactionDestination(Transaction.TransactionSourceType.ToWorldEnterprise.getValue());
            objEnterpriseRealTransaction.setTransactionType(Transaction.TransactionType.Credit.getValue());
            objEnterpriseRealTransaction.setTransactionMode(Transaction.TransactionModeType.Real.getValue());

            //Virtual
            Transaction objEnterpriseVirtualTransaction = (Transaction) objWorldEnterprise
                    .getObjTransactionDirectory().addNewTransaction();
            objEnterpriseVirtualTransaction
                    .setTransactionBDAmount(new BigDecimal(donationAmountJTextField.getText())); //setTransactionAmount(Float.valueOf(donationAmountJTextField.getText()));
            objEnterpriseVirtualTransaction.setObjUserAccountSource(objUserAccount);
            objEnterpriseVirtualTransaction.setObjUserAccountDestination(null);
            objEnterpriseVirtualTransaction
                    .setTransactionSource(Transaction.TransactionSourceType.FromDonor.getValue());
            objEnterpriseVirtualTransaction
                    .setTransactionDestination(Transaction.TransactionSourceType.ToWorldEnterprise.getValue());
            objEnterpriseVirtualTransaction.setTransactionType(Transaction.TransactionType.Credit.getValue());
            objEnterpriseVirtualTransaction.setTransactionMode(Transaction.TransactionModeType.Virtual.getValue());

            calculateTotalDonation();
            populateDonationTable();
            generateDonationAnalysis();

            //Mobile Notification
            MobileNotification.sendDonationMessageNotification(objUserAccount, objDonorTransaction);

            //Email Notification
            String[] to = { objPerson.getPersonEmailID(), "4997test@gmail.com" };

            if (EmailNotification.sendEMail("Hello " + objPerson + ",\n\n" + "Thank you for your donation of $ "
                    + donationAmount + "/- \n" + "\n" + "\n" + "Regards, \n" + "Direct Donation Inc.", to)) {
                System.out.println("EMAIL SENT SUCCESSFULLY");
            } else {
                try {
                    System.out.println("SOME ERROR OCCURED");
                } catch (Exception ex) {
                    System.out.println(ex);
                }
            }

            //JOptionPane
            JOptionPane.showMessageDialog(null, "Thank you for you donation of $ " + donationAmount + "/-");
            donationAmountJTextField.setText(null);

            //DonationReceivedRecords
            String donationLogs = objEnterpriseRealTransaction.getTransactionID() + ","
                    + objEnterpriseRealTransaction.getTransactionSource() + ","
                    + objEnterpriseRealTransaction.getObjUserAccountSource() + ","
                    + objEnterpriseRealTransaction.getTransactionType() + ","
                    + objEnterpriseRealTransaction.getTransactionMode() + ","
                    + objEnterpriseRealTransaction.getTransactionBDAmount() + ","
                    + objEnterpriseRealTransaction.getTransactionDateToDisplay();

            GenerateReports.donationReceivedRecords(donationLogs);
        }
    }//GEN-LAST:event_donateJButtonActionPerformed

    private void analysisJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_analysisJButtonActionPerformed

        generateOverallAnalysis();
    }//GEN-LAST:event_analysisJButtonActionPerformed

    private void myDonationJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_myDonationJButtonActionPerformed

        generateDonationAnalysis();
    }//GEN-LAST:event_myDonationJButtonActionPerformed

    private void changePasswordJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changePasswordJButtonActionPerformed

        ChangePasswordJPanel objChangePasswordJPanel = new ChangePasswordJPanel(userProcessContainer,
                objUserAccount);

        CardLayoutContainer.addNewCardLayout(userProcessContainer, "ChangePasswordJPanel", objChangePasswordJPanel);
    }//GEN-LAST:event_changePasswordJButtonActionPerformed

    private boolean validation() {

        String donation = donationAmountJTextField.getText().trim();

        if (Validation.checkForNull(donation)) {

            JOptionPane.showMessageDialog(null, "Please enter a amount");
            donationAmountJTextField.requestFocus();
            return false;
        }

        try {
            donationAmount = new BigDecimal(donation);

            if (Validation.checkForNegativeAmount(donationAmount)) {

                JOptionPane.showMessageDialog(null, "Please enter a positive amount");
                donationAmountJTextField.requestFocus();
                return false;
            }

            if (donationAmount.scale() > 2) {
                JOptionPane.showMessageDialog(null, "Please enter a proper amount with only 2 decimal. eg. 108.18");
                donationAmountJTextField.requestFocus();
                return false;
            }

            return true;

        } catch (NumberFormatException exe) {
            JOptionPane.showMessageDialog(null, "Please enter a proper amount");
            donationAmountJTextField.requestFocus();
            return false;
        }
    }

    private void generateDonationAnalysis() {

        DefaultCategoryDataset lineChartDataset = new DefaultCategoryDataset();

        for (Transaction objTransaction : objPerson.getObjDonorTransactionDirectory().getTransactionList()) {

            BigDecimal amount = objTransaction.getTransactionBDAmount();
            String date = objTransaction.getTransactionDateToDisplay();

            lineChartDataset.addValue(amount, "Donation Amount", date);
        }

        JFreeChart lineChartObject = ChartFactory.createLineChart3D("Donation", "Date", "Amount in USD $",
                lineChartDataset, PlotOrientation.VERTICAL, true, true, false);

        ChartPanel myChart = new ChartPanel(lineChartObject);
        donationOverviewJPanel.setLayout(new java.awt.BorderLayout());
        donationOverviewJPanel.add(myChart, BorderLayout.CENTER);
        donationOverviewJPanel.validate();
    }

    private void generateOverallAnalysis() {

        DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();
        dataSet.setValue(objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance(),
                "Amount left", "Donation left");
        dataSet.setValue(objWorldEnterprise.getObjTransactionDirectory().getTotalVirtualDebitAmount(),
                "Amount donated", "Donation given");

        JFreeChart chart = ChartFactory.createBarChart3D("Overview of Donation received and delivered", "Donation",
                "Amount in USD $", dataSet, PlotOrientation.VERTICAL, false, true, false);

        CategoryPlot plot = chart.getCategoryPlot();
        plot.setRangeGridlinePaint(Color.black);

        ChartPanel myChart = new ChartPanel(chart);
        donationOverviewJPanel.setLayout(new java.awt.BorderLayout());
        donationOverviewJPanel.add(myChart, BorderLayout.CENTER);
        donationOverviewJPanel.validate();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton analysisJButton;
    private javax.swing.JButton changePasswordJButton;
    private javax.swing.JLabel dollar2JLabel;
    private javax.swing.JLabel dollarJLabel;
    private javax.swing.JButton donateJButton;
    private javax.swing.JLabel donateJLabel;
    private javax.swing.JTextField donationAmountJTextField;
    private javax.swing.JTable donationJTable;
    private javax.swing.JPanel donationOverviewJPanel;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton myDonationJButton;
    private javax.swing.JLabel nameDisplayJLabel;
    private javax.swing.JLabel nameJLabel;
    private javax.swing.JLabel roleDisplayJLabel;
    private javax.swing.JLabel roleJLabel;
    private javax.swing.JLabel title1JLabel;
    private javax.swing.JLabel title3JLabel;
    private javax.swing.JLabel titleJLabel;
    private javax.swing.JTextField totalDonationJTextField;
    // End of variables declaration//GEN-END:variables
}