Back to index

wims  3.65+svn20090927
Classes | Public Member Functions | Package Attributes
WIMSchem.ds.DataTableModel Class Reference
Collaboration diagram for WIMSchem.ds.DataTableModel:
Collaboration graph
[legend]

List of all members.

Classes

class  MoleculeEditor
class  MoleculeRenderer

Public Member Functions

MoleculeRenderer NewMoleculeRenderer ()
MoleculeEditor NewMoleculeEditor (ActionListener ActList)
 DataTableModel (DataSheet DS, DataSheetCache Cache)
void SetDataSheet (DataSheet DS, DataSheetCache Cache)
void SetTemporaryEdit (int Col)
void ClearTemporaryEdit ()
int getColumnCount ()
int getRowCount ()
String getColumnName (int col)
Object getValueAt (int row, int col)
Class getColumnClass (int col)
boolean isCellEditable (int row, int col)
void setValueAt (Object val, int row, int col)
TableCellRenderer getCellRenderer (int row, int col, TableCellRenderer def)

Package Attributes

DataSheet ds = null
DataSheetCache cache = null
int temporaryEdit = -1

Detailed Description

Definition at line 26 of file DataTableModel.java.


Constructor & Destructor Documentation

Definition at line 90 of file DataTableModel.java.

{ds=DS; cache=Cache;}

Member Function Documentation

Definition at line 94 of file DataTableModel.java.

Here is the caller graph for this function:

TableCellRenderer WIMSchem.ds.DataTableModel.getCellRenderer ( int  row,
int  col,
TableCellRenderer  def 
) [inline]

Definition at line 163 of file DataTableModel.java.

    {
       if (ds.ColType(col)==DataSheet.COLTYPE_MOLECULE)
       {
           // !! if column height is set to one-line, use a 'molecular formula' renderer...
           return new MoleculeRenderer();
       }
       
       return def;
    }

Here is the call graph for this function:

Class WIMSchem.ds.DataTableModel.getColumnClass ( int  col) [inline]

Definition at line 118 of file DataTableModel.java.

    {
       int t=ds.ColType(col);
       if (t==DataSheet.COLTYPE_MOLECULE) return new Molecule().getClass();
       if (t==DataSheet.COLTYPE_STRING) return new String("").getClass();
       if (t==DataSheet.COLTYPE_INTEGER) return new String("").getClass();
       if (t==DataSheet.COLTYPE_REAL) return new String("").getClass();
       if (t==DataSheet.COLTYPE_BOOLEAN) return new Boolean(false).getClass();
       return new String("").getClass();
    }

Here is the call graph for this function:

Definition at line 96 of file DataTableModel.java.

{return ds.NumCols();}

Here is the call graph for this function:

String WIMSchem.ds.DataTableModel.getColumnName ( int  col) [inline]

Definition at line 98 of file DataTableModel.java.

{return ds.ColName(col);}

Here is the call graph for this function:

Definition at line 97 of file DataTableModel.java.

{return ds.NumRows();}

Here is the call graph for this function:

Object WIMSchem.ds.DataTableModel.getValueAt ( int  row,
int  col 
) [inline]

Definition at line 99 of file DataTableModel.java.

    {
       int t=ds.ColType(col);
       if (ds.IsNull(row,col))
       {
           if (t==DataSheet.COLTYPE_MOLECULE) return null;
           if (t==DataSheet.COLTYPE_BOOLEAN) return new Boolean(false); // (no UI concept of null)
           return ""; // null
       }
       else
       {
           if (t==DataSheet.COLTYPE_MOLECULE) return ds.GetMolecule(row,col);
           if (t==DataSheet.COLTYPE_STRING) return ds.GetString(row,col);
           if (t==DataSheet.COLTYPE_INTEGER) return new Integer(ds.GetInteger(row,col));
           if (t==DataSheet.COLTYPE_REAL) return new Double(ds.GetReal(row,col));
           if (t==DataSheet.COLTYPE_BOOLEAN) return new Boolean(ds.GetBoolean(row,col));
       }
       return "";
    }

Here is the call graph for this function:

boolean WIMSchem.ds.DataTableModel.isCellEditable ( int  row,
int  col 
) [inline]

Definition at line 128 of file DataTableModel.java.

    {
       // (molecule only) return temporaryEdit==col || ds.ColType(col)!=DataSheet.COLTYPE_MOLECULE;
       return temporaryEdit==col;
    }
MoleculeEditor WIMSchem.ds.DataTableModel.NewMoleculeEditor ( ActionListener  ActList) [inline]

Definition at line 82 of file DataTableModel.java.

{return new MoleculeEditor(ActList);}

Here is the caller graph for this function:

Definition at line 60 of file DataTableModel.java.

{return new MoleculeRenderer();}

Here is the caller graph for this function:

Definition at line 91 of file DataTableModel.java.

{ds=DS; cache=Cache;}

Here is the caller graph for this function:

void WIMSchem.ds.DataTableModel.SetTemporaryEdit ( int  Col) [inline]

Definition at line 93 of file DataTableModel.java.

Here is the caller graph for this function:

void WIMSchem.ds.DataTableModel.setValueAt ( Object  val,
int  row,
int  col 
) [inline]

Definition at line 133 of file DataTableModel.java.

    {
       int t=ds.ColType(col);
       try
       {
           cache.CacheUndo(ds);
       
           if (t==DataSheet.COLTYPE_MOLECULE) ds.SetMolecule(row,col,(Molecule)val);
           else if (t==DataSheet.COLTYPE_STRING) ds.SetString(row,col,(String)val);
           else if (t==DataSheet.COLTYPE_INTEGER) 
           {
              String str=(String)val;
              if (str.length()==0) ds.SetToNull(row,col);
              else ds.SetInteger(row,col,Integer.parseInt(str));
           }
           else if (t==DataSheet.COLTYPE_REAL) 
           {
              String str=(String)val;
              if (str.length()==0) ds.SetToNull(row,col);
              else ds.SetReal(row,col,Double.parseDouble(str));
           }
           else if (t==DataSheet.COLTYPE_BOOLEAN) ds.SetBoolean(row,col,((Boolean)val).booleanValue());
           
           ds.SetDirty();
       }
       catch (NumberFormatException ex) {} // (do nothing --> change gets rejected)
    }

Here is the call graph for this function:


Member Data Documentation

Definition at line 87 of file DataTableModel.java.

Definition at line 86 of file DataTableModel.java.

Definition at line 88 of file DataTableModel.java.


The documentation for this class was generated from the following file: