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 >
Wrap
Text File
|
1998-05-08
|
13KB
|
292 lines
/*
* Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland as part
* of a Borland product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
* COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
* OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
* OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
* OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
* OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
* CODE FILE.
*/
package borland.samples.intl.gui.resources;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import borland.jbcl.dataset.*;
import borland.samples.intl.application.*;
import borland.samples.intl.beans.*;
import borland.samples.intl.beans.event.*;
import borland.samples.intl.gui.*;
/**
* CustomerInfoPanel for German (Switzerland) address format.
*/
public class CustomerInfoPanel_de_CH extends Panel implements InterchangeableCustomerInfoPanel {
AppDataModule appDataModule = AppDataModule.getDataModule();
FieldControl address1Field = new FieldControl();
FieldControl address2Field = new FieldControl();
FieldControl cityField = new FieldControl();
FieldControl countryField = new FieldControl();
FieldControl emailField = new FieldControl();
FieldControl faxField = new FieldControl();
FieldControl firstNameField = new FieldControl();
FieldControl lastNameField = new FieldControl();
FieldControl middleNameField = new FieldControl();
FieldControl phoneField = new FieldControl();
FieldControl postalCodeField = new FieldControl();
FieldControl provinceField = new FieldControl();
LabelControl address1Label = new LabelControl();
LabelControl address2Label = new LabelControl();
LabelControl cityLabel = new LabelControl();
LabelControl countryLabel = new LabelControl();
LabelControl emailLabel = new LabelControl();
LabelControl faxLabel = new LabelControl();
LabelControl firstNameLabel = new LabelControl();
LabelControl lastNameLabel = new LabelControl();
LabelControl middleNameLabel = new LabelControl();
LabelControl phoneLabel = new LabelControl();
LabelControl postalCodeLabel = new LabelControl();
LabelControl provinceLabel = new LabelControl();
GridBagLayout gridBagLayout1 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
GridBagLayout gridBagLayout3 = new GridBagLayout();
GridBagLayout gridBagLayout4 = new GridBagLayout();
GridBagLayout gridBagLayout5 = new GridBagLayout();
GridBagLayout gridBagLayout6 = new GridBagLayout();
BevelPanel bevelPanel1 = new BevelPanel();
BevelPanel bevelPanel2 = new BevelPanel();
BevelPanel bevelPanel3 = new BevelPanel();
BevelPanel bevelPanel4 = new BevelPanel();
BevelPanel bevelPanel5 = new BevelPanel();
BevelPanel bevelPanel6 = new BevelPanel();
GridLayout gridLayout1 = new GridLayout();
ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes",
LocaleChangeManager.getLocale());
public CustomerInfoPanel_de_CH() {
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception{
firstNameLabel.setAlignment(Label.RIGHT);
firstNameLabel.setText(textRes.getString("first_name"));
firstNameField.setColumnName("first_name");
firstNameField.setDataSet(appDataModule.getCustomerDataSet());
lastNameLabel.setAlignment(Label.RIGHT);
lastNameLabel.setText(textRes.getString("last_name"));
lastNameField.setColumnName("last_name");
lastNameField.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel1.setBevelInner(BevelPanel.FLAT);
bevelPanel1.setLayout(gridBagLayout1);
bevelPanel1.add(firstNameLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel1.add(firstNameField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
bevelPanel1.add(lastNameLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel1.add(lastNameField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel1, null);
address1Label.setAlignment(Label.RIGHT);
address1Label.setText(textRes.getString("address1"));
address1Field.setColumnName("address1");
address1Field.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel2.setBevelInner(BevelPanel.FLAT);
bevelPanel2.setLayout(gridBagLayout2);
bevelPanel2.add(address1Label, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel2.add(address1Field, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel2, null);
postalCodeLabel.setAlignment(Label.RIGHT);
postalCodeLabel.setText(textRes.getString("postal_code"));
postalCodeField.setColumnName("postal_code");
postalCodeField.setDataSet(appDataModule.getCustomerDataSet());
cityLabel.setAlignment(Label.RIGHT);
cityLabel.setText(textRes.getString("city"));
cityField.setColumnName("city");
cityField.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel3.setBevelInner(BevelPanel.FLAT);
bevelPanel3.setLayout(gridBagLayout3);
bevelPanel3.add(postalCodeLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel3.add(postalCodeField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
bevelPanel3.add(cityLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel3.add(cityField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel3, null);
countryLabel.setAlignment(Label.RIGHT);
countryLabel.setText(textRes.getString("country"));
countryField.setColumnName("country");
countryField.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel4.setBevelInner(BevelPanel.FLAT);
bevelPanel4.setLayout(gridBagLayout4);
bevelPanel4.add(countryLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel4.add(countryField, new GridBagConstraints2(1, 0, 4, 1, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel4, null);
phoneLabel.setAlignment(Label.RIGHT);
phoneLabel.setText(textRes.getString("phone"));
phoneField.setColumnName("phone");
phoneField.setDataSet(appDataModule.getCustomerDataSet());
faxLabel.setAlignment(Label.RIGHT);
faxLabel.setText(textRes.getString("fax"));
faxField.setColumnName("fax");
faxField.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel5.setBevelInner(BevelPanel.FLAT);
bevelPanel5.setLayout(gridBagLayout5);
bevelPanel5.add(phoneLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel5.add(phoneField, new GridBagConstraints2(1, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
bevelPanel5.add(faxLabel, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel5.add(faxField, new GridBagConstraints2(5, 0, 3, 1, 50.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel5, null);
emailLabel.setAlignment(Label.RIGHT);
emailLabel.setText(textRes.getString("e_mail"));
emailField.setColumnName("e_mail");
emailField.setDataSet(appDataModule.getCustomerDataSet());
bevelPanel6.setBevelInner(BevelPanel.FLAT);
bevelPanel6.setLayout(gridBagLayout6);
bevelPanel6.add(emailLabel, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
bevelPanel6.add(emailField, new GridBagConstraints2(1, 0, 3, 1, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
this.add(bevelPanel6, null);
gridLayout1.setRows(6);
gridLayout1.setColumns(1);
this.setLayout(gridLayout1);
}
public void setDataSet(DataSet dataSet) {
address1Field.setDataSet(dataSet);
address2Field.setDataSet(dataSet);
cityField.setDataSet(dataSet);
countryField.setDataSet(dataSet);
emailField.setDataSet(dataSet);
faxField.setDataSet(dataSet);
firstNameField.setDataSet(dataSet);
lastNameField.setDataSet(dataSet);
middleNameField.setDataSet(dataSet);
phoneField.setDataSet(dataSet);
postalCodeField.setDataSet(dataSet);
provinceField.setDataSet(dataSet);
}
public void setReadOnly(boolean readOnly) {
address1Field.setReadOnly(readOnly);
address2Field.setReadOnly(readOnly);
cityField.setReadOnly(readOnly);
countryField.setReadOnly(readOnly);
emailField.setReadOnly(readOnly);
faxField.setReadOnly(readOnly);
firstNameField.setReadOnly(readOnly);
lastNameField.setReadOnly(readOnly);
middleNameField.setReadOnly(readOnly);
phoneField.setReadOnly(readOnly);
postalCodeField.setReadOnly(readOnly);
provinceField.setReadOnly(readOnly);
if (readOnly) {
address1Field.setBackground(SystemColor.control);
address2Field.setBackground(SystemColor.control);
cityField.setBackground(SystemColor.control);
countryField.setBackground(SystemColor.control);
emailField.setBackground(SystemColor.control);
faxField.setBackground(SystemColor.control);
firstNameField.setBackground(SystemColor.control);
lastNameField.setBackground(SystemColor.control);
middleNameField.setBackground(SystemColor.control);
phoneField.setBackground(SystemColor.control);
postalCodeField.setBackground(SystemColor.control);
provinceField.setBackground(SystemColor.control);
} else {
address1Field.setBackground(SystemColor.window);
address2Field.setBackground(SystemColor.window);
cityField.setBackground(SystemColor.window);
countryField.setBackground(SystemColor.window);
emailField.setBackground(SystemColor.window);
faxField.setBackground(SystemColor.window);
firstNameField.setBackground(SystemColor.window);
lastNameField.setBackground(SystemColor.window);
middleNameField.setBackground(SystemColor.window);
phoneField.setBackground(SystemColor.window);
postalCodeField.setBackground(SystemColor.window);
provinceField.setBackground(SystemColor.window);
}
}
public void localeChanged(LocaleChangeEvent e) {
textRes = ResourceBundle.getBundle("borland.samples.intl.application.resources.TextRes", e.getLocale());
address1Label.setText(textRes.getString("address1"));
address2Label.setText(textRes.getString("address2"));
cityLabel.setText(textRes.getString("city"));
countryLabel.setText(textRes.getString("country"));
emailLabel.setText(textRes.getString("e_mail"));
faxLabel.setText(textRes.getString("fax"));
firstNameLabel.setText(textRes.getString("first_name"));
lastNameLabel.setText(textRes.getString("last_name"));
middleNameLabel.setText(textRes.getString("middle_name"));
phoneLabel.setText(textRes.getString("phone"));
postalCodeLabel.setText(textRes.getString("postal_code"));
provinceLabel.setText(textRes.getString("province"));
}
}