Statistics
| Revision:

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

History | View | Annotate | Download (3.56 KB)

1
/*
2
 *  $Id: TargetPanel.java,v 1.1 2006/06/14 07:29:07 cesar Exp $
3
 *  IzPack
4
 *  Copyright (C) 2001-2004 Julien Ponge, 2004 Klaus Bartz
5
 *
6
 *  File :               TargetPanel.java
7
 *  Description :        A panel to select the installation path.
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.InstallData;
30
import com.izforge.izpack.installer.InstallerFrame;
31

    
32
/**
33
 *  The taget directory selection panel.
34
 *
35
 * @author     Julien Ponge
36
 */
37
public class TargetPanel extends PathInputPanel
38
{
39

    
40
  /**
41
   *  The constructor.
42
   *
43
   * @param  parent  The parent window.
44
   * @param  idata   The installation data.
45
   */
46
  public TargetPanel(InstallerFrame parent, InstallData idata)
47
  {
48
    super(parent, idata);
49
    // load the default directory info (if present)
50
    loadDefaultInstallDir(parent);
51
    if (getDefaultInstallDir() != null)
52
    {
53
      // override the system default that uses app name (which is set in the Installer class)
54
      idata.setInstallPath(getDefaultInstallDir());
55
    }
56
  }
57

    
58
  /**  Called when the panel becomes active.  */
59
  public void panelActivate()
60
  {
61
    // Resolve the default for chosenPath
62
    super.panelActivate();
63
    // Set the default or old value to the path selection panel.
64
    pathSelectionPanel.setPath(idata.getInstallPath());
65
  }
66

    
67
  /**
68
   * This method simple delegates to
69
   * <code>PathInputPanel.loadDefaultInstallDir</code> with
70
   * the current parent as installer frame.
71
   */
72
  public void loadDefaultDir()
73
  {
74
    super.loadDefaultInstallDir(parent);
75
  }
76

    
77
  /**
78
   *  Indicates wether the panel has been validated or not.
79
   *
80
   * @return    Wether the panel has been validated or not.
81
   */
82
  public boolean isValidated()
83
  {
84
    // Standard behavior of PathInputPanel.
85
    if( ! super.isValidated())
86
      return(false);
87
    idata.setInstallPath(pathSelectionPanel.getPath());
88
    return(true);
89
  }
90

    
91

    
92
  /**
93
   * Returns the default install directory. This is equal to 
94
   * <code>PathInputPanel.getDefaultInstallDir</code>
95
   * @return the default install directory
96
   */
97
  public String getDefaultDir()
98
  {
99
    return getDefaultInstallDir();
100
  }
101

    
102
  /**
103
   * Sets the default install directory to the given
104
   * String. This is equal to 
105
   * <code>PathInputPanel.setDefaultInstallDir</code>
106
   * @param defaultDir path to be used for the install directory 
107
   */
108
  public void setDefaultDir(String defaultDir)
109
  {
110
    setDefaultInstallDir(defaultDir);
111
  }
112

    
113
  /**
114
   *  Asks to make the XML panel data.
115
   *
116
   * @param  panelRoot  The tree to put the data in.
117
   */
118
  public void makeXMLData(XMLElement panelRoot)
119
  {
120
    new TargetPanelAutomationHelper().makeXMLData(idata, panelRoot);
121
  }
122
}