001: package com.xoetrope.carousel.catalog;
002:
003: import com.xoetrope.carousel.wizard.XWizardPanel;
004: import java.awt.Rectangle;
005: import java.awt.SystemColor;
006: import java.awt.event.ActionEvent;
007: import java.awt.event.ActionListener;
008: import javax.swing.BorderFactory;
009: import javax.swing.ButtonGroup;
010: import javax.swing.JCheckBox;
011: import javax.swing.JLabel;
012: import javax.swing.JPanel;
013: import javax.swing.JRadioButton;
014: import javax.swing.JTextArea;
015: import net.xoetrope.swing.XImage;
016: import net.xoetrope.editor.project.XEditorProject;
017: import net.xoetrope.editor.project.XEditorProjectManager;
018:
019: /**
020: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
021: * the GNU Public License (GPL), please see license.txt for more details. If
022: * you make commercial use of this software you must purchase a commercial
023: * license from Xoetrope.</p>
024: * <p> $Revision: 1.6 $</p>
025: */
026: public class Facilities extends XWizardPanel implements ActionListener {
027: private boolean isStandalone = false;
028: private XImage imageControl1 = new XImage();
029: private JTextArea jTextArea1 = new JTextArea();
030: private ButtonGroup buttonGroup = new ButtonGroup();
031: private ButtonGroup buttonGroup2 = new ButtonGroup();
032: private JTextArea jTextArea2 = new JTextArea();
033: private JPanel jPanel1 = new JPanel();
034: private JTextArea jTextArea3 = new JTextArea();
035: private JCheckBox masterCB = new JCheckBox();
036: private JCheckBox productPanelCB = new JCheckBox();
037: private JCheckBox detailsPanelCB = new JCheckBox();
038: private JCheckBox cartPanelCB = new JCheckBox();
039: private JRadioButton layout1CB = new JRadioButton();
040: private JRadioButton layout2CB = new JRadioButton();
041: private JLabel jLabel1 = new JLabel();
042: private JLabel jLabel2 = new JLabel();
043: private JLabel jLabel3 = new JLabel();
044: private JPanel jPanel2 = new JPanel();
045: private JPanel jPanel3 = new JPanel();
046: private JPanel jPanel4 = new JPanel();
047: private JRadioButton treeViewRB = new JRadioButton();
048: private JRadioButton simpleViewRB = new JRadioButton();
049: private javax.swing.JCheckBox searchCB = new javax.swing.JCheckBox();
050: private javax.swing.JCheckBox keywordsCB = new javax.swing.JCheckBox();
051: private javax.swing.JCheckBox codeNumCB = new javax.swing.JCheckBox();
052: private javax.swing.JCheckBox ordersCB = new javax.swing.JCheckBox();
053: private javax.swing.JCheckBox contactCB = new javax.swing.JCheckBox();
054: private javax.swing.JCheckBox addressCB = new javax.swing.JCheckBox();
055: private XCatalogueWizardDialog wizard;
056: private boolean usesProductPanel, usesDetailsPanel, usesCartPanel;
057:
058: /**
059: * Constructor which takes an instance of the <CODE>XCatalogueWizardDialog</CODE> and
060: * a String specifying the super class name.
061: * @param wiz the <CODE>XCatalogueWizardDialog</CODE> instance passed to this class.
062: * @param name the <CODE>String</CODE> instance passed to this class specifying the super class name.
063: */
064: public Facilities(XCatalogueWizardDialog wiz, String name) {
065: super (name);
066: wizard = wiz;
067:
068: try {
069: jbInit();
070: } catch (Exception ex) {
071: ex.printStackTrace();
072: }
073: }
074:
075: /**
076: * Method responsible for initialising the components used in this wizard panel.
077: */
078: void jbInit() throws Exception {
079: setLayout(null);
080:
081: productPanelCB.setFocusable(false);
082: detailsPanelCB.setFocusable(false);
083: cartPanelCB.setFocusable(false);
084:
085: layout1CB.setFocusable(false);
086: layout2CB.setFocusable(false);
087: treeViewRB.setFocusable(false);
088: simpleViewRB.setFocusable(false);
089:
090: imageControl1.setBackground(getBackground());
091: imageControl1.setBounds(new Rectangle(5, 9, 179, 366));
092: imageControl1.setImage(((XEditorProject) (XEditorProjectManager
093: .getCurrentProject())).getImage(getClass(),
094: "com/xoetrope/carousel/catalog/facilities.jpg"));
095: imageControl1.setBorder(BorderFactory.createEtchedBorder());
096:
097: jTextArea2.setBackground(getBackground());
098: jTextArea2.setBounds(new Rectangle(190, 10, 400, 39));
099: jTextArea2.setBounds(new Rectangle(191, 9, 400, 22));
100: jTextArea2.setWrapStyleWord(true);
101: jTextArea2.setLineWrap(true);
102: jTextArea2.setEditable(false);
103: jTextArea2
104: .setText("Step 2: Select the facilities you require in the catalogue.");
105: jTextArea2.setBackground(getBackground());
106:
107: jTextArea3.setLineWrap(true);
108: jTextArea3.setWrapStyleWord(true);
109: jTextArea3.setEditable(false);
110: jTextArea3.setBackground(SystemColor.control);
111: jTextArea3
112: .setText("Select components for displaying product info to be included in the catalogue. i.e. "
113: + "a panel for displaying products, a details panel for displaying information for each product and a cart "
114: + "for displaying products to be purchased.");
115: jTextArea3.setBackground(getBackground());
116: jTextArea3.setBounds(new Rectangle(9, 7, 383, 60));
117:
118: jPanel1.setBorder(BorderFactory.createEtchedBorder());
119: jPanel1.setBounds(new Rectangle(191, 73, 397, 109));
120: jPanel1.setLayout(null);
121:
122: productPanelCB
123: .setToolTipText("Include a panel for displaying the products in a simple tile layout or in a tree layout.");
124: productPanelCB.setText("Products panel");
125: productPanelCB.addActionListener(this );
126: productPanelCB.setBounds(new Rectangle(12, 70, 103, 25));
127:
128: detailsPanelCB
129: .setToolTipText("Include a panel for displaying details for each product.");
130: detailsPanelCB.setText("Details panel");
131: detailsPanelCB.addActionListener(this );
132: detailsPanelCB.setBounds(new Rectangle(132, 70, 135, 25));
133:
134: cartPanelCB
135: .setToolTipText("Include a panel for displaying products to be purchased.");
136: cartPanelCB.setText("Cart panel");
137: cartPanelCB.addActionListener(this );
138: cartPanelCB.setBounds(new Rectangle(277, 70, 100, 25));
139:
140: jLabel1.setText("Product Browsing");
141: jLabel1.setBounds(new Rectangle(191, 55, 88, 17));
142:
143: jLabel2.setText("Product View");
144: jLabel2.setBounds(new Rectangle(191, 193, 88, 17));
145:
146: jLabel3.setText("Layout");
147: jLabel3.setBounds(new Rectangle(191, 273, 88, 17));
148:
149: jPanel4.setBorder(BorderFactory.createEtchedBorder());
150: jPanel4.setBounds(new Rectangle(191, 210, 397, 55));
151: jPanel4.setLayout(null);
152:
153: simpleViewRB.setBounds(new Rectangle(85, 16, 93, 25));
154: simpleViewRB.setText("Simple view");
155: simpleViewRB.setSelected(true);
156: buttonGroup.add(simpleViewRB);
157:
158: treeViewRB.setBounds(new Rectangle(220, 16, 93, 25));
159: treeViewRB.setText("Tree view");
160: buttonGroup.add(treeViewRB);
161:
162: jPanel2.setBorder(BorderFactory.createEtchedBorder());
163: jPanel2.setBounds(new Rectangle(191, 290, 397, 55));
164: jPanel2.setLayout(null);
165:
166: jPanel3.setBorder(BorderFactory.createEtchedBorder());
167: jPanel3.setBounds(new Rectangle(191, 315, 397, 55));
168: jPanel3.setLayout(null);
169:
170: layout1CB
171: .setToolTipText("Products displayed on the left with details and shopping cart displayed on the right.");
172: layout1CB.setSelected(true);
173: layout1CB.setText("Layout 1");
174: layout1CB.setBounds(new Rectangle(85, 16, 93, 25));
175: buttonGroup2.add(layout1CB);
176:
177: layout2CB
178: .setToolTipText("Products displayed on top with details and shopping cart displayed on the bottom.");
179: layout2CB.setSelected(false);
180: layout2CB.setText("Layout 2");
181: layout2CB.setBounds(new Rectangle(220, 16, 93, 25));
182: buttonGroup2.add(layout2CB);
183:
184: add(imageControl1, null);
185: this .add(jPanel1, null);
186: jPanel1.add(jTextArea3, null);
187:
188: jPanel1.add(productPanelCB, null);
189: jPanel1.add(detailsPanelCB, null);
190: jPanel1.add(cartPanelCB, null);
191:
192: jPanel1.add(masterCB, null);
193: this .add(jLabel1, null);
194: this .add(jLabel2, null);
195: this .add(jLabel3, null);
196: this .add(jTextArea2, null);
197:
198: this .add(jPanel4, null);
199: simpleViewRB.setEnabled(false);
200: treeViewRB.setEnabled(false);
201: jPanel4.add(simpleViewRB, null);
202: jPanel4.add(treeViewRB, null);
203:
204: this .add(jPanel2, null);
205: layout1CB.setEnabled(false);
206: layout2CB.setEnabled(false);
207: jPanel2.add(layout1CB, null);
208: jPanel2.add(layout2CB, null);
209:
210: // this.add(jPanel3, null);
211: jPanel3.add(ordersCB, null);
212: jPanel3.add(addressCB, null);
213: jPanel3.add(contactCB, null);
214: jTextArea2.setBounds(new Rectangle(190, 10, 400, 39));
215: jTextArea2.setBounds(new Rectangle(190, 10, 400, 39));
216: }
217:
218: /**
219: * Listens for action events on the check boxes within this wizard panel
220: * @param the passed <CODE>ActionEvent</CODE>
221: */
222: public void actionPerformed(ActionEvent evt) {
223: boolean state = ((JCheckBox) evt.getSource()).isSelected();
224:
225: if (evt.getSource() == productPanelCB) {
226: simpleViewRB.setEnabled(state);
227: treeViewRB.setEnabled(state);
228:
229: if (!detailsPanelCB.isSelected()
230: && !cartPanelCB.isSelected()) {
231: layout1CB.setEnabled(state);
232: layout2CB.setEnabled(state);
233: }
234:
235: simpleViewRB.setSelected(state);
236: layout1CB.setSelected(state);
237: } else if (evt.getSource() == detailsPanelCB) {
238: if (!productPanelCB.isSelected()
239: && !cartPanelCB.isSelected()) {
240: layout1CB.setEnabled(state);
241: layout2CB.setEnabled(state);
242: }
243: } else if (evt.getSource() == cartPanelCB) {
244: if (!productPanelCB.isSelected()
245: && !detailsPanelCB.isSelected()) {
246: layout1CB.setEnabled(state);
247: layout2CB.setEnabled(state);
248: }
249: }
250: }
251:
252: /**
253: * Returns whether a simple view is to be used within the catalogue
254: * @return <CODE>boolean</CODE> specifying whether a simple view is to be used or not
255: */
256: public boolean wantsSimpleView() {
257: if (simpleViewRB.isEnabled()) {
258: return simpleViewRB.isSelected();
259: }
260: return false;
261: }
262:
263: /**
264: * Returns whether a tree view is to be used within the catalogue
265: * @return <CODE>boolean</CODE> specifying whether a tree view is to be used or not
266: */
267: public boolean wantsTreeView() {
268: if (treeViewRB.isEnabled()) {
269: return treeViewRB.isSelected();
270: }
271: return false;
272: }
273:
274: /**
275: * Returns whether layout type 1 is to be used within the catalogue
276: * @return <CODE>boolean</CODE> specifying whether layout type 1 is to be used or not
277: */
278: public boolean wantsLayout1() {
279: if (layout1CB.isEnabled()) {
280: return layout1CB.isSelected();
281: }
282: return false;
283: }
284:
285: /**
286: * Returns whether layout type 2 is to be used within the catalogue
287: * @return <CODE>boolean</CODE> specifying whether layout type 2 is to be used or not
288: */
289: public boolean wantsLayout2() {
290: if (layout2CB.isEnabled()) {
291: return layout2CB.isSelected();
292: }
293: return false;
294: }
295:
296: /**
297: * Returns whether the products panel is to be used within the catalogue
298: * @return <CODE>boolean</CODE> specifying whether the products panel is to be used or not
299: */
300: public boolean wantsProductsPanel() {
301: return productPanelCB.isSelected();
302: }
303:
304: /**
305: * Returns whether the details panel is to be used within the catalogue
306: * @return <CODE>boolean</CODE> specifying whether the details panel is to be used or not
307: */
308: public boolean wantsDetailsPanel() {
309: return detailsPanelCB.isSelected();
310: }
311:
312: /**
313: * Returns whether the cart panel is to be used within the catalogue
314: * @return <CODE>boolean</CODE> specifying whether the cart panel is to be used or not
315: */
316: public boolean wantsCartPanel() {
317: return cartPanelCB.isSelected();
318: }
319: }
|