home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / inprise / JSAMPLES.Z / CustomerInfoPanel_es.java < prev    next >
Text File  |  1998-05-08  |  14KB  |  306 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20.  
  21. package borland.samples.intl.gui.resources;
  22.  
  23. import java.awt.*;
  24. import java.awt.event.*;
  25. import java.util.*;
  26. import borland.jbcl.layout.*;
  27. import borland.jbcl.control.*;
  28. import borland.jbcl.dataset.*;
  29.  
  30. import borland.samples.intl.application.*;
  31. import borland.samples.intl.beans.*;
  32. import borland.samples.intl.beans.event.*;
  33. import borland.samples.intl.gui.*;
  34.  
  35.  
  36. /**
  37.  * CustomerInfoPanel for Spanish (Spain) address format.
  38.  */
  39. public class CustomerInfoPanel_es extends Panel implements InterchangeableCustomerInfoPanel {
  40.   AppDataModule appDataModule = AppDataModule.getDataModule();
  41.  
  42.   FieldControl address1Field = new FieldControl();
  43.   FieldControl address2Field = new FieldControl();
  44.   FieldControl cityField = new FieldControl();
  45.   FieldControl countryField = new FieldControl();
  46.   FieldControl emailField = new FieldControl();
  47.   FieldControl faxField = new FieldControl();
  48.   FieldControl firstNameField = new FieldControl();
  49.   FieldControl lastNameField = new FieldControl();
  50.   FieldControl middleNameField = new FieldControl();
  51.   FieldControl phoneField = new FieldControl();
  52.   FieldControl postalCodeField = new FieldControl();
  53.   FieldControl provinceField = new FieldControl();
  54.  
  55.   LabelControl address1Label = new LabelControl();
  56.   LabelControl address2Label = new LabelControl();
  57.   LabelControl cityLabel = new LabelControl();
  58.   LabelControl countryLabel = new LabelControl();
  59.   LabelControl emailLabel = new LabelControl();
  60.   LabelControl faxLabel = new LabelControl();
  61.   LabelControl firstNameLabel = new LabelControl();
  62.   LabelControl lastNameLabel = new LabelControl();
  63.   LabelControl middleNameLabel = new LabelControl();
  64.   LabelControl phoneLabel = new LabelControl();
  65.   LabelControl postalCodeLabel = new LabelControl();
  66.   LabelControl provinceLabel = new LabelControl();
  67.  
  68.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  69.   GridBagLayout gridBagLayout2 = new GridBagLayout();
  70.   GridBagLayout gridBagLayout3 = new GridBagLayout();
  71.   GridBagLayout gridBagLayout4 = new GridBagLayout();
  72.   GridBagLayout gridBagLayout5 = new GridBagLayout();
  73.   GridBagLayout gridBagLayout6 = new GridBagLayout();
  74.  
  75.   BevelPanel bevelPanel1 = new BevelPanel();
  76.   BevelPanel bevelPanel2 = new BevelPanel();
  77.   BevelPanel bevelPanel3 = new BevelPanel();
  78.   BevelPanel bevelPanel4 = new BevelPanel();
  79.   BevelPanel bevelPanel5 = new BevelPanel();
  80.   BevelPanel bevelPanel6 = new BevelPanel();
  81.  
  82.   GridLayout gridLayout1 = new GridLayout();
  83.  
  84.   ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes",
  85.                                                               LocaleChangeManager.getLocale());
  86.  
  87.   public CustomerInfoPanel_es() {
  88.     try {
  89.       jbInit();
  90.     }
  91.     catch (Exception e) {
  92.       e.printStackTrace();
  93.     }
  94.   }
  95.  
  96.   public void jbInit() throws Exception{
  97.  
  98.     firstNameLabel.setAlignment(Label.RIGHT);
  99.     firstNameLabel.setText(textRes.getString("first_name"));
  100.  
  101.     firstNameField.setColumnName("first_name");
  102.     firstNameField.setDataSet(appDataModule.getCustomerDataSet());
  103.  
  104.     middleNameLabel.setAlignment(Label.RIGHT);
  105.     middleNameLabel.setText(textRes.getString("middle_name"));
  106.  
  107.     middleNameField.setColumnName("middle_name");
  108.     middleNameField.setDataSet(appDataModule.getCustomerDataSet());
  109.  
  110.     lastNameLabel.setAlignment(Label.RIGHT);
  111.     lastNameLabel.setText(textRes.getString("last_name"));
  112.  
  113.     lastNameField.setColumnName("last_name");
  114.     lastNameField.setDataSet(appDataModule.getCustomerDataSet());
  115.  
  116.     bevelPanel1.setBevelInner(BevelPanel.FLAT);
  117.     bevelPanel1.setLayout(gridBagLayout1);
  118.     bevelPanel1.add(firstNameLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  119.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  120.     bevelPanel1.add(firstNameField, new GridBagConstraints2(1, 0, 3, 1, 40.0, 0.0
  121.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  122.     bevelPanel1.add(middleNameLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  123.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  124.     bevelPanel1.add(middleNameField, new GridBagConstraints2(5, 0, 3, 1, 30.0, 0.0
  125.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  126.     bevelPanel1.add(lastNameLabel, new GridBagConstraints2(8, 0, 1, 1, 0.0, 0.0
  127.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  128.     bevelPanel1.add(lastNameField, new GridBagConstraints2(9, 0, 3, 1, 30.0, 0.0
  129.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  130.     this.add(bevelPanel1, null);
  131.  
  132.     address1Label.setAlignment(Label.RIGHT);
  133.     address1Label.setText(textRes.getString("address1"));
  134.  
  135.     address1Field.setColumnName("address1");
  136.     address1Field.setDataSet(appDataModule.getCustomerDataSet());
  137.  
  138.     bevelPanel2.setBevelInner(BevelPanel.FLAT);
  139.     bevelPanel2.setLayout(gridBagLayout2);
  140.     bevelPanel2.add(address1Label, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  141.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  142.     bevelPanel2.add(address1Field, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  143.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  144.     this.add(bevelPanel2, null);
  145.  
  146.     postalCodeLabel.setAlignment(Label.RIGHT);
  147.     postalCodeLabel.setText(textRes.getString("postal_code"));
  148.  
  149.     postalCodeField.setColumnName("postal_code");
  150.     postalCodeField.setDataSet(appDataModule.getCustomerDataSet());
  151.  
  152.     cityLabel.setAlignment(Label.RIGHT);
  153.     cityLabel.setText(textRes.getString("city"));
  154.  
  155.     cityField.setColumnName("city");
  156.     cityField.setDataSet(appDataModule.getCustomerDataSet());
  157.  
  158.     bevelPanel3.setBevelInner(BevelPanel.FLAT);
  159.     bevelPanel3.setLayout(gridBagLayout3);
  160.     bevelPanel3.add(postalCodeLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  161.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  162.     bevelPanel3.add(postalCodeField, new GridBagConstraints2(1, 0, 2, 1, 10.0, 0.0
  163.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  164.     bevelPanel3.add(cityLabel, new GridBagConstraints2(3, 0, 1, 1, 0.0, 0.0
  165.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  166.     bevelPanel3.add(cityField, new GridBagConstraints2(4, 0, 3, 1, 45.0, 0.0
  167.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  168.     this.add(bevelPanel3, null);
  169.  
  170.     countryLabel.setAlignment(Label.RIGHT);
  171.     countryLabel.setText(textRes.getString("country"));
  172.  
  173.     countryField.setColumnName("country");
  174.     countryField.setDataSet(appDataModule.getCustomerDataSet());
  175.  
  176.     bevelPanel4.setBevelInner(BevelPanel.FLAT);
  177.     bevelPanel4.setLayout(gridBagLayout4);
  178.     bevelPanel4.add(countryLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  179.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  180.     bevelPanel4.add(countryField, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  181.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  182.     this.add(bevelPanel4, null);
  183.  
  184.     phoneLabel.setAlignment(Label.RIGHT);
  185.     phoneLabel.setText(textRes.getString("phone"));
  186.  
  187.     phoneField.setColumnName("phone");
  188.     phoneField.setDataSet(appDataModule.getCustomerDataSet());
  189.  
  190.     faxLabel.setAlignment(Label.RIGHT);
  191.     faxLabel.setText(textRes.getString("fax"));
  192.  
  193.     faxField.setColumnName("fax");
  194.     faxField.setDataSet(appDataModule.getCustomerDataSet());
  195.  
  196.     bevelPanel5.setBevelInner(BevelPanel.FLAT);
  197.     bevelPanel5.setLayout(gridBagLayout5);
  198.     bevelPanel5.add(phoneLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  199.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  200.     bevelPanel5.add(phoneField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
  201.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  202.     bevelPanel5.add(faxLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  203.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  204.     bevelPanel5.add(faxField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
  205.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  206.     this.add(bevelPanel5, null);
  207.  
  208.     emailLabel.setAlignment(Label.RIGHT);
  209.     emailLabel.setText(textRes.getString("e_mail"));
  210.  
  211.     emailField.setColumnName("e_mail");
  212.     emailField.setDataSet(appDataModule.getCustomerDataSet());
  213.  
  214.     bevelPanel6.setBevelInner(BevelPanel.FLAT);
  215.     bevelPanel6.setLayout(gridBagLayout6);
  216.     bevelPanel6.add(emailLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  217.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  218.     bevelPanel6.add(emailField, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  219.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  220.     this.add(bevelPanel6, null);
  221.  
  222.     gridLayout1.setRows(6);
  223.     gridLayout1.setColumns(1);
  224.     this.setLayout(gridLayout1);
  225.  
  226.   }
  227.  
  228.   public void setDataSet(DataSet dataSet) {
  229.     address1Field.setDataSet(dataSet);
  230.     address2Field.setDataSet(dataSet);
  231.     cityField.setDataSet(dataSet);
  232.     countryField.setDataSet(dataSet);
  233.     emailField.setDataSet(dataSet);
  234.     faxField.setDataSet(dataSet);
  235.     firstNameField.setDataSet(dataSet);
  236.     lastNameField.setDataSet(dataSet);
  237.     middleNameField.setDataSet(dataSet);
  238.     phoneField.setDataSet(dataSet);
  239.     postalCodeField.setDataSet(dataSet);
  240.     provinceField.setDataSet(dataSet);
  241.   }
  242.  
  243.   public void setReadOnly(boolean readOnly) {
  244.  
  245.     address1Field.setReadOnly(readOnly);
  246.     address2Field.setReadOnly(readOnly);
  247.     cityField.setReadOnly(readOnly);
  248.     countryField.setReadOnly(readOnly);
  249.     emailField.setReadOnly(readOnly);
  250.     faxField.setReadOnly(readOnly);
  251.     firstNameField.setReadOnly(readOnly);
  252.     lastNameField.setReadOnly(readOnly);
  253.     middleNameField.setReadOnly(readOnly);
  254.     phoneField.setReadOnly(readOnly);
  255.     postalCodeField.setReadOnly(readOnly);
  256.     provinceField.setReadOnly(readOnly);
  257.  
  258.     if (readOnly) {
  259.       address1Field.setBackground(SystemColor.control);
  260.       address2Field.setBackground(SystemColor.control);
  261.       cityField.setBackground(SystemColor.control);
  262.       countryField.setBackground(SystemColor.control);
  263.       emailField.setBackground(SystemColor.control);
  264.       faxField.setBackground(SystemColor.control);
  265.       firstNameField.setBackground(SystemColor.control);
  266.       lastNameField.setBackground(SystemColor.control);
  267.       middleNameField.setBackground(SystemColor.control);
  268.       phoneField.setBackground(SystemColor.control);
  269.       postalCodeField.setBackground(SystemColor.control);
  270.       provinceField.setBackground(SystemColor.control);
  271.     } else {
  272.       address1Field.setBackground(SystemColor.window);
  273.       address2Field.setBackground(SystemColor.window);
  274.       cityField.setBackground(SystemColor.window);
  275.       countryField.setBackground(SystemColor.window);
  276.       emailField.setBackground(SystemColor.window);
  277.       faxField.setBackground(SystemColor.window);
  278.       firstNameField.setBackground(SystemColor.window);
  279.       lastNameField.setBackground(SystemColor.window);
  280.       middleNameField.setBackground(SystemColor.window);
  281.       phoneField.setBackground(SystemColor.window);
  282.       postalCodeField.setBackground(SystemColor.window);
  283.       provinceField.setBackground(SystemColor.window);
  284.     }
  285.   }
  286.  
  287.   public void localeChanged(LocaleChangeEvent e) {
  288.     textRes = ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes", e.getLocale());
  289.     address1Label.setText(textRes.getString("address1"));
  290.     address2Label.setText(textRes.getString("address2"));
  291.     cityLabel.setText(textRes.getString("city"));
  292.     countryLabel.setText(textRes.getString("country"));
  293.     emailLabel.setText(textRes.getString("e_mail"));
  294.     faxLabel.setText(textRes.getString("fax"));
  295.     firstNameLabel.setText(textRes.getString("first_name"));
  296.     lastNameLabel.setText(textRes.getString("last_name"));
  297.     middleNameLabel.setText(textRes.getString("middle_name"));
  298.     phoneLabel.setText(textRes.getString("phone"));
  299.     postalCodeLabel.setText(textRes.getString("postal_code"));
  300.     provinceLabel.setText(textRes.getString("province"));
  301.   }
  302.  
  303. }
  304.  
  305.  
  306.