root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / panels / ProcessPanelAutomationHelper.java @ 15280
History | View | Annotate | Download (3.53 KB)
1 |
/*
|
---|---|
2 |
* $Id: ProcessPanelAutomationHelper.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
|
3 |
* IzPack
|
4 |
* Copyright (C) 2003 Jonathan Halliday, Julien Ponge
|
5 |
*
|
6 |
* File : CompilePanelAutomationHelper.java
|
7 |
* Description : Automation support functions for CompilePanel.
|
8 |
* Author's email : jonathan.halliday@arjuna.com
|
9 |
* Author's Website : http://www.arjuna.com
|
10 |
*
|
11 |
* This program is free software; you can redistribute it and/or
|
12 |
* modify it under the terms of the GNU General Public License
|
13 |
* as published by the Free Software Foundation; either version 2
|
14 |
* of the License, or any later version.
|
15 |
*
|
16 |
* This program is distributed in the hope that it will be useful,
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
* GNU General Public License for more details.
|
20 |
*
|
21 |
* You should have received a copy of the GNU General Public License
|
22 |
* along with this program; if not, write to the Free Software
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
24 |
*/
|
25 |
package com.izforge.izpack.panels; |
26 |
|
27 |
import java.io.IOException; |
28 |
|
29 |
import net.n3.nanoxml.XMLElement; |
30 |
|
31 |
import com.izforge.izpack.installer.AutomatedInstallData; |
32 |
import com.izforge.izpack.installer.PanelAutomation; |
33 |
import com.izforge.izpack.installer.PanelAutomationHelper; |
34 |
import com.izforge.izpack.installer.ProcessPanelWorker; |
35 |
import com.izforge.izpack.util.AbstractUIProcessHandler; |
36 |
|
37 |
/**
|
38 |
* Functions to support automated usage of the CompilePanel
|
39 |
*
|
40 |
* @author Jonathan Halliday
|
41 |
* @author Tino Schwarze
|
42 |
*/
|
43 |
public class ProcessPanelAutomationHelper extends PanelAutomationHelper |
44 |
implements PanelAutomation, AbstractUIProcessHandler
|
45 |
{ |
46 |
private ProcessPanelWorker worker = null; |
47 |
|
48 |
private int noOfJobs = 0; |
49 |
private int currentJob = 0; |
50 |
|
51 |
/**
|
52 |
* Save data for running automated.
|
53 |
*
|
54 |
* @param installData installation parameters
|
55 |
* @param panelRoot unused.
|
56 |
*/
|
57 |
public void makeXMLData(AutomatedInstallData installData, XMLElement panelRoot) |
58 |
{ |
59 |
// not used here - during automatic installation, no automatic
|
60 |
// installation information is generated
|
61 |
} |
62 |
|
63 |
/**
|
64 |
* Perform the installation actions.
|
65 |
*
|
66 |
* @param panelRoot The panel XML tree root.
|
67 |
*/
|
68 |
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) |
69 |
{ |
70 |
try
|
71 |
{ |
72 |
this.worker = new ProcessPanelWorker (idata, this); |
73 |
|
74 |
this.worker.run ();
|
75 |
} |
76 |
catch (IOException e) |
77 |
{ |
78 |
e.printStackTrace (); |
79 |
} |
80 |
|
81 |
} |
82 |
|
83 |
public void logOutput (String message, boolean stderr) |
84 |
{ |
85 |
if (stderr)
|
86 |
{ |
87 |
System.err.println (message);
|
88 |
} |
89 |
else
|
90 |
{ |
91 |
System.out.println (message);
|
92 |
} |
93 |
} |
94 |
|
95 |
/**
|
96 |
* Reports progress on System.out
|
97 |
*
|
98 |
* @see com.izforge.izpack.util.AbstractUIProcessHandler#startProcessing(int)
|
99 |
*/
|
100 |
public void startProcessing (int noOfJobs) |
101 |
{ |
102 |
System.out.println ("[ Starting processing ]"); |
103 |
this.noOfJobs = noOfJobs;
|
104 |
} |
105 |
|
106 |
/**
|
107 |
*
|
108 |
* @see com.izforge.izpack.util.AbstractUIProcessHandler#finishProcessing()
|
109 |
*/
|
110 |
public void finishProcessing () |
111 |
{ |
112 |
System.out.println ("[ Processing finished ]"); |
113 |
} |
114 |
|
115 |
/**
|
116 |
*
|
117 |
*/
|
118 |
public void startProcess (String name) |
119 |
{ |
120 |
this.currentJob++;
|
121 |
System.out.println ("Starting process "+name+ |
122 |
" ("+Integer.toString (this.currentJob)+"/"+Integer.toString (this.noOfJobs)+")"); |
123 |
} |
124 |
|
125 |
public void finishProcess () |
126 |
{ |
127 |
} |
128 |
} |