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