home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / inprise / JSAMPLES.Z / CustomerInfoPanel_ko.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 Korean (Korea) address format.
  37.  */
  38. public class CustomerInfoPanel_ko 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_ko() {
  87.     try {
  88.       jbInit();
  89.     }
  90.     catch (Exception e) {
  91.       e.printStackTrace();
  92.     }
  93.   }
  94.  
  95.   public void jbInit() throws Exception{
  96.  
  97.     countryLabel.setAlignment(Label.RIGHT);
  98.     countryLabel.setText(textRes.getString("country"));
  99.  
  100.     countryField.setColumnName("country");
  101.     countryField.setDataSet(appDataModule.getCustomerDataSet());
  102.  
  103.     bevelPanel1.setBevelInner(BevelPanel.FLAT);
  104.     bevelPanel1.setLayout(gridBagLayout1);
  105.     bevelPanel1.add(countryLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  106.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  107.     bevelPanel1.add(countryField, new GridBagConstraints2(1, 0, 3, 1, 100.0, 0.0
  108.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  109.     this.add(bevelPanel1, null);
  110.  
  111.     postalCodeLabel.setAlignment(Label.RIGHT);
  112.     postalCodeLabel.setText(textRes.getString("postal_code"));
  113.  
  114.     postalCodeField.setColumnName("postal_code");
  115.     postalCodeField.setDataSet(appDataModule.getCustomerDataSet());
  116.  
  117.     provinceField.setColumnName("province");
  118.     provinceField.setDataSet(appDataModule.getCustomerDataSet());
  119.  
  120.     provinceLabel.setAlignment(Label.RIGHT);
  121.     provinceLabel.setText(textRes.getString("province"));
  122.  
  123.     cityLabel.setAlignment(Label.RIGHT);
  124.     cityLabel.setText(textRes.getString("city"));
  125.  
  126.     cityField.setColumnName("city");
  127.     cityField.setDataSet(appDataModule.getCustomerDataSet());
  128.  
  129.     bevelPanel2.setBevelInner(BevelPanel.FLAT);
  130.     bevelPanel2.setLayout(gridBagLayout2);
  131.     bevelPanel2.add(postalCodeLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  132.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  133.     bevelPanel2.add(postalCodeField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
  134.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  135.     bevelPanel2.add(provinceLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  136.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  137.     bevelPanel2.add(provinceField, new GridBagConstraints2(5, 0, 2, 1, 25.0, 0.0
  138.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  139.     bevelPanel2.add(cityLabel, new GridBagConstraints2(7, 0, 1, 1, 0.0, 0.0
  140.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  141.     bevelPanel2.add(cityField, new GridBagConstraints2(8, 0, 2, 1, 25.0, 0.0
  142.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  143.     this.add(bevelPanel2, null);
  144.  
  145.     address1Label.setAlignment(Label.RIGHT);
  146.     address1Label.setText(textRes.getString("address1"));
  147.  
  148.     address1Field.setColumnName("address1");
  149.     address1Field.setDataSet(appDataModule.getCustomerDataSet());
  150.  
  151.     bevelPanel3.setBevelInner(BevelPanel.FLAT);
  152.     bevelPanel3.setLayout(gridBagLayout3);
  153.     bevelPanel3.add(address1Label, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  154.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  155.     bevelPanel3.add(address1Field, new GridBagConstraints2(1, 0, 5, 1, 100.0, 0.0
  156.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  157.     this.add(bevelPanel3, null);
  158.  
  159.     lastNameLabel.setAlignment(Label.RIGHT);
  160.     lastNameLabel.setText(textRes.getString("last_name"));
  161.  
  162.     lastNameField.setColumnName("last_name");
  163.     lastNameField.setDataSet(appDataModule.getCustomerDataSet());
  164.  
  165.     firstNameLabel.setAlignment(Label.RIGHT);
  166.     firstNameLabel.setText(textRes.getString("first_name"));
  167.  
  168.     firstNameField.setColumnName("first_name");
  169.     firstNameField.setDataSet(appDataModule.getCustomerDataSet());
  170.  
  171.     bevelPanel4.setBevelInner(BevelPanel.FLAT);
  172.     bevelPanel4.setLayout(gridBagLayout4);
  173.     bevelPanel4.add(lastNameLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  174.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  175.     bevelPanel4.add(lastNameField, new GridBagConstraints2(1, 0, 1, 1, 50.0, 0.0
  176.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  177.     bevelPanel4.add(firstNameLabel, new GridBagConstraints2(2, 0, 1, 1, 0.0, 0.0
  178.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  179.     bevelPanel4.add(firstNameField, new GridBagConstraints2(3, 0, 1, 1, 50.0, 0.0
  180.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  181.     this.add(bevelPanel4, null);
  182.  
  183.     phoneLabel.setAlignment(Label.RIGHT);
  184.     phoneLabel.setText(textRes.getString("phone"));
  185.  
  186.     phoneField.setColumnName("phone");
  187.     phoneField.setDataSet(appDataModule.getCustomerDataSet());
  188.  
  189.     faxLabel.setAlignment(Label.RIGHT);
  190.     faxLabel.setText(textRes.getString("fax"));
  191.  
  192.     faxField.setColumnName("fax");
  193.     faxField.setDataSet(appDataModule.getCustomerDataSet());
  194.  
  195.     bevelPanel5.setBevelInner(BevelPanel.FLAT);
  196.     bevelPanel5.setLayout(gridBagLayout5);
  197.     bevelPanel5.add(phoneLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
  198.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  199.     bevelPanel5.add(phoneField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
  200.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  201.     bevelPanel5.add(faxLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
  202.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
  203.     bevelPanel5.add(faxField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
  204.             ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
  205.     this.add(bevelPanel5, null);
  206.  
  207.     emailLabel.setAlignment(Label.RIGHT);
  208.     emailLabel.setText(textRes.getString("e_mail"));
  209.  
  210.     emailField.setColumnName("e_mail");
  211.     emailField.setDataSet(appDataModule.getCustomerDataSet());
  212.  
  213.     bevelPanel6.setBevelInner(BevelPanel.FLAT);
  214.     bevelPanel6.setLayout(gridBagLayout6);
  215.     bevelPanel6.add(emailLabel, new GridBagConstraints2(0, 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(1, 0, 1, 1, 100.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.