home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / inprise / JSAMPLES.Z / CustomerInfoPanel_fr.java < prev    next >
Text File  |  1998-05-08  |  14KB  |  305 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.  * CustomerInfoPanel for French (France) address format.
  37.  */
  38. public class CustomerInfoPanel_fr extends Panel implements InterchangeableCustomerInfoPanel {
  39.   AppDataModule appDataModule = AppDataModule.getDataModule();
  40.  
  41.   FieldControl address1Field = new FieldControl();
  42.   FieldControl address2Field = new FieldControl();
  43.   FieldControl cityField = new FieldControl();
  44.   FieldControl countryField = new FieldControl();
  45.   FieldControl emailField = new FieldControl();
  46.   FieldControl faxField = new FieldControl();
  47.   FieldControl firstNameField = new FieldControl();
  48.   FieldControl lastNameField = new FieldControl();
  49.   FieldControl middleNameField = new FieldControl();
  50.   FieldControl phoneField = new FieldControl();
  51.   FieldControl postalCodeField = new FieldControl();
  52.   FieldControl provinceField = new FieldControl();
  53.  
  54.   LabelControl address1Label = new LabelControl();
  55.   LabelControl address2Label = new LabelControl();
  56.   LabelControl cityLabel = new LabelControl();
  57.   LabelControl countryLabel = new LabelControl();
  58.   LabelControl emailLabel = new LabelControl();
  59.   LabelControl faxLabel = new LabelControl();
  60.   LabelControl firstNameLabel = new LabelControl();
  61.   LabelControl lastNameLabel = new LabelControl();
  62.   LabelControl middleNameLabel = new LabelControl();
  63.   LabelControl phoneLabel = new LabelControl();
  64.   LabelControl postalCodeLabel = new LabelControl();
  65.   LabelControl provinceLabel = new LabelControl();
  66.  
  67.   GridBagLayout gridBagLayout1 = new GridBagLayout();
  68.   GridBagLayout gridBagLayout2 = new GridBagLayout();
  69.   GridBagLayout gridBagLayout3 = new GridBagLayout();
  70.   GridBagLayout gridBagLayout4 = new GridBagLayout();
  71.   GridBagLayout gridBagLayout5 = new GridBagLayout();
  72.   GridBagLayout gridBagLayout6 = new GridBagLayout();
  73.  
  74.   BevelPanel bevelPanel1 = new BevelPanel();
  75.   BevelPanel bevelPanel2 = new BevelPanel();
  76.   BevelPanel bevelPanel3 = new BevelPanel();
  77.   BevelPanel bevelPanel4 = new BevelPanel();
  78.   BevelPanel bevelPanel5 = new BevelPanel();
  79.   BevelPanel bevelPanel6 = new BevelPanel();
  80.  
  81.   GridLayout gridLayout1 = new GridLayout();
  82.  
  83.   ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes",
  84.                                                               LocaleChangeManager.getLocale());
  85.  
  86.   public CustomerInfoPanel_fr() {
  87.     try {
  88.       jbInit();
  89.     }
  90.     catch (Exception e) {
  91.       e.printStackTrace();
  92.     }
  93.   }
  94.  
  95.   public void jbInit() throws Exception{
  96.  
  97.     firstNameLabel.setAlignment(Label.RIGHT);
  98.     firstNameLabel.setText(textRes.getString("first_name"));
  99.  
  100.     firstNameField.setColumnName("first_name");
  101.     firstNameField.setDataSet(appDataModule.getCustomerDataSet());
  102.  
  103.     lastNameLabel.setAlignment(Label.RIGHT);
  104.     lastNameLabel.setText(textRes.getString("last_name"));
  105.  
  106.     lastNameField.setColumnName("last_name");
  107.     lastNameField.setDataSet(appDataModule.getCustomerDataSet());
  108.  
  109.     bevelPanel1.setBevelInner(BevelPanel.FLAT);
  110.     bevelPanel1.setLayout(gridBagLayout1);
  111.     bevelPanel1.add(firstNameLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  112.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  113.     bevelPanel1.add(firstNameField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
  114.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  115.     bevelPanel1.add(lastNameLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  116.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  117.     bevelPanel1.add(lastNameField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
  118.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  119.     this.add(bevelPanel1, null);
  120.  
  121.     address1Label.setAlignment(Label.RIGHT);
  122.     address1Label.setText(textRes.getString("address1"));
  123.  
  124.     address1Field.setColumnName("address1");
  125.     address1Field.setDataSet(appDataModule.getCustomerDataSet());
  126.  
  127.     bevelPanel2.setBevelInner(BevelPanel.FLAT);
  128.     bevelPanel2.setLayout(gridBagLayout2);
  129.     bevelPanel2.add(address1Label, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  130.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  131.     bevelPanel2.add(address1Field, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  132.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  133.     this.add(bevelPanel2, null);
  134.  
  135.     address2Label.setAlignment(Label.RIGHT);
  136.     address2Label.setText(textRes.getString("address2"));
  137.  
  138.     address2Field.setColumnName("address2");
  139.     address2Field.setDataSet(appDataModule.getCustomerDataSet());
  140.  
  141.     bevelPanel3.setBevelInner(BevelPanel.FLAT);
  142.     bevelPanel3.setLayout(gridBagLayout3);
  143.     bevelPanel3.add(address2Label, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  144.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  145.     bevelPanel3.add(address2Field, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  146.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  147.     this.add(bevelPanel3, null);
  148.  
  149.     postalCodeLabel.setAlignment(Label.RIGHT);
  150.     postalCodeLabel.setText(textRes.getString("postal_code"));
  151.  
  152.     postalCodeField.setColumnName("postal_code");
  153.     postalCodeField.setDataSet(appDataModule.getCustomerDataSet());
  154.  
  155.     cityLabel.setAlignment(Label.RIGHT);
  156.     cityLabel.setText(textRes.getString("city"));
  157.  
  158.     cityField.setColumnName("city");
  159.     cityField.setDataSet(appDataModule.getCustomerDataSet());
  160.  
  161.     bevelPanel4.setBevelInner(BevelPanel.FLAT);
  162.     bevelPanel4.setLayout(gridBagLayout4);
  163.     bevelPanel4.add(postalCodeLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  164.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  165.     bevelPanel4.add(postalCodeField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
  166.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  167.     bevelPanel4.add(cityLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  168.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  169.     bevelPanel4.add(cityField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
  170.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  171.     this.add(bevelPanel4, null);
  172.  
  173.     countryLabel.setAlignment(Label.RIGHT);
  174.     countryLabel.setText(textRes.getString("country"));
  175.  
  176.     countryField.setColumnName("country");
  177.     countryField.setDataSet(appDataModule.getCustomerDataSet());
  178.  
  179.     bevelPanel5.setBevelInner(BevelPanel.FLAT);
  180.     bevelPanel5.setLayout(gridBagLayout5);
  181.     bevelPanel5.add(countryLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  182.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  183.     bevelPanel5.add(countryField, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
  184.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  185.     this.add(bevelPanel5, null);
  186.  
  187.     phoneLabel.setAlignment(Label.RIGHT);
  188.     phoneLabel.setText(textRes.getString("phone"));
  189.  
  190.     phoneField.setColumnName("phone");
  191.     phoneField.setDataSet(appDataModule.getCustomerDataSet());
  192.  
  193.     faxLabel.setAlignment(Label.RIGHT);
  194.     faxLabel.setText(textRes.getString("fax"));
  195.  
  196.     faxField.setColumnName("fax");
  197.     faxField.setDataSet(appDataModule.getCustomerDataSet());
  198.  
  199.     emailLabel.setAlignment(Label.RIGHT);
  200.     emailLabel.setText(textRes.getString("e_mail"));
  201.  
  202.     emailField.setColumnName("e_mail");
  203.     emailField.setDataSet(appDataModule.getCustomerDataSet());
  204.  
  205.     bevelPanel6.setBevelInner(BevelPanel.FLAT);
  206.     bevelPanel6.setLayout(gridBagLayout6);
  207.     bevelPanel6.add(phoneLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  208.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  209.     bevelPanel6.add(phoneField, new GridBagConstraints2(1, 0, 3, 1, 33.0, 0.0
  210.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  211.     bevelPanel6.add(faxLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  212.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  213.     bevelPanel6.add(faxField, new GridBagConstraints2(5, 0, 3, 1, 33.0, 0.0
  214.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  215.     bevelPanel6.add(emailLabel, new GridBagConstraints2(8, 0, 1, 1, 0.0, 0.0
  216.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  217.     bevelPanel6.add(emailField, new GridBagConstraints2(9, 0, 3, 1, 33.0, 0.0
  218.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  219.     this.add(bevelPanel6, null);
  220.  
  221.     gridLayout1.setRows(6);
  222.     gridLayout1.setColumns(1);
  223.     this.setLayout(gridLayout1);
  224.  
  225.   }
  226.  
  227.   public void setDataSet(DataSet dataSet) {
  228.     address1Field.setDataSet(dataSet);
  229.     address2Field.setDataSet(dataSet);
  230.     cityField.setDataSet(dataSet);
  231.     countryField.setDataSet(dataSet);
  232.     emailField.setDataSet(dataSet);
  233.     faxField.setDataSet(dataSet);
  234.     firstNameField.setDataSet(dataSet);
  235.     lastNameField.setDataSet(dataSet);
  236.     middleNameField.setDataSet(dataSet);
  237.     phoneField.setDataSet(dataSet);
  238.     postalCodeField.setDataSet(dataSet);
  239.     provinceField.setDataSet(dataSet);
  240.   }
  241.  
  242.   public void setReadOnly(boolean readOnly) {
  243.  
  244.     address1Field.setReadOnly(readOnly);
  245.     address2Field.setReadOnly(readOnly);
  246.     cityField.setReadOnly(readOnly);
  247.     countryField.setReadOnly(readOnly);
  248.     emailField.setReadOnly(readOnly);
  249.     faxField.setReadOnly(readOnly);
  250.     firstNameField.setReadOnly(readOnly);
  251.     lastNameField.setReadOnly(readOnly);
  252.     middleNameField.setReadOnly(readOnly);
  253.     phoneField.setReadOnly(readOnly);
  254.     postalCodeField.setReadOnly(readOnly);
  255.     provinceField.setReadOnly(readOnly);
  256.  
  257.     if (readOnly) {
  258.       address1Field.setBackground(SystemColor.control);
  259.       address2Field.setBackground(SystemColor.control);
  260.       cityField.setBackground(SystemColor.control);
  261.       countryField.setBackground(SystemColor.control);
  262.       emailField.setBackground(SystemColor.control);
  263.       faxField.setBackground(SystemColor.control);
  264.       firstNameField.setBackground(SystemColor.control);
  265.       lastNameField.setBackground(SystemColor.control);
  266.       middleNameField.setBackground(SystemColor.control);
  267.       phoneField.setBackground(SystemColor.control);
  268.       postalCodeField.setBackground(SystemColor.control);
  269.       provinceField.setBackground(SystemColor.control);
  270.     } else {
  271.       address1Field.setBackground(SystemColor.window);
  272.       address2Field.setBackground(SystemColor.window);
  273.       cityField.setBackground(SystemColor.window);
  274.       countryField.setBackground(SystemColor.window);
  275.       emailField.setBackground(SystemColor.window);
  276.       faxField.setBackground(SystemColor.window);
  277.       firstNameField.setBackground(SystemColor.window);
  278.       lastNameField.setBackground(SystemColor.window);
  279.       middleNameField.setBackground(SystemColor.window);
  280.       phoneField.setBackground(SystemColor.window);
  281.       postalCodeField.setBackground(SystemColor.window);
  282.       provinceField.setBackground(SystemColor.window);
  283.     }
  284.   }
  285.  
  286.   public void localeChanged(LocaleChangeEvent e) {
  287.     textRes = ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes", e.getLocale());
  288.     address1Label.setText(textRes.getString("address1"));
  289.     address2Label.setText(textRes.getString("address2"));
  290.     cityLabel.setText(textRes.getString("city"));
  291.     countryLabel.setText(textRes.getString("country"));
  292.     emailLabel.setText(textRes.getString("e_mail"));
  293.     faxLabel.setText(textRes.getString("fax"));
  294.     firstNameLabel.setText(textRes.getString("first_name"));
  295.     lastNameLabel.setText(textRes.getString("last_name"));
  296.     middleNameLabel.setText(textRes.getString("middle_name"));
  297.     phoneLabel.setText(textRes.getString("phone"));
  298.     postalCodeLabel.setText(textRes.getString("postal_code"));
  299.     provinceLabel.setText(textRes.getString("province"));
  300.   }
  301.  
  302. }
  303.  
  304.  
  305.