home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Main.bin / StringTableModel.java < prev    next >
Text File  |  1998-11-18  |  21KB  |  848 lines

  1. package com.symantec.itools.swing.models;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Enumeration;
  5. import java.util.Vector;
  6. import java.util.StringTokenizer;
  7. import com.sun.java.swing.event.TableModelEvent;
  8. import java.math.*;
  9.  
  10. public class StringTableModel
  11.     extends com.sun.java.swing.table.AbstractTableModel
  12.     implements Serializable
  13. {
  14.  
  15.     /**
  16.      * The number of columns currently in the table.
  17.      * This is equal to the widest row of data.
  18.      * The column headers are pinned (padded or truncated) to the width of the data
  19.      */
  20.     protected int colCount = 0;
  21.  
  22.     /**
  23.      * A Vector of Vectors containing the table's data
  24.      */
  25.     protected Vector dataVector = new Vector();
  26.  
  27.     /**
  28.      * A vector of vectors containg booleans indicating editability of
  29.      * each cell in the table.
  30.      */
  31.     protected Vector editableVector = new Vector();
  32.  
  33.     /**
  34.      * A vector containing the column headers
  35.      */
  36.     protected Vector headerVector = new Vector();
  37.  
  38.     /**
  39.      * A boolean indicating whether the table in general is editable.
  40.      */
  41.     protected boolean editable = false;
  42.  
  43.     //
  44.     // com.sun.java.swing.table.TableModel implementation
  45.     //
  46.  
  47.     /**
  48.      * Returns the number of rows in the table.
  49.      * @return The number of rows in the table.
  50.      */
  51.     public int getRowCount()
  52.     {
  53.         return dataVector.size();
  54.     }
  55.  
  56.     /**
  57.      * Returns the number of columns in the table.
  58.      * @return The number of columns in the table.
  59.      */
  60.     public int getColumnCount()
  61.     {
  62.         return colCount;
  63.     }
  64.  
  65.     /**
  66.      * Returns the header for specified column.
  67.      * May be space (padded)
  68.      * @param column The specified column
  69.      * @return The header for specified column.
  70.      */
  71.     public String getColumnName(int column)
  72.     {
  73.         return (String)headerVector.elementAt(column);
  74.     }
  75.  
  76.     /**
  77.      * Returns the class of the type of object held in this column.
  78.      * In this model, it it always String
  79.      * @param columnIndex The specified column
  80.      * @return String.class
  81.      */
  82.     public Class getColumnClass(int columnIndex)
  83.     {
  84.         return String.class;
  85.     }
  86.  
  87.     /**
  88.      * Returns the value in the specified cell
  89.      * @param row The specified row.
  90.      * @param column The specified column
  91.      * @return The value in the specified cell
  92.      */
  93.     public Object getValueAt(int row, int column)
  94.     {
  95.         return ((String)((Vector)dataVector.elementAt(row)).elementAt(column));
  96.     }
  97.  
  98.     /**
  99.      * Set the value for a specified cell
  100.      * @param aValue The object value to set the specified cell to.
  101.      * Should be a string for this model.
  102.      * @param row The specified row.
  103.      * @param column The specified column
  104.      */
  105.     public void setValueAt(Object aValue, int row, int column)
  106.     {
  107.         ((Vector)dataVector.elementAt(row)).setElementAt(aValue, column);
  108.         ((Vector)editableVector.elementAt(row)).setElementAt(Boolean.TRUE, column);
  109.         fireTableCellUpdated(row, column);
  110.     }
  111.  
  112.     /**
  113.      * Set the editability of the specified cell.
  114.      * @param rowIndex The specified row.
  115.      * @param columnIndex The specified column
  116.      * @param f True or false.
  117.      */
  118.     public void setCellEditable(int rowIndex, int columnIndex, boolean f)
  119.     {
  120.         Vector data;
  121.  
  122.         data = (Vector)editableVector.elementAt(rowIndex);
  123.         data.setElementAt(new Boolean(f), columnIndex);
  124.     }
  125.  
  126.     /**
  127.      * Is the cell editable?
  128.      * @param rowIndex The specified row
  129.      * @param columnIndex The specified column
  130.      * @return true if cell is editable
  131.      */
  132.     public boolean isCellEditable(int rowIndex, int columnIndex)
  133.     {
  134.         Vector data;
  135.  
  136.         if (!editable)
  137.             return false;
  138.             
  139.         data = (Vector)editableVector.elementAt(rowIndex);
  140.  
  141.         return (((Boolean)data.elementAt(columnIndex)).booleanValue());
  142.     }
  143.  
  144.     //
  145.     // Properties
  146.     //
  147.  
  148.     /**
  149.      * Calls getItems(char)
  150.      * @return An array of comma-delimited strings representing the
  151.      * data in the table.
  152.      */
  153.     public String[] getItems()
  154.     {
  155.         return (getItems(','));
  156.     }
  157.  
  158.     /**
  159.      * Called by getItems(). Constructs the array of
  160.      * comma-delimited string from the data in dataVector.
  161.      * @param appendChar a comma
  162.      * @return An array of comma-delimited strings representing the
  163.      * data in the table.
  164.      */
  165.     public String[] getItems(char appendChar)
  166.     {
  167.         int rowCount;
  168.         String[] items;
  169.  
  170.         rowCount = dataVector.size();
  171.         items = new String[rowCount];
  172.  
  173.         for(int i = 0; i < rowCount; i++)
  174.         {
  175.             StringBuffer row;
  176.  
  177.             row = new StringBuffer();
  178.  
  179.             for(int j = 0; j < colCount;j++)
  180.             {
  181.                 row.append(((Vector)dataVector.elementAt(i)).elementAt(j));
  182.                 row.append(appendChar);
  183.             }
  184.  
  185.             // strip trailing appendChar off.
  186.             row.setLength(row.length() - 1);
  187.  
  188.             items[i] = row.toString();
  189.         }
  190.  
  191.         return items;
  192.     }
  193.  
  194.     /**
  195.      * Calls setItems(String[],String).
  196.      * @param newItems An array of comma-delimited strings holding the
  197.      * data for the table.
  198.      */
  199.     public void setItems(String[] newItems)
  200.     {
  201.         setItems(newItems, ",");
  202.     }
  203.  
  204.     /**
  205.      * Parses the  String array, one row at a time, via a stringtokenizer
  206.      * by calling setItemAt(String,int,boolean,String)
  207.      * @param newItems The string array of data
  208.      * @param sepChar The comma delimiter
  209.      */
  210.     public void setItems(String[] newItems, String sepChar)
  211.     {
  212.         int rowCount;
  213.         colCount = 0;
  214.         dataVector.setSize(0);
  215.  
  216.         // cycle through rows
  217.         for(int i = 0; i < newItems.length;i++)
  218.         {
  219.             setItemAt(newItems[i], i, false, sepChar);
  220.         }
  221.  
  222.         rowCount = dataVector.size();
  223.  
  224.         // pad any short rows
  225.         for(int k = 0; k < rowCount;k++)
  226.         {
  227.             int rowWidth = ((Vector)dataVector.elementAt(k)).size();
  228.  
  229.             if(rowWidth < colCount)
  230.             {
  231.                 int padding;
  232.  
  233.                 padding = colCount - rowWidth;
  234.  
  235.                 for(int l = 0; l < padding; l++)
  236.                 {
  237.                     ((Vector)dataVector.elementAt(k)).addElement("");
  238.                 }
  239.             }
  240.         }
  241.  
  242.         // Generate notification
  243.         fireTableStructureChanged();
  244.     }
  245.  
  246.     /**
  247.      * Calls setItemAt(String,int,boolean,String)
  248.      * @param item A comma-delimited string representing a row of data
  249.      * @param row The specified row.
  250.      * @param notifyOfChange Whether or not to broadcast an event.
  251.      */
  252.     public void setItemAt(String item, int row, boolean notifyOfChange)
  253.     {
  254.         setItemAt(item, row, notifyOfChange, ",");
  255.     }
  256.  
  257.     /**
  258.      * Puts the item value (row of data) into dataVector
  259.      * Pads any short rows to the widest row with a space.
  260.      * @param item A comma-delimited string representing a row of data
  261.      * @param row The specified row.
  262.      * @param notifyOfChange Whether or not to broadcast an event.
  263.      * @param sepChar The comma delimiter.
  264.      */
  265.     public void setItemAt(String item, int row, boolean notifyOfChange, String sepChar)
  266.     {
  267.         StringTokenizer newRow;
  268.  
  269.         dataVector.insertElementAt(new Vector(), row);
  270.         editableVector.insertElementAt(new Vector(), row);
  271.         newRow = new StringTokenizer(item, sepChar);
  272.         colCount = Math.max(colCount,newRow.countTokens());
  273.  
  274.         // columns
  275.         while(newRow.hasMoreTokens())
  276.         {
  277.             int    rowWidth;
  278.             String rowItem;
  279.  
  280.             rowItem = newRow.nextToken();
  281.             ((Vector)dataVector.elementAt(row)).addElement(rowItem);
  282.             ((Vector)editableVector.elementAt(row)).addElement(Boolean.TRUE);
  283.             rowWidth = ((Vector)dataVector.elementAt(row)).size();
  284.             if(rowWidth > headerVector.size())
  285.             {
  286.                 headerVector.addElement(" ");
  287.             }
  288.         }
  289.  
  290.         if(notifyOfChange)
  291.         {
  292.             fireTableDataChanged();
  293.         }
  294.  
  295.     }
  296.  
  297.     /**
  298.      * Calls getColumnHeaders(char)
  299.      * @return A comma-delimited string containing the columnHeaders
  300.      */
  301.     public String getColumnHeaders()
  302.     {
  303.         return (getColumnHeaders(','));
  304.     }
  305.  
  306.     /**
  307.      * Constructs a comma-delimited string from headerVector
  308.      * @param sepChar String - The comma delimiter
  309.      * @return A comma-delimited string containing the columnHeaders
  310.      */
  311.     public String getColumnHeaders(char sepChar)
  312.     {
  313.         StringBuffer colHeaders = new StringBuffer();
  314.  
  315.         for (int j = 0; j < colCount;j++)
  316.         {
  317.             colHeaders.append((String)headerVector.elementAt(j));
  318.             colHeaders.append(sepChar);
  319.         }
  320.  
  321.         // remove trailing sepChar
  322.         if (colHeaders.length() > 0)
  323.             colHeaders.setLength(colHeaders.length() - 1);
  324.  
  325.         return colHeaders.toString();
  326.     }
  327.  
  328.     /**
  329.      * Calls setcolumnHeaders(String,String)
  330.      * @param newHeaders A comma-delimited string containing the column headers
  331.      */
  332.     public void setColumnHeaders(String newHeaders)
  333.     {
  334.         setColumnHeaders(newHeaders, ",");
  335.     }
  336.  
  337.     /**
  338.      * Sets the column headers.
  339.      * If newHeaders is shorter than colCount
  340.      * then the headerVector is padded with spaces.
  341.      * If newHeaders is longer than colCount, they will be stored but
  342.      * not displayed by JTable.
  343.      * @param newHeaders A comma-delimited string containing the column headers
  344.      * @param sepChar String - The comma delimiter
  345.      */
  346.     public void setColumnHeaders(String newHeaders, String sepChar)
  347.     {
  348.         headerVector = new Vector();
  349.         StringTokenizer headers = new StringTokenizer(newHeaders,sepChar);
  350.         int newHeadersWidth = headers.countTokens();
  351.         for (int j = 0; j < Math.max(newHeadersWidth,colCount); j++)
  352.             {
  353.                 if(headers.hasMoreTokens())
  354.                     {
  355.                         headerVector.addElement(headers.nextToken());
  356.                     }
  357.  
  358.                 else
  359.                    {
  360.                     headerVector.addElement(" ");
  361.                    }
  362.  
  363.             }
  364.  
  365.         fireTableStructureChanged();
  366.         fireTableDataChanged();
  367.     }
  368.  
  369.     /**
  370.      * Is the table in general editable?
  371.      * @return true if table is editable
  372.      */
  373.     public boolean isEditable()
  374.     {
  375.         return editable;
  376.     }
  377.  
  378.     /**
  379.      * Sets whether or not the table in general is editable.
  380.      * @param isEditable boolean
  381.      */
  382.     public void setEditable(boolean isEditable)
  383.     {
  384.         editable = isEditable;
  385.     }
  386.  
  387.     /**
  388.      * Calls getRow(int,char)
  389.      * Get a particular row of data.
  390.      * @param row The specified row.
  391.      * @return A comma delimited string containg the elements in the specified row.
  392.      */
  393.     public String getRow(int row)
  394.     {
  395.         return getRow(row, ',');
  396.     }
  397.  
  398.     /**
  399.      * Get a particular row of data.
  400.      * @param row The specified row.
  401.      * @param appendChar a comma
  402.      * @return A comma delimited string containing the elements in the specified row.
  403.      */
  404.     public String getRow(int row, char appendChar)
  405.     {
  406.         StringBuffer buf;
  407.  
  408.         buf = new StringBuffer();
  409.  
  410.         for(Enumeration e = elements(row); e.hasMoreElements();)
  411.         {
  412.             buf.append((String)e.nextElement());
  413.             buf.append(appendChar);
  414.         }
  415.  
  416.         // remove trailing appendChar
  417.         buf.setLength(buf.length() - 1);
  418.  
  419.         return (buf.toString());
  420.     }
  421.  
  422.     //
  423.     // helper methods
  424.     //
  425.  
  426.     /**
  427.      * Add a row of data. Calls insertRowAt(String,int)
  428.      * @param data A comma-delimited string.
  429.      */
  430.     public void addRow(String data)
  431.     {
  432.         insertRowAt(data, dataVector.size());
  433.     }
  434.  
  435.     /**
  436.      * Calls setItemAt(string,int,boolean)
  437.      * @param data A comma-delimited string.
  438.      * @param row The specified row.
  439.      */
  440.     public void insertRowAt(String data, int row)
  441.     {
  442.         setItemAt(data, row, false);
  443.         fireTableRowsInserted(row, row);
  444.     }
  445.  
  446.     /**
  447.      * Removes the specified row from dataVector
  448.      * @param row The specified row.
  449.      */
  450.     public void removeRow(int row)
  451.     {
  452.         dataVector.removeElementAt(row);
  453.         fireTableRowsDeleted(row, row);
  454.     }
  455.  
  456.     /**
  457.      * Returns the number of rows in dataVector.
  458.      * @return The number of rows
  459.      */
  460.     public int getNumRows()
  461.     {
  462.         return (dataVector.size());
  463.     }
  464.  
  465.     //
  466.     // Vector like methods
  467.     //
  468.  
  469.     /**
  470.      * Gets the value from a particular cell.
  471.      * @param row The specified row
  472.      * @param col The specified column
  473.      * @return The value from a particular cell.
  474.      */
  475.     public Object getElementAt(int row, int col)
  476.     {
  477.         Vector data;
  478.  
  479.         data = (Vector)dataVector.elementAt(row);
  480.  
  481.         return (data.elementAt(col));
  482.     }
  483.  
  484.     /**
  485.      * Fills anArray with corresponding values in dataVector by  calling
  486.      * getElementAt(int,int)
  487.      * @param anArray Object array
  488.      */
  489.     public void copyInto(Object anArray[][])
  490.     {
  491.         for(int i = 0; i < anArray.length; i++)
  492.         {
  493.             for(int j = 0; j < anArray[i].length; j++)
  494.             {
  495.                 anArray[i][j] = elementAt(i, j);
  496.             }
  497.         }
  498.     }
  499.  
  500.     /**
  501.      * Calls the Vector.trimToSize() on the specified row in dataVector
  502.      * @param row The specified row
  503.      */
  504.     public void trimToSize(int row)
  505.     {
  506.         Vector data;
  507.  
  508.         data = (Vector)dataVector.elementAt(row);
  509.         data.trimToSize();
  510.     }
  511.  
  512.     /**
  513.      * Calls the Vector.ensureCapacity() on the specified row in dataVector
  514.      * @param minCapacity The required capacity
  515.      * @param row The specified row
  516.      */
  517.     public void ensureCapacity(int minCapacity, int row)
  518.     {
  519.         Vector data;
  520.  
  521.         data = (Vector)dataVector.elementAt(row);
  522.         data.ensureCapacity(minCapacity);
  523.     }
  524.  
  525.     /**
  526.      * Calls the Vector.setSize() on the specified row in dataVector
  527.      * @param newSize The new size
  528.      * @param row The specified row
  529.      */
  530.     public void setSize(int newSize, int row)
  531.     {
  532.         int oldSize;
  533.         Vector data;
  534.  
  535.         data    = (Vector)dataVector.elementAt(row);
  536.         oldSize = data.size();
  537.         data.setSize(newSize);
  538.  
  539.         if(oldSize != newSize)
  540.         {
  541.             fireTableRowsUpdated(row, row);
  542.         }
  543.     }
  544.  
  545.     /**
  546.      * Calls the Vector.Capacity() on the specified row in dataVector
  547.      * @param row The specified row
  548.      * @return The current capacity of the specified row
  549.      */
  550.     public int capacity(int row)
  551.     {
  552.         Vector data;
  553.  
  554.         data = (Vector)dataVector.elementAt(row);
  555.  
  556.         return (data.capacity());
  557.     }
  558.  
  559.     /**
  560.      * Calls the Vector.Size() on  dataVector
  561.      * @return The current size (number of rows) of dataVector.
  562.      */
  563.     public int size()
  564.     {
  565.         return (dataVector.size());
  566.     }
  567.  
  568.     /**
  569.      * Calls the Vector.Size() on the specified row in dataVector
  570.      * @param row The specified row
  571.      * @return The current size of the specified row
  572.      */
  573.     public int size(int row)
  574.     {
  575.         Vector data;
  576.  
  577.         data = (Vector)dataVector.elementAt(row);
  578.  
  579.         return (data.size());
  580.     }
  581.  
  582.     /**
  583.      * Calls the Vector.isEmpty() on the specified row in dataVector
  584.      * @param row The specified row
  585.      * @return Whether or not the specified row is empty.
  586.      */
  587.     public boolean isEmpty(int row)
  588.     {
  589.         Vector data;
  590.  
  591.         data = (Vector)dataVector.elementAt(row);
  592.  
  593.         return (data.isEmpty());
  594.     }
  595.  
  596.     /**
  597.      * Calls the Vector.elements() on the specified row in dataVector
  598.      * @param row The specified row
  599.      * @return The specified row as an enumeration
  600.      */
  601.     public Enumeration elements(int row)
  602.     {
  603.         Vector data;
  604.  
  605.         data = (Vector)dataVector.elementAt(row);
  606.  
  607.         return (data.elements());
  608.     }
  609.  
  610.     /**
  611.      * Calls the Vector.contains() on the specified row in dataVector
  612.      * @param elem The specified object
  613.      * @param row The specified row
  614.      * @return Whether or not the specified row contains the specified object
  615.      */
  616.     public boolean rowContains(Object elem, int row)
  617.     {
  618.         Vector data;
  619.  
  620.         data = (Vector)dataVector.elementAt(row);
  621.  
  622.         return (data.contains(elem));
  623.     }
  624.  
  625.     /**
  626.      * Determines whether the specified column contains the specified object.
  627.      * @param elem The specified object
  628.      * @param col The specified column
  629.      * @return Whether the specified column contains the specified object.
  630.      */
  631.     public boolean columnContains(Object elem, int col)
  632.     {
  633.         int size;
  634.  
  635.         size = size();
  636.  
  637.         for(int i = 0; i < size; i++)
  638.         {
  639.             if(((Vector)dataVector.elementAt(i)).elementAt(col).equals(elem))
  640.             {
  641.                 return (true);
  642.             }
  643.         }
  644.  
  645.         return (false);
  646.     }
  647.  
  648.     /**
  649.      * Calls the Vector.indexOf(object) on the specified row in dataVector
  650.      * @param elem The specified object
  651.      * @param row The specified row
  652.      * @return The index of the spcified object in the specified row
  653.      */
  654.     public int indexOf(Object elem, int row)
  655.     {
  656.         Vector data;
  657.  
  658.         data = (Vector)dataVector.elementAt(row);
  659.  
  660.         return (data.indexOf(elem));
  661.     }
  662.  
  663.     /**
  664.      * Calls the Vector.indexOf(object,int) on the specified row in dataVector
  665.      * @param elem The specified object
  666.      * @param row The specified row
  667.      * @param col The specified column
  668.      * @return The index of the spcified object in the specified row, but
  669.      * begins the search at the specified column.
  670.      */
  671.     public int indexOf(Object elem, int row, int col)
  672.     {
  673.         Vector data;
  674.  
  675.         data = (Vector)dataVector.elementAt(row);
  676.  
  677.         return (data.indexOf(elem, col));
  678.     }
  679.  
  680.     /**
  681.      * Calls the Vector.lastIndexOf(object) on the specified row in dataVector
  682.      * @param elem The specified object
  683.      * @param row The specified row
  684.      * @return The last occurrence of elem in the specified row.
  685.      */
  686.     public int lastIndexOf(Object elem, int row)
  687.     {
  688.         Vector data;
  689.  
  690.         data = (Vector)dataVector.elementAt(row);
  691.  
  692.         return (data.lastIndexOf(elem));
  693.     }
  694.  
  695.     /**
  696.      * Calls the Vector.lastIndexOf(object,int) on the specified row in dataVector
  697.      * @param elem The specified object
  698.      * @param row The specified row
  699.      * @param col The specified column
  700.      * @return The last occurrence of elem in the specified row, searching backwards
  701.      * from the specified index
  702.      */
  703.     public int lastIndexOf(Object elem, int row, int col)
  704.     {
  705.         Vector data;
  706.  
  707.         data = (Vector)dataVector.elementAt(row);
  708.  
  709.         return (data.lastIndexOf(elem, col));
  710.     }
  711.  
  712.     /**
  713.      * Calls the Vector.elementAt() on the specified row in dataVector
  714.      * @param row The specified row
  715.      * @param col The specified column
  716.      * @return The object at the specified row and column.
  717.      */
  718.     public Object elementAt(int row, int col)
  719.     {
  720.         Vector data;
  721.  
  722.         data = (Vector)dataVector.elementAt(row);
  723.  
  724.         return (data.elementAt(col));
  725.     }
  726.  
  727.     /**
  728.      * Calls the Vector.firstElement() on the specified row in dataVector
  729.      * @param row The specified row
  730.      * @return The first element in the specified row of dataVector
  731.      */
  732.     public Object firstElement(int row)
  733.     {
  734.         Vector data;
  735.  
  736.         data = (Vector)dataVector.elementAt(row);
  737.  
  738.         return (data.firstElement());
  739.     }
  740.  
  741.     /**
  742.      * Calls the Vector.lastElement() on the specified row in dataVector
  743.      * @param row The specified row
  744.      * @return The last element in the specified row of dataVector
  745.      */
  746.     public Object lastElement(int row)
  747.     {
  748.         Vector data;
  749.  
  750.         data = (Vector)dataVector.elementAt(row);
  751.  
  752.         return (data.lastElement());
  753.     }
  754.  
  755.     /**
  756.      * Calls the Vector.setElementAt() on the specified row in dataVector
  757.      * @param obj object - the value to set
  758.      * @param row The specified row
  759.      * @param col The specified column
  760.      */
  761.     public void setElementAt(Object obj, int row, int col)
  762.     {
  763.         Vector data;
  764.  
  765.         data = (Vector)dataVector.elementAt(row);
  766.         data.setElementAt(obj, col);
  767.           fireTableRowsUpdated(row, row);
  768.     }
  769.  
  770.     /**
  771.      * Calls the Vector.removeElementAt() on the specified row in dataVector
  772.      * @param row Removes the value at the specified cell row, and
  773.      * @param col the specified column
  774.      */
  775.     public void removeElementAt(int row, int col)
  776.     {
  777.         Vector data;
  778.  
  779.         data = (Vector)dataVector.elementAt(row);
  780.         data.removeElementAt(col);
  781.            fireTableRowsUpdated(row, row);
  782.     }
  783.  
  784.     /**
  785.      * Calls the Vector.insertElementAt() on the specified row in dataVector
  786.      * @param obj The value to set.
  787.      * @param row the specified row
  788.      * @param col the specified column
  789.      */
  790.     public void insertElementAt(Object obj, int row, int col)
  791.     {
  792.         Vector data;
  793.  
  794.         data = (Vector)dataVector.elementAt(row);
  795.         data.insertElementAt(obj, col);
  796.            fireTableRowsUpdated(row, row);
  797.     }
  798.  
  799.     /**
  800.      * Calls the Vector.addElement() on the specified row in dataVector
  801.      * @param obj The value to add
  802.      * @param row The specified row
  803.      */
  804.     public void addElement(Object obj, int row)
  805.     {
  806.         Vector data;
  807.  
  808.         data = (Vector)dataVector.elementAt(row);
  809.         data.addElement(obj);
  810.            fireTableRowsUpdated(row, row);
  811.     }
  812.  
  813.     /**
  814.      * Calls the Vector.removeElement() on the specified row in dataVector
  815.      * @param obj The value to remove. Removes only the first occurence.
  816.      * @param row The specified row
  817.      * @return Whether or not the value was found
  818.      */
  819.     public boolean removeElement(Object obj, int row)
  820.     {
  821.         Vector  data;
  822.         boolean rv;
  823.  
  824.         data = (Vector)dataVector.elementAt(row);
  825.         rv   = data.removeElement(obj);
  826.  
  827.         if(rv)
  828.         {
  829.                fireTableRowsUpdated(row, row);
  830.         }
  831.  
  832.         return (rv);
  833.     }
  834.  
  835.     /**
  836.      * Calls the Vector.removeAllElements() on the specified row in dataVector
  837.      * @param row The specified row
  838.      */
  839.     public void removeAllElements(int row)
  840.     {
  841.         Vector data;
  842.  
  843.         data = (Vector)dataVector.elementAt(row);
  844.         data.removeAllElements();
  845.            fireTableRowsUpdated(row, row);
  846.     }
  847. }
  848.