home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
ShipToPanel.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
5KB
|
118 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;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import borland.samples.intl.application.*;
import borland.samples.intl.beans.*;
import borland.samples.intl.beans.event.*;
public class ShipToPanel extends BevelPanel implements LocaleChangeListener {
private AppDataModule appDataModule = AppDataModule.getDataModule();
BevelPanel bevelPanel1 = new BevelPanel();
BorderLayout borderLayout1 = new BorderLayout();
InterchangeableCustomerInfoPanel customerInfoPanel;
BorderLayout borderLayout2 = new BorderLayout();
CheckboxControl useSameAddressCheckbox = new CheckboxControl();
ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes",
LocaleChangeManager.getLocale());
ResourceBundle guiRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes",
LocaleChangeManager.getLocale());
public ShipToPanel() {
try {
// customerInfoPanel is loaded at runtime, so we can't design it using
// the designer. But we get it and set its properties here so it can
// be added to the panel in jbInit()
customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("ShipToCustomerInfoPanel");
customerInfoPanel.setReadOnly(true);
customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
customerInfoPanel.localeChanged(new LocaleChangeEvent(this, LocaleChangeManager.getLocale()));
jbInit();
LocaleChangeManager.getLocaleChangeManager().addLocaleChangeListener(this);
}
catch (Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception{
useSameAddressCheckbox.setChecked(true);
useSameAddressCheckbox.setLabel(textRes.getString("Use_same_address"));
useSameAddressCheckbox.addItemListener(new ShipToPanel_useSameAddressCheckbox_itemListenerAdapter(this));
this.setLayout(borderLayout1);
this.add(useSameAddressCheckbox, BorderLayout.NORTH);
this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
}
void useSameAddressCheckbox_itemStateChanged(ItemEvent e) {
if (useSameAddressCheckbox.isChecked()) {
customerInfoPanel.setReadOnly(true);
customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
} else {
customerInfoPanel.setReadOnly(false);
customerInfoPanel.setDataSet(appDataModule.getOrderDataSet());
}
}
public void localeChanged(LocaleChangeEvent e) {
textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes", e.getLocale());
guiRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes", e.getLocale());
useSameAddressCheckbox.setLabel(textRes.getString("Use_same_address"));
this.remove((Panel) customerInfoPanel);
customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("ShipToCustomerInfoPanel");
customerInfoPanel.localeChanged(e);
this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
if (useSameAddressCheckbox.isChecked()) {
customerInfoPanel.setReadOnly(true);
customerInfoPanel.setDataSet(appDataModule.getCustomerDataSet());
} else {
customerInfoPanel.setReadOnly(false);
customerInfoPanel.setDataSet(appDataModule.getOrderDataSet());
}
}
}
class ShipToPanel_useSameAddressCheckbox_itemListenerAdapter implements java.awt.event.ItemListener {
ShipToPanel adaptee;
ShipToPanel_useSameAddressCheckbox_itemListenerAdapter(ShipToPanel adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.useSameAddressCheckbox_itemStateChanged(e);
}
}