Solved

help with code refactor

Posted on 2003-11-11
3
353 Views
Last Modified: 2012-08-13
i have 1 class with 4 methods painting each screen,
addCEComponents
addCRComponents
addCIComponents
addCLComponents

typically it repaints and validates a bean with a fixed layout which is extended

i wanted to split this to atleast 4 classes..each of the methods become a class - for some reasons i couldn't use the cord layout...

so i need help in splitting this to 4 classes and passing the objects (reference passes by values without using new operator twice for this example).

i am new to java, thanks much
-----------------------------------------------------------------------------------------------------------

package aims.extensions.dummyext.support;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.beans.*;
import java.text.SimpleDateFormat;
import sample.util.report.*;
import aims.extensions.dummyext.DUMMYextApp;
import aims.extensions.dummyext.DUMMYextFrame;
import aims.extensions.dummyext.support.DUMMYextData;
import aims.extensions.dummyext.support.DUMMYextCustomLabel;
import aims.extensions.beans.sampletablemodel.*;

public class DUMMYextPanel extends JPanel
{

    /**
     * For the tables, panels, scrollpanes etc the following short names are used
     * for naming convention instead of lenghty names
     * ce - claim entry page
     * cr - claim result page
     * ci - claim indicative  page
     * cl - claim line details  page
     */

    //Objects
    private DUMMYextFrame sampleFrame;
    private DUMMYextData sampleData;
    private DUMMYextCustomLabel multiLabel;

    //Beans
    private sampleTableModelBean atmBean;

    //Layouts
    private GridBagLayout gbLayout;
    private GridBagConstraints gbConstraints;

    //jTable
    //changed public to private
    private JTable crTable;
    private JTable clTable;

    //Panels
    private JPanel cePanel;
    private JPanel crTablePanel;
    private JPanel crButtonPanel;
    private JPanel ciMenuPanel;
    private JPanel ciInfoPanel;
    private JPanel ciMasterPanel;
    private JPanel ciProvPanel;
    private JPanel ciMemberPanel;
    private JPanel ciClaimPanel;
    private JPanel ciTOBPanel;
    private JPanel ciStmtPanel;
    private JPanel ciAdjPanel;
    private JPanel ciButtonPanel;
    private JPanel ciLeftPanel;
    private JPanel ciRightPanel;
    private JPanel ciRightUnused;
    private JPanel ciLeftUnused;
    private JPanel clButtonPanel;
    private JPanel clMasterPanel;
    private JPanel clTopPanel;
    private JPanel clTablePanel;
    private JPanel clPopupPanel;
    private JPanel clDetailsPanel;
    private JPanel clDetailsPanel1;
    private JPanel clErrorPanel;

    //Check box
    private JCheckBox chkAssignment;

    //Scroll Panels
    JScrollPane crScrollPane;
    JScrollPane clScrollPane;
    JScrollPane sectionsScrollPane;

    //Labels
    private JLabel lblClaimID;
    private JLabel lblSubscriberID;
    private JLabel lblMemberSuffix;

    private JLabel lblSections;
    private JLabel lblClaimIDText;
    private JLabel lblClaimIDData;
    private JLabel lblProvIDText;
    private JLabel lblProvIDData;
    private JLabel lblProvNameText;
    private JLabel lblProvNameData;
    private JLabel lblStatusText;
    private JLabel lblStatusData;
    private JLabel lblPayeeText;
    private JLabel lblPayeeData;
    private JLabel lblSubIDText;
    private JLabel lblSubIDData;
    private JLabel lblMemberLastNameText;
    private JLabel lblMemberLastNameData;
    private JLabel lblMemberFirstNameText;
    private JLabel lblMemberFirstNameData;
    private JLabel lblMemberInitialText;
    private JLabel lblMemberInitialData;
    private JLabel lblAccpAssgText;
    private JLabel lblAccpAssgData;
    private JLabel lblPaidDtText;
    private JLabel lblPaidDtData;
    private JLabel lblTypeOfClassText;
    private JLabel lblTypeOfClassData;
    private JLabel lblFrequencyText;
    private JLabel lblFrequencyData;
    private JLabel lblStmntFromDtText;
    private JLabel lblStmntFromDtData;
    private JLabel lblStmntToDtText;
    private JLabel lblStmntToDtData;
    private JLabel lblAdjFromText;
    private JLabel lblAdjFromData;
    private JLabel lblAdjToText;
    private JLabel lblAdjToData;
    private JLabel lblPaidAmountText;
    private JLabel lblPaidAmountData;
    private JLabel lblTotalChargeText;
    private JLabel lblTotalChargeData;
    private JLabel lblConsdText;
    private JLabel lblConsdData;
    private JLabel lblAllowedText;
    private JLabel lblAllowedData;
    private JLabel lblAllowedUnitsText;
    private JLabel lblAllowedUnitsData;
    private JLabel lblDeducText;
    private JLabel lblDeducData;
    private JLabel lblCopayText;
    private JLabel lblCopayData;
    private JLabel lblCoInsText;
    private JLabel lblCoInsData;
    private JLabel lblDisAllowText;
    private JLabel lblDisAllowData;
    private JLabel lblDiscAmtText;
    private JLabel lblDiscAmtData;
    private JLabel lblSuppDiscText;
    private JLabel lblSuppDiscData;
    private JLabel lblWithholdText;
    private JLabel lblWithholdData;
    private JLabel lblEXCDData;

    //List boxes
    private JList lstSections;
    private DefaultListModel lmSections;

    //Text fields
    private JTextField txtClaimID;
    private JTextField txtSubscriberID;
    private JTextField txtMemberSuffix;

    //Buttons - all were public before
    private JButton btnSearch;
    private JButton btnCancel;
    private JButton btnDetails;
    private JButton btnBack;
    private JButton btnBack1;
    private JButton btnBack2;
    private JButton btnOverrides;
    private JButton btnEDI;
    private JButton btnAlternatePayee;
    private JButton btnClaimNotes;
    private JButton btnClaimStatus;
    private JButton btnBlueCard;
    private JButton btnCOB;
    private JButton btnEOB;

    //Variables
    public String clcl_id;
    public String active_clcl_id;
    public String sbsb_id;
    public String meme_sfx;

    /**
     * Default constructor for Main Panel
     * @param data
     */
    public DUMMYextPanel(DUMMYextData data) {
        sampleData = data;
        try {
            jbInit();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }

    public DUMMYextPanel()  {
    }

    /**
     * This method is trigged when applictaion is initialized and it
     * calls the Claim Entry Component method to add the claim entry
     * components
     *
     * @throws Exception
     */
    public void jbInit() throws Exception  {
        addCEComponents();
    }


    /**
     * This method will add the first Claim entry page components
     * No database calls involved inbetween, only a display of the
     * fields so that user can enter Claim ID, Sub ID and Member Suffix
     * @throws Exception
     */
    public void addCEComponents() throws Exception
    {

        setPreferredSize(new Dimension(300,300));
        setMinimumSize(new Dimension(300,300));

        //create a field Panel
        cePanel = new JPanel();
        cePanel.setBorder(BorderFactory.createTitledBorder("Search Purged Claims"));
        cePanel.setPreferredSize(new Dimension(300,180 ));
        cePanel.setMinimumSize(new Dimension(300,180));
        cePanel.setLayout(new FlowLayout(FlowLayout.CENTER,5,5));

        //setup the labels for the field Panel
        lblMemberSuffix = new JLabel("Member Suffix");
        lblMemberSuffix.setPreferredSize(new Dimension(120, 22));
        lblMemberSuffix.setMinimumSize(new Dimension(120, 22));

        lblClaimID = new JLabel("Claim ID");
        lblClaimID.setMinimumSize(new Dimension(120, 22));
        lblClaimID.setPreferredSize(new Dimension(120, 22));

        lblSubscriberID = new JLabel("Subscriber ID");
        lblSubscriberID.setMinimumSize(new Dimension(120, 22));
        lblSubscriberID.setPreferredSize(new Dimension(120, 22));

        //setup the text fields for the field Panel
        txtClaimID = new JTextField();
        txtClaimID.setPreferredSize(new Dimension(120, 22));
        txtClaimID.setMinimumSize(new Dimension(120, 22));

        txtSubscriberID = new JTextField();
        txtSubscriberID.setPreferredSize(new Dimension(120, 22));
        txtSubscriberID.setMinimumSize(new Dimension(120, 22));

        txtMemberSuffix = new JTextField();
        txtMemberSuffix.setPreferredSize(new Dimension(120, 22));
        txtMemberSuffix.setMinimumSize(new Dimension(120, 22));

        //setup the buttons for the field Panel
        btnSearch = new JButton("Search");
        btnSearch.setPreferredSize(new Dimension(110, 22));
        btnSearch.setMinimumSize(new Dimension(110, 22));
        btnSearch.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnSearchActionPerformed(e);
            }
        });

        btnCancel = new JButton("Cancel");
        btnCancel.setPreferredSize(new Dimension(110, 22));
        btnCancel.setMinimumSize(new Dimension(110, 22));
        btnCancel.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnCancelActionPerformed(e);
            }
        });

        //add to field Panel
        cePanel.add(Box.createHorizontalStrut(300));
        cePanel.add(lblClaimID);
        cePanel.add(txtClaimID);
        cePanel.add(lblSubscriberID);
        cePanel.add(txtSubscriberID);
        cePanel.add(lblMemberSuffix);
        cePanel.add(txtMemberSuffix);
        cePanel.add(Box.createHorizontalStrut(300));
        cePanel.add(Box.createHorizontalStrut(300));
        cePanel.add(Box.createHorizontalStrut(300));
        cePanel.add(btnSearch);
        cePanel.add(btnCancel);

        /**
         * Remove all existing components from the bean
         */
        DUMMYextApp.frame.getMasterPanel().removeAll();
        DUMMYextApp.frame.getDetailPanel().removeAll();
        DUMMYextApp.frame.getButtonPanel().removeAll();
        DUMMYextApp.frame.getInfoPanel().removeAll();
        DUMMYextApp.frame.getMenuListPanel().removeAll();

        /**
         * Set the required Panels to "true" or "false"
         */
        DUMMYextApp.frame.setUseMasterPanel(true);
        DUMMYextApp.frame.setUseDetailPanel(false);
        DUMMYextApp.frame.setUseButtonPanel(false);
        DUMMYextApp.frame.setUseInfoPanel(false);
        DUMMYextApp.frame.setUseMenuPanel(false);

        /**
         * Add components to Panels
         */
        DUMMYextApp.frame.getMasterPanel().add(cePanel);

        /**
         * Repaint and Validate
         */
        DUMMYextApp.frame.repaint();
        DUMMYextApp.frame.validate();
    }


    /**
     * <P>This method is trigged when button is clicked from the
     * search screen and it calls the Stored procedure to search
     * for a claim ID or a Subscriber ID.</P>
     * <P>When a claim ID is keyed in, the table will pull information using
     * the following method
     * atmBean.setTableData(sampleData.GetResultsByClaimID(clcl_id));</P>
     * <P> When a Sub ID is keyed in, the table will pull information using
     * the following method
     * atmBean.setTableData(sampleData.GetResultsBySubID(SBSB_ID, meme_sfx));</P>
     * <P>Note: When the MEME_SFX is not entered a integer default 0 is passed
     * and the stored proc checks for a member suffix only if the suffix
     * is not zero</P>
     * <P> When a match is found it displays the output
     * in the table.The Claim result components are finally added to the frame<P>
     *
     * @throws Exception
     */

    public void addCRComponents() throws Exception
    {

        //create the panels
        crTablePanel = new JPanel();
        crButtonPanel = new JPanel();

        //Setting up the button Panel Components
        btnDetails = new JButton("Claim Details");
        btnDetails.setPreferredSize(new Dimension(110, 22));
        btnDetails.setMinimumSize(new Dimension(110, 22));

        btnDetails.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnDetailsActionPerformed();
            }
        });

        btnBack = new JButton(" Back ");
        btnBack.setPreferredSize(new Dimension(110, 22));
        btnBack.setMinimumSize(new Dimension(110, 22));
        btnBack.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnBackActionPerformed(e);
            }
        });

        /**
         * Setting up the Table Panel Components
         */

        String[] strColumnNames = {"Claim ID", "Subscriber ID", "Member Suffix",
                                         "Provider ID","Begin Date", "Status", "Total Charge"};

        try
          {
              atmBean = (sampleTableModelBean) Beans.instantiate(getClass().getClassLoader(), sampleTableModelBean.class.getName());

              /**
               * If a claim ID is entered , search by Claim ID else
               * search by Subscriber ID.
               *
               * This calls the methods GetResultsByClaimID and GetResultsBySubID
               * in the DATA Class which will return a resultset to populate this
               * table.
               */

              if(clcl_id.length()>0)
              {
                  atmBean.setTableData(sampleData.GetResultsByClaimID(clcl_id));
              }
              else if (sbsb_id.length()>0 )
              {
                  atmBean.setTableData(sampleData.GetResultsBySubID(sbsb_id, meme_sfx));
              }

              atmBean.setColumns(strColumnNames);
              atmBean.createTable();

              crTable = atmBean.getReturnTable();
              crTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              crTable.setBorder(BorderFactory.createEtchedBorder());
              crTable.setPreferredScrollableViewportSize(getTablePreferredSize());
              //crTable.setPreferredScrollableViewportSize(new Dimension(500,20));
              crScrollPane  = new JScrollPane(crTable);
              crTablePanel.add(crScrollPane);
          }
          catch(ClassNotFoundException cnfe)
          {
              Reporter.easyReport(ReportType.EXCEPTION,"Could not find the Default Anthem Table Model" + cnfe.getMessage());
          }
          catch(IOException ie)
          {
              Reporter.easyReport(ReportType.EXCEPTION,"IOException: "  + ie.getMessage());
          }

        //Add components to button Panels
        crButtonPanel.add(btnDetails);
        crButtonPanel.add(btnBack);

        //removes existing components from  frame
        DUMMYextApp.frame.getMasterPanel().removeAll();
        DUMMYextApp.frame.getDetailPanel().removeAll();
        DUMMYextApp.frame.getButtonPanel().removeAll();
        DUMMYextApp.frame.getInfoPanel().removeAll();
        DUMMYextApp.frame.getMenuListPanel().removeAll();

        //Sets the panels to true or false (display or don't display)
        DUMMYextApp.frame.setUseMasterPanel(true);
        DUMMYextApp.frame.setUseDetailPanel(false);
        DUMMYextApp.frame.setUseButtonPanel(true);
        DUMMYextApp.frame.setUseInfoPanel(false);
        DUMMYextApp.frame.setUseMenuPanel(false);

        //Add components
        DUMMYextApp.frame.getMasterPanel().add(crTablePanel);
        DUMMYextApp.frame.getButtonPanel().add(crButtonPanel);

        DUMMYextApp.frame.repaint();
        DUMMYextApp.frame.validate();

    }


    public void addCIMenuPanelComponents() throws Exception
    {
          lblSections = new JLabel("Sections",JLabel.LEFT);
          lblSections.setPreferredSize(new Dimension(100, 22));
          lblSections.setMinimumSize(new Dimension(100, 22));

          //lmSections = new DefaultListModel();
          lstSections = new JList(new String [] {"Indicative", "Line Items"});
          sectionsScrollPane = new JScrollPane (lstSections);
          sectionsScrollPane.setPreferredSize(new Dimension(100,50));
          sectionsScrollPane.setMinimumSize(new Dimension(100,50));

          //lstSections.setSelectedIndex(0);
          //lmSections.addElement("Indicative");
          //lmSections.addElement("Line Items");
          lstSections.getSelectionModel().addListSelectionListener(new ListSelectionListener()
          {
              public void valueChanged(ListSelectionEvent e)
              {
                  //System.out.println("changed value");
                  if(! e.getValueIsAdjusting())
                  {
                      lstSections_valueChanged();
                  }
              }
          });

          ciMenuPanel = new JPanel();
          ciMenuPanel.setPreferredSize(new Dimension(100,100 ));
          ciMenuPanel.setMinimumSize(new Dimension(100,100));
          ciMenuPanel.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
          ciMenuPanel.add(lblSections);
          ciMenuPanel.add(sectionsScrollPane);

    }

    /**
     * This following piece of component goes into the bottom left hand side InfoPanel
     * @throws Exception
     */
    public void addCIInfoPanelComponents() throws Exception
    {

          lblClaimIDText = new JLabel("Claim ID");
          lblClaimIDText.setMinimumSize(new Dimension(85, 22));
          lblClaimIDText.setPreferredSize(new Dimension(85, 22));

          lblClaimIDData = new JLabel(active_clcl_id);
          lblClaimIDData.setMinimumSize(new Dimension(85, 22));
          lblClaimIDData.setPreferredSize(new Dimension(85, 22));

          lblProvIDText = new JLabel("Provider ID");
          lblProvIDText.setMinimumSize(new Dimension(85, 22));
          lblProvIDText.setPreferredSize(new Dimension(85, 22));

          lblProvIDData = new JLabel("");
          lblProvIDData.setMinimumSize(new Dimension(85, 22));
          lblProvIDData.setPreferredSize(new Dimension(85, 22));

          lblStatusText = new JLabel("Status");
          lblStatusText.setMinimumSize(new Dimension(85, 22));
          lblStatusText.setPreferredSize(new Dimension(85, 22));

          lblStatusData = new JLabel("");
          lblStatusData.setMinimumSize(new Dimension(85, 22));
          lblStatusData.setPreferredSize(new Dimension(85, 22));

          lblPayeeText = new JLabel("Payee");
          lblPayeeText.setMinimumSize(new Dimension(85, 22));
          lblPayeeText.setPreferredSize(new Dimension(85, 22));

          lblPayeeData = new JLabel("");
          lblPayeeData.setMinimumSize(new Dimension(85, 22));
          lblPayeeData.setPreferredSize(new Dimension(85, 22));

          /**
           * Add the components to ciInfoPanel
           */
          ciInfoPanel = new JPanel();
          ciInfoPanel.setLayout(new GridLayout(8,1,0,0));

          ciInfoPanel.add(lblClaimIDText);
          ciInfoPanel.add(lblClaimIDData);
          ciInfoPanel.add(lblProvIDText);
          ciInfoPanel.add(lblProvIDData);
          ciInfoPanel.add(lblStatusText);
          ciInfoPanel.add(lblStatusData);
          ciInfoPanel.add(lblPayeeText);
          ciInfoPanel.add(lblPayeeData);
    }


    public void addCIMasterPanelComponents() throws Exception
    {
          gbLayout  = new GridBagLayout();
          gbConstraints = new GridBagConstraints();
          gbConstraints.gridwidth = gbConstraints.REMAINDER;

          // left panel
          ciLeftPanel = new JPanel(gbLayout);

          ciMemberPanel = new JPanel();
          ciMemberPanel.setPreferredSize(new Dimension(250,150));
          ciMemberPanel.setBorder(BorderFactory.createTitledBorder("Subscriber / Member"));

          lblSubIDText = new JLabel("Subscriber ID");
          lblSubIDText.setMinimumSize(new Dimension(100, 15));
          lblSubIDText.setPreferredSize(new Dimension(100, 15));

          lblSubIDData = new JLabel("");
          lblSubIDData.setMinimumSize(new Dimension(100, 15));
          lblSubIDData.setPreferredSize(new Dimension(100, 15));

          // test multi label

          /**
           * CLEAN ME
           * Either implement the label which wraps or
           * otherwise use short names
           */

          multiLabel = new DUMMYextCustomLabel();
          multiLabel.setAlignmentX(JLabel.LEFT);
          multiLabel.setAlignmentY(JLabel.LEFT);
          multiLabel.setText("M. Last Name");
          multiLabel.setMaxWidth(100);
          //multiLabel.setMinimumSize(new Dimension(100, 30));
          //multiLabel.setPreferredSize(new Dimension(100, 30));

          lblMemberLastNameText = new JLabel("M. Last Name");
          lblMemberLastNameText.setMinimumSize(new Dimension(100, 15));
          lblMemberLastNameText.setPreferredSize(new Dimension(100, 15));

          lblMemberLastNameData = new JLabel("");
          lblMemberLastNameData.setMinimumSize(new Dimension(100, 15));
          lblMemberLastNameData.setPreferredSize(new Dimension(100, 15));

          lblMemberFirstNameText = new JLabel("M. First Name");
          lblMemberFirstNameText.setMinimumSize(new Dimension(100, 15));
          lblMemberFirstNameText.setPreferredSize(new Dimension(100, 15));

          lblMemberFirstNameData = new JLabel("");
          lblMemberFirstNameData.setMinimumSize(new Dimension(100, 15));
          lblMemberFirstNameData.setPreferredSize(new Dimension(100, 15));

          lblMemberInitialText = new JLabel("Member Initial");
          lblMemberInitialText.setMinimumSize(new Dimension(100, 15));
          lblMemberInitialText.setPreferredSize(new Dimension(100, 15));

          lblMemberInitialData = new JLabel("");
          lblMemberInitialData.setMinimumSize(new Dimension(100, 15));
          lblMemberInitialData.setPreferredSize(new Dimension(100, 15));

          ciMemberPanel.add(lblSubIDText);
          ciMemberPanel.add(lblSubIDData);
          ciMemberPanel.add(lblMemberLastNameText);
          //ciMemberPanel.add(lblMemberLastNameData);
          ciMemberPanel.add(lblMemberLastNameData);
          ciMemberPanel.add(lblMemberFirstNameText);
          ciMemberPanel.add(lblMemberFirstNameData);
          ciMemberPanel.add(lblMemberInitialText);
          ciMemberPanel.add(lblMemberInitialData);

          ciLeftPanel.add(ciMemberPanel, gbConstraints);

          ciProvPanel = new JPanel();
          ciProvPanel.setPreferredSize(new Dimension(250,75));
          ciProvPanel.setBorder(BorderFactory.createTitledBorder("Provider"));

          lblProvNameText = new JLabel("Provider Name");
          lblProvNameText.setMinimumSize(new Dimension(100, 15));
          lblProvNameText.setPreferredSize(new Dimension(100, 15));

          lblProvNameData = new JLabel("");
          lblProvNameData.setPreferredSize(new Dimension(100, 30));
          //lblProvNameData.setPreferredSize(new Dimension(100, 15));
          lblProvNameData.setFont(new Font("Ariel",Font.PLAIN,12));

          ciProvPanel.add(lblProvNameText);
          ciProvPanel.add(lblProvNameData);

          ciLeftPanel.add(ciProvPanel, gbConstraints);

          ciLeftUnused = new JPanel(gbLayout);
          gbConstraints.weightx = 1.0;
          gbConstraints.weighty = 1.0;
          gbConstraints.fill = gbConstraints.BOTH;
          ciLeftPanel.add(ciLeftUnused, gbConstraints);

          // right panel
          gbConstraints.weightx = 0;
          gbConstraints.weighty = 0;
          gbConstraints.fill = gbConstraints.NONE;
          ciRightPanel = new JPanel(gbLayout);

          ciClaimPanel = new JPanel();
          ciClaimPanel.setPreferredSize(new Dimension(250,75));
          ciClaimPanel.setBorder(BorderFactory.createTitledBorder("Accept Assignment"));

          lblAccpAssgText = new JLabel("Accp Assg");
          lblAccpAssgText.setMinimumSize(new Dimension(100, 15));
          lblAccpAssgText.setPreferredSize(new Dimension(100, 15));

          chkAssignment = new JCheckBox("");
          chkAssignment.setMinimumSize(new Dimension(100, 15));
          chkAssignment.setPreferredSize(new Dimension(100, 15));

          lblPaidDtText = new JLabel("Paid Dt");
          lblPaidDtText.setMinimumSize(new Dimension(100, 15));
          lblPaidDtText.setPreferredSize(new Dimension(100, 15));

          lblPaidDtData = new JLabel("");
          lblPaidDtData.setMinimumSize(new Dimension(100, 15));
          lblPaidDtData.setPreferredSize(new Dimension(100, 15));

          ciClaimPanel.add(lblAccpAssgText);
          ciClaimPanel.add(chkAssignment);
          ciClaimPanel.add(lblPaidDtText);
          ciClaimPanel.add(lblPaidDtData);

          ciRightPanel.add(ciClaimPanel, gbConstraints);

          ciTOBPanel = new JPanel();
          ciTOBPanel.setPreferredSize(new Dimension(250,75));
          ciTOBPanel.setBorder(BorderFactory.createTitledBorder("Type of Bill"));

          lblTypeOfClassText = new JLabel("Type of Class");
          lblTypeOfClassText.setMinimumSize(new Dimension(100, 15));
          lblTypeOfClassText.setPreferredSize(new Dimension(100, 15));

          lblTypeOfClassData = new JLabel("");
          lblTypeOfClassData.setMinimumSize(new Dimension(100, 15));
          lblTypeOfClassData.setPreferredSize(new Dimension(100, 15));

          lblFrequencyText = new JLabel("Frequemcy");
          lblFrequencyText.setMinimumSize(new Dimension(100, 15));
          lblFrequencyText.setPreferredSize(new Dimension(100, 15));

          lblFrequencyData = new JLabel("");
          lblFrequencyData.setMinimumSize(new Dimension(100, 15));
          lblFrequencyData.setPreferredSize(new Dimension(100, 15));

          ciTOBPanel.add(lblTypeOfClassText);
          ciTOBPanel.add(lblTypeOfClassData);
          ciTOBPanel.add(lblFrequencyText);
          ciTOBPanel.add(lblFrequencyData);

          ciRightPanel.add(ciTOBPanel, gbConstraints);

          ciStmtPanel = new JPanel();
          ciStmtPanel.setPreferredSize(new Dimension(250,75));
          ciStmtPanel.setBorder(BorderFactory.createTitledBorder("Statement"));

          lblStmntFromDtText = new JLabel("Stmnt From Dt");
          lblStmntFromDtText.setMinimumSize(new Dimension(100, 15));
          lblStmntFromDtText.setPreferredSize(new Dimension(100, 15));

          lblStmntFromDtData = new JLabel("");
          lblStmntFromDtData.setMinimumSize(new Dimension(100, 15));
          lblStmntFromDtData.setPreferredSize(new Dimension(100, 15));

          lblStmntToDtText = new JLabel("Stmnt To Dt");
          lblStmntToDtText.setMinimumSize(new Dimension(100, 15));
          lblStmntToDtText.setPreferredSize(new Dimension(100, 15));

          lblStmntToDtData = new JLabel("");
          lblStmntToDtData.setMinimumSize(new Dimension(100, 15));
          lblStmntToDtData.setPreferredSize(new Dimension(100, 15));

          ciStmtPanel.add(lblStmntFromDtText);
          ciStmtPanel.add(lblStmntFromDtData);
          ciStmtPanel.add(lblStmntToDtText);
          ciStmtPanel.add(lblStmntToDtData);

          ciRightPanel.add(ciStmtPanel, gbConstraints);

          ciAdjPanel = new JPanel();
          ciAdjPanel.setPreferredSize(new Dimension(250,75));
          ciAdjPanel.setBorder(BorderFactory.createTitledBorder("Adjustment"));

          lblAdjFromText = new JLabel("Adj From");
          lblAdjFromText.setMinimumSize(new Dimension(100, 15));
          lblAdjFromText.setPreferredSize(new Dimension(100, 15));

          lblAdjFromData = new JLabel("");
          lblAdjFromData.setMinimumSize(new Dimension(100, 15));
          lblAdjFromData.setPreferredSize(new Dimension(100, 15));

          lblAdjToText = new JLabel("Adj To");
          lblAdjToText.setMinimumSize(new Dimension(100, 15));
          lblAdjToText.setPreferredSize(new Dimension(100, 15));

          lblAdjToData = new JLabel("");
          lblAdjToData.setMinimumSize(new Dimension(100, 15));
          lblAdjToData.setPreferredSize(new Dimension(100, 15));

          ciAdjPanel.add(lblAdjFromText);
          ciAdjPanel.add(lblAdjFromData);
          ciAdjPanel.add(lblAdjToText);
          ciAdjPanel.add(lblAdjToData);

          ciRightPanel.add(ciAdjPanel, gbConstraints);

          ciRightUnused = new JPanel(gbLayout);
          gbConstraints.weightx = 1.0;
          gbConstraints.weighty = 1.0;
          gbConstraints.fill = gbConstraints.BOTH;

          ciRightPanel.add(ciRightUnused, gbConstraints);

          // add left and right panels to panel
          JPanel ciMasterPanel = new JPanel(gbLayout);
          gbConstraints.gridwidth = gbConstraints.RELATIVE;
          ciMasterPanel.add(ciLeftPanel, gbConstraints);
          gbConstraints.gridwidth = gbConstraints.REMAINDER;
          ciMasterPanel.add(ciRightPanel, gbConstraints);

          DUMMYextApp.frame.getMasterPanel().setBounds(0,0,520,330);
          DUMMYextApp.frame.getMasterPanel().add(ciMasterPanel);

    }


    /**
     * right bottom button panel components
     * @throws Exception
     */
    public void addCIButtonPanelComponents() throws Exception
    {
        btnBack1 = new JButton(" Back ");
        btnBack1.setPreferredSize(new Dimension(110, 22));
        btnBack1.setMinimumSize(new Dimension(110, 22));
        btnBack1.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnBack1ActionPerformed(e);
            }
        });

        ciButtonPanel = new JPanel();
        ciButtonPanel.add(btnBack1);
    }


    public void addCLButtonPanelComponents() throws Exception
    {
        btnBack2 = new JButton(" Back ");
        btnBack2.setPreferredSize(new Dimension(110, 22));
        btnBack2.setMinimumSize(new Dimension(110, 22));
        btnBack2.addActionListener(new ActionListener ()
        {
            public void actionPerformed(ActionEvent e)
            {
              btnBack2ActionPerformed(e);
            }
        });

        clButtonPanel = new JPanel();
        clButtonPanel.add(btnBack2);
    }

    /**
     * Call the stored procedure and get the required information
     * for the given Claim ID. The output will always be only
     * one record returned and they just need to be displayed
     * in the JLabels added below
     * @throws Exception
     */
    public void setCIComponentValues() throws Exception
    {
         /**
         * CLEAN ME
         * Please clean up the display of NULLS etc if no values are there
         * Clean the checkbox display
         */
        ResultSet rs = sampleData.GetIndicativeInfo(active_clcl_id);
        while (rs.next())
        {
              lblProvIDData.setText(String.valueOf(rs.getString("PRPR_ID")));
              lblProvNameData.setText("<html>" + String.valueOf(rs.getString("PRPR_NAME")) + "</html>");
              lblStatusData.setText(rs.getString("CLCL_CUR_STS"));
              lblPayeeData.setText(rs.getString("CLCL_PAY_PR_IND"));
              lblSubIDData.setText(sbsb_id);
              lblMemberLastNameData.setText(rs.getString("MEME_LAST_NAME"));
              //multiLabel.setText(rs.getString("MEME_LAST_NAME"));
              lblMemberFirstNameData.setText(rs.getString("MEME_FIRST_NAME"));
              lblMemberInitialData.setText(rs.getString("MEME_ID_NAME"));
              //if ((String.valueOf(rs.getString("CLCL_MED_ASSIGN_IND"))) == 'N')
              //{
              //  chkAssignment.setSelected(true);
              //}
              lblPaidDtData.setText(formatDate(rs.getDate("CLCL_PAID_DT")));
              lblTypeOfClassData.setText(rs.getString("CLHP_FAC_TYPE") + rs.getString("CLHP_BILL_CLASS"));
              lblFrequencyData.setText(rs.getString("CLHP_FREQUENCY"));
              lblStmntFromDtData.setText(formatDate(rs.getDate("CLHP_STAMENT_FR_DT")));
              lblStmntToDtData.setText(formatDate(rs.getDate("CLHP_STAMENT_TO_DT")));
              lblAdjFromData.setText(rs.getString("CLCL_ID_ADJ_FROM"));
              lblAdjToData.setText(rs.getString("CLCL_ID_ADJ_TO"));
        }
    }


    public void addCIComponents() throws Exception
    {
        //remove existing components from bean
        DUMMYextApp.frame.getMasterPanel().removeAll();
        DUMMYextApp.frame.getDetailPanel().removeAll();
        DUMMYextApp.frame.getButtonPanel().removeAll();
        DUMMYextApp.frame.getInfoPanel().removeAll();
        DUMMYextApp.frame.getMenuListPanel().removeAll();

        //set the panels to TRUE inorder to show the panels
        DUMMYextApp.frame.setUseMasterPanel(true);
        DUMMYextApp.frame.setUseDetailPanel(true);
        DUMMYextApp.frame.setUseButtonPanel(true);
        DUMMYextApp.frame.setUseInfoPanel(true);
        DUMMYextApp.frame.setUseMenuPanel(true);

        //Set the components for Left top Menu list Panel
        addCIMenuPanelComponents();

        //Set the components for left bottom Info Panel
        addCIInfoPanelComponents();

        //Set the components for right top Master Panel
        addCIMasterPanelComponents();

        //Set the components for right top Master Panel
        addCIButtonPanelComponents();

        //Add current panels to Bean Panels

        DUMMYextApp.frame.getMenuListPanel().add(ciMenuPanel);
        DUMMYextApp.frame.getInfoPanel().add(ciInfoPanel);
        DUMMYextApp.frame.getButtonPanel().add(ciButtonPanel);

        //Set the values for the laid out components
        setCIComponentValues();

        DUMMYextApp.frame.repaint();
        DUMMYextApp.frame.validate();

    }

    public void addCLMasterPanelComponents() throws Exception
    {

        //gbLayout  = new GridBagLayout();
        //gbConstraints = new GridBagConstraints();

        clTopPanel = new JPanel(new GridLayout(1,5,2,2));

        lblTotalChargeText = new JLabel("  Total Charge",JLabel.LEFT);
        //lblTotalChargeText.setMinimumSize(new Dimension(100, 15));
        //lblTotalChargeText.setPreferredSize(new Dimension(100, 15));

        lblTotalChargeData = new JLabel("",JLabel.LEFT);
        //lblTotalChargeData.setMinimumSize(new Dimension(100, 15));
        //lblTotalChargeData.setPreferredSize(new Dimension(100, 15));

        lblPaidDtText = new JLabel("Patient Paid",JLabel.LEFT);
        //lblPaidDtText.setMinimumSize(new Dimension(100, 15));
        //lblPaidDtText.setPreferredSize(new Dimension(100, 15));

        lblPaidDtData = new JLabel("",JLabel.LEFT);
        //lblPaidDtData.setMinimumSize(new Dimension(100, 15));
        //lblPaidDtData.setPreferredSize(new Dimension(100, 15));

        clTopPanel.add(lblTotalChargeText);
        clTopPanel.add(lblTotalChargeData);
        clTopPanel.add(lblPaidDtText);
        clTopPanel.add(lblPaidDtData);
        clTopPanel.add(Box.createHorizontalStrut(1));

        /**
         * Setting up the Table Panel Components
         */

        clTablePanel = new JPanel();
        //clTablePanel.setPreferredSize(new Dimension(500,50));
        //clTablePanel.setMaximumSize(new Dimension(500,50));

        String[] strColumnNames = { "No", "From Dt", "To Dt","Rev","POS", "TOS", "Proc","Dx","Units",
                                    "Charges","Consider","All Units","Allowed","Paid","Deduc","Copay",
                                    "CoIns","DisAllow","Disc","SupDisc","Risk","Excd"};

        try
        {
              atmBean = (sampleTableModelBean) Beans.instantiate(getClass().getClassLoader(), sampleTableModelBean.class.getName());
              atmBean.setColumns(strColumnNames);
              atmBean.setTableData(sampleData.GetClaimLines(active_clcl_id));
              atmBean.createTable();

              clTable = atmBean.getReturnTable();

              clTable.removeColumn(clTable.getColumnModel().getColumn(21));
              clTable.removeColumn(clTable.getColumnModel().getColumn(20));
              clTable.removeColumn(clTable.getColumnModel().getColumn(19));
              clTable.removeColumn(clTable.getColumnModel().getColumn(18));
              clTable.removeColumn(clTable.getColumnModel().getColumn(17));
              clTable.removeColumn(clTable.getColumnModel().getColumn(16));
              clTable.removeColumn(clTable.getColumnModel().getColumn(15));
              clTable.removeColumn(clTable.getColumnModel().getColumn(14));
              clTable.removeColumn(clTable.getColumnModel().getColumn(13));
              clTable.removeColumn(clTable.getColumnModel().getColumn(12));
              clTable.removeColumn(clTable.getColumnModel().getColumn(11));
              clTable.removeColumn(clTable.getColumnModel().getColumn(10));

              clTable.addMouseListener(new MouseAdapter() {
                  public void mouseClicked(MouseEvent e) {
                      setCLDetailsPanel();
                  }
              });

              clTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              clTable.setBorder(BorderFactory.createEtchedBorder());
              clTable.setPreferredScrollableViewportSize(new Dimension(500,70));
              clScrollPane  = new JScrollPane(clTable);
              clTablePanel.add(clScrollPane);
        }
        catch(ClassNotFoundException cnfe)
        {
              Reporter.easyReport(ReportType.EXCEPTION,"Could not find the Default Anthem Table Model" + cnfe.getMessage());
        }
        catch(IOException ie)
        {
              Reporter.easyReport(ReportType.EXCEPTION,"IOException: "  + ie.getMessage());
        }

        /**
         * Popup Panel components
         */

        clPopupPanel = new JPanel(new GridLayout(2,4,2,2));
        //clPopupPanel.setPreferredSize(new Dimension(490,50));
        //clPopupPanel.setMaximumSize(new Dimension(490,50));

        btnOverrides = new JButton("Claim Overrides");
        btnOverrides.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        btnEDI = new JButton("EDI");
        btnEDI.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        btnAlternatePayee = new JButton("Alternate Payee");
        btnAlternatePayee.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        btnClaimNotes = new JButton("Claim Notes");
        btnClaimNotes.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e) {

          }
        });

        btnClaimStatus = new JButton("Claim Status");
        btnClaimStatus.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        btnBlueCard = new JButton("Blue Card");
        btnBlueCard.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        btnCOB = new JButton("COB");
        btnCOB.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e) {

          }
        });

        btnEOB = new JButton("EOB");
        btnEOB.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e){

          }
        });

        clPopupPanel.add(btnOverrides);
        clPopupPanel.add(btnEDI);
        clPopupPanel.add(btnAlternatePayee);
        clPopupPanel.add(btnClaimNotes);
        clPopupPanel.add(btnClaimStatus);
        clPopupPanel.add(btnBlueCard);
        clPopupPanel.add(btnCOB);
        clPopupPanel.add(btnEOB);

        clDetailsPanel = new JPanel(new GridLayout(4,6,2,2));
        clDetailsPanel1 = new JPanel();
        clDetailsPanel1.add(clDetailsPanel,BorderLayout.CENTER);

        lblConsdText = new JLabel("Consd Charge ");
        lblConsdData = new JLabel("");
        lblConsdData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblDeducText = new JLabel("Deductible ");
        lblDeducData = new JLabel("");
        lblDeducData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblDiscAmtText = new JLabel("Disc Amt ");
        lblDiscAmtData = new JLabel("");
        lblDiscAmtData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblAllowedText  = new JLabel("Allowed Units ");
        lblAllowedData = new JLabel("");
        lblAllowedData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblCopayText = new JLabel("Copay ");
        lblCopayData = new JLabel("");
        lblCopayData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblSuppDiscText = new JLabel("Supp Disc ");
        lblSuppDiscData = new JLabel("");
        lblSuppDiscData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblAllowedUnitsText = new JLabel("Allowed ");
        lblAllowedUnitsData = new JLabel("");
        lblAllowedUnitsData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblCoInsText = new JLabel("Co Insurance ");
        lblCoInsData = new JLabel("");
        lblCoInsData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblWithholdText = new JLabel("Withhold ");
        lblWithholdData = new JLabel("");
        lblWithholdData.setFont(new Font("Dialog",Font.PLAIN,12));
        lblDisAllowText = new JLabel("Disallow ");
        lblDisAllowData = new JLabel("");
        lblDisAllowData.setFont(new Font("Dialog",Font.PLAIN,12));

        //System.out.println(this.getFont());

        //clDetailsPanel.setPreferredSize(new Dimension(500,125));
        //clDetailsPanel.setMaximumSize(new Dimension(500,125));
        clDetailsPanel.add(lblConsdText);
        clDetailsPanel.add(lblConsdData);
        clDetailsPanel.add(lblDeducText);
        clDetailsPanel.add(lblDeducData);
        clDetailsPanel.add(lblDiscAmtText);
        clDetailsPanel.add(lblDiscAmtData);
        clDetailsPanel.add(lblAllowedUnitsText);
        clDetailsPanel.add(lblAllowedUnitsData);
        clDetailsPanel.add(lblCopayText);
        clDetailsPanel.add(lblCopayData);
        clDetailsPanel.add(lblSuppDiscText);
        clDetailsPanel.add(lblSuppDiscData);
        clDetailsPanel.add(lblAllowedText);
        clDetailsPanel.add(lblAllowedData);
        clDetailsPanel.add(lblCoInsText);
        clDetailsPanel.add(lblCoInsData);
        clDetailsPanel.add(lblWithholdText);
        clDetailsPanel.add(lblWithholdData);
        clDetailsPanel.add(Box.createHorizontalStrut(1));
        clDetailsPanel.add(Box.createHorizontalStrut(1));
        clDetailsPanel.add(lblDisAllowText);
        clDetailsPanel.add(lblDisAllowData);
        clDetailsPanel.add(Box.createHorizontalStrut(1));
        clDetailsPanel.add(Box.createHorizontalStrut(1));

        clErrorPanel = new JPanel();

        lblEXCDData = new JLabel("");
        //clErrorPanel.setPreferredSize(new Dimension(500,35));
        //clErrorPanel.setMaximumSize(new Dimension(500,35));
        clErrorPanel.add(lblEXCDData,BorderLayout.SOUTH);

        clMasterPanel = new JPanel();
        //clMasterPanel.setPreferredSize(new Dimension(500,320));
        //clMasterPanel.setMaximumSize(new Dimension(500,320));
        clMasterPanel.setLayout(gbLayout);

        gbConstraints.gridwidth = gbConstraints.REMAINDER;
        gbConstraints.fill = gbConstraints.BOTH;
        gbConstraints.weightx = 1.0;
        gbConstraints.weighty = 0.0075;
        //gbConstraints.weighty = 0.005;
        clMasterPanel.add(clTopPanel,gbConstraints);
        gbConstraints.weighty = 1.0;
        //gbConstraints.weighty = .75;
        clMasterPanel.add(clTablePanel,gbConstraints);
        gbConstraints.weighty = 0.5;
        clMasterPanel.add(clPopupPanel,gbConstraints);
        gbConstraints.weighty = 1.0;
        clMasterPanel.add(clDetailsPanel1,gbConstraints);
        gbConstraints.weighty = 0.0075;
        //gbConstraints.weighty = 0.005;
        clMasterPanel.add(clErrorPanel,gbConstraints);

    }

    public void addCLComponents() throws Exception
    {
        //remove existing components from bean
        DUMMYextApp.frame.getMasterPanel().removeAll();
        DUMMYextApp.frame.getDetailPanel().removeAll();
        DUMMYextApp.frame.getButtonPanel().removeAll();
        //DUMMYextApp.frame.getInfoPanel().removeAll();
        DUMMYextApp.frame.getMenuListPanel().removeAll();

        //set the panels to TRUE inorder to show the panels
        DUMMYextApp.frame.setUseMasterPanel(true);
        DUMMYextApp.frame.setUseDetailPanel(true);
        DUMMYextApp.frame.setUseButtonPanel(true);
        DUMMYextApp.frame.setUseInfoPanel(true);
        DUMMYextApp.frame.setUseMenuPanel(true);

        //Set the components for Left top Menu list Panel
        //Reused this is the same screen as CI components
        addCIMenuPanelComponents();

        //Set the components for left bottom Info Panel
        //Reused this is the same screen as CI components
        //addCIInfoPanelComponents();

        //Button Panel
        addCLButtonPanelComponents();

        //Master Panel
        addCLMasterPanelComponents();

        //Add current panels to Bean Panels

        DUMMYextApp.frame.getMenuListPanel().add(ciMenuPanel);
        DUMMYextApp.frame.getInfoPanel().add(ciInfoPanel);
        DUMMYextApp.frame.getButtonPanel().add(clButtonPanel);
        DUMMYextApp.frame.getMasterPanel().add(clMasterPanel);
        //Set the values for the laid out components
        //setCIComponentValues();
        DUMMYextApp.frame.repaint();
        DUMMYextApp.frame.validate();
    }

    /**
     * Resets all the text fields on Cancel
     */
    private void resetTextBoxes()
    {
        txtClaimID.setText("");
        txtSubscriberID.setText("");
        txtMemberSuffix.setText("");
    }

    /**
     *
     */
    public void setCLDetailsPanel()
    {

          lblConsdData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),11).toString());
          lblAllowedData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),13).toString());
          lblAllowedUnitsData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),12).toString());
          lblDeducData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),14).toString());
          lblCopayData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),15).toString());
          lblCoInsData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),16).toString());
          lblDisAllowData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),17).toString());
          lblDiscAmtData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),18).toString());
          lblSuppDiscData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),19).toString());
          lblWithholdData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),20).toString());
          lblEXCDData.setText(atmBean.tm.getValueAt(clTable.getSelectedRow(),21).toString());
          clDetailsPanel.validate();
          clDetailsPanel.repaint();
    }


    /**
     * This will set the size of JTable
     * @return Dimension
     */
    private Dimension getTablePreferredSize()
    {
        Dimension frameSize = DUMMYextApp.getAppFrame().getMasterPanel().getSize();
        int tableWidth = frameSize.width -35;
       // int tableHeight = frameSize.height-198;
        int tableHeight = frameSize.height-118;
        //int tableHeight = frameSize.height-158;
        Dimension tableSize = new Dimension(tableWidth, tableHeight);
        return tableSize;
    }

    private Dimension getlineTablePreferredSize()
    {
        Dimension frameSize = DUMMYextApp.getAppFrame().getMasterPanel().getSize();
        int tableWidth = frameSize.width; //-35;
       // int tableHeight = frameSize.height-198;
        int tableHeight = frameSize.height-250;
        //int tableHeight = frameSize.height-158;
        Dimension tableSize = new Dimension(tableWidth, tableHeight);
        return tableSize;
    }

    private String formatDate(final java.util.Date d)
    {
        if (d == null) return ""; // date is null
        final SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
        return sdf.format(d);
    }

    /**
     * When the Search button is called this method is triggered
     *
     * If either of Claim ID or Sub ID is entered it will trigger
     * the addCRComponents() method, otherwise it will display a message
     * to user requesting to key in values
     *
     * @param e
     */
    public void btnSearchActionPerformed(ActionEvent e)
    {
        try
        {
            if ((!("".equals(this.txtClaimID.getText()))) || (!("".equals(this.txtSubscriberID.getText()))))
            {
                clcl_id = this.txtClaimID.getText();
                sbsb_id = this.txtSubscriberID.getText();
                meme_sfx = this.txtMemberSuffix.getText();
                addCRComponents();
            }
            else
            {
                JOptionPane.showMessageDialog(sampleFrame, "Either Claim ID or Subscriber ID is required");
            }
        }
        catch(Exception e2)
        {
            e2.printStackTrace();
        }
    }

    /**
     * When the cancel button is pressed, this event is triggered
     * It will call the resetTestBoxes() method to claer the fields
     * @param e
     */
    public void btnCancelActionPerformed(ActionEvent e)
    {
        resetTextBoxes();
    }


    /**
     * <p>This method is triggered when the Claim details button is pressed
     * It will try to get the active claim ID selected by the user
     * in the JTable, and will trigger the addCIComponents() method.</p>
     * <p>If no claim is selected it will display a error message</p?
     * @param e
     */
    public void btnDetailsActionPerformed()
    {
        try
        {
            //JOptionPane.showMessageDialog(this, crTable.getValueAt(crTable.getSelectedRow(),0).toString());
            active_clcl_id = crTable.getValueAt(crTable.getSelectedRow(),0).toString();
            sbsb_id = crTable.getValueAt(crTable.getSelectedRow(),1).toString();
            addCIComponents();
        }
        catch(NullPointerException npe)
        {
            Reporter.easyReport(ReportType.EXCEPTION,"A row was not selected: " + npe.getMessage());
            JOptionPane.showMessageDialog(this,"Please Select a record from the table");
        }
        catch(Exception e4)
        {
            e4.printStackTrace();
        }
    }

    /**
     * <p>This is triggered when the Back button is pressed in the Claim results page
     * It will removeall() existing components and will being back the search
     * entry fields to key in data again.</p>
     * @param e
     */
    public void btnBackActionPerformed(ActionEvent e)
    {
        //invoke the first screen
        try
        {
            addCEComponents();
        }
        catch (Exception e1)
        {
            e1.printStackTrace();
        }
    }


    public void btnBack1ActionPerformed(ActionEvent e)
    {
        //invoke the first screen
        try
        {
            addCRComponents();
        }
        catch (Exception e1)
        {
            e1.printStackTrace();
        }
    }

    public void btnBack2ActionPerformed(ActionEvent e)
    {
        //invoke the first screen
        try
        {
            addCIComponents();
        }
        catch (Exception e2)
        {
            e2.printStackTrace();
        }
    }

    /**
     * CLEAN ME
     * clean up to trigger only once for the same item select
     */

    public void lstSections_valueChanged()
    {
           if (lstSections.getSelectedIndex()==0)
           {
              try
              {
                  System.out.println("Should trigger method 3");
                  addCIComponents();
                  //lstSections.setSelectedIndex(0);
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }
           }
            else //if ((isIndicative = true) && !(lmSections.firstElement()))
           {
              try
              {
                  System.out.println("Should trigger method 4");
                  addCLComponents();
                  //lstSections.setSelectedIndex(-1);
              }
              catch (Exception e)
              {
                  e.printStackTrace();
              }

           }
    }

}


0
Comment
Question by:yoga23
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
monkesdb earned 125 total points
ID: 9728460
Don't you just hate it when people post code like this???

> "here here!"

well... I think i have a design pattern for you (you really should look into design patterns, they are THE Java way of thinking).

I can't remember what it's called (i think it's like the Observer) but let me explain the logic behind it in simple steps...

Firstly, you have your main window (DUMMYTextPanel) let me call it MainFrame for succinctness. Now this is a JPanel inside which are the main GUI elements, it is where you want 4 different 'forms' or 'sets of controls' to appear at different times depending on the press of a button.

From this we gather that if we are to seperate these 4 sets of controls into seperate classes they need a way of referring back to MainFrame.

Also it is typical for readaibity sake and general refactoring practice to keep the 'business logic' seperate from the GUI.

So from this we have...

public interface IClaim
{
// data get and set methods plus any extras neccessary
}

public class Claim implements IData
{
// implement the IClaim interface
}

This is a nice thing to do, create interfaces for classes which will be passed arround a bit. It allows for extra polymorphising.
Anyway, Claim will contain all of the information about the Claim or whatever. You may even want one for a Claim and one for a Subscriber.

Now for one of those 4 classes. It needs to be able to tell MainFrame when it has finished. so a reference to MainFrame must be given to it, usually through an interface.

public class MYForm extends JPanel
{} // leave blank

public class ClaimEntryForm extends MyForm
{
// GUI elements

  IClaim claim; // this is your point of contact with the data
  IMainFrame mainframe; // this is your point of contact with the rest of the GUI

  CEForm(IClaim claim, IMainFrame mainframe)
  {
    this.claim = claim;
    this.mainframe = mainframe;
  }

  void initialise()
  {
    // add the GUI elements to this
  }

  void despose()
  {
    // set down
  }

 // update claim with the data entered into the boxes according to your orriginal program.

  void on_SomeRandomButtonClick(MouseEvent e)
  {
    mainframe.formFinished(this);
  }
}

the other 3 will be very similar, extending MyForm and having the exact same constructor and the initialise and despose methods to suite.

now for the changes to MainFrame

public interface IMainFrame
{
  void formFinished(MyForm);
}

public class MainFrame extends JPanel
{
  Claim claim;

  void addCEComponents()
  {
    this.add(new ClaimEntryForm(claim, this));
  }

  void formFinished(MyForm form)
  {
    this.remove(form); // or you can remove all whatever.
  }
}

Now from you studying this code you should be able to see the interaction between the classes and how it all fits together.

You will need to solve the problem of deciding which form to change to next in formFinished. but i leave that as another problem for you to solve.

good day sir

and never post your entire code again.
0
 
LVL 3

Expert Comment

by:monkesdb
ID: 9728489
that IData should be IClaim
and CEForm should be ClaimEntryForm

(i always for get to look back before sending, espesially which such a long post)
0
 

Author Comment

by:yoga23
ID: 9742923
thanks anyway , i was already done implementing it the same way suggested..

but i am not sure where interface plays a role here,

just splitted it to 5 classes

mainClass

Class1
Class2
..

and passed the objects (Class1.this) ...

i am not aware of polymorphism, just new and this is first application

thanks a lot for helping me

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now