001: /*
002: * OctopusProjectFrame.java. Created on Apr 22, 2004.
003: */
004: package org.webdocwf.util.loader.wizard;
005:
006: import java.awt.BorderLayout;
007: import java.awt.Component;
008: import java.awt.Dimension;
009: import java.awt.event.WindowAdapter;
010: import java.awt.event.WindowEvent;
011:
012: import javax.swing.ImageIcon;
013: import javax.swing.JButton;
014: import javax.swing.JComboBox;
015: import javax.swing.JInternalFrame;
016: import javax.swing.JLabel;
017: import javax.swing.JPanel;
018: import javax.swing.JTabbedPane;
019: import javax.swing.JTextField;
020: import javax.swing.JToolBar;
021:
022: /**
023: * Represents OctopusProject frame. It has two tabs, one for Generator
024: * and one for Loader.
025: *
026: * @author Zoran Milakovic
027: */
028: public class OctopusProjectFrame extends JInternalFrame {
029:
030: JTabbedPane tabbedPane = new JTabbedPane();
031: OctopusLoaderPanel loaderPanel;
032: OctopusGeneratorPanel generatorPanel;
033: JToolBar toolBar;
034: String projectName = "";
035: String pathToOPF = "";
036:
037: public OctopusProjectFrame(String name,
038: OctopusLoaderPanel loaderPanel,
039: OctopusGeneratorPanel generatorPanel, JToolBar toolBar) {
040: super (name, true, false, true, true);
041: this .loaderPanel = loaderPanel;
042: this .generatorPanel = generatorPanel;
043: this .toolBar = toolBar;
044: this .projectName = name;
045: init();
046: }
047:
048: private void init() {
049: try {
050: setFrameIcon(new ImageIcon(getClass().getClassLoader()
051: .getResource(
052: "org/webdocwf/util/loader/"
053: + "wizard/images/Enhydra16.gif")));
054: setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
055: JPanel contentPane = new JPanel(new BorderLayout());
056: contentPane.add(toolBar, BorderLayout.NORTH);
057: contentPane.add(tabbedPane, BorderLayout.CENTER);
058: setContentPane(contentPane);
059: addToTab("TDT Generator", generatorPanel);
060: addToTab("TDT Loader", loaderPanel);
061: // setActiveTab(1);
062: setBounds(0, 0, 1000, 750);
063: } catch (Exception e) {
064: e.printStackTrace();
065: }
066: }
067:
068: public String getProjectName() {
069: return this .projectName;
070: }
071:
072: public OctopusLoaderPanel getLoaderPanel() {
073: return this .loaderPanel;
074: }
075:
076: public OctopusGeneratorPanel getGeneratorPanel() {
077: return this .generatorPanel;
078: }
079:
080: public void addToTab(String title, Component component) {
081: this .tabbedPane.add(title, component);
082: }
083:
084: public void setActiveTab(int index) {
085: this .tabbedPane.setSelectedIndex(index);
086: }
087:
088: public static JButton createOctopusButton(String componentName,
089: Dimension dimension) {
090:
091: JButton button = new JButton();
092: if (!componentName.equalsIgnoreCase(""))
093: button.setText(componentName);
094: button.setAlignmentX(Component.LEFT_ALIGNMENT);
095: button.setAlignmentY(Component.CENTER_ALIGNMENT);
096: button.setMinimumSize(new Dimension(dimension));
097: button.setMaximumSize(new Dimension(dimension));
098: button.setPreferredSize(new Dimension(dimension));
099:
100: return button;
101: }
102:
103: public static JComboBox createOctopusCombobox(String componentName,
104: Dimension dimension) {
105:
106: JComboBox comboBox = new JComboBox();
107: comboBox.setName(componentName);
108: comboBox.setAlignmentX(Component.LEFT_ALIGNMENT);
109: comboBox.setAlignmentY(Component.CENTER_ALIGNMENT);
110: comboBox.setMinimumSize(new Dimension(dimension));
111: comboBox.setMaximumSize(new Dimension(dimension));
112: comboBox.setPreferredSize(new Dimension(dimension));
113:
114: return comboBox;
115: }
116:
117: public static JLabel createOctopusLabel(String componentName,
118: Dimension dimension) {
119:
120: JLabel label = new JLabel();
121: label.setText(componentName);
122: label.setAlignmentX(Component.LEFT_ALIGNMENT);
123: label.setAlignmentY(Component.CENTER_ALIGNMENT);
124: label.setMinimumSize(new Dimension(dimension));
125: label.setMaximumSize(new Dimension(dimension));
126: label.setPreferredSize(new Dimension(dimension));
127:
128: return label;
129: }
130:
131: public static JTextField createOctopusTextField(
132: String componentName, Dimension dimension) {
133:
134: JTextField textField = new JTextField();
135: textField.setName(componentName);
136: textField.setAlignmentX(Component.LEFT_ALIGNMENT);
137: textField.setAlignmentY(Component.CENTER_ALIGNMENT);
138: textField.setMinimumSize(new Dimension(dimension));
139: textField.setMaximumSize(new Dimension(dimension));
140: textField.setPreferredSize(new Dimension(dimension));
141:
142: return textField;
143: }
144:
145: public String getPathToOPF() {
146: return pathToOPF;
147: }
148:
149: public void setPathToOPF(String pathToOPF) {
150: this.pathToOPF = pathToOPF;
151: }
152:
153: }
|