com.izforge.izpack.panels.packs
Class PacksModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.izforge.izpack.panels.packs.PacksModel
All Implemented Interfaces:
Serializable, TableModel
Direct Known Subclasses:
PacksModelGUI

public class PacksModel
extends AbstractTableModel

User: Gaganis Giorgos Date: Sep 17, 2004 Time: 8:33:21 AM

See Also:
Serialized Form

Nested Class Summary
static class PacksModel.CbSelectionState
          Enumeration of possible internal model states of a pack checkbox
 
Field Summary
protected  List<Pack> hiddenPacks
           
protected  List<Pack> packs
           
protected  RulesEngine rules
           
protected  Variables variables
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
PacksModel(InstallData idata)
           
 
Method Summary
 boolean dependenciesExist()
           
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 Map<String,Pack> getInstalledPacks()
          Get previously installed packs on modifying a pre-installed application
 Map<String,Pack> getNameToPack()
           
 Map<String,Integer> getNameToRow()
           
 Pack getPack(String packName)
           
 Pack getPackAtRow(int row)
          Helper function to retrieve a pack object based on which row it is on.
 Map<Pack,Integer> getPacksToRowNumbers()
           
 int getRowCount()
           
 long getTotalByteSize()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 List<Pack> getVisiblePacks()
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isCheckBoxSelectable(int row)
           
 boolean isChecked(int row)
          Check if the checkbox is selected given its row.
 boolean isModifyInstallation()
           
 boolean isPartiallyChecked(int row)
           
 void setValueAt(Object checkValue, int rowIndex, int columnIndex)
           
 void toggleValueAt(int rowIndex)
          Toggle checkbox value from selected to deselected and vice-versa.
 List<Pack> updatePacksToInstall()
          Update packs to installed.
 void updateTable()
          Ensure that the table is up to date.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packs

protected List<Pack> packs

hiddenPacks

protected final List<Pack> hiddenPacks

rules

protected final transient RulesEngine rules

variables

protected final transient Variables variables
Constructor Detail

PacksModel

public PacksModel(InstallData idata)
Method Detail

getVisiblePacks

public List<Pack> getVisiblePacks()
Returns:
a list of visible packs

getPackAtRow

public Pack getPackAtRow(int row)
Helper function to retrieve a pack object based on which row it is on.

Parameters:
row -
Returns:
pack on the given row

updateTable

public void updateTable()
Ensure that the table is up to date. Order does matter


getRowCount

public int getRowCount()

getColumnCount

public int getColumnCount()

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)

toggleValueAt

public void toggleValueAt(int rowIndex)
Toggle checkbox value from selected to deselected and vice-versa.

Parameters:
rowIndex -

setValueAt

public void setValueAt(Object checkValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

updatePacksToInstall

public List<Pack> updatePacksToInstall()
Update packs to installed. A pack to be installed is: 1. A visible pack that has its checkbox checked 2. A hidden pack that condition

Returns:

getInstalledPacks

public Map<String,Pack> getInstalledPacks()
Get previously installed packs on modifying a pre-installed application

Returns:
the installedPacks

isModifyInstallation

public boolean isModifyInstallation()
Returns:
the modifyInstallation

getNameToPack

public Map<String,Pack> getNameToPack()
Returns:
mapping from pack name to pack

getPacksToRowNumbers

public Map<Pack,Integer> getPacksToRowNumbers()
Returns:
mapping from pack to row position

getNameToRow

public Map<String,Integer> getNameToRow()
Returns:
mapping from pack name to row position

getTotalByteSize

public long getTotalByteSize()
Returns:
the number of bytes that the installation requires based on selected packs

isChecked

public boolean isChecked(int row)
Check if the checkbox is selected given its row.

Parameters:
row -
Returns:
true if checkbox is selected else false

isPartiallyChecked

public boolean isPartiallyChecked(int row)
Parameters:
row -
Returns:
true if checkbox is partially selected else false

isCheckBoxSelectable

public boolean isCheckBoxSelectable(int row)
Parameters:
row -
Returns:
true if the checkbox is selected else false

dependenciesExist

public boolean dependenciesExist()
Returns:
true if any dependencies for the visible packs exists else false

getPack

public Pack getPack(String packName)
Parameters:
packName -
Returns:
helper method to get a pack object from the pack's name


Copyright © 2018. All rights reserved.