org.argoprint.ui
Class TemplateTableModel

java.lang.Object
  extended by org.argoprint.ui.TemplateTableModel
All Implemented Interfaces:
javax.swing.table.TableModel

public class TemplateTableModel
extends java.lang.Object
implements javax.swing.table.TableModel

This class represents the contents of the TemplateTable. This contains the template metadata.


Field Summary
static int CATEGORY
          The index of the "category" column
static java.lang.String[] DEFAULT_CATEGORIES
           
static java.lang.String[] DEFAULT_GROUPS
           
static int DESCRIPTION
          The index of the "description" column
static int GROUP
          The index of the "group" column
static int NAME
          The index of the "name" column
static int OUTPUT_FILE
          The index of the "output file" column
static int SELECTED
          The index of the "selected" column
static int TEMPLATE_FILE
          The index of the "template file" column
static int TYPE
          The index of the "type" column
 
Constructor Summary
TemplateTableModel()
          Constructor
TemplateTableModel(java.util.List<TemplateMetaFile> templateList)
          Constructor
 
Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener listener)
          Adds a table model listener.
 void addTemplate(TemplateMetaFile template)
          Adds a template to the table model.
 void fireTableChanged(javax.swing.event.TableModelEvent e)
          Communicates the fact that the table has changed to each of the registered table model listeners.
 void fireTableDataChanged()
          Communicates the fact that the table data has changed to each of the registered table model listeners.
 java.lang.Class<?> getColumnClass(int columnIndex)
          Gets the class of a given column
 int getColumnCount()
          Gets a count of the number of columns
 java.lang.String getColumnName(int columnIndex)
          Gets the name of a given column
 java.util.List<TemplateMetaFile> getLocalTemplates()
          Gets templates that are stored locally.
 TemplateMetaFile getRow(int index)
          Gets the TemplateMetaFile object corresponding to the given index.
 int getRowCount()
          Gets a count of the number of rows in the table.
 int getSelectedRowCount()
          Gets a count of the number of selected templates.
 java.util.List<TemplateMetaFile> getSelectedTemplates()
          This method gets a list of selected templates.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Gets the value at a particular cell in the table.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Determines if the cell is editable.
 void removeTableModelListener(javax.swing.event.TableModelListener listener)
          Removes a table model listener.
 void removeTemplate(TemplateMetaFile template)
          Removes a template from the table model.
 void selectAll(boolean selected)
           
 void setValueAt(java.lang.Object val, int rowIndex, int columnIndex)
          Sets the value of a particular cell in a table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECTED

public static final int SELECTED
The index of the "selected" column

See Also:
Constant Field Values

GROUP

public static final int GROUP
The index of the "group" column

See Also:
Constant Field Values

CATEGORY

public static final int CATEGORY
The index of the "category" column

See Also:
Constant Field Values

NAME

public static final int NAME
The index of the "name" column

See Also:
Constant Field Values

TEMPLATE_FILE

public static final int TEMPLATE_FILE
The index of the "template file" column

See Also:
Constant Field Values

OUTPUT_FILE

public static final int OUTPUT_FILE
The index of the "output file" column

See Also:
Constant Field Values

DESCRIPTION

public static final int DESCRIPTION
The index of the "description" column

See Also:
Constant Field Values

TYPE

public static final int TYPE
The index of the "type" column

See Also:
Constant Field Values

DEFAULT_GROUPS

public static final java.lang.String[] DEFAULT_GROUPS

DEFAULT_CATEGORIES

public static final java.lang.String[] DEFAULT_CATEGORIES
Constructor Detail

TemplateTableModel

public TemplateTableModel(java.util.List<TemplateMetaFile> templateList)
Constructor

Parameters:
templateList - A list of templates

TemplateTableModel

public TemplateTableModel()
Constructor

Method Detail

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener listener)
Adds a table model listener.

Specified by:
addTableModelListener in interface javax.swing.table.TableModel
Parameters:
listener -
See Also:
TableModel.addTableModelListener(javax.swing.event.TableModelListener)

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Gets the class of a given column

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
columnIndex - The index of the column.
Returns:
The class of the column
See Also:
TableModel.getColumnClass(int)

getColumnCount

public int getColumnCount()
Gets a count of the number of columns

Specified by:
getColumnCount in interface javax.swing.table.TableModel

getColumnName

public java.lang.String getColumnName(int columnIndex)
Gets the name of a given column

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
columnIndex - the index of the column
Returns:
the name of the column
See Also:
TableModel.getColumnName(int)

getRowCount

public int getRowCount()
Gets a count of the number of rows in the table.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
a count of the number of rows in the table
See Also:
TableModel.getRowCount()

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Gets the value at a particular cell in the table.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - The row index.
columnIndex - The column index.
Returns:
the value of a cell
See Also:
TableModel.getValueAt(int, int)

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Determines if the cell is editable. Only local templates are considered editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Parameters:
rowIndex - the index of the row.
columnIndex - the index of the column
Returns:
true, if the cell is editable
See Also:
TableModel.isCellEditable(int, int)

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener listener)
Removes a table model listener.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel
Parameters:
listener -
See Also:
TableModel.removeTableModelListener(javax.swing.event.TableModelListener)

getSelectedRowCount

public int getSelectedRowCount()
Gets a count of the number of selected templates.

Returns:
a count of the selected templates

getSelectedTemplates

public java.util.List<TemplateMetaFile> getSelectedTemplates()
This method gets a list of selected templates.

Returns:
a list of selected templates

setValueAt

public void setValueAt(java.lang.Object val,
                       int rowIndex,
                       int columnIndex)
Sets the value of a particular cell in a table.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
val - The new value of a cell.
rowIndex - The index of the row
columnIndex - The index of the column
See Also:
TableModel.setValueAt(java.lang.Object, int, int)

removeTemplate

public void removeTemplate(TemplateMetaFile template)
Removes a template from the table model.

Parameters:
template - The template to be removed.

addTemplate

public void addTemplate(TemplateMetaFile template)
Adds a template to the table model.

Parameters:
template - the template to be added.

fireTableChanged

public void fireTableChanged(javax.swing.event.TableModelEvent e)
Communicates the fact that the table has changed to each of the registered table model listeners.

Parameters:
e - The table model event.

fireTableDataChanged

public void fireTableDataChanged()
Communicates the fact that the table data has changed to each of the registered table model listeners.


getRow

public TemplateMetaFile getRow(int index)
Gets the TemplateMetaFile object corresponding to the given index.

Parameters:
index - The row index of the TemplateMetaFile within the table
Returns:
a TemplateMetaFile object

getLocalTemplates

public java.util.List<TemplateMetaFile> getLocalTemplates()
Gets templates that are stored locally.

Returns:
a list of the local templates.

selectAll

public void selectAll(boolean selected)