[izpack-users] File Browser without combo box

Klaus Bartz bartzkau at gmx.net
Sat Feb 25 16:49:21 CET 2006


Hi Laurent,
there are two "types" of extended IzPack users:
One uses the UserInputPanel and made there panels with
the associated xml file.
The other "type" writes own (custom) panels.
Every group means, that there way is the better for some
proplems, but really it is matter of taste, I think :-)

I am one of the custom panel people...

The first own panel will be realy hard. The rest of the fifty
is easy. OK, you need to be firm with java (it is not a good
place to learn java with IzPack panel implementation...).

Following one of my own path panels. For beginners may be
it will be better to go under IzPack path with
package com.izforge.izpack.panels
but it is not a must. All my "private" panels are under my
package path.
This panel uses the same layout as TargetPanel, therefore it can
be really short (the base class do the most). If you would have
an other layout, may be you should write more. See the impl of
PathInputPanel.
An other panel of this family is the JDKPathPanel. You will
really have problems to make such a panel with the UserInputPanel.

Cheers

Klaus

-------- START $ROOT/com/coi/tools/install/panels/DataPathPanel.java -----
package com.coi.tools.install.panels;

import com.izforge.izpack.installer.InstallData;
import com.izforge.izpack.installer.InstallerFrame;
import com.izforge.izpack.panels.PathInputPanel;

/**
  * Input panel for the data path.
  *
  * @author  Klaus Bartz
  * @version @(#) $Revision: 1.3 $ $Date: 2005/10/26 13:34:26 $
  *
  */
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);
   }

   /**
    *  Indicates wether the panel has been validated or not.
    *
    * @return    Wether the panel has been validated or not.
    */
   public boolean isValidated()
   {
	if( ! super.isValidated() )
       return(false);
     String chosenPath = pathSelectionPanel.getPath();
     if(chosenPath == null || chosenPath.length() < 1 )
       return( false );
     idata.setVariable("DataPath",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("DataPath") != null )
       chosenPath = idata.getVariable("DataPath");
     else
       chosenPath = idata.getInstallPath();
     pathSelectionPanel.setPath(chosenPath);
   }
   /* (non-Javadoc)
    * @see com.coi.tools.install.panels.SummaryPanelClient#getSummaryBody()
    */
   public String getSummaryBody()
   {
     return(String) ( idata.getVariable("DataPath"));
   }
}

-------- END $ROOT/com/coi/tools/install/panels/DataPathPanel.java -----

Am 24.02.2006, 20:30 Uhr, schrieb Laurent Duperval <lduperval at gmail.com>:

> On 2/24/06, Hal Vaughan <hal at thresholddigital.com> wrote:
>> Essentially it is.
>>
>> PathSelectionPanel psPanel = new PathSelectionPanel(this, iData);
>>
>> And then just add it to your panel layout as you would any other widget.
>> Check the JavaDocs for it, so you know how to get the path from it once
>> it's chosen.
>>
>
> At the risk of really sounding stupid and annoying... I don't
> understand the answer. I assume it's because I didn't right the proper
> question, so let me reformulate it.
>
> Can I add a label, text field and browse button to a UserInputPanel
> just by writing the Installation XML file? (So can I specify a
> PathSelectionPanel in XML? If so, where can I see the syntax? I want
> something similar to the "search", but with a text input instead of a
> combo box and no Autodetect button).
>
> If I can't, is there another specialised panel I can use? I know about
> TargetPanel but that sets INSTALL_PATH. I want to set a different
> variable.
>
> Otherwise I will extend UserPanel for my purposes and provide patches.
>
> Thanks,
>
> L
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> http://lists.berlios.de/mailman/listinfo/izpack-users
>



-- 
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/



More information about the izpack-users mailing list