|
Last
revision of this document: |
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. */
protected
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);
};
}
}