Ejemplo n.º 1
0
 // add new Chef
 public void add(Chef chef) {
   _entries.addElement(chef);
   int index = _entries.size() - 1;
   _chefsByName.put(chef.getName(), new Integer(index));
   // tell TableView to update
   fireTableRowsInserted(index, index);
   fireTableRowsUpdated(index, index);
 }
Ejemplo n.º 2
0
 public synchronized Object getValueAt(int row, int col) {
   Chef entry = (Chef) (_entries.elementAt(row));
   if (col == NAME) return entry.getName();
   else if (col == POSITION) return new Double(entry.getPosition()._angle);
   else if (col == TIME) return _timeFormat.format(entry.getTime());
   else if (col == STATE) return Chef.stateStrings[entry.getModelingState()];
   else if (col == SERVING) {
     if (entry.getServing() == null) return "";
     else return entry.getServing()._name;
   } else if (col == BOAT) {
     if (entry.getBoat() != null) return entry.getBoat().getName();
     else return "";
   } else return null;
 }
Ejemplo n.º 3
0
 public void chefUpdated(Chef chef) {
   Integer row = (Integer) (_chefsByName.get(chef.getName()));
   int index = row.intValue();
   fireTableRowsUpdated(index, index);
 }