> List of tutorials

Table of contents for this tutorial

Fat-Client-Development - Code for Class JS_ErrDB_Project__ActionHandler

* For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

  • The owner of this web-site (www.javascout.biz) is not responsible for the content of web-sites linked within this document or linked within other documents of www.javascout.biz.

  • If this document or other documents of this web-site (www.javascout.biz) infringes your rights or you think that rights of others (third parties) are infringed, please inform the author.
    An e-mail can be sent by clicking onto the 'hungry mailbox' in the upper right corner.

Last revision of this document:
2006-10-02

This is document contains the code for Class JS_ErrDB_Project__ActionHandler.
This class contains methods that perform mainly business-processing.
For easy 'cut and paste' ;-)

package js_errdb.clientframes;

import java.awt.event.*;

/**
 *
 * @author
kurt@javascout.biz
 * @date 2006-10-02
 *
 * @description
 * Methods to carry out business-actions.

 
*
 * @change-log
 * when     who          why
 * --------------------------------------------------------
 *
 */

public class
JS_ErrDB_Project__ActionHandler
{
/*
 * Method to handle Actions that were triggered by clicking onto a GUI-Element
 * which has added the interface 'ActionListener'. */
    protected static void handleEvent(JS_ErrDB_Project parmTF, ActionEvent parmActionEvent) {
/* Derive the ActionCommand
 * (which was attached to the GUI-element through method setActionCommand()). */
      String cmd = parmActionEvent.getActionCommand();
/* Check which ActionCommand was handed over and perform the appropriate action. */
      if (cmd.equals("btn_Store")) {
/* Button to store the entered data. */
        store(parmTF);
      }
    }
/*
 * Methods to carry out business-actions
 * ------------------------------------- */
/*
 * Method to store the data from the GUI-elements to the database. */
    protec
ted static void store(JS_ErrDB_Project parmTF) {
/*
 * Transfer the values from the GUI-elements to the Business Object 'Project'. */
      
parmTF.structJS_ErrDB_Project_BOC_Processed.getFromGUI(
        parmTF.get_txt_ProjectCode(),
parmTF.get_txt_LanguageCode(), parmTF.get_txt_TargetDirectory());
/*
 * Use the method of the BO to store the data. */
      
parmTF.structJS_ErrDB_Project_BOC_Processed.store();

/* Verify that the store was run as expected; print out error if not. */
      if (parmTF.structJS_ErrDB_Project_BOC_Processed.StatusCode !=
            
parmTF.structJS_ErrDB_Project_BOC_Processed.CONST_OK) {
        System.
out.println(
          
"Error in store() of JS_ErrDB_Project_BOC; class JS_ErrDB_Project__ActionHandler / store().");
        System.out.println("StatusCode: " +
          Integer.toString(
parmTF.structJS_ErrDB_Project_BOC_Processed.StatusCode));

        System.out.println("StatusMsg: " +
          
parmTF.structJS_ErrDB_Project_BOC_Processed.StatusMsg);

      };

/*
 * Redisplay the list with all Project/Language combinations. */
      
redisplayProject(parmTF);

    }
/*
 * Method to retrieve the list of valid Project/Language combinations
 * and display it in the JTable GUI-element. */
    protected static void redisplayProject(JS_ErrDB_Project parmTF) {
/*
 * Get all actual 'Project/Language' combinations from the database. */
      parmTF.structJS_ErrDB_Project_Set_BOC = new JS_ErrDB_Project_Set_BOC(parmTF);
      parmTF.structJS_ErrDB_Project_Set_BOC.getAllValidProjectLanguageCombinations();
/*
 * Check for errors. */
      if (parmTF.structJS_ErrDB_Project_Set_BOC.StatusCode !=
            
JSBS_BO.CONST_OK) {
        System.
out.println(
          
"Error in gettAllProjectLanguageCombinations() of JS_ErrDB_Project_BOC; " +
          "class JS_ErrDB_Project__ActionHandler / redisplayProject()."
);
        System.out.println("StatusCode: " +
          Integer.toString(
parmTF.structJS_ErrDB_Project_Set_BOC.StatusCode));

        System.out.println("StatusMsg: " +
          
parmTF.structJS_ErrDB_Project_Set_BOC.StatusMsg);

      };

    }

}