|
Last
revision of this document: |
This
is document contains the code for Class JSBS_FrameServices.
For
easy 'cut and paste' ;-).
package
js_base.frame;
import
java.awt.*;
import
javax.swing.*;
/**
*
* @author kurt@javascout.biz
*
@date 2006-05-03
*
* @description
* Class
with static methods providing utilities around the
classes
* JSBS_StartFrame and
JSBS_DetailFrame.
*
* @change-log
*
when who why
*
--------------------------------------------------------
*
*/
public
class JSBS_FrameServices
{
/*
*
Method to recursively search the structure */
private
static int
processLanguageDependantElements(
String
parmFrameClassName,
JSBS_StartFrame
parmfrmJSBS_StartFrame,
Container
parmContainer) {
/* Return-Code
to pass the status, that was reported by called methods, back
*/
int
intStatusCode = 0;
int
locintStatusCode = 0;
/*
* Check
what type is the 'Container' of and call the suitable method
*/
if
(parmContainer instanceof
JLabel) {
JLabel
locJLabel = (JLabel) parmContainer;
locintStatusCode
=
parmfrmJSBS_StartFrame.structJSBS_XML_DisplayStrings.processJLabel(locJLabel,
parmstrFrameClassName);
if
(locintStatusCode > 0) intStatusCode =
locintStatusCode;
return
intStatusCode;
}
/* */
if
(parmContainer instanceof
JButton) {
JButton
locJButton
= (JButton)
parmContainer;
locintStatusCode
=
parmfrmJSBS_StartFrame.structJSBS_XML_DisplayStrings.processJButton(locJButton,
parmstrFrameClassName);
if
(locintStatusCode > 0) intStatusCode =
locintStatusCode;
return
intStatusCode;
}
/* */
if
(parmContainer instanceof
JTextField) {
/* implement
call to appropriate method later */
return
intStatusCode;
}
/*
* Get
child-elements and call this method recursively */
Component
comps[] = parmContainer.getComponents();
for
(int
i = 0; i < comps.length; i++)
{
Component comp =
comps[i];
if
(comp instanceof
Container) {
int
locintStatusCode =
processLanguageDependantElements(parmFrameClassName,
parmfrmJSBS_StartFrame,
(Container)
comp);
/*
* Check
if another Code than 0 (OK) was returned and keep it in that case
*/
if
(locintStatusCode
> 0) intStatusCode
= locintStatusCode
;
}
}
/*
* Return
the Status to the caller */
return
intStatusCode;
}
/*
*
Wrapper-method to be called from classes derived from JSBS_StartFrame
*/
public
static int processLanguageDependantElements(JSBS_StartFrame
parmfrmJSBS_StartFrame) {
/* Return-Code
to pass the status, that was reported by called methods, back
*/
int
intStatusCode = 0;
/* local
StatusCode for comparisons */
int
locintStatusCode = 0;
/*
* Call
the method that sets the text into the TitleBar of the frame
*/
locintStatusCode
=
parmfrmJSBS_StartFrame.structJSBS_XML_DisplayStrings.processJFrame(parmfrmJSBS_StartFrame);
/* Check
if another Code than 0 (OK) was returned and keep it in that case
*/
if
(locintStatusCode
> 0) intStatusCode
= locintStatusCode
;
/*
* Get
the 'ClassName' of the passed parameter - it is used in the next
method-call */
String
locstrClassName =
parmfrmJSBS_StartFrame.getClass().getName().trim();
/*
* Get
the 'ContentPane' and call the method that inspects it recursive
*/
Container
locContainer = parmfrmJSBS_StartFrame.getContentPane();
locintStatusCode
=
processLanguageDependantElements(
locstrClassName,
parmfrmJSBS_StartFrame,
locContainer);
/* Check
if another Code than 0 (OK) was returned and keep it in that case
*/
if
(locintStatusCode
> 0) intStatusCode
= locintStatusCode
;
/*
* Return
the Status to the caller */
return
intStatusCode;
}
/*
*
Wrapper-method to be called from classes derived from JSBS_TaskFrame
*/
public
static int processLanguageDependantElements(JSBS_TaskFrame
parmfrmJSBS_TaskFrame) {
/* Return-Code
to pass the status, that was reported by called methods, back
*/
int
intStatusCode
= 0;
/* local
StatusCode for comparisons */
int
locintStatusCode = 0;
/* Derive
the StartFrame. */
JSBS_StartFrame
frmJSBS_StartFrame = parmfrmJSBS_TaskFrame.frmCC;
/*
* Call
the method that sets the text into the TitleBar of the frame
*/
locintStatusCode
=
frmJSBS_StartFrame.structJSBS_XML_DisplayStrings.processJFrame(parmfrmJSBS_TaskFrame);
/* Check
if another Code than 0 (OK) was returned and keep it in that case
*/
if
(locintStatusCode
> 0) intStatusCode
= locintStatusCode
;
/*
* Get
the 'ClassName' of the passed parameter - it is used in the next
method-call */
String
locstrClassName =
parmfrmJSBS_TaskFrame.getClass().getName().trim();
/*
* Get
the 'ContentPane' and call the method that inspects it recursive
*/
Container
locContainer = parmfrmJSBS_TaskFrame.getContentPane();
locintStatusCode
=
processLanguageDependantElements(
locstrClassName,
frmJSBS_StartFrame,
locContainer);
/* Check
if another Code than 0 (OK) was returned and keep it in that case
*/
if
(locintStatusCode
> 0) intStatusCode
= locintStatusCode
;
/*
* Return
the Status to the caller */
return
intStatusCode;
}
}