KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > wizard > OctopusProjectFrame


1 /*
2  * OctopusProjectFrame.java. Created on Apr 22, 2004.
3  */

4 package org.webdocwf.util.loader.wizard;
5
6 import java.awt.BorderLayout JavaDoc;
7 import java.awt.Component JavaDoc;
8 import java.awt.Dimension JavaDoc;
9 import java.awt.event.WindowAdapter JavaDoc;
10 import java.awt.event.WindowEvent JavaDoc;
11
12 import javax.swing.ImageIcon JavaDoc;
13 import javax.swing.JButton JavaDoc;
14 import javax.swing.JComboBox JavaDoc;
15 import javax.swing.JInternalFrame JavaDoc;
16 import javax.swing.JLabel JavaDoc;
17 import javax.swing.JPanel JavaDoc;
18 import javax.swing.JTabbedPane JavaDoc;
19 import javax.swing.JTextField JavaDoc;
20 import javax.swing.JToolBar JavaDoc;
21
22 /**
23  * Represents OctopusProject frame. It has two tabs, one for Generator
24  * and one for Loader.
25  *
26  * @author Zoran Milakovic
27  */

28 public class OctopusProjectFrame extends JInternalFrame JavaDoc {
29     
30     JTabbedPane JavaDoc tabbedPane = new JTabbedPane JavaDoc();
31     OctopusLoaderPanel loaderPanel;
32     OctopusGeneratorPanel generatorPanel;
33     JToolBar JavaDoc toolBar;
34     String JavaDoc projectName = "";
35     String JavaDoc pathToOPF = "";
36     
37     public OctopusProjectFrame(
38             String JavaDoc name,
39             OctopusLoaderPanel loaderPanel,
40             OctopusGeneratorPanel generatorPanel,
41             JToolBar JavaDoc toolBar) {
42          super(name, true, false, true, true);
43          this.loaderPanel = loaderPanel;
44          this.generatorPanel = generatorPanel;
45          this.toolBar = toolBar;
46          this.projectName = name;
47          init();
48     }
49     
50     private void init() {
51         try {
52         setFrameIcon( new ImageIcon JavaDoc(getClass().getClassLoader().getResource("org/webdocwf/util/loader/"+
53                  "wizard/images/Enhydra16.gif")));
54         setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
55         JPanel JavaDoc contentPane = new JPanel JavaDoc(new BorderLayout JavaDoc());
56         contentPane.add(toolBar,BorderLayout.NORTH);
57         contentPane.add(tabbedPane,BorderLayout.CENTER);
58         setContentPane(contentPane);
59         addToTab("TDT Generator",generatorPanel);
60         addToTab("TDT Loader",loaderPanel);
61 // setActiveTab(1);
62
setBounds(0, 0, 1000, 750);
63         }catch(Exception JavaDoc e) {
64             e.printStackTrace();
65         }
66     }
67     
68     public String JavaDoc getProjectName() {
69         return this.projectName;
70     }
71     
72     public OctopusLoaderPanel getLoaderPanel() {
73         return this.loaderPanel;
74     }
75     
76     public OctopusGeneratorPanel getGeneratorPanel() {
77             return this.generatorPanel;
78         }
79     
80     public void addToTab(String JavaDoc title, Component JavaDoc component) {
81         this.tabbedPane.add(title, component);
82     }
83     
84     public void setActiveTab(int index) {
85             this.tabbedPane.setSelectedIndex(index);
86     }
87     
88     
89     
90     public static JButton JavaDoc createOctopusButton(String JavaDoc componentName, Dimension JavaDoc dimension) {
91
92         JButton JavaDoc button = new JButton JavaDoc();
93         if (!componentName.equalsIgnoreCase(""))
94             button.setText(componentName);
95         button.setAlignmentX(Component.LEFT_ALIGNMENT);
96         button.setAlignmentY(Component.CENTER_ALIGNMENT);
97         button.setMinimumSize(new Dimension JavaDoc(dimension));
98         button.setMaximumSize(new Dimension JavaDoc(dimension));
99         button.setPreferredSize(new Dimension JavaDoc(dimension));
100
101         return button;
102     }
103
104     public static JComboBox JavaDoc createOctopusCombobox(String JavaDoc componentName, Dimension JavaDoc dimension) {
105
106         JComboBox JavaDoc comboBox = new JComboBox JavaDoc();
107         comboBox.setName(componentName);
108         comboBox.setAlignmentX(Component.LEFT_ALIGNMENT);
109         comboBox.setAlignmentY(Component.CENTER_ALIGNMENT);
110         comboBox.setMinimumSize(new Dimension JavaDoc(dimension));
111         comboBox.setMaximumSize(new Dimension JavaDoc(dimension));
112         comboBox.setPreferredSize(new Dimension JavaDoc(dimension));
113
114         return comboBox;
115     }
116
117     public static JLabel JavaDoc createOctopusLabel(String JavaDoc componentName, Dimension JavaDoc dimension) {
118
119         JLabel JavaDoc label = new JLabel JavaDoc();
120         label.setText(componentName);
121         label.setAlignmentX(Component.LEFT_ALIGNMENT);
122         label.setAlignmentY(Component.CENTER_ALIGNMENT);
123         label.setMinimumSize(new Dimension JavaDoc(dimension));
124         label.setMaximumSize(new Dimension JavaDoc(dimension));
125         label.setPreferredSize(new Dimension JavaDoc(dimension));
126
127         return label;
128     }
129
130     public static JTextField JavaDoc createOctopusTextField(String JavaDoc componentName, Dimension JavaDoc dimension) {
131
132         JTextField JavaDoc textField = new JTextField JavaDoc();
133         textField.setName(componentName);
134         textField.setAlignmentX(Component.LEFT_ALIGNMENT);
135         textField.setAlignmentY(Component.CENTER_ALIGNMENT);
136         textField.setMinimumSize(new Dimension JavaDoc(dimension));
137         textField.setMaximumSize(new Dimension JavaDoc(dimension));
138         textField.setPreferredSize(new Dimension JavaDoc(dimension));
139
140         return textField;
141     }
142
143     public String JavaDoc getPathToOPF() {
144         return pathToOPF;
145     }
146
147     public void setPathToOPF(String JavaDoc pathToOPF) {
148         this.pathToOPF = pathToOPF;
149     }
150
151 }
152
Popular Tags