Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / com / izforge / izpack / panels / TargetPanelAutomationHelper.java @ 15280

History | View | Annotate | Download (2.57 KB)

1
/*
2
 *  $Id: TargetPanelAutomationHelper.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 :               TargetPanelAutomationHelper.java
7
 *  Description :        Automation support functions for TargetPanel.
8
 *  Author's email :     julien@izforge.com
9
 *  Author's Website :   http://www.izforge.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 net.n3.nanoxml.XMLElement;
28

    
29
import com.izforge.izpack.installer.AutomatedInstallData;
30
import com.izforge.izpack.installer.PanelAutomation;
31

    
32
/**
33
 * Functions to support automated usage of the TargetPanel
34
 *
35
 * @author Jonathan Halliday
36
 * @author Julien Ponge
37
 */
38
public class TargetPanelAutomationHelper implements PanelAutomation
39
{
40
        /**
41
         *  Asks to make the XML panel data.
42
         *
43
         * @param idata The installation data.
44
         * @param panelRoot The tree to put the data in.
45
         */
46
        public void makeXMLData(AutomatedInstallData idata, XMLElement panelRoot)
47
        {
48
                // Installation path markup
49
                XMLElement ipath = new XMLElement("installpath");
50
                // check this writes even if value is the default,
51
                // because without the constructor, default does not get set.
52
                ipath.setContent(idata.getInstallPath());
53
                
54
                // Checkings to fix bug #1864
55
                XMLElement prev = panelRoot.getFirstChildNamed("installpath");
56
                if (prev != null) panelRoot.removeChild(prev);
57
                
58
                panelRoot.addChild(ipath);
59
        }
60

    
61
        /**
62
         *  Asks to run in the automated mode.
63
         *
64
         * @param idata The installation data.
65
         * @param panelRoot The XML tree to read the data from.
66
         */
67
        public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot)
68
        {
69
                // We set the installation path
70
                XMLElement ipath = panelRoot.getFirstChildNamed("installpath");
71
                idata.setInstallPath(ipath.getContent());
72
        }
73
}