[izpack-changes] r1778 - in izpack-src/trunk: . bin/langpacks/installer src/lib/com/izforge/izpack/panels

noreply at berlios.de noreply at berlios.de
Sun Mar 11 17:07:05 CET 2007


Author: jponge
Date: 2007-03-11 17:06:56 +0100 (Sun, 11 Mar 2007)
New Revision: 1778

Modified:
   izpack-src/trunk/Versions.txt
   izpack-src/trunk/bin/langpacks/installer/deu.xml
   izpack-src/trunk/bin/langpacks/installer/eng.xml
   izpack-src/trunk/bin/langpacks/installer/fin.xml
   izpack-src/trunk/bin/langpacks/installer/por.xml
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
   izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java
Log:
Merged -r1741:1777 from branches/3.10

Modified: izpack-src/trunk/Versions.txt
===================================================================
--- izpack-src/trunk/Versions.txt	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/Versions.txt	2007-03-11 16:06:56 UTC (rev 1778)
@@ -21,6 +21,13 @@
   (Martina Angela Albrecht, via Fabrice Mirabile)
 - FreeDesktop XDG standard support for Gnome and KDE shortcuts support
   (Vladimir Ralev via Julien Ponge)
+- Workaround for a Sun bug in Java 6 which crashes the installer in some non-english locales,
+  see http://jira.jboss.com/jira/browse/JBINSTALL-232 (Vladimir Ralev)
+- Replaced the default checkbox icons in Gnome/KDE since they do not grey-out when disabled
+  as notes in the helper label. This change is only effective for UNIX. (Vladimir Ralev)
+- Added localization support for column names in InstallationGroupPanel
+  (Markus Schlegel via Vladimir Ralev)
+- Finnish langpack update (Ari Voutilainen via Julien Ponge)
 
   > 3.10.0 (build 2007.01.29)
 

Modified: izpack-src/trunk/bin/langpacks/installer/deu.xml
===================================================================
--- izpack-src/trunk/bin/langpacks/installer/deu.xml	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/bin/langpacks/installer/deu.xml	2007-03-11 16:06:56 UTC (rev 1778)
@@ -216,6 +216,7 @@
 	  <str id="nextmedia.cancelbtn" txt="Installation abbrechen" />	
     <str id="nextmedia.choosertitle" txt="Installationsmedium auswählen" />
     <str id="nextmedia.filedesc" txt="Installationspakete (.pak*)" />
+
     <!-- Strings for the loggin/reporting system (Messenger) -->
 
     <!-- This string defines the time stamp format in the installation report.
@@ -252,5 +253,10 @@
 
     <str id="log.error_0"                 txt="konnte die Datei ''{0}'' nicht schreiben"/>
 
+    
+    <str id="InstallationGroupPanel.colNameSelected" txt="Selektiert" />
+    <str id="InstallationGroupPanel.colNameInstallType" txt="Installationstyp" />
+    <str id="InstallationGroupPanel.colNameSize" txt="Grösse" />
+    
 </langpack>
 

Modified: izpack-src/trunk/bin/langpacks/installer/eng.xml
===================================================================
--- izpack-src/trunk/bin/langpacks/installer/eng.xml	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/bin/langpacks/installer/eng.xml	2007-03-11 16:06:56 UTC (rev 1778)
@@ -216,6 +216,7 @@
 	  <str id="nextmedia.cancelbtn" txt="Cancel" />	
     <str id="nextmedia.choosertitle" txt="Choose install media" />
     <str id="nextmedia.filedesc" rdid="install packs (.pak*)" />
+
     <!-- Strings for the loggin/reporting system (Messenger) -->
 
     <!-- This string defines the time stamp format in the installation report.
@@ -252,5 +253,9 @@
     <str id="log.warning_"                txt=""/>
 
     <str id="log.error_0"                 txt="unable to write ''{0}''"/>
+    
+    <str id="InstallationGroupPanel.colNameSelected" txt="Selected" />
+    <str id="InstallationGroupPanel.colNameInstallType" txt="InstallType" />
+    <str id="InstallationGroupPanel.colNameSize" txt="Size" />
 
 </langpack>

Modified: izpack-src/trunk/bin/langpacks/installer/fin.xml
===================================================================
--- izpack-src/trunk/bin/langpacks/installer/fin.xml	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/bin/langpacks/installer/fin.xml	2007-03-11 16:06:56 UTC (rev 1778)
@@ -215,5 +215,10 @@
 	  <str id="nextmedia.cancelbtn" txt="Peruuta" />
     <str id="nextmedia.choosertitle" txt="Valitse asennusmedia" />
     <str id="nextmedia.filedesc" rdid="asennuspaketit (.pak*)" />
+
+    <str id="InstallationGroupPanel.colNameSelected" txt="Valittu" />
+    <str id="InstallationGroupPanel.colNameInstallType" txt="Asennustyyppi" />
+    <str id="InstallationGroupPanel.colNameSize" txt="Koko" />
+
 </langpack>
 

Modified: izpack-src/trunk/bin/langpacks/installer/por.xml
===================================================================
--- izpack-src/trunk/bin/langpacks/installer/por.xml	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/bin/langpacks/installer/por.xml	2007-03-11 16:06:56 UTC (rev 1778)
@@ -4,20 +4,46 @@
 
 <langpack>
 	
-    <!-- General installer strings -->
+    <!-- Heading messages START -->
+    <str id="CheckedHelloPanel.headline" txt="Bem vindo"/>
+    <str id="CompilePanel.headline" txt="Compilar códigos Java"/>
+    <str id="ConditionalUserInputPanel.headline" txt="Dados do usuário"/>
+    <str id="ExtendedInstallPanel.headline" txt="Insatlação e configuração"/>
+    <str id="FinishPanel.headline" txt="Instalação terminada"/>
+    <str id="HelloPanel.headline" txt="Bem vindo"/>
+    <str id="HTMLInfoPanel.headline" txt="Informações"/>
+    <str id="HTMLLicencePanel.headline" txt="Acordo de licença"/>
+    <str id="ImgPacksPanel.headline" txt="Selecione pacotes de instalação"/>
+    <str id="InfoPanel.headline" txt="Informações"/>
+    <str id="InstallPanel.headline" txt="Instalação"/>
+    <str id="JDKPathPanel.headline" txt="Caminho do JDK"/>
+    <str id="LicencePanel.headline" txt="Acordo de licença"/>
+    <str id="PacksPanel.headline" txt="Selecione pacotes de instalação"/>
+    <str id="ProcessPanel.headline" txt="Executar processos externos"/>
+    <str id="ShortcutPanel.headline" txt="Atalhos"/>
+    <str id="SimpleFinishPanel.headline" txt="Instalação terminada"/>
+    <str id="SummaryPanel.headline" txt="Resumo dos dados do usuário"/>
+    <str id="TargetPanel.headline" txt="Caminho de destino"/>
+    <str id="UserInputPanel.headline" txt="Dados do usuário"/>
+	
+	<!-- General installer strings -->
     <str id="installer.title" txt="IzPack - Instalação de "/>
     <str id="installer.next" txt="Próximo"/>
     <str id="installer.prev" txt="Anterior"/>
     <str id="installer.quit" txt="Sair"/>
     <str id="installer.madewith" txt="(Criado com IzPack - http://www.izforge.com/)"/>
     <str id="installer.quit.title" txt="Tem certeza de que deseja sair ?"/>
-    <str id="installer.quit.message" txt="Você quer concelar a instalação?"/>
+    <str id="installer.quit.message" txt="Você quer cancelar a instalação?"/>
     <str id="installer.warning" txt="Aviso !"/>
     <str id="installer.yes" txt="Sim"/>
     <str id="installer.no" txt="Não"/>
     <str id="installer.cancel" txt="Cancelar"/>
     <str id="installer.error" txt="Erro"/>
-    
+    <str id="installer.help" txt="Ajuda"/>
+    <str id="installer.step" txt="Passo"/>
+    <str id="installer.of" txt="de"/>
+    <str id="installer.Message" txt="Menssagem"/>
+	
     <!-- Uninstaller specific strings -->
     <str id="uninstaller.warning" txt="Isto removerá o(s) aplicativo(s) instalado(s) !"/>
     <str id="uninstaller.destroytarget" txt=" Forçar a remoção de "/>
@@ -26,10 +52,16 @@
     <!-- The strings for the 'official' IzPack plugins -->
     <str id="HelloPanel.welcome1" txt="Bem vindo à instalação de "/>
     <str id="HelloPanel.welcome2" txt=" !"/>
-    <str id="HelloPanel.authors" txt="O(s) autor(es) deste programa é(são) : "/>
+    <str id="HelloPanel.authors" txt="Este programa foi desenvolvido por : "/>
     <str id="HelloPanel.url" txt="A página do programa é : "/>
     
-    <str id="LicencePanel.info" txt="Por favor, leia o seguinte contrato de licença :"/>
+    <str id="PrinterSelectPanel.select_printer" txt="Selecione a impressora para utilizar na configuração inicial e teste." />
+
+    <str id="CheckedHelloPanel.productAlreadyExist0" txt="Este produto já se encontra instalado neste computador em "/>
+    <str id="CheckedHelloPanel.productAlreadyExist1" txt=" . Você tem certeza de que quer instalar outra cópia?"/>
+    <str id="CheckedHelloPanel.infoOverUninstallKey" txt="A chave de desinstalação será chamada: " />
+	
+	<str id="LicencePanel.info" txt="Por favor, leia o seguinte contrato de licença :"/>
     <str id="LicencePanel.agree" txt="Eu concordo com este contrato de licença."/>
 	<str id="LicencePanel.notagree" txt="Eu não concordo com este contrato de licença."/>
     <str id="LicencePanel.yes" txt="Sim"/>
@@ -37,20 +69,43 @@
     
     <str id="InfoPanel.info" txt="Por favor, leia a seguinte informação :"/>
     
-    <str id="TargetPanel.info" txt="Selecione o caminho para instalação :"/>
+    <str id="PathInputPanel.required" txt="O diretório escolhido deve existir."/>
+    <str id="PathInputPanel.notValid" txt="O diretório escolhido não contém o produto requerido."/>
+	
+	<str id="TargetPanel.info" txt="Selecione o caminho para instalação :"/>
     <str id="TargetPanel.browse" txt="Procurar ..."/>
     <str id="TargetPanel.warn" 
          txt="O diretório já existe ! Tem certeza de que quer instalar neste diretório e possivelmente sobrescrever arquivos existentes?"/>
     <str id="TargetPanel.empty_target"
          txt="Você não especificou um local! Isto está correto?"/>
 	<str id="TargetPanel.createdir" txt="O diretório especificado será criado :" />
+	<str id="TargetPanel.nodir" 
+         txt="Este arquivo não é um diretório! Por favor, selecione um diretório!"/>
+    <str id="TargetPanel.notwritable" 
+         txt="Este diretório não pode ser escrito! Por favor, escolha outro diretório!"/>
+		 
+    <str id="JDKPathPanel.extendedIntro" txt="O programa instalado necessita um JDK com versão entre ${JDKPathPanel.minVersion} e ${JDKPathPanel.maxVersion}. Um &quot;Java Runtime Environment&quot; (JRE) não é suficiente."/>
+    <str id="JDKPathPanel.intro" txt="O programa instalado necessita um JDK. Um &quot;Java Runtime Environment&quot; (JRE) não é suficiente."/>
+    <str id="JDKPathPanel.info" txt="Selecione o caminho do JDK:"/>
+    <str id="JDKPathPanel.badVersion1" txt="O JDK escolhido tem versão não recomendada (Disponível: "/>
+    <str id="JDKPathPanel.badVersion2" txt=" Necessário: "/>
+    <str id="JDKPathPanel.badVersion3" txt="). Usar esse JDK mesmo assim?"/>
 	
-    <str id="PacksPanel.info" txt="Selecione os pacotes que deseja instalar :"/>
+	<str id="PacksPanel.info" txt="Selecione os pacotes que deseja instalar :"/>
     <str id="PacksPanel.tip" txt="Nota: pacotes cinzas são requeridos."/>
     <str id="PacksPanel.space" txt="Espaço total requerido: "/>
+	<str id="PacksPanel.freespace" txt="Espaço disponível: "/>
 	<str id="PacksPanel.description" txt="Descrição"/>
+    <str id="PacksPanel.dependencyList" 
+        txt="O pacote escolhido tem as seguintes dependências e/ou exclui"/>
+    <str id="PacksPanel.dependencies" txt="Dependências: "/>
+    <str id="PacksPanel.excludes" txt="Exclui: "/>
+    <str id="ImgPacksPanel.dependencyList" txt="Dependências e/ou exclui"/>
+	<str id="PacksPanel.notEnoughSpace" 
+	    txt="O espaço em disco requerido para a instalação é maior que o espaço em disco disponível."/>
+    <str id="PacksPanel.notAscertainable" txt="não dedutível"/>
     
-    <str id="InstallPanel.info" txt="Clique 'Instalar !' para iniciar o processo de instalação"/>
+	<str id="InstallPanel.info" txt="Clique 'Instalar !' para iniciar o processo de instalação"/>
     <str id="InstallPanel.install" txt="Instalar !"/>
     <str id="InstallPanel.tip" txt="Progresso da instalação :"/>
     <str id="InstallPanel.begin" txt="[Nada]"/>
@@ -60,7 +115,7 @@
     <str id="InstallPanel.overwrite.question" txt="O seguinte arquivo já existe. Sobrescrevê-lo?"/>
     
     <str id="FinishPanel.success" txt="Instalação realizada com sucesso."/>
-    <str id="FinishPanel.done" txt="Feito"/>
+    <str id="FinishPanel.done" txt="Pronto"/>
     <str id="FinishPanel.fail" txt="A instalação falhou!"/>
     <str id="FinishPanel.uninst.info" txt="Um programa desinstalador foi criado em:"/>
     <str id="FinishPanel.auto" txt="Gerar um script para instalação automática"/>
@@ -71,10 +126,14 @@
     <str id="ImgPacksPanel.snap" txt="Visualização da tela do pacote  :"/>
     <str id="ImgPacksPanel.checkbox" txt=" Instalar este pacote"/>
     
-    <str id="ShortcutPanel.regular.list" txt="Selecione uma Categoria de Programas para os Atalhos:"/>
-    <str id="ShortcutPanel.regular.default" txt="Limpar"/>
-    <str id="ShortcutPanel.regular.desktop" txt="Criar os atalhos no desktop"/>
-    <str id="ShortcutPanel.regular.create" txt="Criar Atalhos"/>
+    <str id="ShortcutPanel.headline" txt="Configurar atalhos"/>
+    <str id="ShortcutPanel.regular.list" txt="Selecione um grupo para os atalhos:"/>
+		<str id="ShortcutPanel.regular.default" txt="Padrão"/>
+    <str id="ShortcutPanel.regular.desktop" txt="Criar atalhos adicionais na Área de Trabalho"/>
+    <str id="ShortcutPanel.regular.StartMenu:Start-Menu" txt="Start-Menu"/>
+    <str id="ShortcutPanel.regular.StartMenu:K-Menu" txt="K-Menu"/>
+	                                                          <!-- "StartMenu" is a placeholder will be replaced at runtime -->
+	<str id="ShortcutPanel.regular.create" txt="Criar Atalhos"/>
     <str id="ShortcutPanel.regular.userIntro" txt="criar atalho para:"/>
     <str id="ShortcutPanel.regular.currentUser" txt="usuário atual"/>
     <str id="ShortcutPanel.regular.allUsers" txt="todos usuários"/>
@@ -85,8 +144,7 @@
     <str id="ShortcutPanel.alternate.saveButton" txt="Salvar Arquivo de Texto"/>
 	
     <str id="ShortcutPanel.textFile.header" txt="Informação Sobre Atalhos\n====================\n\nA seguinte é uma listagem de toda informação relevante sobre os atalhos\ndesejados. Esta informação deve possibilitar a criação manual de atalhos.\n"/>
-    
-    <str id="ShortcutPanel.textFile.name"         txt="Atalho                : "/>
+        <str id="ShortcutPanel.textFile.name"         txt="Atalho                : "/>
     <str id="ShortcutPanel.textFile.location"     txt="Local Desejado        : "/>
     <str id="ShortcutPanel.textFile.description"  txt="Descrição             : "/>
     <str id="ShortcutPanel.textFile.target"       txt="Arquivo Executável    : "/>
@@ -135,6 +193,27 @@
 	
     <str id="ProcessPanel.heading" txt="Processando" />
 	
-    <!-- Add your own panels specific strings here if you need -->
+    <!-- Strings for the summary of panels - START -->
+    <str id="SummaryPanel.info" txt="Pronto para instalar. Os dados importantes são listados abaixo. Clique &quot;Próximo&quot; para iniciar a instalação, "/>
+    <str id="TargetPanel.summaryCaption" txt="Caminho da instalação"/>
+    <str id="JDKPathPanel.summaryCaption" txt="Caminho do JDK"/>
+    <str id="PacksPanel.summaryCaption" txt="Pacotes de instalação escolhidos"/>
+    <str id="ImgPacksPanel.summaryCaption" txt="Pacotes de instalação escolhidos"/>
+    <!-- Strings for the summary of panels - END -->
+
+    <!-- Strings for the Registry -->
+    <str id="functionFailed.RegOpenKeyEx" txt="Não foi possível abrir a chave do registro {0}\\{1}."/>
+    
+    <!-- Add your own panels specific strings here if you need or use a custom
+         langpack with the same syntax referred as resoure CustomLangpack.xml_[ISO3]"
+    -->     
+
+    <str id="nextmedia.title" txt="Próxima mídia de instalação"/>
+  	<str id="nextmedia.msg" txt="Escolha a próxima mídia de instalação." />
+	  <str id="nextmedia.browsebtn" txt="Explorar" />
+  	<str id="nextmedia.okbtn" txt="Aplicar" />
+	  <str id="nextmedia.cancelbtn" txt="Cancelar" />	
+    <str id="nextmedia.choosertitle" txt="Escolha a mídia de instalação" />
+    <str id="nextmedia.filedesc" rdid="pacotes de instalação (.pak*)" />
 	
 </langpack>

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java	2007-03-11 16:06:56 UTC (rev 1778)
@@ -1,598 +1,601 @@
-/*
- * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
- * 
- * http://www.izforge.com/izpack/
- * http://developer.berlios.de/projects/izpack/
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- *     
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.izforge.izpack.panels;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.List;
-import java.util.HashSet;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.JTextPane;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.TitledBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumnModel;
-import javax.swing.table.TableModel;
-
-import net.n3.nanoxml.XMLElement;
-
-import com.izforge.izpack.Pack;
-import com.izforge.izpack.installer.InstallData;
-import com.izforge.izpack.installer.InstallerFrame;
-import com.izforge.izpack.installer.IzPanel;
-import com.izforge.izpack.util.Debug;
-import com.izforge.izpack.util.AbstractUIHandler;
-
-import java.util.ArrayList;
-import java.net.URLDecoder;
-import java.io.UnsupportedEncodingException;
-
-
-/**
- * A panel which displays the available installGroups found on the packs to
- * allow the user to select a subset of the packs based on the pack
- * installGroups attribute. This panel will be skipped if there are no
- * pack elements with an installGroups attribute.
- * 
- * @author Scott.Stark at jboss.org
- * @version $Revision: 1.1.1.1 $
- */
-public class InstallationGroupPanel extends IzPanel
-    implements ListSelectionListener
-{
-    private static final long serialVersionUID = 1L;
-
-    /** HashMap<String, Pack> of the InstallData.availablePacks */
-    private HashMap packsByName;
-    private TableModel groupTableModel;
-    private JTextPane descriptionField;
-    private JScrollPane groupScrollPane;
-    private JTable groupsTable;
-    private GroupData[] rows;
-    private int selectedGroup = -1;
-
-    public InstallationGroupPanel(InstallerFrame parent, InstallData idata)
-    {
-        super(parent, idata);
-        buildLayout();
-    }
-
-    /**
-     * If there are no packs with an installGroups attribute, this panel is
-     * skipped. Otherwise, the unique installGroups are displayed in a table.
-     */
-    public void panelActivate()
-    {
-        // Set/restore availablePacks from allPacks
-        idata.availablePacks = new ArrayList(idata.allPacks);
-
-        Debug.trace("InstallationGroupPanel.panelActivate, selectedGroup="+selectedGroup);
-        // If there are no groups, skip this panel
-        HashMap installGroups = getInstallGroups(idata);
-        if (installGroups.size() == 0)
-        {
-            super.askQuestion("Skip InstallGroup selection",
-                "Skip InstallGroup selection", AbstractUIHandler.CHOICES_YES_NO);
-            parent.skipPanel();
-            return;
-        }
-
-        // Build the table model from the unique groups
-        groupTableModel = getModel(installGroups);
-        groupsTable.setModel(groupTableModel);
-        TableColumnModel tcm = groupsTable.getColumnModel();
-        tcm.getColumn(0).setCellRenderer(new RadioButtonRenderer());
-        tcm.getColumn(0).setCellEditor(new RadioButtonEditor());
-        //groupsTable.setColumnSelectionAllowed(false);
-        //groupsTable.setRowSelectionAllowed(true);
-        groupsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-        groupsTable.getSelectionModel().addListSelectionListener (this);
-        groupsTable.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
-        groupsTable.setIntercellSpacing(new Dimension(0, 0));
-        groupsTable.setShowGrid(false);
-        if( selectedGroup >= 0 )
-        {
-            groupsTable.getSelectionModel().setSelectionInterval(selectedGroup, selectedGroup);
-            descriptionField.setText(rows[selectedGroup].description);
-        }
-        else
-        {
-            descriptionField.setText(rows[0].description);
-        }
-    }
-
-    /**
-     * Remove all packs from the InstallData availablePacks and selectedPacks
-     * that do not list the selected installation group. Packs without any
-     * installGroups are always included.
-     */
-    public void panelDeactivate()
-    {
-
-        Debug.trace("InstallationGroupPanel.panelDeactivate, selectedGroup="+selectedGroup);
-        if( selectedGroup >= 0 )
-        {
-            removeUnusedPacks();
-            GroupData group = this.rows[selectedGroup];
-            idata.setVariable("INSTALL_GROUP", group.name);
-            Debug.trace("Added variable INSTALL_GROUP="+group.name);
-        }
-    }
-
-    /**
-     * There needs to be a valid selectedGroup to go to the next panel
-     * @return true if selectedGroup >= 0, false otherwise
-     */
-    public boolean isValidated()
-    {
-        Debug.trace("InstallationGroupPanel.isValidated, selectedGroup="+selectedGroup);
-        return selectedGroup >= 0;
-    }
-
-    /**
-     * Update the current selected install group index.
-     * @param e
-     */
-    public void valueChanged(ListSelectionEvent e)
-    {
-        Debug.trace("valueChanged: " + e);
-        if (e.getValueIsAdjusting() == false)
-        {
-            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
-            if( lsm.isSelectionEmpty()  )
-            {
-                descriptionField.setText("");
-            }
-            else
-            {
-                selectedGroup = lsm.getMinSelectionIndex();
-                if( selectedGroup >= 0 )
-                {
-                    GroupData data = rows[selectedGroup];
-                    descriptionField.setText(data.description);
-                }
-                Debug.trace("selectedGroup set to: "+selectedGroup);
-            }
-        }
-    }
-
-    /* Add the installation group to pack mappings
-	 * @see com.izforge.izpack.installer.IzPanel#makeXMLData(net.n3.nanoxml.XMLElement)
-	 */
-	public void makeXMLData(XMLElement panelRoot)
-	{
-		InstallationGroupPanelAutomationHelper helper = new InstallationGroupPanelAutomationHelper();
-		idata.setAttribute("GroupData", rows);
-		idata.setAttribute("packsByName", packsByName);
-		helper.makeXMLData(idata, panelRoot);
-	}
-
-	/**
-     * Create the panel ui.
-     */
-    protected void buildLayout()
-    {
-        GridBagConstraints gridBagConstraints;
-
-        descriptionField = new JTextPane();
-        groupScrollPane = new JScrollPane();
-        groupsTable = new JTable();
-
-        setLayout(new GridBagLayout());
-
-        descriptionField.setMargin(new Insets(2, 2, 2, 2));
-        descriptionField.setAlignmentX(LEFT_ALIGNMENT);
-        descriptionField.setCaretPosition(0);
-        descriptionField.setEditable(false);
-        descriptionField.setOpaque(false);
-        descriptionField.setText("<b>Install group description text</b>");
-        descriptionField.setContentType("text/html");
-        descriptionField.setBorder(new TitledBorder("Description"));
-        gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.gridy = 2;
-        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
-        gridBagConstraints.weightx = 1.0;
-        gridBagConstraints.weighty = 0.3;
-        add(descriptionField, gridBagConstraints);
-
-        groupScrollPane.setBorder(new EmptyBorder(1, 1, 1, 1));
-        groupScrollPane.setViewportView(groupsTable);
-
-        gridBagConstraints = new java.awt.GridBagConstraints();
-        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
-        gridBagConstraints.weightx = 1.0;
-        gridBagConstraints.weighty = 1.0;
-        add(groupScrollPane, gridBagConstraints);
-    }
-
-    protected void removeUnusedPacks()
-    {
-        GroupData data = rows[selectedGroup];
-        Debug.trace("InstallationGroupPanel.removeUnusedPacks, GroupData="+data.name);
-
-        // Now remove the packs not in groupPackNames
-        idata.selectedPacks.clear();
-        idata.selectedPacks.addAll(idata.availablePacks);
-        Iterator iter = idata.availablePacks.iterator();
-        while( iter.hasNext() )
-        {
-            Pack p = (Pack) iter.next();
-
-            //reverse dependencies must be reset in case the user is going
-            //back and forth between the group selection panel and the packs selection panel
-            p.revDependencies = null;
-
-            if( data.packNames.contains(p.name) == false )
-            {
-                iter.remove();
-                Debug.trace("Removed AvailablePack: "+p.name);
-            }
-        }
-
-        List selectedPacks = idata.selectedPacks;
-        iter = selectedPacks.iterator();
-        while( iter.hasNext() )
-        {
-            Pack p = (Pack) iter.next();
-            if( data.packNames.contains(p.name) == false || !p.preselected)
-            {
-                iter.remove();
-                Debug.trace("Removed selectedPack: "+p.name);
-            }
-        }
-    }
-    protected void addDependents(Pack p, HashMap packsByName, GroupData data)
-    {
-        data.packNames.add(p.name);
-        data.size += p.nbytes;
-        Debug.trace("addDependents, added pack: "+p.name);
-        if( p.dependencies == null || p.dependencies.size() == 0 )
-            return;
-
-        Iterator iter = p.dependencies.iterator();
-        Debug.trace(p.name+" dependencies: "+p.dependencies);
-        while( iter.hasNext() )
-        {
-            String dependent = (String) iter.next();
-            if( data.packNames.contains(dependent) == false )
-            {
-                Debug.trace("Need dependent: "+dependent);
-                Pack dependentPack = (Pack) packsByName.get(dependent);
-                addDependents(dependentPack, packsByName, data);
-            }
-        }
-    }
-
-    /**
-     * Build the set of unique installGroups data. The GroupData description
-     * is taken from the InstallationGroupPanel.description.[name] property
-     * where [name] is the installGroup name. The GroupData size is built
-     * from the Pack.nbytes sum.
-     * 
-     * @param idata - the panel install data
-     * @return HashMap<String, GroupData> of unique install group names
-     */
-    protected HashMap getInstallGroups(InstallData idata)
-    {
-        /* First create a packsByName<String, Pack> of all packs and identify
-        the unique install group names.
-        */
-        packsByName = new HashMap();
-        HashMap installGroups = new HashMap();
-        for (int n = 0; n < idata.availablePacks.size(); n++)
-        {
-            Pack p = (Pack) idata.availablePacks.get(n);
-            packsByName.put(p.name, p);
-            Set groups = p.installGroups;
-            Iterator iter = groups.iterator();
-            Debug.trace("Pack: "+p.name+", installGroups: "+groups);
-            while (iter.hasNext())
-            {
-                String group = (String) iter.next();
-                GroupData data = (GroupData) installGroups.get(group);
-                if (data == null)
-                {
-                    String description = getGroupDescription(group);
-                    data = new GroupData(group, description);
-                    installGroups.put(group, data);
-                }
-            }
-        }
-        Debug.trace("Found installGroups: " + installGroups.keySet());
-
-        /* Build up a set of the packs to include in the installation by finding
-        all packs in the selected group, and then include their dependencies.
-        */
-        Iterator gditer = installGroups.values().iterator();
-        while( gditer.hasNext() )
-        {
-            GroupData data = (GroupData) gditer.next();
-            Debug.trace("Adding dependents for: "+data.name);
-            Iterator iter = idata.availablePacks.iterator();
-            while( iter.hasNext() )
-            {
-                Pack p = (Pack) iter.next();
-                Set groups = p.installGroups;
-                if( groups.size() == 0 || groups.contains(data.name) == true )
-                {
-                    // The pack may have already been added while traversing dependencies
-                    if( data.packNames.contains(p.name) == false )
-                        addDependents(p, packsByName, data);
-                }
-            }
-            Debug.trace("Completed dependents for: "+data);
-            if( Debug.tracing() )
-                Debug.trace(data);
-        }
-
-        return installGroups;
-    }
-
-    /**
-     * Look for a key = InstallationGroupPanel.description.[group] entry:
-     * first using idata.langpack.getString(key+".html")
-     * next using idata.langpack.getString(key)
-     * next using idata.getVariable(key)
-     * lastly, defaulting to group + " installation"
-     * @param group - the installation group name
-     * @return the group description
-     */
-    protected String getGroupDescription(String group)
-    {
-        String description = null;
-        String key = "InstallationGroupPanel.description." + group;
-        if( idata.langpack != null )
-        {
-            String htmlKey = key+".html";
-            String html = idata.langpack.getString(htmlKey);
-            // This will equal the key if there is no entry
-            if( htmlKey.equalsIgnoreCase(html) )
-                description = idata.langpack.getString(key);
-            else
-                description = html;
-        }
-        if (description == null || key.equalsIgnoreCase(description))
-            description = idata.getVariable(key);
-        if (description == null)
-            description = group + " installation";
-        try
-        {
-            description = URLDecoder.decode(description, "UTF-8");
-        }
-        catch (UnsupportedEncodingException e)
-        {
-            emitWarning("Failed to convert description", e.getMessage());
-        }
-
-        return description;
-    }
-
-    protected TableModel getModel(HashMap groupData)
-    {
-        String[] columns = { "Selected", "InstallType", "Size"};
-         DefaultTableModel model = new DefaultTableModel (columns, 0)
-         {
-            public boolean isCellEditable (int row, int column)
-            {
-               return column == 0;
-            }
-        };
-        rows = new GroupData[groupData.size()];
-        // The name of the group to select if there is no current selection
-        String defaultGroup = idata.getVariable("InstallationGroupPanel.defaultGroup");
-         Debug.trace("InstallationGroupPanel.defaultGroup="+defaultGroup+", selectedGroup="+selectedGroup);
-         List values = new ArrayList(groupData.values());
-         Collections.sort(values, new Comparator()
-         {
-           public int compare(Object o1, Object o2)
-           {
-               GroupData g1 = (GroupData) o1;
-               GroupData g2 = (GroupData) o2;
-
-               if (g1.name == null || g2.name==null)
-               {
-                   return 0;
-               }
-
-               return g1.name.compareTo(g2.name);
-           }
-        });
-
-        Iterator iter = values.iterator();
-        ButtonGroup buttonGroup = new ButtonGroup();
-        boolean madeSelection = false;
-        int count = 0;
-        while (iter.hasNext())
-        {
-            GroupData gd = (GroupData) iter.next();
-            rows[count] = gd;
-            Debug.trace("Creating button#"+count+", group="+gd.name);
-            JRadioButton btn = new JRadioButton(gd.name);
-            if( selectedGroup == count )
-            {
-                btn.setSelected(true);
-                Debug.trace("Selected button#"+count);
-            }
-            else if ( selectedGroup < 0 && madeSelection == false )
-            {
-                if( defaultGroup != null )
-                {
-                   if( defaultGroup.equals(gd.name) )
-                     madeSelection = true;
-                }
-                else if( count == 0 )
-                    madeSelection = true;
-                if( madeSelection )
-                {
-                    btn.setSelected(true);
-                    Debug.trace("Selected button#"+count);
-                    selectedGroup = count;
-                }
-            }
-            else
-            {
-                btn.setSelected(false);
-            }
-            buttonGroup.add(btn);
-            String sizeText = gd.getSizeString();
-            Object[] data = { btn, gd.description, sizeText};
-            model.addRow(data);
-            count ++;
-        }
-        return model;
-    }
-
-    protected static class GroupData
-    {
-        static final long ONEK = 1024;
-        static final long ONEM = 1024 * 1024;
-        static final long ONEG = 1024 * 1024 * 1024;
-
-        String name;
-        String description;
-        long size;
-        HashSet packNames = new HashSet();
-
-        GroupData(String name, String description)
-        {
-            this.name = name;
-            this.description = description;
-        }
-
-        String getSizeString()
-        {
-            String s;
-            if (size < ONEK)
-            {
-                s = size + " bytes";
-            }
-            else if (size < ONEM)
-            {
-                s = size / ONEK + " KBytes";
-            }
-            else if (size < ONEG)
-            {
-                s = size / ONEM + " MBytes";
-            }
-            else
-            {
-                s = size / ONEG + " GBytes";
-            }
-            return s;
-        }
-        public String toString()
-        {
-            StringBuffer tmp = new StringBuffer("GroupData(");
-            tmp.append(name);
-            tmp.append("){description=");
-            tmp.append(description);
-            tmp.append(", size=");
-            tmp.append(size);
-            tmp.append(", sizeString=");
-            tmp.append(getSizeString());
-            tmp.append(", packNames=");
-            tmp.append(packNames);
-            tmp.append("}");
-            return tmp.toString();
-        }
-    }
-
-    class RadioButtonRenderer implements TableCellRenderer
-    {
-        public Component getTableCellRendererComponent (JTable table, Object value,
-                                                        boolean isSelected, boolean hasFocus,
-                                                        int row, int column)
-        {
-            if (value==null) {
-                return null;
-            }
-
-            JRadioButton button = (JRadioButton) value;
-
-            button.setForeground(isSelected ?
-                                 table.getSelectionForeground() : table.getForeground());
-            button.setBackground(isSelected ?
-                                 table.getSelectionBackground() : table.getBackground());
-
-            return button;
-        }
-    }
-
-    class RadioButtonEditor
-        extends AbstractCellEditor
-        implements ItemListener,
-                   TableCellEditor
-    {
-        private JRadioButton button;
-
-        public Component getTableCellEditorComponent (JTable table, Object value,
-                                                      boolean isSelected, int row, int column)
-        {
-            Debug.trace("getTableCellEditorComponent, row="+row);
-            if (value==null) {
-                return null;
-            }
-
-            button = (JRadioButton) value;
-            button.addItemListener(this);
-
-            button.setForeground(isSelected ?
-                                 table.getSelectionForeground() : table.getForeground());
-            button.setBackground(isSelected ?
-                                 table.getSelectionBackground() : table.getBackground());
-
-            return button;
-        }
-
-        public Object getCellEditorValue ()
-        {
-            button.removeItemListener (this);
-            return button;
-        }
-
-        public void itemStateChanged (ItemEvent e)
-        {
-            Debug.trace("itemStateChanged, e="+e);
-            super.fireEditingStopped ();
-            groupsTable.repaint();
-        }
-    }
-
-}
+/*
+ * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
+ * 
+ * http://www.izforge.com/izpack/
+ * http://developer.berlios.de/projects/izpack/
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *     
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.izforge.izpack.panels;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.List;
+import java.util.HashSet;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.JTextPane;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+
+import net.n3.nanoxml.XMLElement;
+
+import com.izforge.izpack.Pack;
+import com.izforge.izpack.installer.InstallData;
+import com.izforge.izpack.installer.InstallerFrame;
+import com.izforge.izpack.installer.IzPanel;
+import com.izforge.izpack.util.Debug;
+import com.izforge.izpack.util.AbstractUIHandler;
+
+import java.util.ArrayList;
+import java.net.URLDecoder;
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * A panel which displays the available installGroups found on the packs to
+ * allow the user to select a subset of the packs based on the pack
+ * installGroups attribute. This panel will be skipped if there are no
+ * pack elements with an installGroups attribute.
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1.1.1 $
+ */
+public class InstallationGroupPanel extends IzPanel
+    implements ListSelectionListener
+{
+    private static final long serialVersionUID = 1L;
+
+    /** HashMap<String, Pack> of the InstallData.availablePacks */
+    private HashMap packsByName;
+    private TableModel groupTableModel;
+    private JTextPane descriptionField;
+    private JScrollPane groupScrollPane;
+    private JTable groupsTable;
+    private GroupData[] rows;
+    private int selectedGroup = -1;
+
+    public InstallationGroupPanel(InstallerFrame parent, InstallData idata)
+    {
+        super(parent, idata);
+        buildLayout();
+    }
+
+    /**
+     * If there are no packs with an installGroups attribute, this panel is
+     * skipped. Otherwise, the unique installGroups are displayed in a table.
+     */
+    public void panelActivate()
+    {
+        // Set/restore availablePacks from allPacks
+        idata.availablePacks = new ArrayList(idata.allPacks);
+
+        Debug.trace("InstallationGroupPanel.panelActivate, selectedGroup="+selectedGroup);
+        // If there are no groups, skip this panel
+        HashMap installGroups = getInstallGroups(idata);
+        if (installGroups.size() == 0)
+        {
+            super.askQuestion("Skip InstallGroup selection",
+                "Skip InstallGroup selection", AbstractUIHandler.CHOICES_YES_NO);
+            parent.skipPanel();
+            return;
+        }
+
+        // Build the table model from the unique groups
+        groupTableModel = getModel(installGroups);
+        groupsTable.setModel(groupTableModel);
+        TableColumnModel tcm = groupsTable.getColumnModel();
+        tcm.getColumn(0).setCellRenderer(new RadioButtonRenderer());
+        tcm.getColumn(0).setCellEditor(new RadioButtonEditor());
+        //groupsTable.setColumnSelectionAllowed(false);
+        //groupsTable.setRowSelectionAllowed(true);
+        groupsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        groupsTable.getSelectionModel().addListSelectionListener (this);
+        groupsTable.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
+        groupsTable.setIntercellSpacing(new Dimension(0, 0));
+        groupsTable.setShowGrid(false);
+        if( selectedGroup >= 0 )
+        {
+            groupsTable.getSelectionModel().setSelectionInterval(selectedGroup, selectedGroup);
+            descriptionField.setText(rows[selectedGroup].description);
+        }
+        else
+        {
+            descriptionField.setText(rows[0].description);
+        }
+    }
+
+    /**
+     * Remove all packs from the InstallData availablePacks and selectedPacks
+     * that do not list the selected installation group. Packs without any
+     * installGroups are always included.
+     */
+    public void panelDeactivate()
+    {
+
+        Debug.trace("InstallationGroupPanel.panelDeactivate, selectedGroup="+selectedGroup);
+        if( selectedGroup >= 0 )
+        {
+            removeUnusedPacks();
+            GroupData group = this.rows[selectedGroup];
+            idata.setVariable("INSTALL_GROUP", group.name);
+            Debug.trace("Added variable INSTALL_GROUP="+group.name);
+        }
+    }
+
+    /**
+     * There needs to be a valid selectedGroup to go to the next panel
+     * @return true if selectedGroup >= 0, false otherwise
+     */
+    public boolean isValidated()
+    {
+        Debug.trace("InstallationGroupPanel.isValidated, selectedGroup="+selectedGroup);
+        return selectedGroup >= 0;
+    }
+
+    /**
+     * Update the current selected install group index.
+     * @param e
+     */
+    public void valueChanged(ListSelectionEvent e)
+    {
+        Debug.trace("valueChanged: " + e);
+        if (e.getValueIsAdjusting() == false)
+        {
+            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+            if( lsm.isSelectionEmpty()  )
+            {
+                descriptionField.setText("");
+            }
+            else
+            {
+                selectedGroup = lsm.getMinSelectionIndex();
+                if( selectedGroup >= 0 )
+                {
+                    GroupData data = rows[selectedGroup];
+                    descriptionField.setText(data.description);
+                }
+                Debug.trace("selectedGroup set to: "+selectedGroup);
+            }
+        }
+    }
+
+    /* Add the installation group to pack mappings
+	 * @see com.izforge.izpack.installer.IzPanel#makeXMLData(net.n3.nanoxml.XMLElement)
+	 */
+	public void makeXMLData(XMLElement panelRoot)
+	{
+		InstallationGroupPanelAutomationHelper helper = new InstallationGroupPanelAutomationHelper();
+		idata.setAttribute("GroupData", rows);
+		idata.setAttribute("packsByName", packsByName);
+		helper.makeXMLData(idata, panelRoot);
+	}
+
+	/**
+     * Create the panel ui.
+     */
+    protected void buildLayout()
+    {
+        GridBagConstraints gridBagConstraints;
+
+        descriptionField = new JTextPane();
+        groupScrollPane = new JScrollPane();
+        groupsTable = new JTable();
+
+        setLayout(new GridBagLayout());
+
+        descriptionField.setMargin(new Insets(2, 2, 2, 2));
+        descriptionField.setAlignmentX(LEFT_ALIGNMENT);
+        descriptionField.setCaretPosition(0);
+        descriptionField.setEditable(false);
+        descriptionField.setOpaque(false);
+        descriptionField.setText("<b>Install group description text</b>");
+        descriptionField.setContentType("text/html");
+        descriptionField.setBorder(new TitledBorder(idata.langpack.getString("PacksPanel.description")));
+        gridBagConstraints = new java.awt.GridBagConstraints();
+        gridBagConstraints.gridy = 2;
+        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.weighty = 0.3;
+        add(descriptionField, gridBagConstraints);
+
+        groupScrollPane.setBorder(new EmptyBorder(1, 1, 1, 1));
+        groupScrollPane.setViewportView(groupsTable);
+
+        gridBagConstraints = new java.awt.GridBagConstraints();
+        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+        gridBagConstraints.weightx = 1.0;
+        gridBagConstraints.weighty = 1.0;
+        add(groupScrollPane, gridBagConstraints);
+    }
+
+    protected void removeUnusedPacks()
+    {
+        GroupData data = rows[selectedGroup];
+        Debug.trace("InstallationGroupPanel.removeUnusedPacks, GroupData="+data.name);
+
+        // Now remove the packs not in groupPackNames
+        idata.selectedPacks.clear();
+        idata.selectedPacks.addAll(idata.availablePacks);
+        Iterator iter = idata.availablePacks.iterator();
+        while( iter.hasNext() )
+        {
+            Pack p = (Pack) iter.next();
+
+            //reverse dependencies must be reset in case the user is going
+            //back and forth between the group selection panel and the packs selection panel
+            p.revDependencies = null;
+
+            if( data.packNames.contains(p.name) == false )
+            {
+                iter.remove();
+                Debug.trace("Removed AvailablePack: "+p.name);
+            }
+        }
+
+        List selectedPacks = idata.selectedPacks;
+        iter = selectedPacks.iterator();
+        while( iter.hasNext() )
+        {
+            Pack p = (Pack) iter.next();
+            if( data.packNames.contains(p.name) == false || !p.preselected)
+            {
+                iter.remove();
+                Debug.trace("Removed selectedPack: "+p.name);
+            }
+        }
+    }
+    protected void addDependents(Pack p, HashMap packsByName, GroupData data)
+    {
+        data.packNames.add(p.name);
+        data.size += p.nbytes;
+        Debug.trace("addDependents, added pack: "+p.name);
+        if( p.dependencies == null || p.dependencies.size() == 0 )
+            return;
+
+        Iterator iter = p.dependencies.iterator();
+        Debug.trace(p.name+" dependencies: "+p.dependencies);
+        while( iter.hasNext() )
+        {
+            String dependent = (String) iter.next();
+            if( data.packNames.contains(dependent) == false )
+            {
+                Debug.trace("Need dependent: "+dependent);
+                Pack dependentPack = (Pack) packsByName.get(dependent);
+                addDependents(dependentPack, packsByName, data);
+            }
+        }
+    }
+
+    /**
+     * Build the set of unique installGroups data. The GroupData description
+     * is taken from the InstallationGroupPanel.description.[name] property
+     * where [name] is the installGroup name. The GroupData size is built
+     * from the Pack.nbytes sum.
+     * 
+     * @param idata - the panel install data
+     * @return HashMap<String, GroupData> of unique install group names
+     */
+    protected HashMap getInstallGroups(InstallData idata)
+    {
+        /* First create a packsByName<String, Pack> of all packs and identify
+        the unique install group names.
+        */
+        packsByName = new HashMap();
+        HashMap installGroups = new HashMap();
+        for (int n = 0; n < idata.availablePacks.size(); n++)
+        {
+            Pack p = (Pack) idata.availablePacks.get(n);
+            packsByName.put(p.name, p);
+            Set groups = p.installGroups;
+            Iterator iter = groups.iterator();
+            Debug.trace("Pack: "+p.name+", installGroups: "+groups);
+            while (iter.hasNext())
+            {
+                String group = (String) iter.next();
+                GroupData data = (GroupData) installGroups.get(group);
+                if (data == null)
+                {
+                    String description = getGroupDescription(group);
+                    data = new GroupData(group, description);
+                    installGroups.put(group, data);
+                }
+            }
+        }
+        Debug.trace("Found installGroups: " + installGroups.keySet());
+
+        /* Build up a set of the packs to include in the installation by finding
+        all packs in the selected group, and then include their dependencies.
+        */
+        Iterator gditer = installGroups.values().iterator();
+        while( gditer.hasNext() )
+        {
+            GroupData data = (GroupData) gditer.next();
+            Debug.trace("Adding dependents for: "+data.name);
+            Iterator iter = idata.availablePacks.iterator();
+            while( iter.hasNext() )
+            {
+                Pack p = (Pack) iter.next();
+                Set groups = p.installGroups;
+                if( groups.size() == 0 || groups.contains(data.name) == true )
+                {
+                    // The pack may have already been added while traversing dependencies
+                    if( data.packNames.contains(p.name) == false )
+                        addDependents(p, packsByName, data);
+                }
+            }
+            Debug.trace("Completed dependents for: "+data);
+            if( Debug.tracing() )
+                Debug.trace(data);
+        }
+
+        return installGroups;
+    }
+
+    /**
+     * Look for a key = InstallationGroupPanel.description.[group] entry:
+     * first using idata.langpack.getString(key+".html")
+     * next using idata.langpack.getString(key)
+     * next using idata.getVariable(key)
+     * lastly, defaulting to group + " installation"
+     * @param group - the installation group name
+     * @return the group description
+     */
+    protected String getGroupDescription(String group)
+    {
+        String description = null;
+        String key = "InstallationGroupPanel.description." + group;
+        if( idata.langpack != null )
+        {
+            String htmlKey = key+".html";
+            String html = idata.langpack.getString(htmlKey);
+            // This will equal the key if there is no entry
+            if( htmlKey.equalsIgnoreCase(html) )
+                description = idata.langpack.getString(key);
+            else
+                description = html;
+        }
+        if (description == null || key.equalsIgnoreCase(description))
+            description = idata.getVariable(key);
+        if (description == null)
+            description = group + " installation";
+        try
+        {
+            description = URLDecoder.decode(description, "UTF-8");
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            emitWarning("Failed to convert description", e.getMessage());
+        }
+
+        return description;
+    }
+
+    protected TableModel getModel(HashMap groupData)
+    {
+        String c1 = parent.langpack.getString("InstallationGroupPanel.colNameSelected");
+        String c2 = parent.langpack.getString("InstallationGroupPanel.colNameInstallType");
+        String c3 = parent.langpack.getString("InstallationGroupPanel.colNameSize");
+        String[] columns = {c1, c2, c3};
+         DefaultTableModel model = new DefaultTableModel (columns, 0)
+         {
+            public boolean isCellEditable (int row, int column)
+            {
+               return column == 0;
+            }
+        };
+        rows = new GroupData[groupData.size()];
+        // The name of the group to select if there is no current selection
+        String defaultGroup = idata.getVariable("InstallationGroupPanel.defaultGroup");
+         Debug.trace("InstallationGroupPanel.defaultGroup="+defaultGroup+", selectedGroup="+selectedGroup);
+         List values = new ArrayList(groupData.values());
+         Collections.sort(values, new Comparator()
+         {
+           public int compare(Object o1, Object o2)
+           {
+               GroupData g1 = (GroupData) o1;
+               GroupData g2 = (GroupData) o2;
+
+               if (g1.name == null || g2.name==null)
+               {
+                   return 0;
+               }
+
+               return g1.name.compareTo(g2.name);
+           }
+        });
+
+        Iterator iter = values.iterator();
+        ButtonGroup buttonGroup = new ButtonGroup();
+        boolean madeSelection = false;
+        int count = 0;
+        while (iter.hasNext())
+        {
+            GroupData gd = (GroupData) iter.next();
+            rows[count] = gd;
+            Debug.trace("Creating button#"+count+", group="+gd.name);
+            JRadioButton btn = new JRadioButton(gd.name);
+            if( selectedGroup == count )
+            {
+                btn.setSelected(true);
+                Debug.trace("Selected button#"+count);
+            }
+            else if ( selectedGroup < 0 && madeSelection == false )
+            {
+                if( defaultGroup != null )
+                {
+                   if( defaultGroup.equals(gd.name) )
+                     madeSelection = true;
+                }
+                else if( count == 0 )
+                    madeSelection = true;
+                if( madeSelection )
+                {
+                    btn.setSelected(true);
+                    Debug.trace("Selected button#"+count);
+                    selectedGroup = count;
+                }
+            }
+            else
+            {
+                btn.setSelected(false);
+            }
+            buttonGroup.add(btn);
+            String sizeText = gd.getSizeString();
+            Object[] data = { btn, gd.description, sizeText};
+            model.addRow(data);
+            count ++;
+        }
+        return model;
+    }
+
+    protected static class GroupData
+    {
+        static final long ONEK = 1024;
+        static final long ONEM = 1024 * 1024;
+        static final long ONEG = 1024 * 1024 * 1024;
+
+        String name;
+        String description;
+        long size;
+        HashSet packNames = new HashSet();
+
+        GroupData(String name, String description)
+        {
+            this.name = name;
+            this.description = description;
+        }
+
+        String getSizeString()
+        {
+            String s;
+            if (size < ONEK)
+            {
+                s = size + " bytes";
+            }
+            else if (size < ONEM)
+            {
+                s = size / ONEK + " KBytes";
+            }
+            else if (size < ONEG)
+            {
+                s = size / ONEM + " MBytes";
+            }
+            else
+            {
+                s = size / ONEG + " GBytes";
+            }
+            return s;
+        }
+        public String toString()
+        {
+            StringBuffer tmp = new StringBuffer("GroupData(");
+            tmp.append(name);
+            tmp.append("){description=");
+            tmp.append(description);
+            tmp.append(", size=");
+            tmp.append(size);
+            tmp.append(", sizeString=");
+            tmp.append(getSizeString());
+            tmp.append(", packNames=");
+            tmp.append(packNames);
+            tmp.append("}");
+            return tmp.toString();
+        }
+    }
+
+    class RadioButtonRenderer implements TableCellRenderer
+    {
+        public Component getTableCellRendererComponent (JTable table, Object value,
+                                                        boolean isSelected, boolean hasFocus,
+                                                        int row, int column)
+        {
+            if (value==null) {
+                return null;
+            }
+
+            JRadioButton button = (JRadioButton) value;
+
+            button.setForeground(isSelected ?
+                                 table.getSelectionForeground() : table.getForeground());
+            button.setBackground(isSelected ?
+                                 table.getSelectionBackground() : table.getBackground());
+
+            return button;
+        }
+    }
+
+    class RadioButtonEditor
+        extends AbstractCellEditor
+        implements ItemListener,
+                   TableCellEditor
+    {
+        private JRadioButton button;
+
+        public Component getTableCellEditorComponent (JTable table, Object value,
+                                                      boolean isSelected, int row, int column)
+        {
+            Debug.trace("getTableCellEditorComponent, row="+row);
+            if (value==null) {
+                return null;
+            }
+
+            button = (JRadioButton) value;
+            button.addItemListener(this);
+
+            button.setForeground(isSelected ?
+                                 table.getSelectionForeground() : table.getForeground());
+            button.setBackground(isSelected ?
+                                 table.getSelectionBackground() : table.getBackground());
+
+            return button;
+        }
+
+        public Object getCellEditorValue ()
+        {
+            button.removeItemListener (this);
+            return button;
+        }
+
+        public void itemStateChanged (ItemEvent e)
+        {
+            Debug.trace("itemStateChanged, e="+e);
+            super.fireEditingStopped ();
+            groupsTable.repaint();
+        }
+    }
+
+}

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java	2007-03-11 16:00:06 UTC (rev 1777)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java	2007-03-11 16:06:56 UTC (rev 1778)
@@ -27,6 +27,7 @@
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Dimension;
+import java.awt.Graphics;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
@@ -42,6 +43,8 @@
 import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.BoxLayout;
+import javax.swing.ButtonModel;
+import javax.swing.Icon;
 import javax.swing.JCheckBox;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -53,6 +56,7 @@
 import javax.swing.border.Border;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.TableCellEditor;
 import javax.swing.table.TableCellRenderer;
@@ -608,6 +612,13 @@
         public CheckBoxEditorRenderer(boolean useAsEditor)
         {
             display = new JCheckBox();
+            if(com.izforge.izpack.util.OsVersion.IS_UNIX)
+            {
+                display.setIcon(new LFIndependentIcon());
+                display.setDisabledIcon(new LFIndependentIcon());
+                display.setSelectedIcon(new LFIndependentIcon());
+                display.setDisabledSelectedIcon(new LFIndependentIcon());
+            }
             display.setHorizontalAlignment(CENTER);
             if (useAsEditor) display.addActionListener(this);
 
@@ -657,7 +668,88 @@
             stopCellEditing();
         }
     }
+    
+    public static class LFIndependentIcon implements Icon
+    {
+       ButtonModel buttonModel = null;
+       protected int getControlSize() { return 13; }
+       public void paintIcon(Component c, Graphics g, int x, int y)
+       {
+          ButtonModel model = ((JCheckBox)c).getModel();
+          buttonModel = model;
+          int controlSize = getControlSize();
+          if (model.isPressed() && model.isArmed())
+          {
+             g.setColor( MetalLookAndFeel.getControlShadow() );
+             if(model.isEnabled()) g.setColor(Color.green); else g.setColor(Color.gray);
+             g.fillRect( x, y, controlSize-1, controlSize-1);
+             drawPressedBorder(g, x, y, controlSize, controlSize, model);
+          }
+          else
+          {
+             drawBorder(g, x, y, controlSize, controlSize, model);
+          }
+          g.setColor( Color.green );
+          if (model.isSelected())
+          {
+             drawCheck(c,g,x,y);
+          }
+       }
+       private void drawBorder(Graphics g, int x, int y, int w, int h, ButtonModel model)
+       {
+          g.translate(x, y);
 
+          // outer frame rectangle
+          g.setColor(MetalLookAndFeel.getControlDarkShadow());
+          if(!model.isEnabled()) g.setColor(new Color(0.4f, 0.4f, 0.4f));
+          g.drawRect(0, 0, w-2, h-2);
+
+          // middle frame
+          g.setColor(MetalLookAndFeel.getControlHighlight());
+          if(!model.isEnabled()) g.setColor(new Color(0.6f, 0.6f, 0.6f));
+          g.drawRect(1, 1, w-2, h-2);
+
+          // background
+          if(model.isEnabled()) g.setColor(Color.white); else g.setColor(new Color(0.8f, 0.8f, 0.8f));
+          g.fillRect(2, 2, w-3, h-3);
+
+          //some extra lines for FX
+          g.setColor(MetalLookAndFeel.getControl());
+          g.drawLine(0, h-1, 1, h-2);
+          g.drawLine(w-1, 0, w-2, 1);
+          g.translate(-x, -y);
+       }
+       private void drawPressedBorder(Graphics g, int x, int y, int w, int h, ButtonModel model)
+       {
+          g.translate(x, y);
+          drawBorder(g, 0, 0, w, h, model);
+          g.setColor(MetalLookAndFeel.getControlShadow());
+          g.drawLine(1, 1, 1, h-2);
+          g.drawLine(1, 1, w-2, 1);
+          g.drawLine(2, 2, 2, h-3);
+          g.drawLine(2, 2, w-3, 2);
+          g.translate(-x, -y);
+       }
+       protected void drawCheck(Component c, Graphics g, int x, int y)
+       {
+          int controlSize = getControlSize();
+          if(buttonModel!=null)
+             if(buttonModel.isEnabled())
+                g.setColor(new Color(0.0f,0.6f,0.0f));
+             else g.setColor(new Color(0.1f,0.1f,0.1f));
+
+          g.drawLine( x+(controlSize-4), y+2, x+(controlSize-4)-4, y+2+4 );
+          g.drawLine( x+(controlSize-4), y+3, x+(controlSize-4)-4, y+3+4 );
+          g.drawLine( x+(controlSize-4), y+4, x+(controlSize-4)-4, y+4+4 );
+
+          g.drawLine( x+(controlSize-4)-4, y+2+4, x+(controlSize-4)-4-2, y+2+4-2 );
+          g.drawLine( x+(controlSize-4)-4, y+3+4, x+(controlSize-4)-4-2, y+3+4-2 );
+          g.drawLine( x+(controlSize-4)-4, y+4+4, x+(controlSize-4)-4-2, y+4+4-2 );
+       }
+       public int getIconWidth() {return getControlSize();}
+       public int getIconHeight() {return getControlSize();}
+    }
+    
     static class PacksPanelTableCellRenderer extends DefaultTableCellRenderer
     {
 




More information about the izpack-changes mailing list