1 19 20 package org.netbeans.modules.debugger.ui.models; 21 22 import java.util.Vector ; 23 import org.netbeans.api.debugger.Session; 24 import org.netbeans.spi.debugger.ui.Constants; 25 import org.netbeans.spi.viewmodel.TableModel; 26 import org.netbeans.spi.viewmodel.ModelListener; 27 import org.netbeans.spi.viewmodel.UnknownTypeException; 28 29 30 34 public class SessionsTableModel implements TableModel, Constants { 35 36 private Vector listeners = new Vector (); 37 38 39 public Object getValueAt (Object row, String columnID) throws 40 UnknownTypeException { 41 if (row instanceof Session) { 42 if (columnID.equals (SESSION_STATE_COLUMN_ID)) 43 return ""; 44 else 45 if (columnID.equals (SESSION_LANGUAGE_COLUMN_ID)) 46 return row; 47 else 48 if (columnID.equals (SESSION_HOST_NAME_COLUMN_ID)) 49 return ((Session) row).getLocationName (); 50 } 51 throw new UnknownTypeException (row); 52 } 53 54 public boolean isReadOnly (Object row, String columnID) throws 55 UnknownTypeException { 56 if (row instanceof Session) { 57 if (columnID.equals (SESSION_STATE_COLUMN_ID)) 58 return true; 59 else 60 if (columnID.equals (SESSION_LANGUAGE_COLUMN_ID)) 61 return false; 62 else 63 if (columnID.equals (SESSION_HOST_NAME_COLUMN_ID)) 64 return true; 65 } 66 throw new UnknownTypeException (row); 67 } 68 69 public void setValueAt (Object row, String columnID, Object value) 70 throws UnknownTypeException { 71 throw new UnknownTypeException (row); 72 } 73 74 79 public void addModelListener (ModelListener l) { 80 listeners.add (l); 81 } 82 83 88 public void removeModelListener (ModelListener l) { 89 listeners.remove (l); 90 } 91 92 } 93 | Popular Tags |