home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
SoldToPanel.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
4KB
|
112 lines
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.event.*;
public class SoldToPanel extends BevelPanel implements LocaleChangeListener {
private AppDataModule appDataModule = AppDataModule.getDataModule();
LabelControl customerNoLabel = new LabelControl();
LabelControl customerNoField = new LabelControl();
BevelPanel customerNoPanel = new BevelPanel();
BorderLayout borderLayout1 = new BorderLayout();
InterchangeableCustomerInfoPanel customerInfoPanel;
ButtonControl lookupCustomerButton = new ButtonControl();
GridBagLayout gridBagLayout1 = new GridBagLayout();
GridBagLayout gridBagLayout2 = new GridBagLayout();
static ResourceBundle textRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes");
static ResourceBundle guiRes = java.util.ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes");
public SoldToPanel() {
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void jbInit() throws Exception{
lookupCustomerButton.setLabel(textRes.getString("Find_customer"));
lookupCustomerButton.addActionListener(new SoldToPanel_lookupCustomerButton_actionAdapter(this));
customerNoLabel.setText(textRes.getString("Customer_No"));
customerNoLabel.setAlignment(Label.RIGHT);
customerNoField.setDataSet(appDataModule.getCustomerDataSet());
customerNoField.setColumnName("customer_no");
customerNoField.setAlignment(Label.RIGHT);
customerNoPanel.setLayout(gridBagLayout2);
customerNoPanel.setBevelInner(BevelPanel.FLAT);
customerNoPanel.add(customerNoLabel, null);
customerNoPanel.add(customerNoField, null);
customerNoPanel.add(lookupCustomerButton, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
customerNoPanel.add(customerNoLabel, new GridBagConstraints2(1, 0, 3, 1, 100.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
customerNoPanel.add(customerNoField, new GridBagConstraints2(4, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 10), 0, 0));
this.setLayout(borderLayout1);
customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("SoldToCustomerInfoPanel");
this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
this.add(customerNoPanel, BorderLayout.NORTH);
LocaleChangeManager.getLocaleChangeManager().addLocaleChangeListener(this);
}
void lookupCustomerButton_actionPerformed(ActionEvent e) {
try {
Component component = this;
Frame frame = null;
while ((component = component.getParent()) != null) {
if (component instanceof Frame) {
frame = (Frame) component;
break;
}
}
if (frame == null) {
frame = new Frame();
}
CustomerLookupDialog customerLookupDialog = new CustomerLookupDialog(frame, true);
customerLookupDialog.show();
if (customerLookupDialog.isValidCustomer()) {
appDataModule.syncCustomerNoWithCurrentOrder();
}
} catch (Exception ex) {
borland.jbcl.util.Diagnostic.printStackTrace(ex);
}
}
public void localeChanged(LocaleChangeEvent e) {
textRes = ResourceBundle.getBundle("borland.samples.intl.gui.resources.TextRes", e.getLocale());
guiRes = ResourceBundle.getBundle("borland.samples.intl.gui.resources.GuiRes", e.getLocale());
customerNoLabel.setText(textRes.getString("Customer_No"));
lookupCustomerButton.setLabel(textRes.getString("Find_customer"));
this.remove((Panel) customerInfoPanel);
customerInfoPanel = (InterchangeableCustomerInfoPanel) guiRes.getObject("SoldToCustomerInfoPanel");
this.add((Panel) customerInfoPanel, BorderLayout.CENTER);
}
}
class SoldToPanel_lookupCustomerButton_actionAdapter implements java.awt.event.ActionListener{
SoldToPanel adaptee;
SoldToPanel_lookupCustomerButton_actionAdapter(SoldToPanel adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.lookupCustomerButton_actionPerformed(e);
}
}