text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package erp.mbps.form;

import cfd.DCfdConsts;
import erp.client.SClientInterface;
import erp.data.SDataConstants;
import erp.data.SDataConstantsSys;
import erp.data.SDataUtilities;
import erp.data.SProcConstants;
import erp.lib.SLibConstants;
import erp.lib.SLibTimeUtilities;
import erp.lib.SLibUtilities;
import erp.lib.data.SDataRegistry;
import erp.lib.form.SFormComponentItem;
import erp.lib.form.SFormField;
import erp.lib.form.SFormUtilities;
import erp.lib.form.SFormValidation;
import erp.mbps.data.SDataBizPartner;
import erp.mbps.data.SDataBizPartnerBranch;
import erp.mbps.data.SDataBizPartnerBranchAddress;
import erp.mbps.data.SDataBizPartnerBranchContact;
import erp.mbps.data.SDataBizPartnerCategory;
import erp.mfin.data.SFinUtilities;
import erp.mod.SModSysConsts;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.util.Vector;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import sa.lib.SLibMethod;
import sa.lib.SLibUtils;

/**
 *
 * @author Juan Barajas, Sergio Flores
 */
public class SFormBizPartnerSimple extends javax.swing.JDialog implements erp.lib.form.SFormExtendedInterface, java.awt.event.ActionListener {

    private int mnFormType;
    private int mnFormResult;
    private int mnFormStatus;
    private boolean mbFirstTime;
    private boolean mbResetingForm;
    private java.util.Vector<erp.lib.form.SFormField> mvFields;
    private erp.client.SClientInterface miClient;

    private erp.mbps.data.SDataBizPartner moBizPartner;
    private erp.mbps.data.SDataBizPartnerCategory moBizPartnerCategory;
    private erp.mbps.data.SDataBizPartnerBranch moBizPartnerBranch;
    private erp.mbps.data.SDataBizPartnerBranchAddress moBizPartnerBranchAddress;
    private erp.mbps.data.SDataBizPartnerBranchContact moBizPartnerBranchContact;
    private erp.lib.form.SFormField moFieldFkBizPartnerIdentityTypeId;
    private erp.lib.form.SFormField moFieldLastName;
    private erp.lib.form.SFormField moFieldFirstName;
    private erp.lib.form.SFormField moFieldBizPartner;
    private erp.lib.form.SFormField moFieldBizPartnerCommercial;
    private erp.lib.form.SFormField moFieldFiscalId;
    private erp.lib.form.SFormField moFieldAlternativeId;
    private erp.lib.form.SFormField moFieldIsDeleted;
    private erp.lib.form.SFormField moFieldIsAttRelatedParty;
    private erp.lib.form.SFormField moFieldIsAttBank;
    private erp.lib.form.SFormField moFieldIsAttCarrier;
    private erp.lib.form.SFormField moFieldIsAttSalesAgent;
    private erp.lib.form.SFormField moFieldIsAttEmployee;
    private erp.lib.form.SFormField moFieldIsAttPartnerShareholder;
    private erp.lib.form.SFormField moFieldIsCategoryDeleted;
    private erp.lib.form.SFormField moFieldFkBizPartnerCategoryId;
    private erp.lib.form.SFormField moFieldFkBizPartnerTypeId;
    private erp.lib.form.SFormField moFieldKey;
    private erp.lib.form.SFormField moFieldEmail;
    private erp.lib.form.SFormField moFieldCaptureAddress;

    private int mnParamBizPartnerType;
    private int mnParamBizPartnerCategory;

    private erp.mbps.data.SDataBizPartnerCategory[] maoDbmsCategorySettings;

    private erp.mbps.form.SPanelBizPartnerBranchAddress moPanelBizPartnerBranchAddress;

    private ImageIcon moIconHasCategorySup;
    private ImageIcon moIconHasCategoryCus;
    private ImageIcon moIconHasCategoryCdr;
    private ImageIcon moIconHasCategoryDbr;
    private ImageIcon moIconHasNotCategory;

    private int mnFormTypeExport;
    private boolean mbIsNeededPosSave;

    /** Creates new form SFormBizPartnerSimple */
    public SFormBizPartnerSimple(erp.client.SClientInterface client) {
        super(client.getFrame(), true);
        miClient = client;

        initComponents();
        initComponentsExtra();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jlFkBizPartnerIdentityTypeId = new javax.swing.JLabel();
        jcbFkBizPartnerIdentityTypeId = new javax.swing.JComboBox<SFormComponentItem>();
        jLabel2 = new javax.swing.JLabel();
        jckIsDeleted = new javax.swing.JCheckBox();
        jPanel25 = new javax.swing.JPanel();
        jlLastName = new javax.swing.JLabel();
        jtfLastName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jckIsAttRelatedParty = new javax.swing.JCheckBox();
        jPanel22 = new javax.swing.JPanel();
        jlFirstName = new javax.swing.JLabel();
        jtfFirstName = new javax.swing.JTextField();
        jPanel26 = new javax.swing.JPanel();
        jlBizPartner = new javax.swing.JLabel();
        jtfBizPartner = new javax.swing.JTextField();
        jPanel27 = new javax.swing.JPanel();
        jlBizPartnerCommercial = new javax.swing.JLabel();
        jtfBizPartnerCommercial = new javax.swing.JTextField();
        jbRecreateBizPartnerCommercial = new javax.swing.JButton();
        jPanel29 = new javax.swing.JPanel();
        jlFiscalId = new javax.swing.JLabel();
        jtfFiscalId = new javax.swing.JTextField();
        jlAlternativeId = new javax.swing.JLabel();
        jftAlternativeId = new javax.swing.JFormattedTextField();
        jPanel9 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jlIconCustomer = new javax.swing.JLabel();
        jlDummy3 = new javax.swing.JLabel();
        jlIconSupplier = new javax.swing.JLabel();
        jlDummy4 = new javax.swing.JLabel();
        jlIconDebtor = new javax.swing.JLabel();
        jlDummy5 = new javax.swing.JLabel();
        jlIconCreditor = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jbCustomer = new javax.swing.JButton();
        jbSupplier = new javax.swing.JButton();
        jbDebtor = new javax.swing.JButton();
        jbCreditor = new javax.swing.JButton();
        jPanel12 = new javax.swing.JPanel();
        jckIsAttBank = new javax.swing.JCheckBox();
        jckIsAttCarrier = new javax.swing.JCheckBox();
        jckIsAttSalesAgent = new javax.swing.JCheckBox();
        jPanel14 = new javax.swing.JPanel();
        jckIsAttEmployee = new javax.swing.JCheckBox();
        jckIsAttPartnerShareholder = new javax.swing.JCheckBox();
        jPanel28 = new javax.swing.JPanel();
        jckIsCategoryDeleted = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jpBranchAddress = new javax.swing.JPanel();
        jpOficialAddress = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        jckCaptureAddress = new javax.swing.JCheckBox();
        jPanel17 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jlFkBizPartnerTypeId = new javax.swing.JLabel();
        jcbFkBizPartnerTypeId = new javax.swing.JComboBox<SFormComponentItem>();
        jPanel8 = new javax.swing.JPanel();
        jlFkBizPartnerCategoryId = new javax.swing.JLabel();
        jcbFkBizPartnerCategoryId = new javax.swing.JComboBox();
        jPanel18 = new javax.swing.JPanel();
        jlKey = new javax.swing.JLabel();
        jftKey = new javax.swing.JFormattedTextField();
        jPanel23 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        jlEmail = new javax.swing.JLabel();
        jtfEmail = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jPanel41 = new javax.swing.JPanel();
        jtfPkBizPartnerId_Ro = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jbOk = new javax.swing.JButton();
        jbCancel = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Asociado de negocios");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Información general:"));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel3.setLayout(new java.awt.BorderLayout());

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del registro:"));
        jPanel13.setLayout(new java.awt.BorderLayout());

        jPanel19.setLayout(new java.awt.GridLayout(6, 1, 0, 2));

        jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlFkBizPartnerIdentityTypeId.setText("Tipo identidad: *");
        jlFkBizPartnerIdentityTypeId.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel6.add(jlFkBizPartnerIdentityTypeId);

        jcbFkBizPartnerIdentityTypeId.setPreferredSize(new java.awt.Dimension(200, 23));
        jcbFkBizPartnerIdentityTypeId.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jcbFkBizPartnerIdentityTypeIdItemStateChanged(evt);
            }
        });
        jPanel6.add(jcbFkBizPartnerIdentityTypeId);

        jLabel2.setPreferredSize(new java.awt.Dimension(50, 23));
        jPanel6.add(jLabel2);

        jckIsDeleted.setForeground(new java.awt.Color(204, 0, 0));
        jckIsDeleted.setText("Asociado negocios eliminado");
        jPanel6.add(jckIsDeleted);

        jPanel19.add(jPanel6);

        jPanel25.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlLastName.setText("Apellido(s): *");
        jlLastName.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel25.add(jlLastName);

        jtfLastName.setText("APELLIDOS");
        jtfLastName.setPreferredSize(new java.awt.Dimension(200, 23));
        jPanel25.add(jtfLastName);

        jLabel3.setPreferredSize(new java.awt.Dimension(50, 23));
        jPanel25.add(jLabel3);

        jckIsAttRelatedParty.setText("Es parte relacionada");
        jPanel25.add(jckIsAttRelatedParty);

        jPanel19.add(jPanel25);

        jPanel22.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlFirstName.setText("Nombre(s): *");
        jlFirstName.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel22.add(jlFirstName);

        jtfFirstName.setText("NOMBRES");
        jtfFirstName.setPreferredSize(new java.awt.Dimension(200, 23));
        jPanel22.add(jtfFirstName);

        jPanel19.add(jPanel22);

        jPanel26.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlBizPartner.setText("Nombre: *");
        jlBizPartner.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel26.add(jlBizPartner);

        jtfBizPartner.setText("ASOCIADO DE NEGOCIOS");
        jtfBizPartner.setPreferredSize(new java.awt.Dimension(354, 23));
        jPanel26.add(jtfBizPartner);

        jPanel19.add(jPanel26);

        jPanel27.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlBizPartnerCommercial.setText("Nombre comercial:");
        jlBizPartnerCommercial.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel27.add(jlBizPartnerCommercial);

        jtfBizPartnerCommercial.setText("NOMBRE COMERCIAL");
        jtfBizPartnerCommercial.setPreferredSize(new java.awt.Dimension(354, 23));
        jPanel27.add(jtfBizPartnerCommercial);

        jbRecreateBizPartnerCommercial.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp/img/icon_std_action.gif"))); // NOI18N
        jbRecreateBizPartnerCommercial.setToolTipText("Crear nombre comercial");
        jbRecreateBizPartnerCommercial.setFocusable(false);
        jbRecreateBizPartnerCommercial.setPreferredSize(new java.awt.Dimension(23, 23));
        jPanel27.add(jbRecreateBizPartnerCommercial);

        jPanel19.add(jPanel27);

        jPanel29.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlFiscalId.setText("RFC: *");
        jlFiscalId.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel29.add(jlFiscalId);

        jtfFiscalId.setText("RFC");
        jtfFiscalId.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel29.add(jtfFiscalId);

        jlAlternativeId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlAlternativeId.setText("CURP:");
        jlAlternativeId.setPreferredSize(new java.awt.Dimension(54, 23));
        jPanel29.add(jlAlternativeId);

        jftAlternativeId.setText("CURP");
        jftAlternativeId.setFocusLostBehavior(javax.swing.JFormattedTextField.PERSIST);
        jftAlternativeId.setPreferredSize(new java.awt.Dimension(125, 23));
        jftAlternativeId.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jftAlternativeIdFocusLost(evt);
            }
        });
        jPanel29.add(jftAlternativeId);

        jPanel19.add(jPanel29);

        jPanel13.add(jPanel19, java.awt.BorderLayout.NORTH);

        jPanel3.add(jPanel13, java.awt.BorderLayout.WEST);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Categorías del asociado de negocios:"));
        jPanel9.setLayout(new java.awt.BorderLayout());

        jPanel15.setLayout(new java.awt.GridLayout(5, 1, 0, 2));

        jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jLabel1.setPreferredSize(new java.awt.Dimension(25, 23));
        jPanel10.add(jLabel1);

        jlIconCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp/img/bp_cus.png"))); // NOI18N
        jPanel10.add(jlIconCustomer);

        jlDummy3.setPreferredSize(new java.awt.Dimension(50, 23));
        jPanel10.add(jlDummy3);

        jlIconSupplier.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp/img/bp_sup.png"))); // NOI18N
        jPanel10.add(jlIconSupplier);

        jlDummy4.setPreferredSize(new java.awt.Dimension(53, 23));
        jPanel10.add(jlDummy4);

        jlIconDebtor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp/img/bp_dbr.png"))); // NOI18N
        jPanel10.add(jlIconDebtor);

        jlDummy5.setPreferredSize(new java.awt.Dimension(53, 23));
        jPanel10.add(jlDummy5);

        jlIconCreditor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp/img/bp_cdr.png"))); // NOI18N
        jPanel10.add(jlIconCreditor);

        jPanel15.add(jPanel10);

        jPanel11.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jbCustomer.setText("Cliente");
        jbCustomer.setMargin(new java.awt.Insets(2, 0, 2, 0));
        jbCustomer.setPreferredSize(new java.awt.Dimension(90, 23));
        jPanel11.add(jbCustomer);

        jbSupplier.setText("Proveedor");
        jbSupplier.setMargin(new java.awt.Insets(2, 0, 2, 0));
        jbSupplier.setPreferredSize(new java.awt.Dimension(90, 23));
        jPanel11.add(jbSupplier);

        jbDebtor.setText("Deudor div.");
        jbDebtor.setMargin(new java.awt.Insets(2, 0, 2, 0));
        jbDebtor.setPreferredSize(new java.awt.Dimension(90, 23));
        jPanel11.add(jbDebtor);

        jbCreditor.setText("Acreedor div.");
        jbCreditor.setMargin(new java.awt.Insets(2, 0, 2, 0));
        jbCreditor.setPreferredSize(new java.awt.Dimension(90, 23));
        jPanel11.add(jbCreditor);

        jPanel15.add(jPanel11);

        jPanel12.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jckIsAttBank.setText("Es banco");
        jckIsAttBank.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel12.add(jckIsAttBank);

        jckIsAttCarrier.setText("Es transportista");
        jckIsAttCarrier.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel12.add(jckIsAttCarrier);

        jckIsAttSalesAgent.setText("Es agente ventas");
        jckIsAttSalesAgent.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel12.add(jckIsAttSalesAgent);

        jPanel15.add(jPanel12);

        jPanel14.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jckIsAttEmployee.setText("Es empleado");
        jckIsAttEmployee.setPreferredSize(new java.awt.Dimension(125, 23));
        jckIsAttEmployee.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jckIsAttEmployeeItemStateChanged(evt);
            }
        });
        jPanel14.add(jckIsAttEmployee);

        jckIsAttPartnerShareholder.setText("Es socio/accionista");
        jckIsAttPartnerShareholder.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel14.add(jckIsAttPartnerShareholder);

        jPanel15.add(jPanel14);

        jPanel28.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 5, 0));

        jckIsCategoryDeleted.setForeground(new java.awt.Color(204, 0, 0));
        jckIsCategoryDeleted.setText("Categoría eliminada");
        jckIsCategoryDeleted.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        jckIsCategoryDeleted.setPreferredSize(new java.awt.Dimension(200, 23));
        jPanel28.add(jckIsCategoryDeleted);

        jPanel15.add(jPanel28);

        jPanel9.add(jPanel15, java.awt.BorderLayout.NORTH);

        jPanel3.add(jPanel9, java.awt.BorderLayout.CENTER);

        jPanel2.add(jPanel3, java.awt.BorderLayout.NORTH);

        jPanel4.setLayout(new java.awt.BorderLayout());

        jpBranchAddress.setBorder(javax.swing.BorderFactory.createTitledBorder("Información del domicilio:"));
        jpBranchAddress.setLayout(new java.awt.BorderLayout());

        jpOficialAddress.setLayout(new java.awt.BorderLayout());
        jpBranchAddress.add(jpOficialAddress, java.awt.BorderLayout.CENTER);

        jPanel21.setLayout(new java.awt.BorderLayout());

        jckCaptureAddress.setText("Capturar domicilio");
        jckCaptureAddress.setPreferredSize(new java.awt.Dimension(250, 23));
        jckCaptureAddress.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jckCaptureAddressItemStateChanged(evt);
            }
        });
        jPanel21.add(jckCaptureAddress, java.awt.BorderLayout.CENTER);

        jpBranchAddress.add(jPanel21, java.awt.BorderLayout.NORTH);

        jPanel4.add(jpBranchAddress, java.awt.BorderLayout.CENTER);

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Información adicional:"));
        jPanel17.setLayout(new java.awt.BorderLayout());

        jPanel16.setLayout(new java.awt.GridLayout(5, 1, 0, 5));

        jPanel7.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlFkBizPartnerTypeId.setText("Tipo asoc. neg.: *");
        jlFkBizPartnerTypeId.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel7.add(jlFkBizPartnerTypeId);

        jcbFkBizPartnerTypeId.setPreferredSize(new java.awt.Dimension(250, 23));
        jPanel7.add(jcbFkBizPartnerTypeId);

        jPanel16.add(jPanel7);

        jPanel8.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlFkBizPartnerCategoryId.setText("Categoría asoc. neg.: *");
        jlFkBizPartnerCategoryId.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel8.add(jlFkBizPartnerCategoryId);

        jcbFkBizPartnerCategoryId.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jcbFkBizPartnerCategoryId.setEnabled(false);
        jcbFkBizPartnerCategoryId.setFocusable(false);
        jcbFkBizPartnerCategoryId.setPreferredSize(new java.awt.Dimension(250, 23));
        jPanel8.add(jcbFkBizPartnerCategoryId);

        jPanel16.add(jPanel8);

        jPanel18.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlKey.setText("Clave asoc. neg.: *");
        jlKey.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel18.add(jlKey);

        jftKey.setFocusLostBehavior(javax.swing.JFormattedTextField.PERSIST);
        jftKey.setPreferredSize(new java.awt.Dimension(100, 23));
        jPanel18.add(jftKey);

        jPanel16.add(jPanel18);

        jPanel23.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));
        jPanel16.add(jPanel23);

        jPanel24.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jlEmail.setText("Cuenta correo-e");
        jlEmail.setPreferredSize(new java.awt.Dimension(125, 23));
        jPanel24.add(jlEmail);

        jtfEmail.setText("CUENTA CORREO-E");
        jtfEmail.setPreferredSize(new java.awt.Dimension(240, 23));
        jPanel24.add(jtfEmail);

        jPanel16.add(jPanel24);

        jPanel17.add(jPanel16, java.awt.BorderLayout.NORTH);

        jPanel4.add(jPanel17, java.awt.BorderLayout.WEST);

        jPanel2.add(jPanel4, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        jPanel5.setLayout(new java.awt.GridLayout(1, 2));

        jPanel41.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        jtfPkBizPartnerId_Ro.setEditable(false);
        jtfPkBizPartnerId_Ro.setHorizontalAlignment(javax.swing.JTextField.TRAILING);
        jtfPkBizPartnerId_Ro.setToolTipText("ID del asociado de negocios");
        jtfPkBizPartnerId_Ro.setFocusable(false);
        jtfPkBizPartnerId_Ro.setPreferredSize(new java.awt.Dimension(65, 23));
        jPanel41.add(jtfPkBizPartnerId_Ro);

        jPanel5.add(jPanel41);

        jPanel1.setPreferredSize(new java.awt.Dimension(392, 33));
        jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

        jbOk.setText("Aceptar");
        jbOk.setToolTipText("[Ctrl + Enter]");
        jbOk.setPreferredSize(new java.awt.Dimension(75, 23));
        jPanel1.add(jbOk);

        jbCancel.setText("Cancelar");
        jbCancel.setToolTipText("[Escape]");
        jPanel1.add(jbCancel);

        jPanel5.add(jPanel1);

        getContentPane().add(jPanel5, java.awt.BorderLayout.SOUTH);

        setSize(new java.awt.Dimension(992, 535));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        windowActivate();
    }//GEN-LAST:event_formWindowActivated

    private void jftAlternativeIdFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jftAlternativeIdFocusLost
        focusLostAlternativeId();
    }//GEN-LAST:event_jftAlternativeIdFocusLost

    private void jcbFkBizPartnerIdentityTypeIdItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jcbFkBizPartnerIdentityTypeIdItemStateChanged
        if (evt.getStateChange() == ItemEvent.SELECTED) {
            itemStateChangedBizPartenrIdentityType();
        }
    }//GEN-LAST:event_jcbFkBizPartnerIdentityTypeIdItemStateChanged

    private void jckCaptureAddressItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jckCaptureAddressItemStateChanged
        itemStateChangedCaptureAddress();
    }//GEN-LAST:event_jckCaptureAddressItemStateChanged

    private void jckIsAttEmployeeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jckIsAttEmployeeItemStateChanged
        itemStateChangedIsAttEmployee();
    }//GEN-LAST:event_jckIsAttEmployeeItemStateChanged

    private void renderKey() {
        switch (mnParamBizPartnerCategory) {
            case SDataConstantsSys.BPSS_CT_BP_CDR:
                if (miClient.getSessionXXX().getParamsErp().getIsKeyCreditorApplying()) {
                    jftKey.setEnabled(true);
                }
                else {
                    jftKey.setEnabled(false);
                }
                break;
            case SDataConstantsSys.BPSS_CT_BP_DBR:
                if (miClient.getSessionXXX().getParamsErp().getIsKeyDebtorApplying()) {
                    jftKey.setEnabled(true);
                }
                else {
                    jftKey.setEnabled(false);
                }
                break;
            default:
        }
    }

    private void initComponentsExtra() {
        mvFields = new Vector<>();

        moIconHasCategorySup = new ImageIcon(getClass().getResource("/erp/img/bp_sup.png"));
        moIconHasCategoryCus = new ImageIcon(getClass().getResource("/erp/img/bp_cus.png"));
        moIconHasCategoryCdr = new ImageIcon(getClass().getResource("/erp/img/bp_cdr.png"));
        moIconHasCategoryDbr = new ImageIcon(getClass().getResource("/erp/img/bp_dbr.png"));
        moIconHasNotCategory = new ImageIcon(getClass().getResource("/erp/img/bp_bw.png"));

        maoDbmsCategorySettings = new SDataBizPartnerCategory[SDataConstantsSys.BPSX_CT_BP_QTY];

        moFieldFkBizPartnerIdentityTypeId = new SFormField(miClient, SLibConstants.DATA_TYPE_KEY, true, jcbFkBizPartnerIdentityTypeId, jlFkBizPartnerIdentityTypeId);
        moFieldLastName = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jtfLastName, jlLastName);
        moFieldLastName.setLengthMax(100);
        moFieldFirstName = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jtfFirstName, jlFirstName);
        moFieldFirstName.setLengthMax(100);
        moFieldBizPartner = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, true, jtfBizPartner, jlBizPartner);
        moFieldBizPartner.setLengthMax(202);
        moFieldBizPartnerCommercial = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jtfBizPartnerCommercial, jlBizPartnerCommercial);
        moFieldBizPartnerCommercial.setLengthMax(202);
        moFieldFiscalId = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, true, jtfFiscalId, jlFiscalId);
        moFieldFiscalId.setLengthMin(DCfdConsts.LEN_RFC_ORG);
        moFieldFiscalId.setLengthMax(DCfdConsts.LEN_RFC_PER);
        moFieldFiscalId.setAutoCaseType(SLibConstants.CASE_UPPER);
        moFieldAlternativeId = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jftAlternativeId, jlAlternativeId);
        moFieldAlternativeId.setLengthMax(25);
        moFieldAlternativeId.setAutoCaseType(SLibConstants.CASE_UPPER);
        moFieldIsDeleted = new SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsDeleted);
        moFieldIsAttRelatedParty = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttRelatedParty);
        moFieldIsAttBank = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttBank);
        moFieldIsAttCarrier = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttCarrier);
        moFieldIsAttSalesAgent = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttSalesAgent);
        moFieldIsAttEmployee = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttEmployee);
        moFieldIsAttPartnerShareholder = new erp.lib.form.SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsAttPartnerShareholder);
        moFieldIsCategoryDeleted = new SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckIsCategoryDeleted);
        moFieldFkBizPartnerCategoryId = new SFormField(miClient, SLibConstants.DATA_TYPE_KEY, true, jcbFkBizPartnerCategoryId, jlFkBizPartnerCategoryId);
        moFieldFkBizPartnerTypeId = new SFormField(miClient, SLibConstants.DATA_TYPE_KEY, true, jcbFkBizPartnerTypeId, jlFkBizPartnerTypeId);
        moFieldKey = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jftKey, jlKey);
        moFieldKey.setLengthMax(25);
        moFieldEmail = new SFormField(miClient, SLibConstants.DATA_TYPE_STRING, false, jtfEmail, jlEmail);
        moFieldEmail.setLengthMax(50);
        moFieldEmail.setAutoCaseType(SLibConstants.UNDEFINED);
        moFieldCaptureAddress = new SFormField(miClient, SLibConstants.DATA_TYPE_BOOLEAN, false, jckCaptureAddress);

        moPanelBizPartnerBranchAddress = new SPanelBizPartnerBranchAddress(miClient);
        jpOficialAddress.add(moPanelBizPartnerBranchAddress, BorderLayout.NORTH);

        mvFields.add(moFieldFkBizPartnerIdentityTypeId);
        mvFields.add(moFieldBizPartnerCommercial);
        mvFields.add(moFieldIsDeleted);
        mvFields.add(moFieldIsAttRelatedParty);
        mvFields.add(moFieldIsAttBank);
        mvFields.add(moFieldIsAttCarrier);
        mvFields.add(moFieldIsAttSalesAgent);
        mvFields.add(moFieldIsAttEmployee);
        mvFields.add(moFieldIsAttPartnerShareholder);
        mvFields.add(moFieldFkBizPartnerCategoryId);
        mvFields.add(moFieldFkBizPartnerTypeId);
        mvFields.add(moFieldKey);
        mvFields.add(moFieldEmail);
        mvFields.add(moFieldCaptureAddress);

        jbOk.addActionListener(this);
        jbCancel.addActionListener(this);
        jbRecreateBizPartnerCommercial.addActionListener(this);

        jbSupplier.addActionListener(this);
        jbCustomer.addActionListener(this);
        jbCreditor.addActionListener(this);
        jbDebtor.addActionListener(this);

        AbstractAction actionOk = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) { actionOk(); }
        };

        SFormUtilities.putActionMap(getRootPane(), actionOk, "ok", KeyEvent.VK_ENTER, KeyEvent.CTRL_DOWN_MASK);

        AbstractAction action = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) { actionCancel(); }
        };

        SFormUtilities.putActionMap(getRootPane(), action, "cancel", KeyEvent.VK_ESCAPE, 0);
    }

    private void windowActivate() {
        if (mbFirstTime) {
            mbFirstTime = false;
            jcbFkBizPartnerIdentityTypeId.requestFocusInWindow();
        }
    }

    private boolean isCreditor() {
        return mnParamBizPartnerCategory == SDataConstantsSys.BPSS_CT_BP_CDR;
    }

    private boolean isDebtor() {
        return mnParamBizPartnerCategory == SDataConstantsSys.BPSS_CT_BP_DBR;
    }

    private String getBizPartnerName() {
        String name = "";

        if (jcbFkBizPartnerIdentityTypeId.getSelectedIndex() > 0) {
            switch (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0]) {
                case SDataConstantsSys.BPSS_TP_BP_IDY_PER:
                    name = moFieldLastName.getString() + (moFieldLastName.getString().length() == 0 ? "" : ", ") + moFieldFirstName.getString();
                    break;
                case SDataConstantsSys.BPSS_TP_BP_IDY_ORG:
                    name = moFieldBizPartner.getString();
                    break;
                default:
                    // do nothing
            }
        }

        return name;
    }

    private void focusLostAlternativeId() {
        if (jftAlternativeId.getText().trim().length() > 0) {
            jftAlternativeId.setText(jftAlternativeId.getText().toUpperCase());
        }
        else {
            jftAlternativeId.setText("");
        }
    }

    private void itemStateChangedBizPartenrIdentityType() {
        renderBizPartnerSettings();
        renderBizPartnerCategories();
    }

    private void itemStateChangedCaptureAddress() {
        moPanelBizPartnerBranchAddress.setFieldsEnabled(jckCaptureAddress.isSelected());
    }

    private void itemStateChangedIsAttEmployee() {
        if (jckIsAttEmployee.isEnabled()) {
            mnFormTypeExport = SDataConstants.BPSX_BP_EMP;
            mbIsNeededPosSave = jckIsAttEmployee.isSelected();
        }
    }

    private void renderBizPartnerSettings() {
        if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER) {
            jtfFirstName.setEnabled(true);
            jtfLastName.setEnabled(true);
            jftAlternativeId.setEnabled(true);
            jtfBizPartner.setEnabled(false);
            moFieldAlternativeId.setMaskFormatter("UUUU######XXXXXXXX");
        }
        else {
            jtfFirstName.setEnabled(false);
            jtfLastName.setEnabled(false);
            jftAlternativeId.setEnabled(false);
            jtfBizPartner.setEnabled(true);
        }
    }

    private void renderBizPartnerCategories() {
        if (mnParamBizPartnerType == SDataConstants.BPSX_BP_CDR) {
            jbSupplier.setEnabled(true);
            jbCustomer.setEnabled(true);
            jbCreditor.setEnabled(false);
            jbDebtor.setEnabled(true);
            setParamBizPartnerCategoryFilter(SDataConstantsSys.BPSS_CT_BP_CDR);
        }
        else if (mnParamBizPartnerType == SDataConstants.BPSX_BP_DBR) {
            jbSupplier.setEnabled(true);
            jbCustomer.setEnabled(true);
            jbCreditor.setEnabled(true);
            jbDebtor.setEnabled(false);
            setParamBizPartnerCategoryFilter(SDataConstantsSys.BPSS_CT_BP_DBR);
        }
        setBizPartnerCategory();
        setIconCategory();
    }

    private void setFieldEnableEmployee(boolean enable) {
        jckIsAttEmployee.setEnabled(enable);
        jckIsCategoryDeleted.setEnabled(enable);
        jckIsDeleted.setEnabled(enable);
    }

    private void setIconCategory() {
        jlIconSupplier.setIcon(moBizPartner == null ? mnParamBizPartnerType == SDataConstants.BPSX_BP_SUP ? moIconHasCategorySup : moIconHasNotCategory : moBizPartner.getIsSupplier() || mnParamBizPartnerType == SDataConstants.BPSX_BP_SUP ? moIconHasCategorySup : moIconHasNotCategory);
        jlIconCustomer.setIcon(moBizPartner == null ? mnParamBizPartnerType == SDataConstants.BPSX_BP_CUS ? moIconHasCategoryCus : moIconHasNotCategory : moBizPartner.getIsCustomer() || mnParamBizPartnerType == SDataConstants.BPSX_BP_CUS ? moIconHasCategoryCus : moIconHasNotCategory);
        jlIconCreditor.setIcon(moBizPartner == null ? mnParamBizPartnerType == SDataConstants.BPSX_BP_CDR ? moIconHasCategoryCdr : moIconHasNotCategory : moBizPartner.getIsCreditor() || mnParamBizPartnerType == SDataConstants.BPSX_BP_CDR ? moIconHasCategoryCdr : moIconHasNotCategory);
        jlIconDebtor.setIcon(moBizPartner == null ? mnParamBizPartnerType == SDataConstants.BPSX_BP_DBR ? moIconHasCategoryDbr : moIconHasNotCategory : moBizPartner.getIsDebtor() || mnParamBizPartnerType == SDataConstants.BPSX_BP_DBR ? moIconHasCategoryDbr : moIconHasNotCategory);
    }

    @SuppressWarnings("unchecked")
    private void setBizPartnerCategory() {
        SFormUtilities.populateComboBox(miClient, jcbFkBizPartnerCategoryId, SDataConstants.BPSS_CT_BP);
        if (mnParamBizPartnerType == SDataConstants.BPSX_BP_CDR) {
             moFieldFkBizPartnerCategoryId.setKey(new int [] {SDataConstantsSys.BPSS_CT_BP_CDR});
        }
        else if (mnParamBizPartnerType == SDataConstants.BPSX_BP_DBR) {
             moFieldFkBizPartnerCategoryId.setKey(new int [] {SDataConstantsSys.BPSS_CT_BP_DBR});
        }
    }

    private void actionSupplier() {
        if (jbSupplier.isEnabled()) {
            mnFormTypeExport = SDataConstants.BPSX_BP_SUP;

            if (moBizPartner != null && moBizPartner.getIsSupplier()) {
                if (miClient.showMsgBoxConfirm("Para abrir la categoría de proveedor para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                    actionOk();
                    mbIsNeededPosSave = true;
                }
            }
            else if (miClient.showMsgBoxConfirm("Para crear la categoría de proveedor para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                actionOk();
                mbIsNeededPosSave = true;
            }
        }
    }

    private void actionCustomer() {
        if (jbCustomer.isEnabled()) {
            mnFormTypeExport = SDataConstants.BPSX_BP_CUS;

            if (moBizPartner != null && moBizPartner.getIsCustomer()) {
                if (miClient.showMsgBoxConfirm("Para abrir la categoría de cliente para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                    actionOk();
                    mbIsNeededPosSave = true;
                }
            }
            else if (miClient.showMsgBoxConfirm("Para crear la categoría de cliente para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                actionOk();
                mbIsNeededPosSave = true;
            }
        }
    }

    private void actionCreditor() {
        if (jbCreditor.isEnabled()) {
            mnFormTypeExport = SDataConstants.BPSX_BP_CDR;

            if (moBizPartner != null && moBizPartner.getIsCreditor()) {
                if (miClient.showMsgBoxConfirm("Para abrir la categoría de acreedor diverso para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                    actionOk();
                    mbIsNeededPosSave = true;
                }
            }
            else if (miClient.showMsgBoxConfirm("Para crear la categoría de acreedor diverso para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                actionOk();
                mbIsNeededPosSave = true;
            }
        }
    }

    private void actionDebtor() {
        if (jbDebtor.isEnabled()) {
            mnFormTypeExport = SDataConstants.BPSX_BP_DBR;

            if (moBizPartner != null && moBizPartner.getIsDebtor()) {
                if (miClient.showMsgBoxConfirm("Para abrir la categoría de deudor diverso para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                    actionOk();
                    mbIsNeededPosSave = true;
                }
            }
            else if (miClient.showMsgBoxConfirm("Para crear la categoría de deudor diverso para este asociado de negocios necesita guardar los cambios,\n¿Desea continuar?") == JOptionPane.YES_OPTION) {
                actionOk();
                mbIsNeededPosSave = true;
            }
        }
    }

    private void actionRecreateBizPartnerCommercial() {
        jtfBizPartnerCommercial.setText("");
        if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER) {
            jtfBizPartnerCommercial.setText(jtfLastName.getText() + ", " + jtfFirstName.getText());
            jtfBizPartnerCommercial.requestFocus();
        }
        else {
            jtfBizPartnerCommercial.setText(jtfBizPartner.getText());
            jtfBizPartnerCommercial.requestFocus();
        }
    }

    private void actionOk() {
        SFormValidation validation = formValidate();

        if (validation.getIsError()) {
            if (validation.getComponent() != null) {
                validation.getComponent().requestFocus();
            }
            if (validation.getMessage().length() > 0) {
                miClient.showMsgBoxWarning(validation.getMessage());
            }
        }
        else {
            mnFormResult = SLibConstants.FORM_RESULT_OK;
            setVisible(false);
        }
    }

    private void actionCancel() {
        mnFormResult = SLibConstants.FORM_RESULT_CANCEL;
        setVisible(false);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel41;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JButton jbCancel;
    private javax.swing.JButton jbCreditor;
    private javax.swing.JButton jbCustomer;
    private javax.swing.JButton jbDebtor;
    private javax.swing.JButton jbOk;
    private javax.swing.JButton jbRecreateBizPartnerCommercial;
    private javax.swing.JButton jbSupplier;
    private javax.swing.JComboBox jcbFkBizPartnerCategoryId;
    private javax.swing.JComboBox<SFormComponentItem> jcbFkBizPartnerIdentityTypeId;
    private javax.swing.JComboBox<SFormComponentItem> jcbFkBizPartnerTypeId;
    private javax.swing.JCheckBox jckCaptureAddress;
    private javax.swing.JCheckBox jckIsAttBank;
    private javax.swing.JCheckBox jckIsAttCarrier;
    private javax.swing.JCheckBox jckIsAttEmployee;
    private javax.swing.JCheckBox jckIsAttPartnerShareholder;
    private javax.swing.JCheckBox jckIsAttRelatedParty;
    private javax.swing.JCheckBox jckIsAttSalesAgent;
    private javax.swing.JCheckBox jckIsCategoryDeleted;
    private javax.swing.JCheckBox jckIsDeleted;
    private javax.swing.JFormattedTextField jftAlternativeId;
    private javax.swing.JFormattedTextField jftKey;
    private javax.swing.JLabel jlAlternativeId;
    private javax.swing.JLabel jlBizPartner;
    private javax.swing.JLabel jlBizPartnerCommercial;
    private javax.swing.JLabel jlDummy3;
    private javax.swing.JLabel jlDummy4;
    private javax.swing.JLabel jlDummy5;
    private javax.swing.JLabel jlEmail;
    private javax.swing.JLabel jlFirstName;
    private javax.swing.JLabel jlFiscalId;
    private javax.swing.JLabel jlFkBizPartnerCategoryId;
    private javax.swing.JLabel jlFkBizPartnerIdentityTypeId;
    private javax.swing.JLabel jlFkBizPartnerTypeId;
    private javax.swing.JLabel jlIconCreditor;
    private javax.swing.JLabel jlIconCustomer;
    private javax.swing.JLabel jlIconDebtor;
    private javax.swing.JLabel jlIconSupplier;
    private javax.swing.JLabel jlKey;
    private javax.swing.JLabel jlLastName;
    private javax.swing.JPanel jpBranchAddress;
    private javax.swing.JPanel jpOficialAddress;
    private javax.swing.JTextField jtfBizPartner;
    private javax.swing.JTextField jtfBizPartnerCommercial;
    private javax.swing.JTextField jtfEmail;
    private javax.swing.JTextField jtfFirstName;
    private javax.swing.JTextField jtfFiscalId;
    private javax.swing.JTextField jtfLastName;
    private javax.swing.JTextField jtfPkBizPartnerId_Ro;
    // End of variables declaration//GEN-END:variables

    @Override
    public void formClearRegistry() {
        moBizPartnerCategory = null;
    }

    @Override
    public void formReset() {
        mnFormResult = SLibConstants.UNDEFINED;
        mnFormStatus = SLibConstants.UNDEFINED;
        mbFirstTime = true;

        moBizPartner = null;
        moBizPartnerCategory = null;
        moBizPartnerBranch = null;
        moBizPartnerBranchAddress = null;
        moBizPartnerBranchContact = null;

        mnFormTypeExport = SLibConstants.UNDEFINED;
        mbIsNeededPosSave = false;

        for (int i = 0; i < mvFields.size(); i++) {
            ((erp.lib.form.SFormField) mvFields.get(i)).resetField();
        }

        jtfFirstName.setText("");
        jtfLastName.setText("");
        jtfBizPartner.setText("");
        jtfFiscalId.setText("");
        jftAlternativeId.setText("");
        jtfPkBizPartnerId_Ro.setText("");
        jtfFirstName.setEnabled(false);
        jtfLastName.setEnabled(false);
        jtfBizPartner.setEnabled(false);
        jftAlternativeId.setEnabled(false);
        jtfEmail.setText("");

        renderBizPartnerCategories();
        renderKey();
        moPanelBizPartnerBranchAddress.formReset();
        moPanelBizPartnerBranchAddress.setParamIsInMainWindow(true);
        jckCaptureAddress.setSelected(false);
        itemStateChangedCaptureAddress();

        jckIsDeleted.setEnabled(false);
        jckIsCategoryDeleted.setEnabled(false);
        setFieldEnableEmployee(false);
    }

    @Override
    public void formRefreshCatalogues() {
        int bizCategory = 0;

        renderBizPartnerCategories();
        SFormUtilities.populateComboBox(miClient, jcbFkBizPartnerIdentityTypeId, SDataConstants.BPSS_TP_BP_IDY);

        switch (mnParamBizPartnerCategory) {
            case SDataConstantsSys.BPSS_CT_BP_CDR:
                bizCategory = SDataConstants.BPSX_TP_BP_CDR;
                break;
            case SDataConstantsSys.BPSS_CT_BP_DBR:
                bizCategory = SDataConstants.BPSX_TP_BP_DBR;
                break;
            default:
                break;
        }

        SFormUtilities.populateComboBox(miClient, jcbFkBizPartnerTypeId, bizCategory);
        moPanelBizPartnerBranchAddress.formRefreshCatalogues();
    }

    @Override
    public erp.lib.form.SFormValidation formValidate() {
        SFormValidation validation = new SFormValidation();

        for (int i = 0; i < mvFields.size(); i++) {
            if (!((erp.lib.form.SFormField) mvFields.get(i)).validateField()) {
                validation.setIsError(true);
                validation.setComponent(((erp.lib.form.SFormField) mvFields.get(i)).getComponent());
                break;
            }
        }

        if (!validation.getIsError()) {
            String fiscalId = jtfFiscalId.getText().trim();
            int fiscalIdLength = moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER ? DCfdConsts.LEN_RFC_PER : DCfdConsts.LEN_RFC_ORG;

            if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER && jtfLastName.getText().isEmpty()) {
                validation.setComponent(jtfLastName);
                validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_EMPTY + "'" + jlLastName.getText() + "'.");
            }
            else if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER && jtfFirstName.getText().isEmpty()) {
                validation.setComponent(jtfFirstName);
                validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_EMPTY + "'" + jlFirstName.getText() + "'.");
            }
            else if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_ORG && jtfBizPartner.getText().isEmpty()) {
                validation.setComponent(jtfBizPartner);
                validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_EMPTY + "'" + jlBizPartner.getText() + "'.");
            }
            else if (fiscalId.isEmpty()) {
                validation.setComponent(jtfFiscalId);
                validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_EMPTY + "'" + jlFiscalId.getText() + "'.");
            }
            else if (!fiscalId.equals(DCfdConsts.RFC_GEN_NAC) && !fiscalId.equals(DCfdConsts.RFC_GEN_INT) && fiscalId.length() != fiscalIdLength) {
                validation.setComponent(jtfFiscalId);
                validation.setMessage("El valor del campo '" + jlFiscalId.getText() + "', '" + fiscalId + "', debe tener " + fiscalIdLength + " caracteres.");
            }
            else {
                if (jckIsDeleted.isSelected() || jckIsCategoryDeleted.isSelected()) {
                    try {
                        if (SFinUtilities.hasBizPartnerMovesFinance(miClient, miClient.getSessionXXX().getSystemYear(), moBizPartner.getPkBizPartnerId())) {
                            validation.setTabbedPaneIndex(0);
                            validation.setComponent(jckIsDeleted);
                            validation.setMessage("No se puede eliminar al '" + getTitle() + "' o su categoría debido a que tiene movimientos en el ejercicio actual " + miClient.getSessionXXX().getSystemYear() + ".");
                        }
                    }
                    catch (Exception e) {
                        SLibUtilities.renderException(this, e);
                    }

                    if (!validation.getIsError()) {
                        if (jckIsDeleted.isSelected() && miClient.showMsgBoxConfirm("¿Está seguro que desea eliminar al '" + getTitle() + "'?") != JOptionPane.YES_OPTION) {
                            validation.setTabbedPaneIndex(0);
                            validation.setComponent(jckIsDeleted);
                            validation.setMessage("Se debe deseleccionar el campo '" + jckIsDeleted.getText() + "' para no eliminar al '" + getTitle() + "'.");
                        }

                        if (!validation.getIsError()) {
                            if (jckIsCategoryDeleted.isSelected() && miClient.showMsgBoxConfirm("¿Está seguro que desea eliminar la categoría del '" + getTitle() + "'?") != JOptionPane.YES_OPTION) {
                                validation.setTabbedPaneIndex(0);
                                validation.setComponent(jckIsCategoryDeleted);
                                validation.setMessage("Se debe deseleccionar el campo '" + jckIsCategoryDeleted.getText() + "' para no eliminar la categoría del '" + getTitle() + "'.");
                            }
                        }
                    }
                }

                if (!validation.getIsError()) {
                    Object[] valParams = new Object[] { moBizPartner == null ? 0 : moBizPartner.getPkBizPartnerId(), moFieldBizPartner.getString() }; // odd parameters passing
                    int valCount = SDataUtilities.callProcedureVal(miClient, SProcConstants.BPSU_BP, valParams, SLibConstants.EXEC_MODE_VERBOSE);

                    if (valCount > 0 && miClient.showMsgBoxConfirm("El valor del campo '" + jlBizPartner.getText() + "', '" + moFieldBizPartner.getString() + "',"
                            + "\nya existe " + valCount + " " + (valCount == 1 ? "vez" : "veces") + " en el sistema, ¿desea conservarlo?") != JOptionPane.YES_OPTION) {
                        validation.setTabbedPaneIndex(0);
                        validation.setComponent(jtfBizPartner);
                        validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_VALUE_DIF + "'" + jlBizPartner.getText() + "'.");
                    }

                    if (!validation.getIsError()) {
                        valParams = new Object[] { moBizPartner == null ? 0 : moBizPartner.getPkBizPartnerId(), fiscalId }; // odd parameters passing
                        valCount = SDataUtilities.callProcedureVal(miClient, SProcConstants.BPSU_BP_FISCAL_ID, valParams, SLibConstants.EXEC_MODE_VERBOSE);

                        if (valCount > 0 && miClient.showMsgBoxConfirm("El valor del campo '" + jlFiscalId.getText() + "', '" + fiscalId + "',"
                                + "\nya existe " + valCount + " " + (valCount == 1 ? "vez" : "veces") + " en el sistema, ¿desea conservarlo?") != JOptionPane.YES_OPTION) {
                            validation.setTabbedPaneIndex(0);
                            validation.setComponent(jtfFiscalId);
                            validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_VALUE_DIF + "'" + jlFiscalId.getText() + "'.");
                        }
                    }
                }

                if (!validation.getIsError()) {
                    if (moFieldKey.getString().isEmpty() && (
                            isCreditor() && miClient.getSessionXXX().getParamsErp().getIsKeyCreditorApplying() ||
                            isDebtor() && miClient.getSessionXXX().getParamsErp().getIsKeyDebtorApplying())) {
                        validation.setComponent(jftKey);
                        validation.setMessage(SLibConstants.MSG_ERR_GUI_FIELD_EMPTY + "'" + jlKey.getText() + "'.");
                    }
                }

                if (!validation.getIsError() && !moFieldEmail.getString().isEmpty()) {
                    String message = SLibUtilities.validateEmail(moFieldEmail.getString());
                    if (!message.isEmpty()) {
                        validation.setComponent(jtfEmail);
                        validation.setMessage(message);
                    }
                }

                if (!validation.getIsError() && jckCaptureAddress.isSelected()) {
                    validation = moPanelBizPartnerBranchAddress.formValidate();
                }
            }
        }

        return validation;
    }

    @Override
    public void setFormStatus(int status) {
        mnFormStatus = status;
    }

    @Override
    public void setFormVisible(boolean visible) {
        setVisible(visible);
    }

    @Override
    public int getFormStatus() {
        return mnFormStatus;
    }

    @Override
    public int getFormResult() {
        return mnFormResult;
    }

    @Override
    public void setRegistry(erp.lib.data.SDataRegistry registry) {
        moBizPartner = (SDataBizPartner) registry;

        moFieldFkBizPartnerIdentityTypeId.setFieldValue(new int[] { moBizPartner.getFkBizPartnerIdentityTypeId() });
        renderBizPartnerSettings();
        moFieldFirstName.setFieldValue(moBizPartner.getFirstname());
        moFieldLastName.setFieldValue(moBizPartner.getLastname());
        if (moBizPartner.getFkBizPartnerIdentityTypeId() == SDataConstantsSys.BPSS_TP_BP_IDY_PER) {
            moFieldBizPartner.setFieldValue("");
        }
        else {
            moFieldBizPartner.setFieldValue(moBizPartner.getBizPartner());
        }
        moFieldBizPartnerCommercial.setFieldValue(moBizPartner.getBizPartner().compareTo(moBizPartner.getBizPartnerCommercial()) == 0 ? "" : moBizPartner.getBizPartnerCommercial());
        moFieldFiscalId.setFieldValue(moBizPartner.getFiscalId());
        moFieldAlternativeId.setFieldValue(moBizPartner.getAlternativeId());
        moFieldIsAttBank.setFieldValue(moBizPartner.getIsAttributeBank());
        moFieldIsAttCarrier.setFieldValue(moBizPartner.getIsAttributeCarrier());
        moFieldIsAttSalesAgent.setFieldValue(moBizPartner.getIsAttributeSalesAgent());
        moFieldIsAttEmployee.setFieldValue(moBizPartner.getIsAttributeEmployee());
        moFieldIsAttPartnerShareholder.setFieldValue(moBizPartner.getIsAttributePartnerShareholder());
        moFieldIsAttRelatedParty.setFieldValue(moBizPartner.getIsAttributeRelatedParty());
        moFieldIsDeleted.setFieldValue(moBizPartner.getIsDeleted());
        jtfPkBizPartnerId_Ro.setText("" + moBizPartner.getPkBizPartnerId());

        maoDbmsCategorySettings[0] = moBizPartner.getDbmsCategorySettingsCdr();
        maoDbmsCategorySettings[1] = moBizPartner.getDbmsCategorySettingsDbr();

        if (isCreditor()) {
            moBizPartnerCategory = maoDbmsCategorySettings[0];
        }
        else if (isDebtor()) {
            moBizPartnerCategory = maoDbmsCategorySettings[1];
        }

        if (moBizPartnerCategory != null) {
            moFieldFkBizPartnerCategoryId.setFieldValue(new int[] { moBizPartnerCategory.getFkBizPartnerCategoryId()});
            moFieldFkBizPartnerTypeId.setFieldValue(new int[] { moBizPartnerCategory.getFkBizPartnerCategoryId(), moBizPartnerCategory.getFkBizPartnerTypeId() });

            if (moBizPartnerCategory.getFkBizPartnerCategoryId() == SDataConstantsSys.BPSS_CT_BP_SUP) {
                moFieldKey.setMaskFormatter(miClient.getSessionXXX().getParamsErp().getFormatKeySupplier());
            }
            else if (moBizPartnerCategory.getFkBizPartnerCategoryId() == SDataConstantsSys.BPSS_CT_BP_CUS) {
                moFieldKey.setMaskFormatter(miClient.getSessionXXX().getParamsErp().getFormatKeyCustomer());
            }

            moFieldKey.setFieldValue(moBizPartnerCategory.getKey());
            moFieldIsCategoryDeleted.setFieldValue(moBizPartnerCategory.getIsDeleted());
        }
        renderKey();

        boolean captureAddress = false;
        moBizPartnerBranch = moBizPartner.getDbmsBizPartnerBranchHq();

        if (moBizPartnerBranch != null) {
            // official address:

            moBizPartnerBranchAddress = moBizPartnerBranch.getDbmsBizPartnerBranchAddressOfficial();

            if (moBizPartnerBranchAddress != null) {
                moPanelBizPartnerBranchAddress.setRegistry(moBizPartnerBranchAddress);
                captureAddress = moBizPartnerBranchAddress.getStreet().length() > 0;
            }

            // official contact:

            moBizPartnerBranchContact = moBizPartnerBranch.getDbmsBizPartnerBranchContactOfficial();

            if (moBizPartnerBranchContact != null) {
                moFieldEmail.setFieldValue(moBizPartnerBranchContact.getEmail01());
            }
        }

        jckCaptureAddress.setSelected(captureAddress);
        itemStateChangedCaptureAddress();

        jckIsDeleted.setEnabled(true);
        jckIsCategoryDeleted.setEnabled(true);
        setFieldEnableEmployee(moBizPartner.getDbmsDataEmployee() == null);
    }

    @Override
    public erp.lib.data.SDataRegistry getRegistry() {
        if (moBizPartner == null) {
            moBizPartner = new SDataBizPartner();
            moBizPartner.setFkUserNewId(miClient.getSession().getUser().getPkUserId());
        }
        else {
            moBizPartner.setFkUserEditId(miClient.getSession().getUser().getPkUserId());
        }

        moBizPartner.setFkBizPartnerIdentityTypeId(moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0]);
        moBizPartner.setFkTaxIdentityId(moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0]); // same as type of business partner identity
        moBizPartner.setFkBizAreaId(SDataConstantsSys.BPSU_BA_DEFAULT);
        moBizPartner.setFkFiscalBankId(SModSysConsts.FINS_FISCAL_BANK_NA);

        if (moFieldFkBizPartnerIdentityTypeId.getKeyAsIntArray()[0] == SDataConstantsSys.BPSS_TP_BP_IDY_PER) {
            moBizPartner.setLastname(moFieldLastName.getString());
            moBizPartner.setFirstname(moFieldFirstName.getString());
            moBizPartner.setAlternativeId(moFieldAlternativeId.getString().toUpperCase()); // CURP
        }
        else {
            moBizPartner.setLastname("");
            moBizPartner.setFirstname("");
            moBizPartner.setAlternativeId("");
        }

        moBizPartner.setBizPartner(getBizPartnerName());
        moBizPartner.setBizPartnerCommercial(moFieldBizPartnerCommercial.getString().isEmpty() ? moBizPartner.getBizPartner() : moFieldBizPartnerCommercial.getString());

        moBizPartner.setFiscalId(moFieldFiscalId.getString().toUpperCase());
        //moBizPartner.setFiscalFrgId(...);
        //moBizPartner.setCodeBankSantander(...);
        //moBizPartner.setCodeBankBanBajio(...);
        //moBizPartner.setWeb(...);

        moBizPartner.setIsAttributeBank(moFieldIsAttBank.getBoolean());
        moBizPartner.setIsAttributeCarrier(moFieldIsAttCarrier.getBoolean());
        moBizPartner.setIsAttributeSalesAgent(moFieldIsAttSalesAgent.getBoolean());
        moBizPartner.setIsAttributeEmployee(moFieldIsAttEmployee.getBoolean() && !jckIsAttEmployee.isEnabled());
        moBizPartner.setIsAttributePartnerShareholder(moFieldIsAttPartnerShareholder.getBoolean());
        moBizPartner.setIsAttributeRelatedParty(moFieldIsAttRelatedParty.getBoolean());
        moBizPartner.setIsDeleted(moFieldIsDeleted.getBoolean());

        // Save business partner category:

        //moBizPartner.setIsCompany(...);
        //moBizPartner.setIsSupplier(...);
        //moBizPartner.setIsCustomer(...);

        switch (mnParamBizPartnerType) {
            case SDataConstants.BPSX_BP_CDR:
                moBizPartner.setIsCreditor(true);
                break;
            case SDataConstants.BPSX_BP_DBR:
                moBizPartner.setIsDebtor(true);
                break;
            default:
        }

        if (moBizPartnerCategory == null) {
            moBizPartnerCategory = new SDataBizPartnerCategory();
            moBizPartnerCategory.setFkUserNewId(miClient.getSession().getUser().getPkUserId());
        }
        else {
            moBizPartnerCategory.setFkUserEditId(miClient.getSession().getUser().getPkUserId());
        }

        moBizPartnerCategory.setPkBizPartnerCategoryId(moFieldFkBizPartnerCategoryId.getKeyAsIntArray()[0]);
        moBizPartnerCategory.setKey(moFieldKey.getString());
        //moBizPartnerCategory.setCompanyKey(...);

        moBizPartnerCategory.setCreditLimit(0);
        moBizPartnerCategory.setDaysOfCredit(0);
        moBizPartnerCategory.setDaysOfGrace(0);
        moBizPartnerCategory.setGuarantee(0);
        moBizPartnerCategory.setInsurance(0);
        moBizPartnerCategory.setIsGuaranteeInProcess(false);
        moBizPartnerCategory.setIsInsuranceInProcess(false);

        moBizPartnerCategory.setGuaranteeType("");

        moBizPartnerCategory.setDateStart(SLibTimeUtilities.getBeginOfYear(miClient.getSessionXXX().getWorkingDate()));
        moBizPartnerCategory.setDateEnd_n(null);
        moBizPartnerCategory.setPaymentAccount("");
        moBizPartnerCategory.setNumberExporter("");
        moBizPartnerCategory.setDiotOperation("");
        moBizPartnerCategory.setCfdiPaymentWay("");
        moBizPartnerCategory.setCfdiCfdiUsage("");
        moBizPartnerCategory.setTaxRegime("");

        moBizPartnerCategory.setIsCreditByUser(false);
        moBizPartnerCategory.setFkBizPartnerCategoryId(moFieldFkBizPartnerCategoryId.getKeyAsIntArray()[0]);
        moBizPartnerCategory.setFkBizPartnerTypeId(jcbFkBizPartnerTypeId.getSelectedIndex() <= 0 ? SDataConstantsSys.BPSU_TP_BP_DEFAULT : moFieldFkBizPartnerTypeId.getKeyAsIntArray()[1]);
        moBizPartnerCategory.setFkCreditTypeId_n(SDataConstantsSys.BPSS_TP_CRED_CRED_NO);
        moBizPartnerCategory.setFkRiskId_n(SModSysConsts.BPSS_RISK_C_RSK_H);
        moBizPartnerCategory.setFkPaymentSystemTypeId_n(0);
        moBizPartnerCategory.setFkCfdAddendaTypeId(SDataConstantsSys.BPSS_TP_CFD_ADD_NA);

        moBizPartnerCategory.setFkLanguageId_n(-1);
        moBizPartnerCategory.setFkCurrencyId_n(-1);
        moBizPartnerCategory.setAuxLanguageSysId(miClient.getSessionXXX().getParamsErp().getFkLanguageId());
        moBizPartnerCategory.setAuxCurrencySysId(miClient.getSessionXXX().getParamsErp().getFkCurrencyId());
        moBizPartnerCategory.setFkUserAnalystId_n(0);
        moBizPartnerCategory.setIsDeleted(moFieldIsCategoryDeleted.getBoolean());

        moBizPartnerCategory.setDbmBizPartnerType(jcbFkBizPartnerTypeId.getSelectedItem().toString());
        moBizPartnerCategory.setDbmsCreditType("");
        moBizPartnerCategory.setDbmsLanguage("");
        moBizPartnerCategory.setDbmsCurrency("");

        moBizPartnerCategory.setIsRegistryEdited(true);

        switch (mnParamBizPartnerCategory) {
            case SDataConstantsSys.BPSS_CT_BP_CDR:
                moBizPartner.setDbmsCategorySettingsCdr(moBizPartnerCategory);
                break;
            case SDataConstantsSys.BPSS_CT_BP_DBR:
                moBizPartner.setDbmsCategorySettingsDbr(moBizPartnerCategory);
                break;
            default:
                // do nothing
        }

        // headquarters:

        moBizPartner.getDbmsBizPartnerBranches().clear();

        if (moBizPartnerBranch == null) {
            moBizPartnerBranch = new SDataBizPartnerBranch();
            moBizPartnerBranch.setFkUserNewId(miClient.getSession().getUser().getPkUserId());
        }
        else {
            moBizPartnerBranch.setFkUserEditId(miClient.getSession().getUser().getPkUserId());
        }

        moBizPartnerBranch.setFkBizPartnerBranchTypeId(SDataConstantsSys.BPSS_TP_BPB_HQ);
        moBizPartnerBranch.setBizPartnerBranch(SModSysConsts.TXT_HQ);
        moBizPartnerBranch.setIsAddressPrintable(true);
        moBizPartnerBranch.setIsDeleted(false);
        moBizPartnerBranch.setDbmsTaxRegion("");

        moBizPartnerBranch.setIsRegistryEdited(true);
        moBizPartner.getDbmsBizPartnerBranches().add(moBizPartnerBranch);

        // official address:

        moBizPartnerBranch.getDbmsBizPartnerBranchAddresses().clear();

        moBizPartnerBranchAddress = (SDataBizPartnerBranchAddress) moPanelBizPartnerBranchAddress.getRegistry();
        moBizPartnerBranchAddress.setIsDefault(true);
        moBizPartnerBranchAddress.setFkAddressTypeId(SDataConstantsSys.BPSS_TP_ADD_OFF); // official address

        moBizPartnerBranchAddress.setIsRegistryEdited(true);
        moBizPartnerBranch.getDbmsBizPartnerBranchAddresses().add(moBizPartnerBranchAddress);

        // official contact:

        moBizPartnerBranch.getDbmsBizPartnerBranchContacts().clear();

        if (moBizPartnerBranchContact == null) {
            moBizPartnerBranchContact = new SDataBizPartnerBranchContact();
            moBizPartnerBranchContact.setFkUserNewId(miClient.getSession().getUser().getPkUserId());
        }
        else {
            moBizPartnerBranchContact.setFkUserEditId(miClient.getSession().getUser().getPkUserId());
        }

        moBizPartnerBranchContact.setFkTelephoneType01Id(SDataConstantsSys.BPSS_TP_TEL_NA);
        moBizPartnerBranchContact.setFkTelephoneType02Id(SDataConstantsSys.BPSS_TP_TEL_NA);
        moBizPartnerBranchContact.setFkTelephoneType03Id(SDataConstantsSys.BPSS_TP_TEL_NA);
        moBizPartnerBranchContact.setEmail01(moFieldEmail.getString());
        moBizPartnerBranchContact.setFkContactTypeId(SDataConstantsSys.BPSS_TP_CON_ADM);

        moBizPartnerBranchContact.setIsRegistryEdited(true);
        moBizPartnerBranch.getDbmsBizPartnerBranchContacts().add(moBizPartnerBranchContact);

        moBizPartner.setIsRegistryEdited(true);

        return moBizPartner;
    }

    @Override
    public void setValue(int type, java.lang.Object value) {
        switch (type) {
            case SDataConstantsSys.VALUE_BIZ_PARTNER_TYPE:
                mnParamBizPartnerType = ((int[]) value)[0];

                switch (mnParamBizPartnerType) {
                    case SDataConstants.BPSX_BP_DBR:
                        setTitle("Deudor diverso");
                        jckIsCategoryDeleted.setText("Deudor diverso eliminado");
                        break;
                    case SDataConstants.BPSX_BP_CDR:
                        setTitle("Acreedor diverso");
                        jckIsCategoryDeleted.setText("Acreedor diverso eliminado");
                        break;
                    default:
                        setTitle("Asociado de negocios");
                        jckIsCategoryDeleted.setText("Asociado eliminado");
                }
                break;
            default:
        }
    }

    @Override
    public java.lang.Object getValue(int type) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public javax.swing.JLabel getTimeoutLabel() {
        return null;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() instanceof javax.swing.JButton) {
            javax.swing.JButton button = (javax.swing.JButton) e.getSource();

            if (button == jbOk) {
                actionOk();
            }
            else if (button == jbCancel) {
                actionCancel();
            }
            else if (button == jbRecreateBizPartnerCommercial) {
                actionRecreateBizPartnerCommercial();
            }
            else if (button == jbSupplier) {
                actionSupplier();
            }
            else if (button == jbCustomer) {
                actionCustomer();
            }
            else if (button == jbCreditor) {
                actionCreditor();
            }
            else if (button == jbDebtor) {
                actionDebtor();
            }
        }
    }

    public void setParamBizPartnerCategoryFilter(int n) { mnParamBizPartnerCategory = n; }

    @Override
    public SLibMethod getPostSaveMethod(SDataRegistry registry) {
        SLibMethod method = null;

        if (mbIsNeededPosSave) {
            try {
                method = new SLibMethod(registry, registry.getClass().getMethod("openCategory", new Class[] { SClientInterface.class, int.class, Object.class }), new Object[] { miClient, mnFormTypeExport, registry.getPrimaryKey() });
            }
            catch (NoSuchMethodException | SecurityException e) {
                SLibUtils.showException(this, e);
            }
        }

        return method;
    }
}


text:
/**
 * KindEditor ASP.NET
 *
 * 本ASP.NET程序是演示程序,建议不要直接在实际项目中使用。
 * 如果您确定直接使用本程序,使用之前请仔细确认相关安全设置。
 *
 */

using System;
using System.Collections;
using System.Web;
using System.IO;
using System.Globalization;
using LitJson;

using USTA.PageBase;
using System.Web.SessionState;

public class Upload : IHttpHandler, IRequiresSessionState
{
    //文件保存目录路径
    private String savePath = "/UploadImages/";
    //文件保存目录URL
    private String saveUrl = "/UploadImages/";
    //定义允许上传的文件扩展名
    private String fileTypes = "gif,jpg,jpeg,png,bmp";
    //最大文件大小
    private int maxSize = 1000000;

    private HttpContext context;

    public void ProcessRequest(HttpContext context)
    {

        CommonFunction.CheckUser();

        this.context = context;

        HttpPostedFile imgFile = context.Request.Files["imgFile"];
        if (imgFile == null)
        {
            showError("请选择文件。");
        }

        String dirPath = context.Server.MapPath(savePath);
        if (!Directory.Exists(dirPath))
        {
            showError("上传目录不存在。");
        }

        String fileName = imgFile.FileName;
        String fileExt = Path.GetExtension(fileName).ToLower();
        ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(','));

        if (imgFile.InputStream == null || imgFile.InputStream.Length > maxSize)
        {
            showError("上传文件大小超过限制。");
        }

        if (String.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1)
        {
            showError("上传文件扩展名是不允许的扩展名。");
        }

        String newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt;
        String filePath = dirPath + newFileName;

        imgFile.SaveAs(filePath);

        String fileUrl = saveUrl + newFileName;

        Hashtable hash = new Hashtable();
        hash["error"] = 0;
        hash["url"] = fileUrl;
        context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
        context.Response.Write(JsonMapper.ToJson(hash));
        context.Response.End();
    }

    private void showError(string message)
    {
        Hashtable hash = new Hashtable();
        hash["error"] = 1;
        hash["message"] = message;
        context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
        context.Response.Write(JsonMapper.ToJson(hash));
        context.Response.End();
    }

    public bool IsReusable
    {
        get
        {
            return true;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import * as React from 'react'

import { getDisplayName } from 'hoc/helpers'

import { AuthConfig, AuthServerProps, AuthWithServer } from '../types'

const withAuthScaphold = ({
  redirectOnError,
  redirectOnSuccess
}: AuthConfig) => (WrappedComponent: React.SFC<AuthWithServer>) => {
  const ScapholdAuth: React.SFC<AuthServerProps> = ({
    authHelpers: { errors, purgeSession, redirect },
    createUser,
    forgotPassword,
    history,
    location,
    loginUser,
    storeSession,
    updateUser,
    ...props
  }) => {
    // ------------------------------------
    // Private
    // ------------------------------------
    const newSession = (user) => {
      storeSession({ ...user, sessionType: 'basic' })
      return user
    }

    // ------------------------------------
    // Public Methods
    // ------------------------------------
    const createAccount = (input) => createUser(input).then(newSession)

    const login = (input) => loginUser(input).then(newSession)

    const logout = () => purgeSession()

    const updatePassword = (input) => updateUser(input)

    const recoverAccount = (input) => forgotPassword(input)

    const authProps = {
      createAccount,
      login,
      logout,
      recoverAccount,
      updatePassword
    }

    const passThruProps = {
      errors,
      history,
      location,
      redirect,
      redirectOnError,
      redirectOnSuccess
    }

    return (
      <WrappedComponent {...authProps} {...props} {...passThruProps} />
    )
  }

  ScapholdAuth.displayName = getDisplayName(WrappedComponent, 'scapholdAuth')

  return ScapholdAuth
}

export default withAuthScaphold


text:
package sample.jsp;

import java.net.URI;
import java.util.Arrays;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Basic integration tests for JSP application.
 *
 * @author Phillip Webb
 */
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class SampleWebJspApplicationTests {

	@Autowired
	private TestRestTemplate restTemplate;

	@Test
	public void testJspWithEl() {
		ResponseEntity<String> entity = this.restTemplate.getForEntity("/", String.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
		assertThat(entity.getBody()).contains("/resources/text.txt");
	}

	@Test
	public void customErrorPage() throws Exception {
		HttpHeaders headers = new HttpHeaders();
		headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
		RequestEntity<Void> request = new RequestEntity<>(headers, HttpMethod.GET,
				URI.create("/foo"));
		ResponseEntity<String> entity = this.restTemplate.exchange(request, String.class);
		assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
		assertThat(entity.getBody())
				.contains("Something went wrong: 500 Internal Server Error");
	}

}


text:
var TodoItem = (function () {
    function TodoItem(id, title) {
        this.id = id;
        this.title = title;
    }
    TodoItem.prototype.toString = function () {
        return this.title;
    };
    return TodoItem;
})();
exports.TodoItem = TodoItem;


text:
<ng-content></ng-content>
<a class="type-toggle" (click)="toggleShow()">
	<ion-icon class="show-option" [hidden]="show" name="eye"></ion-icon>
	<ion-icon class="hide-option" [hidden]="!show" name="eye-off"></ion-icon>
</a>


text:
"""Tests for the session manager."""

from unittest import TestCase

from tornado import web

from ..sessionmanager import SessionManager
from IPython.html.services.kernels.kernelmanager import MappingKernelManager
from IPython.html.services.contents.manager import ContentsManager

class DummyKernel(object):
    def __init__(self, kernel_name='python'):
        self.kernel_name = kernel_name

class DummyMKM(MappingKernelManager):
    """MappingKernelManager interface that doesn't start kernels, for testing"""
    def __init__(self, *args, **kwargs):
        super(DummyMKM, self).__init__(*args, **kwargs)
        self.id_letters = iter(u'ABCDEFGHIJK')

    def _new_id(self):
        return next(self.id_letters)

    def start_kernel(self, kernel_id=None, path=None, kernel_name='python', **kwargs):
        kernel_id = kernel_id or self._new_id()
        self._kernels[kernel_id] = DummyKernel(kernel_name=kernel_name)
        return kernel_id

    def shutdown_kernel(self, kernel_id, now=False):
        del self._kernels[kernel_id]

class TestSessionManager(TestCase):

    def setUp(self):
        self.sm = SessionManager(
            kernel_manager=DummyMKM(),
            contents_manager=ContentsManager(),
        )

    def test_get_session(self):
        sm = self.sm
        session_id = sm.create_session(path='/path/to/test.ipynb',
                                       kernel_name='bar')['id']
        model = sm.get_session(session_id=session_id)
        expected = {'id':session_id,
                    'notebook':{'path': u'/path/to/test.ipynb'},
                    'kernel': {'id':u'A', 'name': 'bar'}}
        self.assertEqual(model, expected)

    def test_bad_get_session(self):
        # Should raise error if a bad key is passed to the database.
        sm = self.sm
        session_id = sm.create_session(path='/path/to/test.ipynb',
                                       kernel_name='foo')['id']
        self.assertRaises(TypeError, sm.get_session, bad_id=session_id) # Bad keyword

    def test_get_session_dead_kernel(self):
        sm = self.sm
        session = sm.create_session(path='/path/to/1/test1.ipynb', kernel_name='python')
        # kill the kernel
        sm.kernel_manager.shutdown_kernel(session['kernel']['id'])
        with self.assertRaises(KeyError):
            sm.get_session(session_id=session['id'])
        # no sessions left
        listed = sm.list_sessions()
        self.assertEqual(listed, [])

    def test_list_sessions(self):
        sm = self.sm
        sessions = [
            sm.create_session(path='/path/to/1/test1.ipynb', kernel_name='python'),
            sm.create_session(path='/path/to/2/test2.ipynb', kernel_name='python'),
            sm.create_session(path='/path/to/3/test3.ipynb', kernel_name='python'),
        ]
        sessions = sm.list_sessions()
        expected = [
            {
                'id':sessions[0]['id'],
                'notebook':{'path': u'/path/to/1/test1.ipynb'},
                'kernel':{'id':u'A', 'name':'python'}
            }, {
                'id':sessions[1]['id'],
                'notebook': {'path': u'/path/to/2/test2.ipynb'},
                'kernel':{'id':u'B', 'name':'python'}
            }, {
                'id':sessions[2]['id'],
                'notebook':{'path': u'/path/to/3/test3.ipynb'},
                'kernel':{'id':u'C', 'name':'python'}
            }
        ]
        self.assertEqual(sessions, expected)

    def test_list_sessions_dead_kernel(self):
        sm = self.sm
        sessions = [
            sm.create_session(path='/path/to/1/test1.ipynb', kernel_name='python'),
            sm.create_session(path='/path/to/2/test2.ipynb', kernel_name='python'),
        ]
        # kill one of the kernels
        sm.kernel_manager.shutdown_kernel(sessions[0]['kernel']['id'])
        listed = sm.list_sessions()
        expected = [
            {
                'id': sessions[1]['id'],
                'notebook': {
                    'path': u'/path/to/2/test2.ipynb',
                },
                'kernel': {
                    'id': u'B',
                    'name':'python',
                }
            }
        ]
        self.assertEqual(listed, expected)

    def test_update_session(self):
        sm = self.sm
        session_id = sm.create_session(path='/path/to/test.ipynb',
                                       kernel_name='julia')['id']
        sm.update_session(session_id, path='/path/to/new_name.ipynb')
        model = sm.get_session(session_id=session_id)
        expected = {'id':session_id,
                    'notebook':{'path': u'/path/to/new_name.ipynb'},
                    'kernel':{'id':u'A', 'name':'julia'}}
        self.assertEqual(model, expected)

    def test_bad_update_session(self):
        # try to update a session with a bad keyword ~ raise error
        sm = self.sm
        session_id = sm.create_session(path='/path/to/test.ipynb',
                                       kernel_name='ir')['id']
        self.assertRaises(TypeError, sm.update_session, session_id=session_id, bad_kw='test.ipynb') # Bad keyword

    def test_delete_session(self):
        sm = self.sm
        sessions = [
            sm.create_session(path='/path/to/1/test1.ipynb', kernel_name='python'),
            sm.create_session(path='/path/to/2/test2.ipynb', kernel_name='python'),
            sm.create_session(path='/path/to/3/test3.ipynb', kernel_name='python'),
        ]
        sm.delete_session(sessions[1]['id'])
        new_sessions = sm.list_sessions()
        expected = [{
                'id': sessions[0]['id'],
                'notebook': {'path': u'/path/to/1/test1.ipynb'},
                'kernel': {'id':u'A', 'name':'python'}
            }, {
                'id': sessions[2]['id'],
                'notebook': {'path': u'/path/to/3/test3.ipynb'},
                'kernel': {'id':u'C', 'name':'python'}
            }
        ]
        self.assertEqual(new_sessions, expected)

    def test_bad_delete_session(self):
        # try to delete a session that doesn't exist ~ raise error
        sm = self.sm
        sm.create_session(path='/path/to/test.ipynb', kernel_name='python')
        self.assertRaises(TypeError, sm.delete_session, bad_kwarg='23424') # Bad keyword
        self.assertRaises(web.HTTPError, sm.delete_session, session_id='23424') # nonexistant


text:
(function() {

	var app;
	var DOMReadyEvent;

	var prerun = [];
	var registerPrerunCallback = function(callback, context) {
		prerun.push({method: callback, context: context});
	};

	// Determine the proper event for DOM is ready
	if (jasy.Env.getValue('engine') == 'trident') {
		DOMReadyEvent = 'readystatechange';
	} else {
		DOMReadyEvent = 'DOMContentLoaded';
	}

	/**
	 * Is document ready?
	 *
	 * @return {Boolean} true: Document/DOM is ready;
	 *                   false: otherwise
	 */
	var isDocReady = function() {
		var isReady = false;

		if (jasy.Env.getValue('engine') === 'trident') {
			if (document.readyState === 'complete') {
				isReady = true;
			}
		} else {
			if (document.readyState === 'interactive' || document.readyState === 'complete') {
				isReady = true;
			}
		}

		return isReady;
	};

	/**
	 * Handle document state changes
	 *
	 * Called when the state of the document changes, for example from
	 * interactive to complete.
	 *
	 * @param event {Event} The state change event
	 */
	var onDocStateChange = function(event) {
		if (isDocReady()) {
			runStartUp();
		}
	};

	/**
	 * Run start routine
	 *
	 * When the document is ready, the application is initialized.
	 */
	var runStartUp = function() {
		if (isDocReady()) {
			lowland.bom.Events.unlisten(document, DOMReadyEvent, onDocStateChange);

			var Application = core.Class.getByName(jasy.Env.getValue('application') + '.Application');
			var init = app = new Application();

			if (prerun.length <= 0) {
				init.main();
				init.finalize();
			} else {
				var preruns = prerun.length;

				var cbrun = function() {
					preruns--;
					if (preruns === 0) {
						init.main();
						init.finalize();
					}
				};

				for (var i=0,ii=prerun.length; i<ii; i++) {
					prerun[i].method.call(prerun[i].context, cbrun);
				}
			}
		}
	};

	/**
	 * Get application
	 *
	 * Returns reference to the (instantiated) application
	 *
	 * @return {var} Reference to the (instantiated) application
	 */
	var getApplication = function() {
		return app;
	};

	/**
	 * Start-up
	 */
	var startUp = function() {
		if (isDocReady()) {
			runStartUp();
		} else {
			lowland.bom.Events.listen(document, DOMReadyEvent, onDocStateChange);
		}
	};

	/**
	 * Shut-down
	 */
	var shutDown = function() {
		lowland.ObjectManager.dispose();
	};

	/**
	 * Init
	 */
	core.Class("unify.core.Init", {
		include : [unify.core.Object],

		construct : function() {
			unify.core.Object.call(this);
		},

		members : {
			main : function() {
				throw new Error("main is not implemented");
			},
			finalize : function() {}
		}
	});

	unify.core.Statics.annotate(unify.core.Init, {
		getApplication : getApplication,
		registerPrerunCallback : registerPrerunCallback,
		startUp : startUp,
		shutDown : shutDown
	});

})();


text:
package testing

// helper for testing plugins
// a fake host is created here that can be used by plugins for testing

import (
	"k8s.io/kubernetes/pkg/api"
	clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
	kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
	containertest "k8s.io/kubernetes/pkg/kubelet/container/testing"
)

type fakeNetworkHost struct {
	fakeNamespaceGetter
	kubeClient clientset.Interface
	Legacy     bool
	Runtime    *containertest.FakeRuntime
}

func NewFakeHost(kubeClient clientset.Interface) *fakeNetworkHost {
	host := &fakeNetworkHost{kubeClient: kubeClient, Legacy: true, Runtime: &containertest.FakeRuntime{}}
	return host
}

func (fnh *fakeNetworkHost) GetPodByName(name, namespace string) (*api.Pod, bool) {
	return nil, false
}

func (fnh *fakeNetworkHost) GetKubeClient() clientset.Interface {
	return nil
}

func (nh *fakeNetworkHost) GetRuntime() kubecontainer.Runtime {
	return nh.Runtime
}

func (nh *fakeNetworkHost) SupportsLegacyFeatures() bool {
	return nh.Legacy
}

type fakeNamespaceGetter struct {
	ns string
}

func (nh *fakeNamespaceGetter) GetNetNS(containerID string) (string, error) {
	return nh.ns, nil
}


text:
package com.fasterxml.jackson.databind.cfg;

import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.Base64Variant;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair;
import com.fasterxml.jackson.databind.introspect.ClassIntrospector;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.io.Serializable;
import java.text.DateFormat;
import java.util.Locale;
import java.util.TimeZone;

public final class BaseSettings
  implements Serializable
{
  private static final long serialVersionUID = 4939673998947122190L;
  protected final AnnotationIntrospector _annotationIntrospector;
  protected final ClassIntrospector _classIntrospector;
  protected final DateFormat _dateFormat;
  protected final Base64Variant _defaultBase64;
  protected final HandlerInstantiator _handlerInstantiator;
  protected final Locale _locale;
  protected final PropertyNamingStrategy _propertyNamingStrategy;
  protected final TimeZone _timeZone;
  protected final TypeFactory _typeFactory;
  protected final TypeResolverBuilder<?> _typeResolverBuilder;
  protected final VisibilityChecker<?> _visibilityChecker;

  public BaseSettings(ClassIntrospector paramClassIntrospector, AnnotationIntrospector paramAnnotationIntrospector, VisibilityChecker<?> paramVisibilityChecker, PropertyNamingStrategy paramPropertyNamingStrategy, TypeFactory paramTypeFactory, TypeResolverBuilder<?> paramTypeResolverBuilder, DateFormat paramDateFormat, HandlerInstantiator paramHandlerInstantiator, Locale paramLocale, TimeZone paramTimeZone, Base64Variant paramBase64Variant)
  {
    this._classIntrospector = paramClassIntrospector;
    this._annotationIntrospector = paramAnnotationIntrospector;
    this._visibilityChecker = paramVisibilityChecker;
    this._propertyNamingStrategy = paramPropertyNamingStrategy;
    this._typeFactory = paramTypeFactory;
    this._typeResolverBuilder = paramTypeResolverBuilder;
    this._dateFormat = paramDateFormat;
    this._handlerInstantiator = paramHandlerInstantiator;
    this._locale = paramLocale;
    this._timeZone = paramTimeZone;
    this._defaultBase64 = paramBase64Variant;
  }

  public final AnnotationIntrospector getAnnotationIntrospector()
  {
    return this._annotationIntrospector;
  }

  public final Base64Variant getBase64Variant()
  {
    return this._defaultBase64;
  }

  public final ClassIntrospector getClassIntrospector()
  {
    return this._classIntrospector;
  }

  public final DateFormat getDateFormat()
  {
    return this._dateFormat;
  }

  public final HandlerInstantiator getHandlerInstantiator()
  {
    return this._handlerInstantiator;
  }

  public final Locale getLocale()
  {
    return this._locale;
  }

  public final PropertyNamingStrategy getPropertyNamingStrategy()
  {
    return this._propertyNamingStrategy;
  }

  public final TimeZone getTimeZone()
  {
    return this._timeZone;
  }

  public final TypeFactory getTypeFactory()
  {
    return this._typeFactory;
  }

  public final TypeResolverBuilder<?> getTypeResolverBuilder()
  {
    return this._typeResolverBuilder;
  }

  public final VisibilityChecker<?> getVisibilityChecker()
  {
    return this._visibilityChecker;
  }

  public final BaseSettings with(Base64Variant paramBase64Variant)
  {
    if (paramBase64Variant == this._defaultBase64)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, paramBase64Variant);
  }

  public final BaseSettings with(Locale paramLocale)
  {
    if (this._locale == paramLocale)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, paramLocale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings with(TimeZone paramTimeZone)
  {
    if (paramTimeZone == null)
      throw new IllegalArgumentException();
    DateFormat localDateFormat1 = this._dateFormat;
    Object localObject;
    if ((localDateFormat1 instanceof StdDateFormat))
    {
      localObject = ((StdDateFormat)localDateFormat1).withTimeZone(paramTimeZone);
    }
    else
    {
      DateFormat localDateFormat2 = (DateFormat)localDateFormat1.clone();
      localObject = localDateFormat2;
      localDateFormat2.setTimeZone(paramTimeZone);
    }
    ClassIntrospector localClassIntrospector = this._classIntrospector;
    AnnotationIntrospector localAnnotationIntrospector = this._annotationIntrospector;
    VisibilityChecker localVisibilityChecker = this._visibilityChecker;
    PropertyNamingStrategy localPropertyNamingStrategy = this._propertyNamingStrategy;
    TypeFactory localTypeFactory = this._typeFactory;
    TypeResolverBuilder localTypeResolverBuilder = this._typeResolverBuilder;
    HandlerInstantiator localHandlerInstantiator = this._handlerInstantiator;
    Locale localLocale = this._locale;
    Base64Variant localBase64Variant = this._defaultBase64;
    return new BaseSettings(localClassIntrospector, localAnnotationIntrospector, localVisibilityChecker, localPropertyNamingStrategy, localTypeFactory, localTypeResolverBuilder, (DateFormat)localObject, localHandlerInstantiator, localLocale, paramTimeZone, localBase64Variant);
  }

  public final BaseSettings withAnnotationIntrospector(AnnotationIntrospector paramAnnotationIntrospector)
  {
    if (this._annotationIntrospector == paramAnnotationIntrospector)
      return this;
    return new BaseSettings(this._classIntrospector, paramAnnotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withAppendedAnnotationIntrospector(AnnotationIntrospector paramAnnotationIntrospector)
  {
    return withAnnotationIntrospector(AnnotationIntrospectorPair.create(this._annotationIntrospector, paramAnnotationIntrospector));
  }

  public final BaseSettings withClassIntrospector(ClassIntrospector paramClassIntrospector)
  {
    if (this._classIntrospector == paramClassIntrospector)
      return this;
    return new BaseSettings(paramClassIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withDateFormat(DateFormat paramDateFormat)
  {
    if (this._dateFormat == paramDateFormat)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, paramDateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withHandlerInstantiator(HandlerInstantiator paramHandlerInstantiator)
  {
    if (this._handlerInstantiator == paramHandlerInstantiator)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, paramHandlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withInsertedAnnotationIntrospector(AnnotationIntrospector paramAnnotationIntrospector)
  {
    return withAnnotationIntrospector(AnnotationIntrospectorPair.create(paramAnnotationIntrospector, this._annotationIntrospector));
  }

  public final BaseSettings withPropertyNamingStrategy(PropertyNamingStrategy paramPropertyNamingStrategy)
  {
    if (this._propertyNamingStrategy == paramPropertyNamingStrategy)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, paramPropertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withTypeFactory(TypeFactory paramTypeFactory)
  {
    if (this._typeFactory == paramTypeFactory)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, paramTypeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withTypeResolverBuilder(TypeResolverBuilder<?> paramTypeResolverBuilder)
  {
    if (this._typeResolverBuilder == paramTypeResolverBuilder)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker, this._propertyNamingStrategy, this._typeFactory, paramTypeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withVisibility(PropertyAccessor paramPropertyAccessor, JsonAutoDetect.Visibility paramVisibility)
  {
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, this._visibilityChecker.withVisibility(paramPropertyAccessor, paramVisibility), this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }

  public final BaseSettings withVisibilityChecker(VisibilityChecker<?> paramVisibilityChecker)
  {
    if (this._visibilityChecker == paramVisibilityChecker)
      return this;
    return new BaseSettings(this._classIntrospector, this._annotationIntrospector, paramVisibilityChecker, this._propertyNamingStrategy, this._typeFactory, this._typeResolverBuilder, this._dateFormat, this._handlerInstantiator, this._locale, this._timeZone, this._defaultBase64);
  }
}

/* Location:           /Users/vikas/Documents/Mhacks_Real_app/classes-dex2jar.jar
 * Qualified Name:     com.fasterxml.jackson.databind.cfg.BaseSettings
 * JD-Core Version:    0.6.2
 */