[izpack-users] Simple question about PathInputPanel
Christopher D. Jones
chris.jonesey at gmail.com
Sun Feb 10 16:46:09 CET 2008
I have extended the PathInputPanel to make a custom panel to select a
directory needed for my installation.
The problem I am having is I cannot figure out how to set the label on the
panel. The panel shows up but it looks like the default target install
panel.
I am sure I am missing something simple, so any help would be greatly
appreciated.
Here is my Java code:
package com.izforge.izpack.panels;
import javax.swing.JLabel;
import com.izforge.izpack.installer.InstallData;
import com.izforge.izpack.installer.InstallerFrame;
/**
* Input panel for the data path.
*
*/
public class DataPathPanel extends PathInputPanel {
/**
* The constructor.
*
* @param parent The parent window.
* @param idata The installation data.
*/
public DataPathPanel(InstallerFrame parent, InstallData idata) {
super(parent, idata);
headline = "FUBAR headline";
headLineLabel = new JLabel ("FUBAR headlinelabel");
}
/**
* Indicates whether the panel has been validated or not.
*
* @return Whether the panel has been validated or not.
*/
public boolean isValidated() {
if (!super.isValidated())
return (false);
System.out.println ("isValidated");
String chosenPath = pathSelectionPanel.getPath();
if (chosenPath == null || chosenPath.length() < 1)
return (false);
idata.setVariable("DATA_DIRECTORY", chosenPath);
return (true);
}
/* (non-Javadoc)
* @see com.izforge.izpack.installer.IzPanel#panelActivate()
*/
public void panelActivate() {
super.panelActivate();
// Resolve and set the default for chosenPath
String chosenPath;
// common lines for back steps...
if (idata.getVariable("DATA_DIRECTORY") != null)
chosenPath = idata.getVariable("DATA_DIRECTORY");
else
chosenPath = idata.getInstallPath();
pathSelectionPanel.setPath(chosenPath);
}
/* (non-Javadoc)
* @see com.coi.tools.install.panels.SummaryPanelClient#getSummaryBody()
*/
public String getSummaryBody() {
return (String) (idata.getVariable("DATA_DIRECTORY"));
}
}
And here is my install file:
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<!--
To compile it :
- go in the bin directory where you installed IzPack
- call "compile ../sample/install.xml -b ../sample"
-->
<installation version="1.0">
<!--
The info section.
The meaning of the tags should be natural ...
-->
<info>
<appname>Hello World</appname>
<appversion>0.1 Beta</appversion>
<authors>
<author name="Ink Inc." email="me at ink.com"/>
</authors>
<url>http://www.inkinc.com/</url>
</info>
<!--
The gui preferences indication.
Sets the installer window to 640x480. It will not be able to change
the size.
-->
<guiprefs width="640" height="480" resizable="no"/>
<!--
The locale section.
Asks here to include the English and French langpacks.
-->
<locale>
<langpack iso3="eng"/>
</locale>
<str id="DataPathPanel.intro" txt="For the application configuration
directory, another path can be selected than the project directory. You can
choose the given project directory or select another one."/>
<str id="DataPathPanel.info" txt="Path of application configuration
directory: "/>
<!--
The panels section.
We indicate here which panels we want to use. The order will be
respected.
-->
<panels>
<panel classname="DataPathPanel"/>
<panel classname="FinishPanel"/>
</panels>
<!--
The packs section.
We specify here our packs.
-->
<packs>
<pack name="Application" required="yes" preselected="yes">
<description>The application files.</description>
<file src="hello_world/bogus" targetdir="$INSTALL_PATH"/>
</pack>
<pack name="Documentation" required="no" preselected="yes">
<description>The documentation</description>
<file src="doc" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/izpack-users/attachments/20080210/e6893f4c/attachment.html
More information about the izpack-users
mailing list