1 | package org.greenstone.admin.gui;
|
---|
2 |
|
---|
3 | import java.awt.*;
|
---|
4 | import java.awt.event.*;
|
---|
5 | import java.io.*;
|
---|
6 | import java.lang.reflect.Constructor;
|
---|
7 | import java.lang.reflect.Method;
|
---|
8 | import java.util.*;
|
---|
9 |
|
---|
10 | import javax.swing.*;
|
---|
11 | import javax.swing.event.*;
|
---|
12 | import javax.swing.tree.*;
|
---|
13 |
|
---|
14 | import javax.xml.parsers.DocumentBuilder;
|
---|
15 | import javax.xml.parsers.DocumentBuilderFactory;
|
---|
16 | import javax.xml.transform.OutputKeys;
|
---|
17 | import javax.xml.transform.Transformer;
|
---|
18 | import javax.xml.transform.TransformerFactory;
|
---|
19 | import javax.xml.transform.dom.DOMSource;
|
---|
20 | import javax.xml.transform.stream.StreamResult;
|
---|
21 |
|
---|
22 | import org.greenstone.admin.GAIManager;
|
---|
23 | import org.greenstone.admin.GAI;
|
---|
24 | import org.greenstone.admin.Configuration;
|
---|
25 | import org.greenstone.gsdl3.util.GSPath;
|
---|
26 | import org.greenstone.gsdl3.util.GlobalProperties;
|
---|
27 |
|
---|
28 | import org.w3c.dom.Document;
|
---|
29 | import org.w3c.dom.Element;
|
---|
30 | import org.w3c.dom.Node;
|
---|
31 | import org.w3c.dom.NodeList;
|
---|
32 | import org.w3c.dom.Text;
|
---|
33 |
|
---|
34 |
|
---|
35 | public class ExtPane extends JPanel {
|
---|
36 |
|
---|
37 | /* The pane to demonstrate extension information*/
|
---|
38 |
|
---|
39 | protected JSplitPane main_ext_pane = null;
|
---|
40 |
|
---|
41 | /** The panel that contains a log_list */
|
---|
42 | private JPanel extensionList_pane = null;
|
---|
43 |
|
---|
44 | /** The panel that contains the log content. */
|
---|
45 | protected static JPanel extensionContent_pane = null;
|
---|
46 |
|
---|
47 | /** The List showing all the log files concerned. */
|
---|
48 | //protected JList extension_list=null;
|
---|
49 |
|
---|
50 | /** The label at the top of the logList_pane. */
|
---|
51 | protected JLabel extensionList_label = null;
|
---|
52 |
|
---|
53 | /** The label shown at the top of the logContent Pane. */
|
---|
54 | protected JLabel extensionContent_label = null;
|
---|
55 |
|
---|
56 | /** The scrollable area into which the log content is placed. */
|
---|
57 | protected JScrollPane description_content = null;
|
---|
58 |
|
---|
59 | /* Log TEXT AREA*/
|
---|
60 | protected JTextArea description_textarea = null;
|
---|
61 |
|
---|
62 | protected JScrollPane message_content = null;
|
---|
63 |
|
---|
64 | /* Log TEXT AREA*/
|
---|
65 | protected static JTextArea message_textarea = null;
|
---|
66 |
|
---|
67 | protected static JPanel current_description_pane = null;
|
---|
68 |
|
---|
69 | protected JPanel button_pane = null;
|
---|
70 |
|
---|
71 | /** Buttons */
|
---|
72 | //protected JButton download_button = null;
|
---|
73 | //protected static JButton pre_configure_button = null;
|
---|
74 | //protected JButton install_button = null;
|
---|
75 | //protected JButton post_configure_button = null;
|
---|
76 | //protected JButton uninstall_button = null;
|
---|
77 | //protected JButton switch_button = null;
|
---|
78 |
|
---|
79 | protected static JPanel control_pane = null;
|
---|
80 |
|
---|
81 | protected JPanel main_content_pane = null;
|
---|
82 |
|
---|
83 | protected JTree extensionTreeList = null;
|
---|
84 |
|
---|
85 | protected DefaultMutableTreeNode top = new DefaultMutableTreeNode("Extension List");
|
---|
86 |
|
---|
87 | protected HashMap extensionInformation = null;
|
---|
88 |
|
---|
89 | protected JPanel extensionContentHeaderPane = null;
|
---|
90 |
|
---|
91 | protected String file_location;
|
---|
92 |
|
---|
93 | protected final String extension_status_root = "Configuration";
|
---|
94 | protected File extension_status_file = null;
|
---|
95 | protected String extension_file = null;
|
---|
96 |
|
---|
97 | /** The various sizes for the screen layout*/
|
---|
98 | static protected Dimension MIN_SIZE = new Dimension( 90, 90);
|
---|
99 | static protected Dimension LIST_SIZE = new Dimension(200, 450);
|
---|
100 | static protected Dimension LOGPANE_SIZE = new Dimension (800,450);
|
---|
101 | static protected int left_padding = 5;
|
---|
102 | static String fileSeparator = File.separator;
|
---|
103 |
|
---|
104 | GlobalProperties globalProperty = null;
|
---|
105 |
|
---|
106 | GSPath gspath = null;
|
---|
107 |
|
---|
108 |
|
---|
109 | //WorkingCopy wc;
|
---|
110 |
|
---|
111 | public ExtPane() {
|
---|
112 |
|
---|
113 | //System.out.println("start");
|
---|
114 | String gsdl3Home = get_GSDL3HOME();
|
---|
115 | //file_location ="/research/cc108/greenstone3Project/ext/extension_project_list.xml";
|
---|
116 | file_location = gsdl3Home+fileSeparator+"ext"+fileSeparator+"extension_project_list.xml";
|
---|
117 | //file_lcoation = = "/research/cc108/greenstone3Project/ext/extension_project_list.xml
|
---|
118 | // create all the necessary panes
|
---|
119 | control_pane = new JPanel();
|
---|
120 | button_pane = new JPanel();
|
---|
121 | current_description_pane = new JPanel();
|
---|
122 | extensionContentHeaderPane = new JPanel();
|
---|
123 | extensionInformation = new HashMap();
|
---|
124 |
|
---|
125 | //wc = new WorkingCopy();
|
---|
126 |
|
---|
127 | // Extension_Pane
|
---|
128 | main_ext_pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
---|
129 | main_ext_pane.setPreferredSize(LOGPANE_SIZE);
|
---|
130 |
|
---|
131 | // Extension_TextArea
|
---|
132 | description_textarea = new JTextArea();
|
---|
133 | description_textarea.setEditable(false);
|
---|
134 | description_textarea.setLineWrap(true);
|
---|
135 | description_textarea.setWrapStyleWord(true);
|
---|
136 | description_textarea.setMargin(new Insets(0,left_padding,0,0));
|
---|
137 | //description_textarea.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
|
---|
138 |
|
---|
139 | message_textarea = new JTextArea();
|
---|
140 | message_textarea.setEditable(false);
|
---|
141 | message_textarea.setAutoscrolls(true);
|
---|
142 | message_textarea.setLineWrap(true);
|
---|
143 | message_textarea.setWrapStyleWord(true);
|
---|
144 | message_textarea.setMargin(new Insets(0,left_padding,0,0));
|
---|
145 |
|
---|
146 | /*
|
---|
147 | download_button = new JButton();
|
---|
148 | download_button.setEnabled(false);
|
---|
149 | download_button.setText("Download");
|
---|
150 |
|
---|
151 | ActionListener donwloadButton = new ActionListener() {
|
---|
152 | public void actionPerformed(ActionEvent ae) {
|
---|
153 | download_jButton_Adapter(ae);
|
---|
154 | }
|
---|
155 | };
|
---|
156 |
|
---|
157 | ActionListener cursorDoIt1 = CursorController.createListener(this, donwloadButton);
|
---|
158 | download_button.addActionListener(cursorDoIt1);
|
---|
159 |
|
---|
160 | pre_configure_button = new JButton();
|
---|
161 | pre_configure_button.setEnabled(false);
|
---|
162 | pre_configure_button.setText("Pre-Configuration");
|
---|
163 |
|
---|
164 |
|
---|
165 | ActionListener preconfigureButton = new ActionListener() {
|
---|
166 | public void actionPerformed(ActionEvent ae) {
|
---|
167 | preConfigure_jButton_Adapter(ae);
|
---|
168 | }
|
---|
169 | };
|
---|
170 |
|
---|
171 | ActionListener cursorDoIt3 = CursorController.createListener(this,preconfigureButton);
|
---|
172 | pre_configure_button.addActionListener(cursorDoIt3);
|
---|
173 |
|
---|
174 |
|
---|
175 | install_button = new JButton();
|
---|
176 | install_button.setEnabled(false);
|
---|
177 | install_button.setText("Compile/Install");
|
---|
178 |
|
---|
179 | post_configure_button = new JButton();
|
---|
180 | post_configure_button.setText("Post-Configuration");
|
---|
181 | post_configure_button.setEnabled(false);
|
---|
182 |
|
---|
183 | uninstall_button = new JButton();
|
---|
184 | uninstall_button.setText("Uninstall");
|
---|
185 | uninstall_button.setEnabled(false);
|
---|
186 |
|
---|
187 | switch_button = new JButton();
|
---|
188 | switch_button.setText("Switch");
|
---|
189 | switch_button.setEnabled(false);
|
---|
190 |
|
---|
191 |
|
---|
192 | ActionListener switchButton = new ActionListener() {
|
---|
193 | public void actionPerformed(ActionEvent ae) {
|
---|
194 | switch_jButton_Adapter(ae);
|
---|
195 | }
|
---|
196 | };
|
---|
197 |
|
---|
198 | ActionListener cursorDoIt2 = CursorController.createListener(this, switchButton);
|
---|
199 | switch_button.addActionListener(cursorDoIt2);
|
---|
200 | */
|
---|
201 | }
|
---|
202 |
|
---|
203 |
|
---|
204 | public void actionPerformed(ActionEvent event) {
|
---|
205 | }
|
---|
206 |
|
---|
207 |
|
---|
208 | /** This method is callsed to actually layout the components.*/
|
---|
209 | public void display() {
|
---|
210 |
|
---|
211 | load_Admin_UI();
|
---|
212 | HashMap projectNameMap = getProjectList();
|
---|
213 | Set s = projectNameMap.keySet();
|
---|
214 | Iterator it = s.iterator();
|
---|
215 | int i = 0;
|
---|
216 |
|
---|
217 | while(it.hasNext()){
|
---|
218 | String projectNameGroup = (String)it.next();
|
---|
219 | ArrayList alist = (ArrayList)projectNameMap.get(projectNameGroup);
|
---|
220 | DefaultMutableTreeNode projecti = new DefaultMutableTreeNode (projectNameGroup);
|
---|
221 |
|
---|
222 | for (int j = 0; j< alist.size(); j++){
|
---|
223 | String projectName = (String)alist.get(j);
|
---|
224 | DefaultMutableTreeNode projectNameGroupj = new DefaultMutableTreeNode (projectName);
|
---|
225 | projecti.add(projectNameGroupj);
|
---|
226 | }
|
---|
227 | top.add(projecti);
|
---|
228 | i++;
|
---|
229 | }
|
---|
230 |
|
---|
231 | extensionTreeList = new JTree(top);
|
---|
232 | extensionTreeList.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
|
---|
233 | extensionTreeList.addTreeSelectionListener(new ConfTreeListener());
|
---|
234 |
|
---|
235 | // extensionList_Pane
|
---|
236 | extensionList_pane = new JPanel();
|
---|
237 | extensionList_pane.setBorder(BorderFactory.createLoweredBevelBorder());
|
---|
238 | extensionList_label = new JLabel();
|
---|
239 | extensionList_label.setOpaque(true);
|
---|
240 | extensionList_label.setBackground(Configuration.getColor("coloring.workspace_heading_background"));
|
---|
241 | extensionList_label.setForeground(Configuration.getColor("coloring.workspace_heading_foreground"));
|
---|
242 | extensionList_label.setText("Available Extensions");
|
---|
243 | extensionList_label.setBorder(BorderFactory.createEmptyBorder(0, left_padding, 0, 0));
|
---|
244 | // extensionContent_Pane
|
---|
245 | extensionContent_pane = new JPanel();
|
---|
246 | extensionContent_pane.setBorder(BorderFactory.createLoweredBevelBorder());
|
---|
247 | extensionContent_pane.setBackground(Configuration.getColor("coloring.workspace_selection_background"));
|
---|
248 | extensionContent_pane.setForeground(Configuration.getColor("coloring.workspace_selection_foreground"));
|
---|
249 |
|
---|
250 | extensionContent_label = new JLabel();
|
---|
251 | extensionContent_label.setBorder(BorderFactory.createEmptyBorder(0, left_padding, 0, 0));
|
---|
252 | extensionContent_label.setOpaque(false);
|
---|
253 | extensionContent_label.setBackground(Configuration.getColor("coloring.workspace_selection_background"));
|
---|
254 | extensionContent_label.setForeground(Configuration.getColor("coloring.workspace_selection_foreground"));
|
---|
255 | extensionContent_label.setText("Extension Content");
|
---|
256 | main_content_pane = new JPanel();
|
---|
257 |
|
---|
258 | // TEXTAREA Layout
|
---|
259 | description_content = new JScrollPane(description_textarea);
|
---|
260 | description_content .setName("description_content");
|
---|
261 | //description_content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
|
---|
262 | message_content = new JScrollPane(message_textarea);
|
---|
263 |
|
---|
264 | control_pane.setLayout (new BorderLayout());
|
---|
265 | control_pane.setBorder(BorderFactory.createEmptyBorder(05,10,5,10));
|
---|
266 | control_pane.setPreferredSize(new Dimension(200,50));
|
---|
267 | control_pane.setSize(new Dimension(200,50));
|
---|
268 | control_pane.add (button_pane, BorderLayout.CENTER);
|
---|
269 |
|
---|
270 | // Layout Components
|
---|
271 | extensionList_pane.setLayout(new BorderLayout());
|
---|
272 | extensionList_pane.add(extensionTreeList, BorderLayout.CENTER);
|
---|
273 | extensionList_pane.add(extensionList_label, BorderLayout.NORTH);
|
---|
274 |
|
---|
275 | main_content_pane.setLayout(new BorderLayout());
|
---|
276 | main_content_pane.setPreferredSize(new Dimension(600, 200));
|
---|
277 | main_content_pane.setSize(new Dimension(600, 200));
|
---|
278 | main_content_pane.add(control_pane, BorderLayout.WEST);
|
---|
279 | main_content_pane.add(message_content, BorderLayout.CENTER);
|
---|
280 |
|
---|
281 | //extensionContentHeaderPane.setLayout(new FlowLayout());
|
---|
282 | //extensionContentHeaderPane.add(extensionContent_label);
|
---|
283 | //extensionContentHeaderPane.add(switch_button);
|
---|
284 |
|
---|
285 | extensionContent_pane.setLayout(new BorderLayout());
|
---|
286 | extensionContent_pane.add(main_content_pane,BorderLayout.SOUTH);
|
---|
287 | extensionContent_pane.add(extensionContent_label, BorderLayout.NORTH);
|
---|
288 | extensionContent_pane.add(description_content, BorderLayout.CENTER);
|
---|
289 |
|
---|
290 | main_ext_pane.add(extensionList_pane, JSplitPane.LEFT);
|
---|
291 | main_ext_pane.add(extensionContent_pane, JSplitPane.RIGHT);
|
---|
292 | main_ext_pane.setDividerLocation(LIST_SIZE.width - 10);
|
---|
293 |
|
---|
294 | this.setLayout(new BorderLayout());
|
---|
295 | this.add(main_ext_pane, BorderLayout.CENTER);
|
---|
296 |
|
---|
297 | }
|
---|
298 |
|
---|
299 |
|
---|
300 | protected Element getRootElement(){
|
---|
301 |
|
---|
302 | Element rootNode = null;
|
---|
303 |
|
---|
304 | try{
|
---|
305 | DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
|
---|
306 | DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
|
---|
307 | Document doc = docBuilder.newDocument();
|
---|
308 | doc = docBuilder.parse (new File(file_location));
|
---|
309 | rootNode = doc.getDocumentElement();
|
---|
310 | return rootNode;
|
---|
311 |
|
---|
312 | }catch (Exception e) {
|
---|
313 | e.printStackTrace();
|
---|
314 | return null;
|
---|
315 | }
|
---|
316 | }
|
---|
317 |
|
---|
318 | protected HashMap getProjectList(){
|
---|
319 |
|
---|
320 | HashMap projectGroupMap = new HashMap();
|
---|
321 | Element rootNode = getRootElement();
|
---|
322 | NodeList projectList = rootNode.getElementsByTagName(adminUI_Pane.EXTENSION);
|
---|
323 |
|
---|
324 | for(int i = 0; i<projectList.getLength(); i++){
|
---|
325 |
|
---|
326 | Element projectNode = (Element)projectList.item(i);
|
---|
327 | NodeList nameList = projectNode.getElementsByTagName(adminUI_Pane.NAME);
|
---|
328 | String name = nameList.item(0).getChildNodes().item(0).getNodeValue();
|
---|
329 |
|
---|
330 | NodeList groupList = projectNode.getElementsByTagName(adminUI_Pane.GROUP);
|
---|
331 | String group = groupList.item(0).getChildNodes().item(0).getNodeValue();
|
---|
332 |
|
---|
333 | if(projectGroupMap.containsKey(group)){
|
---|
334 | ArrayList alist = (ArrayList)projectGroupMap.get(group);
|
---|
335 | alist.add(name);
|
---|
336 | projectGroupMap.put(group, alist);
|
---|
337 | }
|
---|
338 | else{
|
---|
339 | ArrayList alist = new ArrayList();
|
---|
340 | alist.add(name);
|
---|
341 | projectGroupMap.put(group, alist);
|
---|
342 | }
|
---|
343 | }
|
---|
344 | return projectGroupMap;
|
---|
345 | }
|
---|
346 |
|
---|
347 | public String get_GSDL3HOME(){
|
---|
348 |
|
---|
349 | String gsdl3Home = globalProperty.getGSDL3Home();
|
---|
350 | String os = "linux";
|
---|
351 |
|
---|
352 | if(fileSeparator.equals("\\")){
|
---|
353 | gsdl3Home = gsdl3Home.replace("\\", "/");
|
---|
354 | os = "windows";
|
---|
355 | }
|
---|
356 |
|
---|
357 | gsdl3Home = gspath.removeLastLink(gsdl3Home);
|
---|
358 |
|
---|
359 | if(os.equals("windows")){
|
---|
360 | gsdl3Home = gsdl3Home.replace("/", "\\");
|
---|
361 | }
|
---|
362 | return gsdl3Home;
|
---|
363 | }
|
---|
364 |
|
---|
365 | protected class ConfTreeListener implements TreeSelectionListener{
|
---|
366 |
|
---|
367 | public void valueChanged (TreeSelectionEvent e){
|
---|
368 |
|
---|
369 | String option = new String();
|
---|
370 |
|
---|
371 | try{
|
---|
372 | option = extensionTreeList.getLastSelectedPathComponent().toString();
|
---|
373 | }catch(Exception ex){
|
---|
374 |
|
---|
375 | }
|
---|
376 |
|
---|
377 | if(extensionInformation.containsKey(option)){
|
---|
378 |
|
---|
379 | try{
|
---|
380 | extensionContent_pane.remove(2);
|
---|
381 | extensionContent_pane.validate();
|
---|
382 | extensionContent_pane.repaint();
|
---|
383 |
|
---|
384 | ArrayList alist = (ArrayList) extensionInformation.get(option);
|
---|
385 | Class c = (Class)alist.get(0);
|
---|
386 | Object o = (Object)alist.get(1);
|
---|
387 |
|
---|
388 |
|
---|
389 |
|
---|
390 |
|
---|
391 | JPanel cardLayoutPane = new JPanel(new CardLayout());
|
---|
392 | Method get_Description_Pane = c.getMethod("getDescriptionPane", new Class[0]);
|
---|
393 | JPanel descriptionPane = (JPanel)get_Description_Pane.invoke(o,new Object[0]);
|
---|
394 | Method get_Control_Pane = c.getMethod("getControlPane", new Class[0]);
|
---|
395 | JPanel controlPane = (JPanel)get_Control_Pane.invoke(o,new Object[0]);
|
---|
396 |
|
---|
397 | cardLayoutPane.add(descriptionPane, "Description");
|
---|
398 | cardLayoutPane.add(controlPane, "Control");
|
---|
399 | current_description_pane = cardLayoutPane;
|
---|
400 |
|
---|
401 |
|
---|
402 | control_pane.remove(0);
|
---|
403 | control_pane.revalidate();
|
---|
404 | control_pane.repaint();
|
---|
405 |
|
---|
406 | button_pane = getProjetcButtonPane();
|
---|
407 | control_pane.add(button_pane);
|
---|
408 | control_pane.revalidate();
|
---|
409 | control_pane.repaint();
|
---|
410 |
|
---|
411 | Method isConfigurable = c.getMethod("isConfigurable", new Class[0]);
|
---|
412 | Boolean configurable = (Boolean) isConfigurable.invoke(o,new Object[0]);
|
---|
413 |
|
---|
414 | extensionContent_label.setText(option);
|
---|
415 |
|
---|
416 | extensionContent_pane.add(current_description_pane, BorderLayout.CENTER);
|
---|
417 | extensionContent_pane.validate();
|
---|
418 | extensionContent_pane.repaint();
|
---|
419 |
|
---|
420 | Class[] types = new Class[] { String.class};
|
---|
421 | Method getStatus = c.getMethod("getCommandStatus", types);
|
---|
422 |
|
---|
423 | Object[] args = new Object[] { "install"};
|
---|
424 | boolean status = (Boolean)(getStatus.invoke(o, args));
|
---|
425 | if(status){
|
---|
426 | updateExtensionContentPane();
|
---|
427 | }
|
---|
428 | /*
|
---|
429 | *
|
---|
430 | *
|
---|
431 | * updateExtensionContentPane
|
---|
432 | */
|
---|
433 |
|
---|
434 | }catch(Exception ex){
|
---|
435 | ex.printStackTrace();
|
---|
436 | description_textarea.setText("");
|
---|
437 | description_textarea.append("Sorry, this extension is not available!");
|
---|
438 | extensionContent_pane.add(description_content, BorderLayout.CENTER);
|
---|
439 | extensionContent_pane.validate();
|
---|
440 | extensionContent_pane.repaint();
|
---|
441 | }
|
---|
442 | }
|
---|
443 | else{
|
---|
444 | if(control_pane.getComponentCount()>0){
|
---|
445 | System.out.println("remove");
|
---|
446 | control_pane.remove(0);
|
---|
447 | control_pane.revalidate();
|
---|
448 | control_pane.repaint();
|
---|
449 | control_pane.add(new JPanel());
|
---|
450 | control_pane.revalidate();
|
---|
451 | control_pane.repaint();
|
---|
452 | }
|
---|
453 |
|
---|
454 | if(extensionContent_pane.getComponentCount()>0){
|
---|
455 |
|
---|
456 | extensionContent_label.setText("Extension Content");
|
---|
457 | extensionContent_pane.remove(2);
|
---|
458 | extensionContent_pane.revalidate();
|
---|
459 | extensionContent_pane.repaint();
|
---|
460 |
|
---|
461 |
|
---|
462 | JTextArea ja= new JTextArea();
|
---|
463 | JScrollPane jp = new JScrollPane(ja);
|
---|
464 | extensionContent_pane.add(jp);
|
---|
465 | extensionContent_pane.revalidate();
|
---|
466 | extensionContent_pane.repaint();
|
---|
467 |
|
---|
468 |
|
---|
469 |
|
---|
470 | }
|
---|
471 | }
|
---|
472 | }
|
---|
473 | }
|
---|
474 |
|
---|
475 |
|
---|
476 |
|
---|
477 |
|
---|
478 | public JPanel getProjetcButtonPane(){
|
---|
479 | String option = extensionTreeList.getLastSelectedPathComponent().toString();
|
---|
480 | JPanel buttonPane = new JPanel();
|
---|
481 | try{
|
---|
482 |
|
---|
483 | ArrayList alist = (ArrayList) extensionInformation.get(option);
|
---|
484 | Class c = (Class)alist.get(0);
|
---|
485 | Object o = (Object)alist.get(1);
|
---|
486 |
|
---|
487 | Method a = c.getMethod("getButtonPane", new Class[0]);
|
---|
488 | buttonPane = (JPanel)a.invoke(o, new Object[0]);
|
---|
489 |
|
---|
490 |
|
---|
491 | }catch (Exception ex){
|
---|
492 | ex.printStackTrace();
|
---|
493 | }
|
---|
494 | return buttonPane;
|
---|
495 | }
|
---|
496 |
|
---|
497 | public void load_Admin_UI(){
|
---|
498 |
|
---|
499 | Element rootNode = getRootElement();
|
---|
500 |
|
---|
501 | NodeList projectList = rootNode.getElementsByTagName(adminUI_Pane.EXTENSION);
|
---|
502 |
|
---|
503 | for(int i = 0; i<projectList.getLength(); i++){
|
---|
504 |
|
---|
505 | Element projectNode = (Element)projectList.item(i);
|
---|
506 | ArrayList alist = new ArrayList();
|
---|
507 | NodeList nameList = projectNode.getElementsByTagName(adminUI_Pane.NAME);
|
---|
508 | String name = nameList.item(0).getChildNodes().item(0).getNodeValue();
|
---|
509 |
|
---|
510 | NodeList uiList = projectNode.getElementsByTagName(adminUI_Pane.ADMIN_UI);
|
---|
511 | String admin_ui = uiList.item(0).getChildNodes().item(0).getNodeValue();
|
---|
512 |
|
---|
513 | try{
|
---|
514 | Class c = Class.forName(admin_ui);
|
---|
515 | Class[] paramTypes = {String.class};
|
---|
516 | Constructor ct = c.getConstructor(paramTypes);
|
---|
517 | Object[] paramList = {name};
|
---|
518 |
|
---|
519 | Object theNewObject = (Object)ct.newInstance(paramList);
|
---|
520 | alist.add(c);
|
---|
521 | alist.add(theNewObject);
|
---|
522 | extensionInformation.put(name, alist);
|
---|
523 | }catch (Exception ex){
|
---|
524 | ex.printStackTrace();
|
---|
525 | }
|
---|
526 |
|
---|
527 | }
|
---|
528 | }
|
---|
529 |
|
---|
530 | public static void updateButtonPane(JPanel pane){
|
---|
531 | control_pane.remove(0);
|
---|
532 | control_pane.revalidate();
|
---|
533 | control_pane.repaint();
|
---|
534 | control_pane.add(pane);
|
---|
535 | }
|
---|
536 |
|
---|
537 | public static void updateExtensionContentPane(){
|
---|
538 | CardLayout cl = (CardLayout)( current_description_pane.getLayout());
|
---|
539 | cl.next(current_description_pane);
|
---|
540 |
|
---|
541 | }
|
---|
542 |
|
---|
543 | /*
|
---|
544 | private void updateStatus(String project_name, String action){
|
---|
545 |
|
---|
546 | try{
|
---|
547 | DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
|
---|
548 | DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
|
---|
549 | Document doc = docBuilder.newDocument();
|
---|
550 | Element root = doc.createElement(extension_status_root);
|
---|
551 |
|
---|
552 | boolean fileExist = extension_status_file.exists();
|
---|
553 |
|
---|
554 | if(!fileExist){
|
---|
555 | extension_status_file = new File (extension_file);
|
---|
556 | root = doc.createElement(extension_status_root);
|
---|
557 | }
|
---|
558 | else{
|
---|
559 | doc = docBuilder.parse (extension_status_file);
|
---|
560 | root = doc.getDocumentElement();
|
---|
561 | }
|
---|
562 |
|
---|
563 |
|
---|
564 | TransformerFactory tf = TransformerFactory.newInstance();
|
---|
565 | Transformer transformer= tf.newTransformer();
|
---|
566 | DOMSource source= new DOMSource(root);
|
---|
567 | transformer.setOutputProperty(OutputKeys.INDENT,"yes");
|
---|
568 |
|
---|
569 | Writer pwx= new BufferedWriter(new OutputStreamWriter(new FileOutputStream(extension_status_file),"UTF-8"));
|
---|
570 | StreamResult result= new StreamResult(pwx);
|
---|
571 | transformer.transform(source,result);
|
---|
572 | pwx.close();
|
---|
573 |
|
---|
574 | root = null;
|
---|
575 | docBuilderFactory = null;
|
---|
576 | docBuilder = null;
|
---|
577 | doc = null;
|
---|
578 |
|
---|
579 | }catch (Exception e) {
|
---|
580 | System.out.println(e);
|
---|
581 | }
|
---|
582 | }*/
|
---|
583 |
|
---|
584 | }
|
---|
585 |
|
---|
586 | /*
|
---|
587 | class SVNDownloadThread extends Thread {
|
---|
588 |
|
---|
589 | JTextArea _messageTextArea;
|
---|
590 | WorkingCopy _workingCopy;
|
---|
591 | ExtPane _extPane;
|
---|
592 | String _URL;
|
---|
593 | String _destination;
|
---|
594 |
|
---|
595 | public SVNDownloadThread (JTextArea messageArea, WorkingCopy working_copy, ExtPane ext_pane, String svnURL, String destination) {
|
---|
596 | _workingCopy= working_copy;
|
---|
597 | _messageTextArea = messageArea;
|
---|
598 | _extPane = ext_pane;
|
---|
599 | _URL = svnURL;
|
---|
600 | _destination = destination;
|
---|
601 | }
|
---|
602 |
|
---|
603 | public void run() {
|
---|
604 | try{
|
---|
605 | _workingCopy.Download(_messageTextArea, _extPane.message_content, _URL, _destination);
|
---|
606 | }catch(Exception ex){}
|
---|
607 | }
|
---|
608 | }
|
---|
609 | */
|
---|
610 |
|
---|
611 | class ProjectGroup{
|
---|
612 |
|
---|
613 | protected String groupName = null;
|
---|
614 | protected ArrayList nameList = null;
|
---|
615 |
|
---|
616 | public ProjectGroup(){
|
---|
617 | nameList = new ArrayList();
|
---|
618 | }
|
---|
619 |
|
---|
620 | public void setGroupName(String name){
|
---|
621 | groupName = name;
|
---|
622 | }
|
---|
623 |
|
---|
624 | public String getGroupName(){
|
---|
625 | return groupName;
|
---|
626 | }
|
---|
627 |
|
---|
628 | public void addGroupName(String name){
|
---|
629 | nameList.add(name);
|
---|
630 | }
|
---|
631 |
|
---|
632 | public ArrayList getGroupNameList(){
|
---|
633 | return nameList;
|
---|
634 | }
|
---|
635 | } |
---|