net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingAccountEntryAttrJPanel.java Source code

Java tutorial

Introduction

Here is the source code for net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingAccountEntryAttrJPanel.java

Source

// Description: Java 7 Swing Attribute JPanel implementation for AccountEntry.

/*
 *   MSS Code Factory Accounting Business Application Model
 *
 *   Copyright (c) 2014 Mark Sobkow
 *   
 *   This program is available as free software under the GNU GPL v3, or
 *   under a commercial license from Mark Sobkow.  For commercial licensing
 *   details, please contact msobkow@sasktel.net.
 *   
 *   Under the terms of the GPL:
 *   
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation, either version 3 of the License, or
 *      (at your option) any later version.
 *     
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *     
 *      You should have received a copy of the GNU General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *      This source code incorporates modified modules originally licensed
 *      under the Apache 2.0 license by MSS Code Factory including CFSecurity
 *      (net-sourceforge-msscodefactory-2.0-cfsecurity.xml),
 *      CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and
 *      CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the
 *      required models being available as part of the MSS Code Factory 1.11
 *      distribution source and install zips.
 *   
 *      You can download installations of MSS Code Factory 1.11 from
 *      http://msscodefactory.sourceforge.net/
 *   
 * ***********************************************************************
 *
 *   Code manufactured by MSS Code Factory
 */

package net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing;

import java.math.*;
import java.sql.*;
import java.text.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*;
import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.*;
import org.apache.commons.codec.binary.Base64;
import net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.*;
import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccObj.*;

/**
 *   CFAccSwingAccountEntryAttrJPanel Swing Attribute JPanel implementation
 *   for AccountEntry.
 */
public class CFAccSwingAccountEntryAttrJPanel extends CFJPanel implements ICFAccSwingAccountEntryJPanelCommon {
    protected ICFAccSwingSchema swingSchema = null;
    boolean swingIsInitializing = true;

    protected class TenantJLabel extends JLabel {
        public TenantJLabel() {
            super();
            setText("Tenant");
        }
    }

    protected class CallbackTenantChosen implements ICFAccSwingTenantChosen {
        public CallbackTenantChosen() {
        }

        public void choseTenant(ICFAccTenantObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceOwnerTenant != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceOwnerTenant.setReferencedObject(value);
                                    editObj.setRequiredOwnerTenant(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewTenantReference extends AbstractAction {
        public ActionViewTenantReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccTenantObj referencedObj = focus.getRequiredOwnerTenant(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("TENT".equals(classCode)) {
                        frame = swingSchema.getTenantFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccTenantObj");
                    }
                }
            }
        }
    }

    protected class ActionPickTenantReference extends AbstractAction {
        public ActionPickTenantReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccTenantObj referencedObj = focus.getRequiredOwnerTenant(swingIsInitializing);
            SortedMap<CFAccTenantPKey, ICFAccTenantObj> mapOfTenant = null;
            CFAccAuthorization auth = schemaObj.getAuthorization();
            long containingClusterId = auth.getSecClusterId();
            mapOfTenant = schemaObj.getTenantTableObj().readTenantByClusterIdx(containingClusterId);
            if (mapOfTenant == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfTenant");
            }
            Collection<ICFAccTenantObj> cltn = mapOfTenant.values();
            JInternalFrame frame = swingSchema.getTenantFactory().newPickerJInternalFrame(referencedObj, null, cltn,
                    new CallbackTenantChosen());
            ((ICFAccSwingTenantJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class TenantCFJReferenceEditor extends CFJReferenceEditor {
        public TenantCFJReferenceEditor() {
            super(new ActionPickTenantReference(), new ActionViewTenantReference());
        }
    }

    protected class AccountJLabel extends JLabel {
        public AccountJLabel() {
            super();
            setText("Account");
        }
    }

    protected class CallbackAccountChosen implements ICFAccSwingAccountChosen {
        public CallbackAccountChosen() {
        }

        public void choseAccount(ICFAccAccountObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceContainerAccount != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceContainerAccount.setReferencedObject(value);
                                    editObj.setRequiredContainerAccount(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewAccountReference extends AbstractAction {
        public ActionViewAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccAccountObj referencedObj = focus.getRequiredContainerAccount(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ACCT".equals(classCode)) {
                        frame = swingSchema.getAccountFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccAccountObj");
                    }
                }
            }
        }
    }

    protected class ActionPickAccountReference extends AbstractAction {
        public ActionPickAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccAccountObj referencedObj = focus.getRequiredContainerAccount(swingIsInitializing);
            SortedMap<CFAccAccountPKey, ICFAccAccountObj> mapOfAccount = null;
            CFAccAuthorization auth = schemaObj.getAuthorization();
            long containingTenantId = auth.getSecTenantId();
            mapOfAccount = schemaObj.getAccountTableObj().readAccountByTenantIdx(containingTenantId);
            if (mapOfAccount == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfAccount");
            }
            Collection<ICFAccAccountObj> cltn = mapOfAccount.values();
            JInternalFrame frame = swingSchema.getAccountFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackAccountChosen());
            ((ICFAccSwingAccountJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class AccountCFJReferenceEditor extends CFJReferenceEditor {
        public AccountCFJReferenceEditor() {
            super(new ActionPickAccountReference(), new ActionViewAccountReference());
        }
    }

    protected class SplitAccountJLabel extends JLabel {
        public SplitAccountJLabel() {
            super();
            setText("Split Account");
        }
    }

    protected class CallbackSplitAccountChosen implements ICFAccSwingAccountEntryChosen {
        public CallbackSplitAccountChosen() {
        }

        public void choseAccountEntry(ICFAccAccountEntryObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupSplit != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupSplit.setReferencedObject(value);
                                    editObj.setOptionalLookupSplit(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewSplitAccountReference extends AbstractAction {
        public ActionViewSplitAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccAccountEntryObj referencedObj = focus.getOptionalLookupSplit(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ACNY".equals(classCode)) {
                        frame = swingSchema.getAccountEntryFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccAccountEntryObj");
                    }
                }
            }
        }
    }

    protected class ActionPickSplitAccountReference extends AbstractAction {
        public ActionPickSplitAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccAccountEntryObj referencedObj = focus.getOptionalLookupSplit(swingIsInitializing);
            SortedMap<CFAccAccountEntryPKey, ICFAccAccountEntryObj> mapOfAccountEntry = null;
            Collection<ICFAccAccountEntryObj> cltn = null;
            JInternalFrame frame = swingSchema.getAccountEntryFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackSplitAccountChosen());
            ((ICFAccSwingAccountEntryJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class SplitAccountCFJReferenceEditor extends CFJReferenceEditor {
        public SplitAccountCFJReferenceEditor() {
            super(new ActionPickSplitAccountReference(), new ActionViewSplitAccountReference());
        }
    }

    protected class DebitCurrencyJLabel extends JLabel {
        public DebitCurrencyJLabel() {
            super();
            setText("Debit Currency");
        }
    }

    protected class CallbackDebitCurrencyChosen implements ICFAccSwingISOCurrencyChosen {
        public CallbackDebitCurrencyChosen() {
        }

        public void choseISOCurrency(ICFAccISOCurrencyObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupDrCcy != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupDrCcy.setReferencedObject(value);
                                    editObj.setOptionalLookupDrCcy(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewDebitCurrencyReference extends AbstractAction {
        public ActionViewDebitCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccISOCurrencyObj referencedObj = focus.getOptionalLookupDrCcy(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ISCY".equals(classCode)) {
                        frame = swingSchema.getISOCurrencyFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccISOCurrencyObj");
                    }
                }
            }
        }
    }

    protected class ActionPickDebitCurrencyReference extends AbstractAction {
        public ActionPickDebitCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccISOCurrencyObj referencedObj = focus.getOptionalLookupDrCcy(swingIsInitializing);
            SortedMap<CFAccISOCurrencyPKey, ICFAccISOCurrencyObj> mapOfISOCurrency = null;
            mapOfISOCurrency = schemaObj.getISOCurrencyTableObj().readAllISOCurrency();
            if (mapOfISOCurrency == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfISOCurrency");
            }
            Collection<ICFAccISOCurrencyObj> cltn = mapOfISOCurrency.values();
            JInternalFrame frame = swingSchema.getISOCurrencyFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackDebitCurrencyChosen());
            ((ICFAccSwingISOCurrencyJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class DebitCurrencyCFJReferenceEditor extends CFJReferenceEditor {
        public DebitCurrencyCFJReferenceEditor() {
            super(new ActionPickDebitCurrencyReference(), new ActionViewDebitCurrencyReference());
        }
    }

    protected class CreditCurrencyJLabel extends JLabel {
        public CreditCurrencyJLabel() {
            super();
            setText("Credit Currency");
        }
    }

    protected class CallbackCreditCurrencyChosen implements ICFAccSwingISOCurrencyChosen {
        public CallbackCreditCurrencyChosen() {
        }

        public void choseISOCurrency(ICFAccISOCurrencyObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupCrCcy != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupCrCcy.setReferencedObject(value);
                                    editObj.setOptionalLookupCrCcy(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewCreditCurrencyReference extends AbstractAction {
        public ActionViewCreditCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccISOCurrencyObj referencedObj = focus.getOptionalLookupCrCcy(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ISCY".equals(classCode)) {
                        frame = swingSchema.getISOCurrencyFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccISOCurrencyObj");
                    }
                }
            }
        }
    }

    protected class ActionPickCreditCurrencyReference extends AbstractAction {
        public ActionPickCreditCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccISOCurrencyObj referencedObj = focus.getOptionalLookupCrCcy(swingIsInitializing);
            SortedMap<CFAccISOCurrencyPKey, ICFAccISOCurrencyObj> mapOfISOCurrency = null;
            mapOfISOCurrency = schemaObj.getISOCurrencyTableObj().readAllISOCurrency();
            if (mapOfISOCurrency == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfISOCurrency");
            }
            Collection<ICFAccISOCurrencyObj> cltn = mapOfISOCurrency.values();
            JInternalFrame frame = swingSchema.getISOCurrencyFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackCreditCurrencyChosen());
            ((ICFAccSwingISOCurrencyJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class CreditCurrencyCFJReferenceEditor extends CFJReferenceEditor {
        public CreditCurrencyCFJReferenceEditor() {
            super(new ActionPickCreditCurrencyReference(), new ActionViewCreditCurrencyReference());
        }
    }

    protected class ConvertedCurrencyJLabel extends JLabel {
        public ConvertedCurrencyJLabel() {
            super();
            setText("Converted Currency");
        }
    }

    protected class CallbackConvertedCurrencyChosen implements ICFAccSwingISOCurrencyChosen {
        public CallbackConvertedCurrencyChosen() {
        }

        public void choseISOCurrency(ICFAccISOCurrencyObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupCvtCcy != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupCvtCcy.setReferencedObject(value);
                                    editObj.setRequiredLookupCvtCcy(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewConvertedCurrencyReference extends AbstractAction {
        public ActionViewConvertedCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccISOCurrencyObj referencedObj = focus.getRequiredLookupCvtCcy(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ISCY".equals(classCode)) {
                        frame = swingSchema.getISOCurrencyFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccISOCurrencyObj");
                    }
                }
            }
        }
    }

    protected class ActionPickConvertedCurrencyReference extends AbstractAction {
        public ActionPickConvertedCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccISOCurrencyObj referencedObj = focus.getRequiredLookupCvtCcy(swingIsInitializing);
            SortedMap<CFAccISOCurrencyPKey, ICFAccISOCurrencyObj> mapOfISOCurrency = null;
            mapOfISOCurrency = schemaObj.getISOCurrencyTableObj().readAllISOCurrency();
            if (mapOfISOCurrency == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfISOCurrency");
            }
            Collection<ICFAccISOCurrencyObj> cltn = mapOfISOCurrency.values();
            JInternalFrame frame = swingSchema.getISOCurrencyFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackConvertedCurrencyChosen());
            ((ICFAccSwingISOCurrencyJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class ConvertedCurrencyCFJReferenceEditor extends CFJReferenceEditor {
        public ConvertedCurrencyCFJReferenceEditor() {
            super(new ActionPickConvertedCurrencyReference(), new ActionViewConvertedCurrencyReference());
        }
    }

    protected class BalanceCurrencyJLabel extends JLabel {
        public BalanceCurrencyJLabel() {
            super();
            setText("Balance Currency");
        }
    }

    protected class CallbackBalanceCurrencyChosen implements ICFAccSwingISOCurrencyChosen {
        public CallbackBalanceCurrencyChosen() {
        }

        public void choseISOCurrency(ICFAccISOCurrencyObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupBalCcy != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupBalCcy.setReferencedObject(value);
                                    editObj.setRequiredLookupBalCcy(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewBalanceCurrencyReference extends AbstractAction {
        public ActionViewBalanceCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccISOCurrencyObj referencedObj = focus.getRequiredLookupBalCcy(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ISCY".equals(classCode)) {
                        frame = swingSchema.getISOCurrencyFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccISOCurrencyObj");
                    }
                }
            }
        }
    }

    protected class ActionPickBalanceCurrencyReference extends AbstractAction {
        public ActionPickBalanceCurrencyReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccISOCurrencyObj referencedObj = focus.getRequiredLookupBalCcy(swingIsInitializing);
            SortedMap<CFAccISOCurrencyPKey, ICFAccISOCurrencyObj> mapOfISOCurrency = null;
            mapOfISOCurrency = schemaObj.getISOCurrencyTableObj().readAllISOCurrency();
            if (mapOfISOCurrency == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfISOCurrency");
            }
            Collection<ICFAccISOCurrencyObj> cltn = mapOfISOCurrency.values();
            JInternalFrame frame = swingSchema.getISOCurrencyFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackBalanceCurrencyChosen());
            ((ICFAccSwingISOCurrencyJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class BalanceCurrencyCFJReferenceEditor extends CFJReferenceEditor {
        public BalanceCurrencyCFJReferenceEditor() {
            super(new ActionPickBalanceCurrencyReference(), new ActionViewBalanceCurrencyReference());
        }
    }

    protected class TransferAccountJLabel extends JLabel {
        public TransferAccountJLabel() {
            super();
            setText("Transfer Account");
        }
    }

    protected class CallbackTransferAccountChosen implements ICFAccSwingAccountChosen {
        public CallbackTransferAccountChosen() {
        }

        public void choseAccount(ICFAccAccountObj value) {
            Component cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                if (!((JInternalFrame) cont).isClosed()) {
                    if (swingReferenceLookupXfrAccount != null) {
                        ICFAccAccountEntryObj cur = getSwingFocusAsAccountEntry();
                        if (cur != null) {
                            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) cur.getEdit();
                            if (null != editObj) {
                                CFJPanel.PanelMode curMode = getPanelMode();
                                if ((curMode == CFJPanel.PanelMode.Add) || (curMode == CFJPanel.PanelMode.Edit)) {
                                    swingReferenceLookupXfrAccount.setReferencedObject(value);
                                    editObj.setOptionalLookupXfrAccount(value);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    protected class ActionViewTransferAccountReference extends AbstractAction {
        public ActionViewTransferAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus != null) {
                ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
                if (editObj != null) {
                    focus = editObj;
                }
                JInternalFrame frame = null;
                Container cont;
                JDesktopPane desktop;
                ICFAccAccountObj referencedObj = focus.getOptionalLookupXfrAccount(swingIsInitializing);
                if (referencedObj != null) {
                    String classCode = referencedObj.getClassCode();
                    if ("ACCT".equals(classCode)) {
                        frame = swingSchema.getAccountFactory().newViewEditJInternalFrame(referencedObj);
                        cont = getParent();
                        while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                            cont = cont.getParent();
                        }
                        if (cont != null) {
                            JInternalFrame myInternalFrame = (JInternalFrame) cont;
                            myInternalFrame.getDesktopPane().add(frame);
                            frame.setVisible(true);
                            frame.show();
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                S_ProcName, "swingFocus", focus, "ICFAccAccountObj");
                    }
                }
            }
        }
    }

    protected class ActionPickTransferAccountReference extends AbstractAction {
        public ActionPickTransferAccountReference() {
            super();
            setEnabled(true);
        }

        public void actionPerformed(ActionEvent e) {
            final String S_ProcName = "actionPerformed";
            Container cont;
            JDesktopPane desktop;
            ICFAccSchemaObj schemaObj = swingSchema.getSchema();
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            ICFAccAccountEntryEditObj editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
            if (editObj != null) {
                focus = editObj;
            }
            ICFAccAccountObj referencedObj = focus.getOptionalLookupXfrAccount(swingIsInitializing);
            SortedMap<CFAccAccountPKey, ICFAccAccountObj> mapOfAccount = null;
            CFAccAuthorization auth = schemaObj.getAuthorization();
            long containingTenantId = auth.getSecTenantId();
            mapOfAccount = schemaObj.getAccountTableObj().readAccountByTenantIdx(containingTenantId);
            if (mapOfAccount == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "mapOfAccount");
            }
            Collection<ICFAccAccountObj> cltn = mapOfAccount.values();
            JInternalFrame frame = swingSchema.getAccountFactory().newPickerJInternalFrame(referencedObj, null,
                    cltn, new CallbackTransferAccountChosen());
            ((ICFAccSwingAccountJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
            cont = getParent();
            while ((cont != null) && (!(cont instanceof JInternalFrame))) {
                cont = cont.getParent();
            }
            if (cont != null) {
                JInternalFrame myInternalFrame = (JInternalFrame) cont;
                myInternalFrame.getDesktopPane().add(frame);
                frame.setVisible(true);
                frame.show();
            }
        }
    }

    protected class TransferAccountCFJReferenceEditor extends CFJReferenceEditor {
        public TransferAccountCFJReferenceEditor() {
            super(new ActionPickTransferAccountReference(), new ActionViewTransferAccountReference());
        }
    }

    protected class EntryIdJLabel extends JLabel {
        public EntryIdJLabel() {
            super();
            setText("EntryId");
        }
    }

    protected class EntryIdJEditor extends CFJUuidEditor {
        public EntryIdJEditor() {
            super();
        }
    }

    protected class EntryStampJLabel extends JLabel {
        public EntryStampJLabel() {
            super();
            setText("EntryStamp");
        }
    }

    protected class EntryStampJEditor extends CFJTimestampEditor {
        public EntryStampJEditor() {
            super();
        }
    }

    protected class DescriptionJLabel extends JLabel {
        public DescriptionJLabel() {
            super();
            setText("Description");
        }
    }

    protected class DescriptionJEditor extends CFJStringEditor {
        public DescriptionJEditor() {
            super();
            setMaxLen(128);
        }
    }

    protected class DebitJLabel extends JLabel {
        public DebitJLabel() {
            super();
            setText("Debit");
        }
    }

    protected class DebitJEditor extends CFJNumberEditor {
        public DebitJEditor() {
            super(32, 5);
        }
    }

    protected class CreditJLabel extends JLabel {
        public CreditJLabel() {
            super();
            setText("Credit");
        }
    }

    protected class CreditJEditor extends CFJNumberEditor {
        public CreditJEditor() {
            super(32, 5);
        }
    }

    protected class ConvertedAmountJLabel extends JLabel {
        public ConvertedAmountJLabel() {
            super();
            setText("ConvertedAmount");
        }
    }

    protected class ConvertedAmountJEditor extends CFJNumberEditor {
        public ConvertedAmountJEditor() {
            super(32, 5);
        }
    }

    protected class BalanceJLabel extends JLabel {
        public BalanceJLabel() {
            super();
            setText("Balance");
        }
    }

    protected class BalanceJEditor extends CFJNumberEditor {
        public BalanceJEditor() {
            super(32, 5);
        }
    }

    protected ICFAccTenantObj swingOwnerTenantObj = null;
    protected TenantJLabel swingLabelOwnerTenant = null;
    protected TenantCFJReferenceEditor swingReferenceOwnerTenant = null;
    protected ICFAccAccountObj swingContainerAccountObj = null;
    protected AccountJLabel swingLabelContainerAccount = null;
    protected AccountCFJReferenceEditor swingReferenceContainerAccount = null;
    protected ICFAccAccountEntryObj swingLookupSplitObj = null;
    protected SplitAccountJLabel swingLabelLookupSplit = null;
    protected SplitAccountCFJReferenceEditor swingReferenceLookupSplit = null;
    protected ICFAccISOCurrencyObj swingLookupDrCcyObj = null;
    protected DebitCurrencyJLabel swingLabelLookupDrCcy = null;
    protected DebitCurrencyCFJReferenceEditor swingReferenceLookupDrCcy = null;
    protected ICFAccISOCurrencyObj swingLookupCrCcyObj = null;
    protected CreditCurrencyJLabel swingLabelLookupCrCcy = null;
    protected CreditCurrencyCFJReferenceEditor swingReferenceLookupCrCcy = null;
    protected ICFAccISOCurrencyObj swingLookupCvtCcyObj = null;
    protected ConvertedCurrencyJLabel swingLabelLookupCvtCcy = null;
    protected ConvertedCurrencyCFJReferenceEditor swingReferenceLookupCvtCcy = null;
    protected ICFAccISOCurrencyObj swingLookupBalCcyObj = null;
    protected BalanceCurrencyJLabel swingLabelLookupBalCcy = null;
    protected BalanceCurrencyCFJReferenceEditor swingReferenceLookupBalCcy = null;
    protected ICFAccAccountObj swingLookupXfrAccountObj = null;
    protected TransferAccountJLabel swingLabelLookupXfrAccount = null;
    protected TransferAccountCFJReferenceEditor swingReferenceLookupXfrAccount = null;
    protected EntryIdJLabel swingLabelEntryId = null;
    protected EntryIdJEditor swingEditorEntryId = null;
    protected EntryStampJLabel swingLabelEntryStamp = null;
    protected EntryStampJEditor swingEditorEntryStamp = null;
    protected DescriptionJLabel swingLabelDescription = null;
    protected DescriptionJEditor swingEditorDescription = null;
    protected DebitJLabel swingLabelDebit = null;
    protected DebitJEditor swingEditorDebit = null;
    protected CreditJLabel swingLabelCredit = null;
    protected CreditJEditor swingEditorCredit = null;
    protected ConvertedAmountJLabel swingLabelConvertedAmount = null;
    protected ConvertedAmountJEditor swingEditorConvertedAmount = null;
    protected BalanceJLabel swingLabelBalance = null;
    protected BalanceJEditor swingEditorBalance = null;

    public CFAccSwingAccountEntryAttrJPanel(ICFAccSwingSchema argSchema, ICFAccAccountEntryObj argFocus) {
        super();
        JLabel label;
        JComponent compo;
        CFJReferenceEditor reference;
        final String S_ProcName = "construct-schema-focus";
        if (argSchema == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                    "argSchema");
        }
        // argFocus is optional; focus may be set later during execution as
        // conditions of the runtime change.
        swingSchema = argSchema;
        setSwingFocusAsAccountEntry(argFocus);
        final int spacing = 5;
        int y = spacing;
        final int height = 25;
        final int textheight = 80;
        final int vspacing = height + spacing;
        final int textvspacing = textheight + spacing;
        final int labelx = spacing;
        final int labelwidth = 200;
        final int fieldx = labelx + labelwidth + spacing;
        final int fieldwidth = 785;
        final int panelwidth = fieldx + fieldwidth + spacing;
        // temporary -- I think you have to have a panel bigger than the coordinates initially
        setSize(panelwidth, 100000);

        label = getSwingLabelOwnerTenant();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceOwnerTenant();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelContainerAccount();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceContainerAccount();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupSplit();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupSplit();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupDrCcy();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupDrCcy();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupCrCcy();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupCrCcy();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupCvtCcy();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupCvtCcy();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupBalCcy();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupBalCcy();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupXfrAccount();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupXfrAccount();
        add(reference);
        reference.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelEntryId();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorEntryId();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelEntryStamp();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorEntryStamp();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelDescription();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorDescription();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelDebit();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorDebit();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelCredit();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorCredit();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelConvertedAmount();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorConvertedAmount();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelBalance();
        add(label);
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorBalance();
        add(compo);
        compo.setBounds(fieldx, y, fieldwidth, height);
        y = y + vspacing;

        // Now we can set the proper size based on the fields and references populated
        setSize(panelwidth, y);
        Dimension pfsz = new Dimension(panelwidth, y);
        setPreferredSize(pfsz);
        Dimension min = new Dimension(400, y);
        setMinimumSize(min);
        populateFields();
        adjustComponentEnableStates();
        swingIsInitializing = false;
    }

    public ICFAccSwingSchema getSwingSchema() {
        return (swingSchema);
    }

    public void setSwingFocus(ICFLibAnyObj2 value) {
        final String S_ProcName = "setSwingFocus";
        if ((value == null) || (value instanceof ICFAccAccountEntryObj)) {
            super.setSwingFocus(value);
        } else {
            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "value",
                    value, "ICFAccAccountEntryObj");
        }
        populateFields();
        adjustComponentEnableStates();
    }

    public ICFAccAccountEntryObj getSwingFocusAsAccountEntry() {
        return ((ICFAccAccountEntryObj) getSwingFocus());
    }

    public void setSwingFocusAsAccountEntry(ICFAccAccountEntryObj value) {
        setSwingFocus(value);
    }

    public ICFAccTenantObj getSwingOwnerTenantObj() {
        return (swingOwnerTenantObj);
    }

    public void setSwingOwnerTenantObj(ICFAccTenantObj value) {
        swingOwnerTenantObj = value;
    }

    public TenantJLabel getSwingLabelOwnerTenant() {
        if (swingLabelOwnerTenant == null) {
            swingLabelOwnerTenant = new TenantJLabel();
        }
        return (swingLabelOwnerTenant);
    }

    public CFJReferenceEditor getSwingReferenceOwnerTenant() {
        if (swingReferenceOwnerTenant == null) {
            swingReferenceOwnerTenant = new TenantCFJReferenceEditor();
        }
        return (swingReferenceOwnerTenant);
    }

    public void setSwingReferenceOwnerTenant(TenantCFJReferenceEditor value) {
        swingReferenceOwnerTenant = value;
    }

    public ICFAccAccountObj getSwingContainerAccountObj() {
        if (swingContainerAccountObj == null) {
        }
        return (swingContainerAccountObj);
    }

    public void setSwingContainerAccountObj(ICFAccAccountObj value) {
        swingContainerAccountObj = value;
    }

    public AccountJLabel getSwingLabelContainerAccount() {
        if (swingLabelContainerAccount == null) {
            swingLabelContainerAccount = new AccountJLabel();
        }
        return (swingLabelContainerAccount);
    }

    public AccountCFJReferenceEditor getSwingReferenceContainerAccount() {
        if (swingReferenceContainerAccount == null) {
            swingReferenceContainerAccount = new AccountCFJReferenceEditor();
        }
        return (swingReferenceContainerAccount);
    }

    public void setSwingReferenceContainerAccount(AccountCFJReferenceEditor value) {
        swingReferenceContainerAccount = value;
    }

    public ICFAccAccountEntryObj getSwingLookupSplitObj() {
        return (swingLookupSplitObj);
    }

    public void setSwingLookupSplitObj(ICFAccAccountEntryObj value) {
        swingLookupSplitObj = value;
    }

    public JLabel getSwingLabelLookupSplit() {
        if (swingLabelLookupSplit == null) {
            swingLabelLookupSplit = new SplitAccountJLabel();
        }
        return (swingLabelLookupSplit);
    }

    public CFJReferenceEditor getSwingReferenceLookupSplit() {
        if (swingReferenceLookupSplit == null) {
            swingReferenceLookupSplit = new SplitAccountCFJReferenceEditor();
        }
        return (swingReferenceLookupSplit);
    }

    public void setSwingReferenceLookupSplit(SplitAccountCFJReferenceEditor value) {
        swingReferenceLookupSplit = value;
    }

    public ICFAccISOCurrencyObj getSwingLookupDrCcyObj() {
        return (swingLookupDrCcyObj);
    }

    public void setSwingLookupDrCcyObj(ICFAccISOCurrencyObj value) {
        swingLookupDrCcyObj = value;
    }

    public JLabel getSwingLabelLookupDrCcy() {
        if (swingLabelLookupDrCcy == null) {
            swingLabelLookupDrCcy = new DebitCurrencyJLabel();
        }
        return (swingLabelLookupDrCcy);
    }

    public CFJReferenceEditor getSwingReferenceLookupDrCcy() {
        if (swingReferenceLookupDrCcy == null) {
            swingReferenceLookupDrCcy = new DebitCurrencyCFJReferenceEditor();
        }
        return (swingReferenceLookupDrCcy);
    }

    public void setSwingReferenceLookupDrCcy(DebitCurrencyCFJReferenceEditor value) {
        swingReferenceLookupDrCcy = value;
    }

    public ICFAccISOCurrencyObj getSwingLookupCrCcyObj() {
        return (swingLookupCrCcyObj);
    }

    public void setSwingLookupCrCcyObj(ICFAccISOCurrencyObj value) {
        swingLookupCrCcyObj = value;
    }

    public JLabel getSwingLabelLookupCrCcy() {
        if (swingLabelLookupCrCcy == null) {
            swingLabelLookupCrCcy = new CreditCurrencyJLabel();
        }
        return (swingLabelLookupCrCcy);
    }

    public CFJReferenceEditor getSwingReferenceLookupCrCcy() {
        if (swingReferenceLookupCrCcy == null) {
            swingReferenceLookupCrCcy = new CreditCurrencyCFJReferenceEditor();
        }
        return (swingReferenceLookupCrCcy);
    }

    public void setSwingReferenceLookupCrCcy(CreditCurrencyCFJReferenceEditor value) {
        swingReferenceLookupCrCcy = value;
    }

    public ICFAccISOCurrencyObj getSwingLookupCvtCcyObj() {
        return (swingLookupCvtCcyObj);
    }

    public void setSwingLookupCvtCcyObj(ICFAccISOCurrencyObj value) {
        swingLookupCvtCcyObj = value;
    }

    public JLabel getSwingLabelLookupCvtCcy() {
        if (swingLabelLookupCvtCcy == null) {
            swingLabelLookupCvtCcy = new ConvertedCurrencyJLabel();
        }
        return (swingLabelLookupCvtCcy);
    }

    public CFJReferenceEditor getSwingReferenceLookupCvtCcy() {
        if (swingReferenceLookupCvtCcy == null) {
            swingReferenceLookupCvtCcy = new ConvertedCurrencyCFJReferenceEditor();
        }
        return (swingReferenceLookupCvtCcy);
    }

    public void setSwingReferenceLookupCvtCcy(ConvertedCurrencyCFJReferenceEditor value) {
        swingReferenceLookupCvtCcy = value;
    }

    public ICFAccISOCurrencyObj getSwingLookupBalCcyObj() {
        return (swingLookupBalCcyObj);
    }

    public void setSwingLookupBalCcyObj(ICFAccISOCurrencyObj value) {
        swingLookupBalCcyObj = value;
    }

    public JLabel getSwingLabelLookupBalCcy() {
        if (swingLabelLookupBalCcy == null) {
            swingLabelLookupBalCcy = new BalanceCurrencyJLabel();
        }
        return (swingLabelLookupBalCcy);
    }

    public CFJReferenceEditor getSwingReferenceLookupBalCcy() {
        if (swingReferenceLookupBalCcy == null) {
            swingReferenceLookupBalCcy = new BalanceCurrencyCFJReferenceEditor();
        }
        return (swingReferenceLookupBalCcy);
    }

    public void setSwingReferenceLookupBalCcy(BalanceCurrencyCFJReferenceEditor value) {
        swingReferenceLookupBalCcy = value;
    }

    public ICFAccAccountObj getSwingLookupXfrAccountObj() {
        return (swingLookupXfrAccountObj);
    }

    public void setSwingLookupXfrAccountObj(ICFAccAccountObj value) {
        swingLookupXfrAccountObj = value;
    }

    public JLabel getSwingLabelLookupXfrAccount() {
        if (swingLabelLookupXfrAccount == null) {
            swingLabelLookupXfrAccount = new TransferAccountJLabel();
        }
        return (swingLabelLookupXfrAccount);
    }

    public CFJReferenceEditor getSwingReferenceLookupXfrAccount() {
        if (swingReferenceLookupXfrAccount == null) {
            swingReferenceLookupXfrAccount = new TransferAccountCFJReferenceEditor();
        }
        return (swingReferenceLookupXfrAccount);
    }

    public void setSwingReferenceLookupXfrAccount(TransferAccountCFJReferenceEditor value) {
        swingReferenceLookupXfrAccount = value;
    }

    public EntryIdJLabel getSwingLabelEntryId() {
        if (swingLabelEntryId == null) {
            swingLabelEntryId = new EntryIdJLabel();
        }
        return (swingLabelEntryId);
    }

    public void setSwingLabelEntryId(EntryIdJLabel value) {
        swingLabelEntryId = value;
    }

    public EntryIdJEditor getSwingEditorEntryId() {
        if (swingEditorEntryId == null) {
            swingEditorEntryId = new EntryIdJEditor();
        }
        return (swingEditorEntryId);
    }

    public void setSwingEditorEntryId(EntryIdJEditor value) {
        swingEditorEntryId = value;
    }

    public EntryStampJLabel getSwingLabelEntryStamp() {
        if (swingLabelEntryStamp == null) {
            swingLabelEntryStamp = new EntryStampJLabel();
        }
        return (swingLabelEntryStamp);
    }

    public void setSwingLabelEntryStamp(EntryStampJLabel value) {
        swingLabelEntryStamp = value;
    }

    public EntryStampJEditor getSwingEditorEntryStamp() {
        if (swingEditorEntryStamp == null) {
            swingEditorEntryStamp = new EntryStampJEditor();
        }
        return (swingEditorEntryStamp);
    }

    public void setSwingEditorEntryStamp(EntryStampJEditor value) {
        swingEditorEntryStamp = value;
    }

    public DescriptionJLabel getSwingLabelDescription() {
        if (swingLabelDescription == null) {
            swingLabelDescription = new DescriptionJLabel();
        }
        return (swingLabelDescription);
    }

    public void setSwingLabelDescription(DescriptionJLabel value) {
        swingLabelDescription = value;
    }

    public DescriptionJEditor getSwingEditorDescription() {
        if (swingEditorDescription == null) {
            swingEditorDescription = new DescriptionJEditor();
        }
        return (swingEditorDescription);
    }

    public void setSwingEditorDescription(DescriptionJEditor value) {
        swingEditorDescription = value;
    }

    public DebitJLabel getSwingLabelDebit() {
        if (swingLabelDebit == null) {
            swingLabelDebit = new DebitJLabel();
        }
        return (swingLabelDebit);
    }

    public void setSwingLabelDebit(DebitJLabel value) {
        swingLabelDebit = value;
    }

    public DebitJEditor getSwingEditorDebit() {
        if (swingEditorDebit == null) {
            swingEditorDebit = new DebitJEditor();
        }
        return (swingEditorDebit);
    }

    public void setSwingEditorDebit(DebitJEditor value) {
        swingEditorDebit = value;
    }

    public CreditJLabel getSwingLabelCredit() {
        if (swingLabelCredit == null) {
            swingLabelCredit = new CreditJLabel();
        }
        return (swingLabelCredit);
    }

    public void setSwingLabelCredit(CreditJLabel value) {
        swingLabelCredit = value;
    }

    public CreditJEditor getSwingEditorCredit() {
        if (swingEditorCredit == null) {
            swingEditorCredit = new CreditJEditor();
        }
        return (swingEditorCredit);
    }

    public void setSwingEditorCredit(CreditJEditor value) {
        swingEditorCredit = value;
    }

    public ConvertedAmountJLabel getSwingLabelConvertedAmount() {
        if (swingLabelConvertedAmount == null) {
            swingLabelConvertedAmount = new ConvertedAmountJLabel();
        }
        return (swingLabelConvertedAmount);
    }

    public void setSwingLabelConvertedAmount(ConvertedAmountJLabel value) {
        swingLabelConvertedAmount = value;
    }

    public ConvertedAmountJEditor getSwingEditorConvertedAmount() {
        if (swingEditorConvertedAmount == null) {
            swingEditorConvertedAmount = new ConvertedAmountJEditor();
        }
        return (swingEditorConvertedAmount);
    }

    public void setSwingEditorConvertedAmount(ConvertedAmountJEditor value) {
        swingEditorConvertedAmount = value;
    }

    public BalanceJLabel getSwingLabelBalance() {
        if (swingLabelBalance == null) {
            swingLabelBalance = new BalanceJLabel();
        }
        return (swingLabelBalance);
    }

    public void setSwingLabelBalance(BalanceJLabel value) {
        swingLabelBalance = value;
    }

    public BalanceJEditor getSwingEditorBalance() {
        if (swingEditorBalance == null) {
            swingEditorBalance = new BalanceJEditor();
        }
        return (swingEditorBalance);
    }

    public void setSwingEditorBalance(BalanceJEditor value) {
        swingEditorBalance = value;
    }

    public void doLayout() {
        JLabel label;
        JComponent compo;
        CFJReferenceEditor reference;
        Dimension dim;
        final int spacing = 5;
        int y = spacing;
        final int height = 25;
        final int textheight = 80;
        final int vspacing = height + spacing;
        final int textvspacing = textheight + spacing;
        final int labelx = spacing;
        final int labelwidth = 200;
        final int fieldx = labelx + labelwidth + spacing;
        final int fieldwidth = 1024;
        Dimension jpsz = getSize();
        int usefieldwidth = jpsz.width - 215;

        label = getSwingLabelOwnerTenant();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceOwnerTenant();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelContainerAccount();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceContainerAccount();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupSplit();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupSplit();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupDrCcy();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupDrCcy();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupCrCcy();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupCrCcy();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupCvtCcy();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupCvtCcy();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupBalCcy();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupBalCcy();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelLookupXfrAccount();
        label.setBounds(labelx, y, labelwidth, height);
        reference = getSwingReferenceLookupXfrAccount();
        reference.setBounds(fieldx, y, usefieldwidth, height);
        y = y + vspacing;

        label = getSwingLabelEntryId();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorEntryId();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelEntryStamp();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorEntryStamp();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelDescription();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorDescription();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelDebit();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorDebit();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelCredit();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorCredit();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelConvertedAmount();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorConvertedAmount();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

        label = getSwingLabelBalance();
        label.setBounds(labelx, y, labelwidth, height);
        compo = getSwingEditorBalance();
        dim = compo.getMaximumSize();
        if (dim.width < usefieldwidth) {
            compo.setBounds(fieldx, y, dim.width, height);
        } else {
            compo.setBounds(fieldx, y, fieldwidth, height);
        }
        y = y + vspacing;

    }

    public void populateFields() {
        ICFAccAccountEntryObj popObj;
        ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
        if (focus != null) {
            popObj = (ICFAccAccountEntryObj) (focus.getEdit());
            if (popObj == null) {
                popObj = focus;
            }
        } else {
            popObj = null;
        }
        if (getPanelMode() == CFJPanel.PanelMode.Unknown) {
            popObj = null;
        }
        if (popObj == null) {
            swingOwnerTenantObj = null;
        } else {
            swingOwnerTenantObj = popObj.getRequiredOwnerTenant(swingIsInitializing);
        }
        if (swingReferenceOwnerTenant != null) {
            swingReferenceOwnerTenant.setReferencedObject(swingOwnerTenantObj);
        }

        if (popObj == null) {
            swingContainerAccountObj = null;
        } else {
            swingContainerAccountObj = popObj.getRequiredContainerAccount(swingIsInitializing);
        }
        if (swingReferenceContainerAccount != null) {
            swingReferenceContainerAccount.setReferencedObject(swingContainerAccountObj);
        }

        if (popObj == null) {
            swingLookupSplitObj = null;
        } else {
            swingLookupSplitObj = popObj.getOptionalLookupSplit(swingIsInitializing);
        }
        if (swingReferenceLookupSplit != null) {
            swingReferenceLookupSplit.setReferencedObject(swingLookupSplitObj);
        }

        if (popObj == null) {
            swingLookupDrCcyObj = null;
        } else {
            swingLookupDrCcyObj = popObj.getOptionalLookupDrCcy(swingIsInitializing);
        }
        if (swingReferenceLookupDrCcy != null) {
            swingReferenceLookupDrCcy.setReferencedObject(swingLookupDrCcyObj);
        }

        if (popObj == null) {
            swingLookupCrCcyObj = null;
        } else {
            swingLookupCrCcyObj = popObj.getOptionalLookupCrCcy(swingIsInitializing);
        }
        if (swingReferenceLookupCrCcy != null) {
            swingReferenceLookupCrCcy.setReferencedObject(swingLookupCrCcyObj);
        }

        if (popObj == null) {
            swingLookupCvtCcyObj = null;
        } else {
            swingLookupCvtCcyObj = popObj.getRequiredLookupCvtCcy(swingIsInitializing);
        }
        if (swingReferenceLookupCvtCcy != null) {
            swingReferenceLookupCvtCcy.setReferencedObject(swingLookupCvtCcyObj);
        }

        if (popObj == null) {
            swingLookupBalCcyObj = null;
        } else {
            swingLookupBalCcyObj = popObj.getRequiredLookupBalCcy(swingIsInitializing);
        }
        if (swingReferenceLookupBalCcy != null) {
            swingReferenceLookupBalCcy.setReferencedObject(swingLookupBalCcyObj);
        }

        if (popObj == null) {
            swingLookupXfrAccountObj = null;
        } else {
            swingLookupXfrAccountObj = popObj.getOptionalLookupXfrAccount(swingIsInitializing);
        }
        if (swingReferenceLookupXfrAccount != null) {
            swingReferenceLookupXfrAccount.setReferencedObject(swingLookupXfrAccountObj);
        }

        if (popObj == null) {
            getSwingEditorEntryId().setUuidValue(null);
        } else {
            getSwingEditorEntryId().setUuidValue(popObj.getRequiredEntryId());
        }

        if (popObj == null) {
            getSwingEditorEntryStamp().setTimestampValue(null);
        } else {
            getSwingEditorEntryStamp().setTimestampValue(popObj.getRequiredEntryStamp());
        }

        if (popObj == null) {
            getSwingEditorDescription().setStringValue(null);
        } else {
            getSwingEditorDescription().setStringValue(popObj.getRequiredDescription());
        }

        if (popObj == null) {
            getSwingEditorDebit().setNumberValue(null);
        } else {
            getSwingEditorDebit().setNumberValue(popObj.getOptionalDebit());
        }

        if (popObj == null) {
            getSwingEditorCredit().setNumberValue(null);
        } else {
            getSwingEditorCredit().setNumberValue(popObj.getOptionalCredit());
        }

        if (popObj == null) {
            getSwingEditorConvertedAmount().setNumberValue(null);
        } else {
            getSwingEditorConvertedAmount().setNumberValue(popObj.getRequiredConvertedAmount());
        }

        if (popObj == null) {
            getSwingEditorBalance().setNumberValue(null);
        } else {
            getSwingEditorBalance().setNumberValue(popObj.getRequiredBalance());
        }
    }

    public void postFields() {
        final String S_ProcName = "postFields";
        ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
        ICFAccAccountEntryEditObj editObj;
        if (focus != null) {
            editObj = (ICFAccAccountEntryEditObj) (focus.getEdit());
        } else {
            editObj = null;
        }
        if (editObj == null) {
            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                    "Panel is unfocused or is not editing the focus object");
        }
        // You are not allowed to edit the Container or Owner references, so they're not retrieved

        swingLookupSplitObj = (ICFAccAccountEntryObj) (swingReferenceLookupSplit.getReferencedObject());
        editObj.setOptionalLookupSplit(swingLookupSplitObj);

        swingLookupDrCcyObj = (ICFAccISOCurrencyObj) (swingReferenceLookupDrCcy.getReferencedObject());
        editObj.setOptionalLookupDrCcy(swingLookupDrCcyObj);

        swingLookupCrCcyObj = (ICFAccISOCurrencyObj) (swingReferenceLookupCrCcy.getReferencedObject());
        editObj.setOptionalLookupCrCcy(swingLookupCrCcyObj);

        swingLookupCvtCcyObj = (ICFAccISOCurrencyObj) (swingReferenceLookupCvtCcy.getReferencedObject());
        editObj.setRequiredLookupCvtCcy(swingLookupCvtCcyObj);

        swingLookupBalCcyObj = (ICFAccISOCurrencyObj) (swingReferenceLookupBalCcy.getReferencedObject());
        editObj.setRequiredLookupBalCcy(swingLookupBalCcyObj);

        swingLookupXfrAccountObj = (ICFAccAccountObj) (swingReferenceLookupXfrAccount.getReferencedObject());
        editObj.setOptionalLookupXfrAccount(swingLookupXfrAccountObj);

        editObj.setRequiredEntryStamp(getSwingEditorEntryStamp().getTimestampValue());

        editObj.setRequiredDescription(getSwingEditorDescription().getStringValue());

        editObj.setOptionalDebit(getSwingEditorDebit().getNumberValue());

        editObj.setOptionalCredit(getSwingEditorCredit().getNumberValue());

        editObj.setRequiredConvertedAmount(getSwingEditorConvertedAmount().getNumberValue());

        editObj.setRequiredBalance(getSwingEditorBalance().getNumberValue());
    }

    public void setPanelMode(CFJPanel.PanelMode value) {
        final String S_ProcName = "setPanelMode";
        CFJPanel.PanelMode oldValue = getPanelMode();
        if (oldValue == value) {
            return;
        }
        ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
        if ((value != CFJPanel.PanelMode.Unknown) && (value != CFJPanel.PanelMode.View)) {
            if (focus == null) {
                throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                        "swingFocus");
            }
        }
        ICFAccAccountEntryEditObj editObj;
        if (focus != null) {
            editObj = (ICFAccAccountEntryEditObj) focus.getEdit();
        } else {
            editObj = null;
        }
        switch (value) {
        case Unknown:
            switch (oldValue) {
            case Unknown:
                break;
            default:
                if (editObj != null) {
                    editObj.endEdit();
                }
                break;
            }
            break;
        case Add:
            switch (oldValue) {
            case Unknown:
            case Add:
            case View:
                if (editObj == null) {
                    if (focus != null) {
                        if (!focus.getIsNew()) {
                            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                    "Transitioning to PanelMode Add requires Focus.getIsNew() to be true");
                        }
                        editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                        if (editObj == null) {
                            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                    "Expected beginEdit() to return a new edition of the focus object");
                        }
                    } else {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                                "focus");
                    }
                }
                break;
            case Edit:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode Edit to Add");
            case Update:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode Update to Add");
            case Delete:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode Delete to Add");
            default:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode default to Add");
            }
            break;
        case View:
            switch (oldValue) {
            case Unknown:
                break;
            case View:
                break;
            case Edit:
                break;
            case Update:
                break;
            case Delete:
                break;
            default:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode " + oldValue + " to View");
            }
            if (editObj != null) {
                editObj.endEdit();
            }
            break;
        case Edit:
            switch (oldValue) {
            case Unknown:
                if (editObj == null) {
                    editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                    if (editObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                "Expected beginEdit() to return a new edition of the focus object");
                    }
                }
                break;
            case View:
                if (editObj == null) {
                    editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                    if (editObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                "Expected beginEdit() to return a new edition of the focus object");
                    }
                }
                break;
            case Edit:
                if (editObj == null) {
                    editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                    if (editObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                "Expected beginEdit() to return a new edition of the focus object");
                    }
                }
                break;
            default:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode " + oldValue + " to Edit");
            }
            break;
        case Update:
            if ((oldValue != CFJPanel.PanelMode.Edit) && (oldValue != CFJPanel.PanelMode.Add)) {
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition from mode " + oldValue + " to Update");
            }
            super.setPanelMode(value);
            if (editObj != null) {
                postFields();
                if (editObj.getIsNew()) {
                    focus = (ICFAccAccountEntryObj) editObj.create();
                    setSwingFocus(focus);
                } else {
                    editObj.update();
                }
                editObj.endEdit();
                editObj = null;
            }
            setPanelMode(CFJPanel.PanelMode.View);
            break;
        case Delete:
            switch (oldValue) {
            case View:
                if (focus != null) {
                    if (editObj == null) {
                        editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                        if (editObj == null) {
                            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                    "Expected beginEdit() to return a new edition of the focus object");
                        }
                    }
                }
                break;
            case Edit:
                if (focus != null) {
                    if (editObj == null) {
                        editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                        if (editObj == null) {
                            throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                    "Expected beginEdit() to return a new edition of the focus object");
                        }
                    }
                }
                break;
            case Update:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode Update to Delete");
            case Delete:
                if (editObj == null) {
                    editObj = (ICFAccAccountEntryEditObj) focus.beginEdit();
                    if (editObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                                "Expected beginEdit() to return a new edition of the focus object");
                    }
                }
                break;
            default:
                throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                        "Cannot transition PanelMode " + oldValue + " to Delete");
            }
            editObj.delete();
            editObj.endEdit();
            setSwingFocus(null);
            setPanelMode(CFJPanel.PanelMode.Unknown);
            break;
        default:
            switch (oldValue) {
            case Unknown:
                break;
            default:
                if (editObj != null) {
                    editObj.endEdit();
                }
                break;
            }
            break;
        }
        super.setPanelMode(value);
        populateFields();
        adjustComponentEnableStates();
    }

    public void adjustComponentEnableStates() {
        CFJPanel.PanelMode mode = getPanelMode();
        boolean isEditing;
        switch (mode) {
        case Unknown:
        case View:
        case Delete:
            isEditing = false;
            break;
        case Add:
        case Edit:
        case Update:
            isEditing = true;
            break;
        default:
            isEditing = false;
            break;
        }
        if (isEditing) {
            ICFAccAccountEntryObj focus = getSwingFocusAsAccountEntry();
            if (focus == null) {
                isEditing = false;
            } else if (null == focus.getEdit()) {
                isEditing = false;
            }
        }
        if (swingReferenceOwnerTenant != null) {
            swingReferenceOwnerTenant.setEnabled(false);
        }
        if (swingReferenceContainerAccount != null) {
            swingReferenceContainerAccount.setEnabled(false);
        }
        if (swingReferenceLookupSplit != null) {
            swingReferenceLookupSplit.setEnabled(isEditing);
        }
        if (swingReferenceLookupDrCcy != null) {
            swingReferenceLookupDrCcy.setEnabled(isEditing);
        }
        if (swingReferenceLookupCrCcy != null) {
            swingReferenceLookupCrCcy.setEnabled(isEditing);
        }
        if (swingReferenceLookupCvtCcy != null) {
            swingReferenceLookupCvtCcy.setEnabled(isEditing);
        }
        if (swingReferenceLookupBalCcy != null) {
            swingReferenceLookupBalCcy.setEnabled(isEditing);
        }
        if (swingReferenceLookupXfrAccount != null) {
            swingReferenceLookupXfrAccount.setEnabled(isEditing);
        }
        if (swingEditorEntryId != null) {
            swingEditorEntryId.setEnabled(false);
        }
        if (swingEditorEntryStamp != null) {
            swingEditorEntryStamp.setEnabled(isEditing);
        }
        if (swingEditorDescription != null) {
            swingEditorDescription.setEnabled(isEditing);
        }
        if (swingEditorDebit != null) {
            swingEditorDebit.setEnabled(isEditing);
        }
        if (swingEditorCredit != null) {
            swingEditorCredit.setEnabled(isEditing);
        }
        if (swingEditorConvertedAmount != null) {
            swingEditorConvertedAmount.setEnabled(isEditing);
        }
        if (swingEditorBalance != null) {
            swingEditorBalance.setEnabled(isEditing);
        }
    }
}