Bibi
19 Oct 2005 21:04

ujap.bibi
Class Fields

java.lang.Object
  extended byujap.bibi.Fields
All Implemented Interfaces:
TableModel

public class Fields
extends Object
implements TableModel

Author:
Ute Platzer

Field Summary
private  Vector lissy
           
private  Map map
          to allow fast checking - the keys are names (lowercase) and the values are strings.
private  List values
          to preserve the order of the elements, a List of SingleFields
 
Constructor Summary
Fields()
           
Fields(Collection l)
          a shallow copy is made of the List.
 
Method Summary
 void addRow()
          add an empty row
 void addRow(SingleField p)
          rows are only added if there is not already a row with the same name
 void addTableModelListener(TableModelListener l)
           
 Object clone()
           
 boolean equals(Object o)
          compares if all fields are equal (via the map)
private  void fireChange(TableModelEvent e)
           
 String get(String name)
          return the value of the field with the specified name, or null if field is not there.
 Class getColumnClass(int columnIndex)
          String.class
 int getColumnCount()
          2
 String getColumnName(int columnIndex)
          field - value
 int getRowCount()
           
 Set getSingleFields()
          return an unmodifiable view on the SingleFields
 Object getValueAt(int rowIndex, int columnIndex)
           
 int hashCode()
          the hashCode of the map
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void removeRow(int row)
          first remove the row, then fire the event
 void removeTableModelListener(TableModelListener l)
           
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 String toString()
           
private  void writeNames(String type, String namelist, Writer w)
          write list of names in author or editor string, including <author> or <editor> tags (specify type: "author" or "editor"
Can handle different formats of author strings:
"Firstname M.
 void writeXML(Writer w)
           
private  void writeXMLField(String name, String value, Writer w, boolean isStandard)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

values

private List values
to preserve the order of the elements, a List of SingleFields


map

private Map map
to allow fast checking - the keys are names (lowercase) and the values are strings.


lissy

private Vector lissy
Constructor Detail

Fields

public Fields()

Fields

public Fields(Collection l)
a shallow copy is made of the List. The Collection must contain objects of type SingleField. For duplicate entries (fields with the same name) only the first occurrence is used.

Method Detail

getColumnClass

public Class getColumnClass(int columnIndex)
String.class

Specified by:
getColumnClass in interface TableModel

getColumnCount

public int getColumnCount()
2

Specified by:
getColumnCount in interface TableModel

getColumnName

public String getColumnName(int columnIndex)
field - value

Specified by:
getColumnName in interface TableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Throws:
IllegalArgumentException - if a field name is changed (column 0) to the name of another field already existing, because no two rows may have the same field name

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

removeRow

public void removeRow(int row)
first remove the row, then fire the event


addRow

public void addRow()
add an empty row


addRow

public void addRow(SingleField p)
rows are only added if there is not already a row with the same name

Throws:
IllegalArgumentException - if the name of the field being added already exists.

isCellEditable

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

addTableModelListener

public void addTableModelListener(TableModelListener l)
Specified by:
addTableModelListener in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Specified by:
removeTableModelListener in interface TableModel

fireChange

private void fireChange(TableModelEvent e)

get

public String get(String name)
return the value of the field with the specified name, or null if field is not there.


equals

public boolean equals(Object o)
compares if all fields are equal (via the map)


hashCode

public int hashCode()
the hashCode of the map


getSingleFields

public Set getSingleFields()
return an unmodifiable view on the SingleFields


clone

public Object clone()

writeXML

public void writeXML(Writer w)
              throws IOException
Throws:
IOException

writeNames

private void writeNames(String type,
                        String namelist,
                        Writer w)
                 throws IOException
write list of names in author or editor string, including <author> or <editor> tags (specify type: "author" or "editor"
Can handle different formats of author strings:
"Firstname M. Lastname and Otherfirst b. Secondlast"
"Lastname, First B. and Otherlast, Firstname M."

Throws:
IOException

toString

public String toString()

writeXMLField

private void writeXMLField(String name,
                           String value,
                           Writer w,
                           boolean isStandard)
                    throws IOException
Throws:
IOException

Bibi
19 Oct 2005 21:04

Copyright ? 2002-2005 Ute Platzer. All Rights Reserved.