com.ca.directory.jxplorer.viewer.tableviewer
Class AttributeTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--com.ca.directory.jxplorer.viewer.tableviewer.AttributeTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class AttributeTableModel
extends javax.swing.table.AbstractTableModel

See Also:
Serialized Form

Field Summary
protected  boolean dataChanged
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AttributeTableModel()
           
 
Method Summary
 void addAttribute(java.lang.String ID, AttributeValue val, int type)
           
 void addAttribute(java.lang.String ID, AttributeValue val, int type, int indexPos)
           
 void addNamingComponent(AttributeType currentType, AttributeValue currentValue)
           
 boolean changedByUser()
          This returns whether the table data has been modified since the original display of the entry.
 boolean checkMandatoryAttributesSet()
          Checks that all mandatory attributes have at least one value entered.
 void clear()
          Removes all data leaving an empty table.
 void deleteAttribute(java.lang.String ID, int indexPos)
           
 void dumpNamingArrays()
           
 void fireChange()
           
 javax.naming.directory.Attribute getAttribute(java.lang.String ID)
          Reads all the values for a given attribute from the table.
 java.lang.Class getColumnClass(int c)
          Returns the class of the objects in the different columns: AttributeType.class for col 0, AttributeValue.class for col 1.
 int getColumnCount()
          Returns number of columns (=2)
 java.lang.String getColumnName(int columnIndex)
          Gets column header names.
 DXEntry getNewEntry()
          Returns a new entry
 DXEntry getOldEntry()
           
 RDN getRDN()
          Returns the escaped RDN (possibly multi-valued).
 int getRDNSize()
          Returns the size of the naming RDN.
 int getRowCount()
          Returns number of rows (varies dynamically)
 java.lang.String getStringValueAt(int row, int col)
          Returns a value as a string.
 java.lang.Object getValueAt(int row, int col)
          Return the object at a given position.
 void insertAttribute(DXAttribute att, int type)
          Adds a single attribute, and (possibly multiple, or blank) values to the table.
 void insertAttributes(DXEntry entry)
          Insert a set of attributes into the table.
 boolean isCellEditable(int row, int col)
          Whether a particular column is editable (yes if col!
 boolean isMandatory(java.lang.String attributeTypeName)
          Brute force search to find an attributeType given only the name.
 void removeNamingComponent(AttributeType currentType, AttributeValue currentValue)
          This removes a component from the array of naming atts, and sets the currentValue object to be a naming value.
 void reset()
          'Resets' the value of all attribute Value cells back to their original value.
protected  void setRDN(RDN rdn)
          Sets up the list of naming attribute types - values pairs.
 void setValueAt(java.lang.Object aValue, int row, int col)
          Allows a cell value to be set (should only ever be the second column, col=1).
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataChanged

protected boolean dataChanged
Constructor Detail

AttributeTableModel

public AttributeTableModel()
Method Detail

getRDNSize

public int getRDNSize()
Returns the size of the naming RDN.


getColumnClass

public java.lang.Class getColumnClass(int c)
Returns the class of the objects in the different columns: AttributeType.class for col 0, AttributeValue.class for col 1.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getColumnCount

public int getColumnCount()
Returns number of columns (=2)


getRowCount

public int getRowCount()
Returns number of rows (varies dynamically)


setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int col)
Allows a cell value to be set (should only ever be the second column, col=1).

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getStringValueAt

public java.lang.String getStringValueAt(int row,
                                         int col)
Returns a value as a string. Null and zero length string are made 1 character blank strings, so that the joke called swing printing can be kludged to work.


getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Return the object at a given position.


isCellEditable

public boolean isCellEditable(int row,
                              int col)
Whether a particular column is editable (yes if col!=0)

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

getColumnName

public java.lang.String getColumnName(int columnIndex)
Gets column header names.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

reset

public void reset()
'Resets' the value of all attribute Value cells back to their original value.


clear

public void clear()
Removes all data leaving an empty table.


insertAttributes

public void insertAttributes(DXEntry entry)
Insert a set of attributes into the table.


setRDN

protected void setRDN(RDN rdn)
Sets up the list of naming attribute types - values pairs. (usually there is only ONE naming value, but sometimes an entry is multi valued).

Parameters:
rdn - the RDN to extract the naming information from.

insertAttribute

public void insertAttribute(DXAttribute att,
                            int type)
                     throws javax.naming.NamingException
Adds a single attribute, and (possibly multiple, or blank) values to the table.

javax.naming.NamingException

addAttribute

public void addAttribute(java.lang.String ID,
                         AttributeValue val,
                         int type)

addAttribute

public void addAttribute(java.lang.String ID,
                         AttributeValue val,
                         int type,
                         int indexPos)

deleteAttribute

public void deleteAttribute(java.lang.String ID,
                            int indexPos)

fireChange

public void fireChange()

getOldEntry

public DXEntry getOldEntry()

getRDN

public RDN getRDN()

Returns the escaped RDN (possibly multi-valued).

Implementation Note: The returned RDN is created based on the internal naming type/value arrays, which must be synched with the user modified attribute list


getNewEntry

public DXEntry getNewEntry()
Returns a new entry


getAttribute

public javax.naming.directory.Attribute getAttribute(java.lang.String ID)
Reads all the values for a given attribute from the table.


isMandatory

public boolean isMandatory(java.lang.String attributeTypeName)
Brute force search to find an attributeType given only the name. rarely used - main use is when popupTool tries to create a new attribute value entry, knowing only the type name.


checkMandatoryAttributesSet

public boolean checkMandatoryAttributesSet()
Checks that all mandatory attributes have at least one value entered.


removeNamingComponent

public void removeNamingComponent(AttributeType currentType,
                                  AttributeValue currentValue)
This removes a component from the array of naming atts, and sets the currentValue object to be a naming value.


dumpNamingArrays

public void dumpNamingArrays()

addNamingComponent

public void addNamingComponent(AttributeType currentType,
                               AttributeValue currentValue)

changedByUser

public boolean changedByUser()
This returns whether the table data has been modified since the original display of the entry.