com.clearfield.security
Class CertificateTableModel

java.lang.Object
  extended by com.clearfield.security.CertificateTableModel
All Implemented Interfaces:
javax.swing.table.TableModel

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

A model which handles the requirements of separating the certificate information into differing sections.

Copyright © 2006 Clearfield Ltd. This software is distributed under the BSD license. See the accompanying license.txt for details.

Version:
1.0.0
Author:
Dr. David J. Knowles

Field Summary
protected  java.security.cert.Certificate certificate
           
protected  java.lang.String[] columnNames
           
protected  java.text.DateFormat formatter
           
protected static int ISSUER_INDEX
           
protected  java.util.Vector modelListeners
           
protected  java.lang.String[] rowNames
           
protected  java.lang.String[] rowValues
           
protected static int SERIAL_NUMER_INDEX
           
protected static int SIGNATURE_ALGORITHM_INDEX
           
protected static int SIGNATURE_INDEX
           
protected static int SUBJECT_INDEX
           
protected static int VALIDITY_INDEX
           
protected static int VERSION_INDEX
           
 
Constructor Summary
CertificateTableModel()
          Constructs the model.
 
Method Summary
 void addTableModelListener(javax.swing.event.TableModelListener l)
          Adds a listener to this model.
protected  void clearDataFields()
          Clears all the data fields and sets them to nothing.
protected  java.lang.String convertSignatureToString(byte[] signature)
          This function converts the signature byte array to a matching string.
protected  void fireTableModelEvent()
          Fires the model event to the listener.
 java.security.cert.Certificate getCertificate()
          Returns the certificate which powers the model.
 java.lang.Class getColumnClass(int columnIndex)
          Get the class of the column index.
 int getColumnCount()
          Returns the number of columns in the table.
 java.lang.String getColumnName(int columnIndex)
          Returns the column name matching the specified column index.
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Returns the object which matches the corresponding table cell.
 boolean isCellEditable(int rowIndex, int columnIndex)
          Returns the editable state of the cell.
 void removeTableModelListener(javax.swing.event.TableModelListener l)
          Removes the specified model listener.
 void setCertificate(java.security.cert.Certificate certificate)
          Sets the certificate which powers the model.
protected  void setUpDataFields()
          Sets up the data fields given the certificate.
 void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
          Sets the cell value at the specified row/column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

certificate

protected java.security.cert.Certificate certificate

columnNames

protected java.lang.String[] columnNames

VERSION_INDEX

protected static final int VERSION_INDEX
See Also:
Constant Field Values

SERIAL_NUMER_INDEX

protected static final int SERIAL_NUMER_INDEX
See Also:
Constant Field Values

SIGNATURE_ALGORITHM_INDEX

protected static final int SIGNATURE_ALGORITHM_INDEX
See Also:
Constant Field Values

ISSUER_INDEX

protected static final int ISSUER_INDEX
See Also:
Constant Field Values

VALIDITY_INDEX

protected static final int VALIDITY_INDEX
See Also:
Constant Field Values

SUBJECT_INDEX

protected static final int SUBJECT_INDEX
See Also:
Constant Field Values

SIGNATURE_INDEX

protected static final int SIGNATURE_INDEX
See Also:
Constant Field Values

rowNames

protected java.lang.String[] rowNames

rowValues

protected java.lang.String[] rowValues

modelListeners

protected java.util.Vector modelListeners

formatter

protected java.text.DateFormat formatter
Constructor Detail

CertificateTableModel

public CertificateTableModel()
Constructs the model.

Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Specified by:
getRowCount in interface javax.swing.table.TableModel
Returns:
int number of rows.

getColumnCount

public int getColumnCount()
Returns the number of columns in the table.

Specified by:
getColumnCount in interface javax.swing.table.TableModel
Returns:
int number of columns.

getColumnName

public java.lang.String getColumnName(int columnIndex)
Returns the column name matching the specified column index.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Parameters:
columnIndex - int index of the column to get the name for.
Returns:
String column name.

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Get the class of the column index.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Parameters:
columnIndex - int index of the column to get the class for.
Returns:
Class for the columns.

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Returns the editable state of the cell. For this application the answer is always false.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Returns:
boolean containing the editable state.

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Returns the object which matches the corresponding table cell.

Specified by:
getValueAt in interface javax.swing.table.TableModel
Parameters:
rowIndex - int row index of the cell.
columnIndex - int column index of the cell.
Returns:
Object which matches the cell in the table.

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int rowIndex,
                       int columnIndex)
Sets the cell value at the specified row/column. This does nothing in this model.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Parameters:
aValue - Object to set the cell to.
rowIndex - int row index of the cell.
columnIndex - int column index of the cell.

addTableModelListener

public void addTableModelListener(javax.swing.event.TableModelListener l)
Adds a listener to this model.

Specified by:
addTableModelListener in interface javax.swing.table.TableModel
Parameters:
l - TableModelListener which will listen to this model.

removeTableModelListener

public void removeTableModelListener(javax.swing.event.TableModelListener l)
Removes the specified model listener.

Specified by:
removeTableModelListener in interface javax.swing.table.TableModel
Parameters:
l - TableModelListener to remove.

fireTableModelEvent

protected void fireTableModelEvent()
Fires the model event to the listener.


getCertificate

public java.security.cert.Certificate getCertificate()
Returns the certificate which powers the model.

Returns:
Returns the certificate.

setCertificate

public void setCertificate(java.security.cert.Certificate certificate)
Sets the certificate which powers the model.

Parameters:
certificate - The certificate to set.

clearDataFields

protected void clearDataFields()
Clears all the data fields and sets them to nothing.


setUpDataFields

protected void setUpDataFields()
Sets up the data fields given the certificate.


convertSignatureToString

protected java.lang.String convertSignatureToString(byte[] signature)
This function converts the signature byte array to a matching string.

Parameters:
signature - byte array containing the signature.
Returns:
String version of the signature.