001: package com.xoetrope.carousel.catalog;
002:
003: import com.xoetrope.carousel.wizard.XWizardPanel;
004: import java.awt.Color;
005: import java.awt.Dimension;
006: import java.awt.Font;
007: import java.awt.Rectangle;
008: import java.awt.event.ActionEvent;
009: import java.awt.event.ActionListener;
010: import javax.swing.BorderFactory;
011: import javax.swing.ButtonGroup;
012: import javax.swing.JCheckBox;
013: import javax.swing.JComboBox;
014: import javax.swing.JLabel;
015: import javax.swing.JPanel;
016: import javax.swing.JRadioButton;
017: import javax.swing.JTextArea;
018: import net.xoetrope.editor.project.XEditorProject;
019: import net.xoetrope.editor.project.XEditorProjectManager;
020: import net.xoetrope.swing.XComboBox;
021: import net.xoetrope.swing.XImage;
022:
023: /**
024: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
025: * the GNU Public License (GPL), please see license.txt for more details. If
026: * you make commercial use of this software you must purchase a commercial
027: * license from Xoetrope.</p>
028: * <p> $Revision: 1.5 $</p>
029: */
030: public class Styles extends XWizardPanel implements ActionListener {
031: private boolean isStandalone = false;
032: private XCatalogueWizardDialog wizard;
033: private XImage imageControl1 = new XImage();
034: private XImage styleImage = new XImage();
035: private JTextArea jTextArea1 = new JTextArea();
036: private JPanel jPanel1 = new JPanel();
037: private JLabel jLabel1 = new JLabel();
038: private JRadioButton casualRB = new JRadioButton();
039: private JRadioButton personalRB = new JRadioButton();
040: private JRadioButton professionalRB = new JRadioButton();
041: private JRadioButton entertainingRB = new JRadioButton();
042: private JLabel jLabel2 = new JLabel();
043: private JPanel jPanel2 = new JPanel();
044: private JRadioButton vgaRB = new JRadioButton();
045: private JRadioButton svgaRB = new JRadioButton();
046: private JRadioButton xgaRB = new JRadioButton();
047: private JRadioButton sxgaRB = new JRadioButton();
048: private JLabel jLabel3 = new JLabel();
049: private JPanel jPanel3 = new JPanel();
050: private JCheckBox scaleCB = new JCheckBox();
051: private ButtonGroup styleBg = new ButtonGroup();
052: private ButtonGroup sizeBg = new ButtonGroup();
053: private JComboBox selectStyle;
054: private String[] styleImages = { "default.png", "washout.png",
055: "base.png", "heading.png", "banner.png", "progress.png" };
056: private String[] styles = { null, "washOut", "base", "Heading",
057: "Banner", "Progress" };
058:
059: /**
060: * Constructor which takes an instance of the <CODE>XCatalogueWizardDialog</CODE> and
061: * a String specifying the super class name.
062: * @param wiz the <CODE>XCatalogueWizardDialog</CODE> instance passed to this class.
063: * @param name the <CODE>String</CODE> instance passed to this class specifying the super class name.
064: */
065: public Styles(XCatalogueWizardDialog wiz, String name) {
066: super (name);
067: wizard = wiz;
068:
069: try {
070: jbInit();
071: } catch (Exception ex) {
072: ex.printStackTrace();
073: }
074: }
075:
076: void jbInit() throws Exception {
077: Font font = new java.awt.Font("SansSerif", 0, 11);
078: setLayout(null);
079:
080: imageControl1.setBackground(getBackground());
081: imageControl1.setBounds(new Rectangle(5, 9, 179, 366));
082: imageControl1.setImage(((XEditorProject) (XEditorProjectManager
083: .getCurrentProject())).getImage(getClass(),
084: "com/xoetrope/carousel/catalog/styles.jpg"));
085: imageControl1.setBorder(BorderFactory.createEtchedBorder());
086: add(imageControl1);
087:
088: jTextArea1.setBackground(getBackground());
089: jTextArea1
090: .setText("Step 6: Pick a style that best matches the your company\'s style and the intended role of your catalogue");
091: jTextArea1.setLineWrap(true);
092: jTextArea1.setEditable(false);
093: jTextArea1.setWrapStyleWord(true);
094: jTextArea1.setBounds(new Rectangle(190, 10, 400, 39));
095:
096: jPanel1.setBorder(BorderFactory.createEtchedBorder());
097: jPanel1.setBounds(new Rectangle(191, 73, 397, 58));
098: jPanel1.setLayout(null);
099:
100: jLabel1.setText("Style");
101: jLabel1.setBounds(new Rectangle(191, 55, 88, 17));
102:
103: jTextArea1.setBackground(getBackground());
104: jTextArea1
105: .setText("Step 6: Pick a style that best matches the your company\'s style and the intended role of your catalogue");
106: jTextArea1.setLineWrap(true);
107: jTextArea1.setWrapStyleWord(true);
108: jTextArea1.setBounds(new Rectangle(190, 10, 400, 39));
109:
110: jPanel1.setBorder(BorderFactory.createEtchedBorder());
111: jPanel1.setBounds(new Rectangle(191, 27, 397, 348));
112: jPanel1.setLayout(null);
113:
114: jLabel1.setText("Select Style");
115: jLabel1.setBounds(new Rectangle(191, 8, 88, 17));
116: add(jLabel1);
117:
118: String[] list = { "default", "Wash-out", "Base", "Heading",
119: "Banner", "Progress" };
120: selectStyle = new JComboBox(list);
121: selectStyle.setFocusable(false);
122: selectStyle.addActionListener(this );
123: selectStyle.setBounds(125, 20, 150, 20);
124: jPanel1.add(selectStyle);
125:
126: styleImage.setBounds(33, 65, 327, 256);
127: styleImage.setBorder(BorderFactory.createEtchedBorder());
128: styleImage.setImage(((XEditorProject) (XEditorProjectManager
129: .getCurrentProject())).getImage(getClass(),
130: "com/xoetrope/carousel/catalog/templates/images/"
131: + styleImages[0]));
132: jPanel1.add(styleImage);
133:
134: add(jPanel1);
135: }
136:
137: /**
138: * Called when an action is performed on the select style combo box
139: * @param evt <CODE>ActionEvent</CODE> passed to this method
140: */
141: public void actionPerformed(ActionEvent evt) {
142: JComboBox cb = (JComboBox) evt.getSource();
143: int index = cb.getSelectedIndex();
144: styleImage.setImage(((XEditorProject) (XEditorProjectManager
145: .getCurrentProject())).getImage(getClass(),
146: "com/xoetrope/carousel/catalog/templates/images/"
147: + styleImages[index]));
148: }
149:
150: /**
151: * Returns the selected style
152: * @return <CODE>String</CODE> specifying the selected style
153: */
154: public String getStyle() {
155: int index = selectStyle.getSelectedIndex();
156: return styles[index];
157: }
158: }
|