UserInterface.FinanceRole.DonateToPoorPeopleJPanel.java Source code

Java tutorial

Introduction

Here is the source code for UserInterface.FinanceRole.DonateToPoorPeopleJPanel.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.FinanceRole;

import Business.CountryEnterprise.CountryEnterprise;
import Business.Helper.AutoDonate;
import Business.Helper.CardLayoutContainer;
import Business.Helper.GenerateReports;
import Business.Helper.Validation;
import Business.Organization.Organization;
import Business.Organization.PoorPeopleOrganization;
import Business.Organization.WorldAdminOrganization;
import Business.Person.Person;
import Business.Transaction.Transaction;
import Business.UserAccount.UserAccount;
import Business.WorldEnterprise;
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 DonateToPoorPeopleJPanel extends javax.swing.JPanel {

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

    public DonateToPoorPeopleJPanel(JPanel userProcessContainerPassed, UserAccount objUserAccountPassed,
            WorldEnterprise objWorldEnterprisePassed, Organization objOrganizationPassed) {
        initComponents();

        this.userProcessContainer = userProcessContainerPassed;
        this.objUserAccount = objUserAccountPassed;
        this.objWorldEnterprise = objWorldEnterprisePassed;
        this.objOrganization = objOrganizationPassed;

        populateCountryComboBox();

        if (objOrganizationPassed instanceof WorldAdminOrganization) {
            dollarJLabel.setVisible(false);
            autoDonateJButton.setVisible(false);
            donateAmountJLabel.setVisible(false);
            donationAmountJTextField.setVisible(false);
            donateJButton.setVisible(false);
        } else {
            dollarJLabel.setVisible(true);
            autoDonateJButton.setVisible(true);
            donateAmountJLabel.setVisible(true);
            donationAmountJTextField.setVisible(true);
            donateJButton.setVisible(true);
        }
    }

    private void populateCountryComboBox() {

        countryJComboBox.removeAllItems();

        for (CountryEnterprise objCountryEnterprise : objWorldEnterprise.getObjCountryEnterpriseDirectory()
                .getCountryEnterpriseList()) {
            countryJComboBox.addItem(objCountryEnterprise);
        }
    }

    private void populatePoorPeopleTable(CountryEnterprise objCountryEnterprise) {

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

        for (Organization objPPOrganization : objCountryEnterprise.getObjOrganizationDirectory()
                .getOrganizationList()) {
            if (objPPOrganization instanceof PoorPeopleOrganization) {
                for (UserAccount objUserAccount : objPPOrganization.getObjUserAccountDirectory()
                        .getUserAccountList()) {
                    if (objUserAccount.getUserAccountStatus().equals(UserAccount.StatusType.Acitve.getValue())) {
                        Person objPerson = objUserAccount.getObjPerson();
                        if (objPerson.getPersonStatus().equals(Person.PersonRegStatusType.Active.getValue())) {

                            Object row[] = new Object[4];
                            row[0] = objPerson.getPersonInternationalID();
                            row[1] = objPerson;
                            row[2] = objUserAccount;
                            row[3] = objPerson.getObjFamilyMemberDirectory().getFamilyMemberList().size();

                            dtm.addRow(row);
                        }
                    }
                }
            }
        }
    }

    /**
     * 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() {

        backJButton4 = new javax.swing.JButton();
        titleJLabel = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        poorPeopleJTable = new javax.swing.JTable();
        jScrollPane2 = new javax.swing.JScrollPane();
        donationHistoryJTable = new javax.swing.JTable();
        donateJButton = new javax.swing.JButton();
        title1JLabel = new javax.swing.JLabel();
        donateAmountJLabel = new javax.swing.JLabel();
        donationAmountJTextField = new javax.swing.JTextField();
        countryJLabel = new javax.swing.JLabel();
        countryJComboBox = new javax.swing.JComboBox();
        autoDonateJButton = new javax.swing.JButton();
        transferDetailsJPanel = new javax.swing.JPanel();
        dollarJLabel = new javax.swing.JLabel();

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

        backJButton4.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        backJButton4.setText("<< Back");
        backJButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backJButton4ActionPerformed(evt);
            }
        });

        titleJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        titleJLabel.setText("List of Poor People");

        poorPeopleJTable.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        poorPeopleJTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "International ID", "Name", "User Name", "Family Members" }) {
            boolean[] canEdit = new boolean[] { false, false, false, false };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        poorPeopleJTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                poorPeopleJTableMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(poorPeopleJTable);
        if (poorPeopleJTable.getColumnModel().getColumnCount() > 0) {
            poorPeopleJTable.getColumnModel().getColumn(0).setResizable(false);
            poorPeopleJTable.getColumnModel().getColumn(1).setResizable(false);
            poorPeopleJTable.getColumnModel().getColumn(2).setResizable(false);
            poorPeopleJTable.getColumnModel().getColumn(3).setResizable(false);
        }

        donationHistoryJTable.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        donationHistoryJTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {

        }, new String[] { "Transaction ID", "Amount", "Date" }) {
            boolean[] canEdit = new boolean[] { false, false, false };

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

        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");

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

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

        countryJLabel.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        countryJLabel.setText("Select Country:");

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

        autoDonateJButton.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        autoDonateJButton.setText("One touch Auto-Donate");
        autoDonateJButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                autoDonateJButtonActionPerformed(evt);
            }
        });

        transferDetailsJPanel.setMaximumSize(new java.awt.Dimension(648, 151));
        transferDetailsJPanel.setMinimumSize(new java.awt.Dimension(648, 151));

        javax.swing.GroupLayout transferDetailsJPanelLayout = new javax.swing.GroupLayout(transferDetailsJPanel);
        transferDetailsJPanel.setLayout(transferDetailsJPanelLayout);
        transferDetailsJPanelLayout.setHorizontalGroup(transferDetailsJPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 648, Short.MAX_VALUE));
        transferDetailsJPanelLayout.setVerticalGroup(transferDetailsJPanelLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 151, Short.MAX_VALUE));

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

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout.createSequentialGroup().addGap(15, 15, 15).addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup().addGap(203, 203, 203).addComponent(countryJLabel)
                                .addGap(18, 18, 18).addComponent(countryJComboBox,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 177,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 648,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(layout.createSequentialGroup().addGroup(layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(title1JLabel)
                                        .addGroup(layout.createSequentialGroup().addComponent(dollarJLabel)
                                                .addGap(18, 18, 18)
                                                .addGroup(layout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createSequentialGroup()
                                                                .addComponent(donationAmountJTextField,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 114,
                                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addPreferredGap(
                                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(donateJButton))
                                                        .addGroup(layout.createSequentialGroup().addGap(64, 64, 64)
                                                                .addComponent(donateAmountJLabel)))))
                                        .addGap(284, 284, 284))
                                .addComponent(autoDonateJButton, javax.swing.GroupLayout.PREFERRED_SIZE, 235,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(66, 66, 66))
                .addGroup(layout.createSequentialGroup().addGap(301, 301, 301).addComponent(titleJLabel))
                .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane2,
                        javax.swing.GroupLayout.PREFERRED_SIZE, 648, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(transferDetailsJPanel,
                        javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createSequentialGroup().addContainerGap().addComponent(backJButton4)));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout.createSequentialGroup().addContainerGap().addComponent(titleJLabel).addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(countryJLabel)
                                .addComponent(countryJComboBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 141,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(autoDonateJButton).addGap(5, 5, 5)
                        .addComponent(donateAmountJLabel).addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(donateJButton)
                                .addComponent(donationAmountJTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(dollarJLabel))
                        .addGap(18, 18, 18).addComponent(title1JLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 146,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(transferDetailsJPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18).addComponent(backJButton4).addContainerGap(29, Short.MAX_VALUE)));
    }// </editor-fold>//GEN-END:initComponents

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

        CardLayoutContainer.removeCurrentCardLayout(userProcessContainer, this);
    }//GEN-LAST:event_backJButton4ActionPerformed

    private void poorPeopleJTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_poorPeopleJTableMouseClicked

        Person objPerson = null;
        UserAccount objUserAccount = null;

        int selectedPP = poorPeopleJTable.getSelectedRow();

        if (selectedPP < 0) {
            JOptionPane.showMessageDialog(null, "Please select a Person");
            return;
        }

        objUserAccount = (UserAccount) poorPeopleJTable.getValueAt(selectedPP, 2);

        if (objUserAccount != null) {
            objPerson = objUserAccount.getObjPerson();
            populateTransactionTable(objPerson);
        } else {
            JOptionPane.showMessageDialog(null, "Please select again");
        }
    }//GEN-LAST:event_poorPeopleJTableMouseClicked

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

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

        if (validationSuccess) {

            Person objPPPerson = null;
            UserAccount objPPUserAccount = null;

            int selectedPP = poorPeopleJTable.getSelectedRow();

            if (selectedPP < 0) {
                JOptionPane.showMessageDialog(null, "Please select a Person");
                return;
            }

            objPPUserAccount = (UserAccount) poorPeopleJTable.getValueAt(selectedPP, 2);

            if (objPPUserAccount != null) {
                objPPPerson = objPPUserAccount.getObjPerson();

                objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();

                BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance();

                int positiveWorldBalance = worldBalance.compareTo(donationAmount);

                if (positiveWorldBalance >= 1) {

                    int response = JOptionPane.showConfirmDialog(null,
                            "Total donation of $ " + donationAmount + "/- Do you want to Donate?", "Confirm",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                    if (response == JOptionPane.YES_OPTION) {

                        //PoorPeople Transaction
                        Transaction objVirtualPPTransaction = (Transaction) objPPPerson
                                .getObjPoorPeopleTransactionDirectory().addNewTransaction();
                        objVirtualPPTransaction
                                .setTransactionBDAmount(new BigDecimal(donationAmountJTextField.getText()));
                        objVirtualPPTransaction.setObjUserAccountSource(objUserAccount);
                        objVirtualPPTransaction.setObjUserAccountDestination(objPPUserAccount);
                        objVirtualPPTransaction.setTransactionSource(
                                Transaction.TransactionSourceType.FromWorldEnterprise.getValue());
                        objVirtualPPTransaction.setTransactionDestination(
                                Transaction.TransactionSourceType.ToPoorPeople.getValue());
                        objVirtualPPTransaction.setTransactionType(Transaction.TransactionType.Credit.getValue());
                        objVirtualPPTransaction
                                .setTransactionMode(Transaction.TransactionModeType.Virtual.getValue());
                        objPPPerson.getObjPoorPeopleTransactionDirectory().updateTransactionAccount();

                        //WorldEnterprise Transaction
                        Transaction objVirtualWETransaction = (Transaction) objWorldEnterprise
                                .getObjTransactionDirectory().addNewTransaction();
                        objVirtualWETransaction
                                .setTransactionBDAmount(new BigDecimal(donationAmountJTextField.getText()));
                        objVirtualWETransaction.setObjUserAccountSource(objUserAccount);
                        objVirtualWETransaction.setObjUserAccountDestination(objPPUserAccount);
                        objVirtualWETransaction.setTransactionSource(
                                Transaction.TransactionSourceType.FromWorldEnterprise.getValue());
                        objVirtualWETransaction.setTransactionDestination(
                                Transaction.TransactionSourceType.ToPoorPeople.getValue());
                        objVirtualWETransaction.setTransactionType(Transaction.TransactionType.Debit.getValue());
                        objVirtualWETransaction
                                .setTransactionMode(Transaction.TransactionModeType.Virtual.getValue());
                        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();

                        JOptionPane.showMessageDialog(null, "$ " + donationAmount + "/- donated successfully");

                        //DonationGivenRecords
                        String donationLogs = objVirtualWETransaction.getTransactionID() + ","
                                + objVirtualWETransaction.getTransactionBDAmount() + ","
                                + objVirtualWETransaction.getObjUserAccountSource() + ","
                                + objVirtualWETransaction.getTransactionSource() + ","
                                + objVirtualWETransaction.getObjUserAccountDestination() + ","
                                + objVirtualWETransaction.getTransactionDestination() + ","
                                + objVirtualWETransaction.getTransactionType() + ","
                                + objVirtualWETransaction.getTransactionMode();

                        GenerateReports.donationGivenRecords(donationLogs);

                        donationAmountJTextField.setText(null);

                        populateTransactionTable(objPPPerson);
                    }
                } else {
                    JOptionPane.showMessageDialog(null, "World Balance is low");
                }
            } else {
                JOptionPane.showMessageDialog(null, "Please select again");
            }
        }
    }//GEN-LAST:event_donateJButtonActionPerformed

    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");
            return false;
        }
    }

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

        CountryEnterprise objCountryEnterprise = (CountryEnterprise) countryJComboBox.getSelectedItem();

        if (objCountryEnterprise != null) {
            populatePoorPeopleTable(objCountryEnterprise);
            populateTransactionTable(null);
        }
    }//GEN-LAST:event_countryJComboBoxActionPerformed

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

        objWorldEnterprise.getObjTransactionDirectory().updateTransactionAccount();

        BigDecimal worldDonation = AutoDonate.donationCheck(objWorldEnterprise, objUserAccount);
        BigDecimal worldBalance = objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance();
        System.out.println(worldDonation);

        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableRealBalance());
        System.out.println(objWorldEnterprise.getObjTransactionDirectory().getAvailableVirtualBalance());

        int positiveWorldBalance = worldBalance.compareTo(worldDonation);

        if (positiveWorldBalance >= 1) {
            //JDialog.setDefaultLookAndFeelDecorated(true);

            int response = JOptionPane.showConfirmDialog(null,
                    "Total donation of $ " + worldDonation + "/- Do you want to Donate?", "Confirm",
                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (response == JOptionPane.YES_OPTION) {
                System.out.println("Yes button clicked");
                worldDonation = AutoDonate.donationConfirm(objWorldEnterprise, objUserAccount);

                JOptionPane.showMessageDialog(null, "$ " + worldDonation + "/- donated successfully");
            }
        } else {
            JOptionPane.showMessageDialog(null, "World Balance is low");
        }
    }//GEN-LAST:event_autoDonateJButtonActionPerformed

    private void populateTransactionTable(Person objPerson) {

        //Chart
        DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

        //Table
        DefaultTableModel dtm = (DefaultTableModel) donationHistoryJTable.getModel();
        dtm.setRowCount(0);

        if (objPerson != null) {
            for (Transaction objTransaction : objPerson.getObjPoorPeopleTransactionDirectory()
                    .getTransactionList()) {

                if (objTransaction.getTransactionSource()
                        .equals(Transaction.TransactionSourceType.FromWorldEnterprise.getValue())) {

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

                    dtm.addRow(row);

                    dataSet.setValue(objTransaction.getTransactionBDAmount(), "Amount",
                            objTransaction.getTransactionDateToDisplay());
                }
            }

            JFreeChart chart = ChartFactory.createBarChart3D("Overview of entire Transaction", "Transaction Date",
                    "Amount in USD $", dataSet, PlotOrientation.VERTICAL, false, true, false);

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

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

            transferDetailsJPanel.setVisible(true);
        } else {

            transferDetailsJPanel.setVisible(false);

        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton autoDonateJButton;
    private javax.swing.JButton backJButton4;
    private javax.swing.JComboBox countryJComboBox;
    private javax.swing.JLabel countryJLabel;
    private javax.swing.JLabel dollarJLabel;
    private javax.swing.JLabel donateAmountJLabel;
    private javax.swing.JButton donateJButton;
    private javax.swing.JTextField donationAmountJTextField;
    private javax.swing.JTable donationHistoryJTable;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable poorPeopleJTable;
    private javax.swing.JLabel title1JLabel;
    private javax.swing.JLabel titleJLabel;
    private javax.swing.JPanel transferDetailsJPanel;
    // End of variables declaration//GEN-END:variables
}