1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.xmlcv.gui;
28
29 import javax.swing.JInternalFrame;
30 import javax.swing.JTabbedPane;
31 import javax.swing.SwingConstants;
32 import javax.swing.event.ChangeEvent;
33 import javax.swing.event.ChangeListener;
34
35 import org.xmlcv.CVModel;
36 import org.xmlcv.XmlCVException;
37 import org.xmlcv.gui.listeners.CVInternalFrameListener;
38 import org.xmlcv.gui.tabs.AbstractTab;
39 import org.xmlcv.gui.tabs.TabConferences;
40 import org.xmlcv.gui.tabs.TabEducation;
41 import org.xmlcv.gui.tabs.TabExperience;
42 import org.xmlcv.gui.tabs.TabHoobies;
43 import org.xmlcv.gui.tabs.TabIdentity;
44 import org.xmlcv.gui.tabs.TabKnowledge;
45 import org.xmlcv.gui.tabs.TabProjects;
46 import org.xmlcv.util.I18n;
47
48 /***
49 * Internal frame for each CV
50 *
51 * @version $Revision: 114 $
52 * @author <a href="mailto:drazzib@drazzib.com">Damien Raude-Morvan </a>
53 */
54 public class CViFrame extends JInternalFrame {
55
56 /*** Tabs */
57 private JTabbedPane _mainTabPane;
58
59 private TabIdentity _identiteTabPane;
60
61 private TabEducation _educationTabPane;
62
63 private TabExperience _experienceTabPane;
64
65 private TabKnowledge _knowledgeTabPane;
66
67 private TabProjects _projectsTabPane;
68
69 private TabConferences _conferencesTabPane;
70
71 private TabHoobies _hoobiesTabPane;
72
73 /*** CVDocumentBean (XMLBeans mapping to XML) */
74 private CVModel _bean;
75
76 public CViFrame() {
77
78
79 this._bean = new CVModel();
80
81
82 init();
83
84
85 this.setTitle(I18n.getString("CvIFrame.newCV"));
86
87 }
88
89 public CViFrame(String absolutePath) throws XmlCVException {
90
91
92 this._bean = new CVModel(absolutePath);
93
94
95
96
97 init();
98
99
100 this.setTitle(I18n.getString("CvIFrame.CV") + absolutePath);
101 }
102
103 private void init() {
104
105
106
107
108 this._identiteTabPane = new TabIdentity(this._bean.getCV());
109 this._educationTabPane = new TabEducation(this._bean.getCV());
110 this._experienceTabPane = new TabExperience(this._bean.getCV());
111 this._knowledgeTabPane = new TabKnowledge(this._bean.getCV());
112 this._projectsTabPane = new TabProjects(this._bean.getCV());
113 this._conferencesTabPane = new TabConferences(this._bean.getCV());
114 this._hoobiesTabPane = new TabHoobies(this._bean.getCV());
115
116
117 this._mainTabPane = new JTabbedPane();
118 this._mainTabPane.setTabPlacement(SwingConstants.LEFT);
119 this._mainTabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
120 this._mainTabPane
121 .insertTab(
122 I18n.getString("CvIFrame.Identity"), null, this._identiteTabPane, I18n.getString("CvIFrame.Identity"), 0);
123 this._mainTabPane
124 .insertTab(
125 I18n.getString("CvIFrame.Formation"), null, this._educationTabPane, I18n.getString("CvIFrame.Formation"), 1);
126 this._mainTabPane
127 .insertTab(
128 I18n.getString("CvIFrame.Experience"), null, this._experienceTabPane, I18n.getString("CvIFrame.Experience"), 2);
129 this._mainTabPane
130 .insertTab(
131 I18n.getString("CvIFrame.Knowledge"), null, this._knowledgeTabPane, I18n.getString("CvIFrame.Knowledge"), 3);
132 this._mainTabPane
133 .insertTab(
134 I18n.getString("CvIFrame.Projects"), null, this._projectsTabPane, I18n.getString("CvIFrame.Projects"), 4);
135 this._mainTabPane
136 .insertTab(
137 I18n.getString("CvIFrame.Conferences"), null, this._conferencesTabPane, I18n.getString("CvIFrame.Conferences"), 5);
138 this._mainTabPane
139 .insertTab(
140 I18n.getString("CvIFrame.Hoobies"), null, this._hoobiesTabPane, I18n.getString("CvIFrame.Hoobies"), 6);
141
142
143 this._mainTabPane.addChangeListener(new ChangeListener() {
144
145 public void stateChanged(ChangeEvent evt) {
146 JTabbedPane pane = (JTabbedPane) evt.getSource();
147
148
149 AbstractTab currentTab = (AbstractTab) pane
150 .getSelectedComponent();
151
152
153
154 }
155 });
156
157
158 this.getContentPane().add(this._mainTabPane);
159
160
161 this.addInternalFrameListener(new CVInternalFrameListener());
162
163 this.setResizable(true);
164 this.setClosable(true);
165 this.setMaximizable(true);
166 this.setIconifiable(false);
167 }
168
169 /***
170 * @return Returns the CV bean.
171 */
172 public CVModel getBean() {
173 return this._bean;
174 }
175
176 /***
177 * @param pBean
178 * The CV bean to set.
179 */
180 public void setBean(CVModel pBean) {
181 this._bean = pBean;
182 }
183 }