001: package com.xoetrope.carousel.catalog;
002:
003: import com.xoetrope.carousel.wizard.XWizardPanel;
004: import java.awt.Font;
005: import java.awt.Rectangle;
006: import java.awt.event.ActionEvent;
007: import java.awt.event.ActionListener;
008: import javax.swing.BorderFactory;
009: import javax.swing.JCheckBox;
010: import javax.swing.JLabel;
011: import javax.swing.JList;
012: import javax.swing.JPanel;
013: import javax.swing.JScrollPane;
014: import javax.swing.JTextArea;
015: import javax.swing.event.ChangeEvent;
016: import javax.swing.event.ChangeListener;
017: import net.xoetrope.editor.project.XEditorProject;
018: import net.xoetrope.editor.project.XEditorProjectManager;
019: import net.xoetrope.swing.XImage;
020:
021: /**
022: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
023: * the GNU Public License (GPL), please see license.txt for more details. If
024: * you make commercial use of this software you must purchase a commercial
025: * license from Xoetrope.</p>
026: * <p> $Revision: 1.4 $</p>
027: */
028: public class Orders extends XWizardPanel {
029: private boolean isStandalone = false;
030: private XCatalogueWizardDialog wizard;
031: private XImage imageControl1 = new XImage();
032: private JTextArea jTextArea1 = new JTextArea();
033: private JPanel jPanel1 = new JPanel();
034: private JLabel jLabel1 = new JLabel();
035: private JCheckBox saveCB = new JCheckBox();
036: private JCheckBox onlineCB = new JCheckBox();
037: private JCheckBox passwordCB = new JCheckBox();
038: private JCheckBox printableCB = new JCheckBox();
039: private JCheckBox deliveryCB = new JCheckBox();
040: private JCheckBox billingCB = new JCheckBox();
041: private JLabel jLabel2 = new JLabel();
042: private JScrollPane jScrollPane1 = new JScrollPane();
043: private String addressFields[] = { "Name", "Address", "City",
044: "Street", "Country", "Telephone", "Extension", "Fax",
045: "email", "Website/URL", "Company Name", "Department",
046: "Job Title" };
047: private int addressSelections[] = { 0, 1, 2, 3, 4, 5, 6, 8 };
048: private JList addressFieldsList = new JList(addressFields);
049:
050: /**
051: * Constructor which takes an instance of the <CODE>XCatalogueWizardDialog</CODE> and
052: * a String specifying the super class name.
053: * @param wiz the <CODE>XCatalogueWizardDialog</CODE> instance passed to this class.
054: * @param name the <CODE>String</CODE> instance passed to this class specifying the super class name.
055: */
056: public Orders(XCatalogueWizardDialog wiz, String name) {
057: super (name);
058: wizard = wiz;
059:
060: try {
061: jbInit();
062: } catch (Exception ex) {
063: ex.printStackTrace();
064: }
065: }
066:
067: /**
068: * Method responsible for initialising the components used in this wizard panel.
069: */
070: void jbInit() throws Exception {
071: Font font = new java.awt.Font("SansSerif", 0, 11);
072: setLayout(null);
073:
074: deliveryCB.setFocusable(false);
075: billingCB.setFocusable(false);
076: addressFieldsList.setFocusable(false);
077:
078: imageControl1.setBackground(getBackground());
079: imageControl1.setBounds(new Rectangle(5, 9, 179, 366));
080: imageControl1.setImage(((XEditorProject) (XEditorProjectManager
081: .getCurrentProject())).getImage(getClass(),
082: "com/xoetrope/carousel/catalog/factory4.jpg"));
083: imageControl1.setBorder(BorderFactory.createEtchedBorder());
084:
085: jTextArea1.setBackground(getBackground());
086: jTextArea1
087: .setText("Step 4: Select the items you need to track orders and the options that suit your systems.");
088: jTextArea1.setLineWrap(true);
089: jTextArea1.setEditable(false);
090: jTextArea1.setWrapStyleWord(true);
091: jTextArea1.setBounds(new Rectangle(190, 10, 400, 39));
092:
093: jPanel1.setBorder(BorderFactory.createEtchedBorder());
094: jPanel1.setBounds(new Rectangle(191, 73, 397, 53));
095: jPanel1.setLayout(null);
096:
097: jLabel1.setText("Options");
098: jLabel1.setBounds(new Rectangle(191, 55, 88, 17));
099:
100: deliveryCB
101: .setToolTipText("Use a separate delivery address for orders");
102: deliveryCB.setText("Separate delivery addresses");
103: deliveryCB.setBounds(new Rectangle(10, 4, 170, 25));
104:
105: billingCB
106: .setToolTipText("Use a separate billing address for orders");
107: billingCB.setText("Separate billing addresses");
108: billingCB.setBounds(new Rectangle(10, 23, 170, 25));
109:
110: saveCB
111: .setToolTipText("Save and review orders even after they have been fulfilled");
112: saveCB.setSelected(true);
113: saveCB.setText("Save orders");
114: saveCB.setBounds(new Rectangle(10, 4, 170, 25));
115:
116: onlineCB.setToolTipText("Connect to a server to order items");
117: onlineCB.setText("On-line ordering");
118: onlineCB.setBounds(new Rectangle(10, 23, 170, 25));
119:
120: passwordCB
121: .setToolTipText("Require a user to enter a password to gain access to orders");
122: passwordCB.setText("Use passwords");
123: passwordCB.setBounds(new Rectangle(10, 42, 170, 25));
124:
125: printableCB
126: .setToolTipText("Allow orders to be printed out for faxing or for records");
127: printableCB.setSelected(true);
128: printableCB.setText("Printable order forms");
129: printableCB.setBounds(new Rectangle(190, 4, 170, 25));
130:
131: jLabel2.setText("Address fields");
132: jLabel2.setBounds(new Rectangle(192, 135, 114, 17));
133:
134: addressFieldsList
135: .setToolTipText("Select the fields you want included in the orders database");
136: addressFieldsList.setSelectedIndices(addressSelections);
137: jScrollPane1.setBounds(new Rectangle(192, 154, 396, 219));
138: jScrollPane1.getViewport().add(addressFieldsList, null);
139:
140: add(imageControl1, null);
141: add(jTextArea1, null);
142: add(jPanel1, null);
143:
144: jPanel1.add(deliveryCB, null);
145: jPanel1.add(billingCB, null);
146:
147: add(jLabel1, null);
148: add(jLabel2, null);
149: add(jScrollPane1, null);
150:
151: addressFieldsList.setFont(font);
152: }
153:
154: /**
155: * Returns whether delivery adresses are to be used within the catalogue
156: * @return <CODE>boolean</CODE> specifying whether delivery adresses info is to be used or not
157: */
158: public boolean wantsDeliveryAddress() {
159: return deliveryCB.isSelected();
160: }
161:
162: /**
163: * Returns whether billing addresses are to be used within the catalogue
164: * @return <CODE>boolean</CODE> specifying whether billing addresses info is to be used or not
165: */
166: public boolean wantsBillingAddress() {
167: return billingCB.isSelected();
168: }
169:
170: /**
171: * Returns the selected fields from the address fields list
172: * @return <CODE>int</CODE> array specifying the selected fields in the address fields list
173: */
174: public int[] getSelectedFields() {
175: return addressFieldsList.getSelectedIndices();
176: }
177: }
|