> List of tutorials for developing a Fat-Client in Java

Index – Advanced Java-Fat-Client development

Code for Class JS_ProjAssist_CommandCenter

* 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-08-30

This is document contains the code for Class JS_ProjAssist_CommandCenter.
This class contains variables and methods used for all StartFrames (CommandCenter) of application-programs.
For easy 'cut and paste' ;-)

package js_projassist.clientframes;

import java.awt.event.*;

import js_base.connections.*;
import js_base.frame.*;
import js_base.structures.*;
import js_base.xml.*;

/**
 *
 * @author
kurt@javascout.biz
 * @date 2006-05-07
 *
 * @description
 * Command Center for the Fat-Client-Application to maintain
 * auxiliary data for Projects.
 * This assistance comprises:
 * * Maintaining text-components for GUI-elements in different languages.
 * * Maintaining error- and warning-messages in different languages.
 * * Configuring slide-shows for the presentation with a web-browser.
 
*
 * @change-log
 * when          who          why
 * --------------------------------------------------------
 *
 */

public class JS_ProjAssist_CommandCenter extends
JSBS_StartFrame {
/*
 * -------------------------------
 * Constructor of the class */
    
public JS_ProjAssist_CommandCenter(String parmstrLanguageCode){
      super();
      initialize_before_frame(parmstrLanguageCode);
      initialize_frame();
      initialize_after_frame();
    }

 
/*
 * -------------------------------
 * Method with code to be executed before the GUI is build */
    private void initialize_before_frame(String parmstrLanguageCode) {
/*
 * ********************
 * Set the version of the application:
 * >> Please comment out the version you are not testing or which is not for delivery ! << */
      RunVersion = CONST_StandAlone;
//      RunVersion = CONST_FatClient;
/*
 * Initialize the structure with the set of parameters
 * (defined in the inherited class JSBS_StartFrame). */
      structJSBS_UniversalParameters = new JSBS_UniversalParameters(parmstrLanguageCode);
/*
 * Initialize the structure with the language dependent GUI-element
 * (defined in the inherited class JSBS_StartFrame).
 * This also loads the structure from the file. */
      structJSBS_XML_DisplayStrings = new JSBS_XML_DisplayStrings(structJSBS_UniversalParameters);
/* Verify if the class was constructed without an error. */
      if (structJSBS_XML_DisplayStrings.StatusCode != JSBS_XML_Constants.CONST_OK) {
        System.out.println("Error while building 'structJSBS_XML_DisplayStrings'; StatusCode: " +
          (new Integer(structJSBS_XML_DisplayStrings.StatusCode)).toString());
        System.exit(structJSBS_XML_DisplayStrings.StatusCode);
      }

/*
 * Initialize the XML-structure for the selectable Business Tasks.
 * The variable for the structure is defined in the inherited class JSBS_StartFrame). */
      structJSBS_XML_Tasks = new JSBS_XML_Tasks(structJSBS_UniversalParameters);
/* Verify if the class was constructed without an error. */
      if (structJSBS_XML_Tasks.StatusCode != JSBS_XML_Constants.CONST_OK) {
        System.out.println("Error while building 'structJSBS_XML_Tasks'; StatusCode: " +
          (new Integer(structJSBS_XML_Tasks.StatusCode)).toString());
        System.exit(structJSBS_XML_Tasks.StatusCode);
      }

/* Display the Task-List in the JTree designated to do this.
 * This works, even if the GUI-Element is not yet part of a frame and displayed ;-). */
      
tree_SelectableTasks = structJSBS_XML_Tasks.getTaskTree();
/* Establish the connection to the database-system and/or the JAS -
 * depending on the RunVersion. */
      
if ((RunVersion == CONST_StandAlone) || (RunVersion == CONST_MobileClient)) {
        structJSBS_DB_ConnectionManager =
          new
JSBS_DB_ConnectionManager(structJSBS_UniversalParameters);
/* Verify if the class was constructed without an error. */
        if (structJSBS_DB_ConnectionManager.StatusCode != JSBS_XML_Constants.CONST_OK) {
          System.out.println("Error while building 'structJSBS_DB_ConnectionManager'; StatusCode: " +
            (new Integer(structJSBS_DB_ConnectionManager.StatusCode)).toString() +
            "; StatusMessage: " +
structJSBS_DB_ConnectionManager.StatusMsg)
;
          System.exit(structJSBS_DB_ConnectionManager.StatusCode);
        }

      }
    }

 
/*
 * -------------------------------
 * Method with code to construct and display the GUI (Graphic User Interface) */
    private void initialize_frame() {
      setVisible(true);
      setSize(600, 400);
/* Use the standard GUI-layout (without currency-selection)
 * as defined in the inherited class (JSBS_StartFrame). */
      setContentPane(get_pnl_Main());
    }

 
/*
 * -------------------------------
 * Method with code to be executed after the GUI is build */
    private void initialize_after_frame() {
/* Assign the language dependent text to the GUI-elements.
 * The method used is defined in the imported library JSBS_Base. */
      JSBS_GUIServices.processLanguageDependantElements(this);
    }
/*
 * -------------------------------
 * Method that is triggered when a button is clicked.
 * This method overwrites the method in the inherited class (JSBS_StartFrame). */
    public void actionPerformed(ActionEvent e) {
      JS_ProjAssist_CommandCenter__ActionHandler.handleEvent(this, e);
    }

 
    public static void main(String[] args) {
      String locstrLanguageCode = "";
      if (args.length > 0) locstrLanguageCode = args[0];
      try {
        JS_ProjAssist_CommandCenter aJS_ProjAssist_CommandCenter =
                new JS_ProjAssist_CommandCenter(locstrLanguageCode);
      }
      catch(Throwable exc) {
        System.out.println("Exception occured in main() of JS_ProjAssist_CommandCenter");
        exc.printStackTrace(System.out);
      }
    }

}