1 package com.opensymphony.workflow.designer.model; 2 3 import com.opensymphony.workflow.loader.PermissionDescriptor; 4 import com.opensymphony.workflow.designer.ResourceManager; 5 6 11 public class PermissionsTableModel extends ListTableModel 12 { 13 private String [] header = new String []{ResourceManager.getString("id"), ResourceManager.getString("name")}; 14 15 public PermissionsTableModel() 16 { 17 } 18 19 public boolean isCellEditable(int rowIndex, int columnIndex) 20 { 21 return true; 22 } 23 24 public void setValueAt(Object aValue, int rowIndex, int columnIndex) 25 { 26 PermissionDescriptor permission = (PermissionDescriptor)list.get(rowIndex); 27 switch(columnIndex) 28 { 29 case 0: 30 if(aValue!=null) 31 permission.setId(((Integer )aValue).intValue()); 32 break; 33 case 1: 34 permission.setName(aValue!=null ? aValue.toString() : null); 35 } 36 } 37 38 public int getColumnCount() 39 { 40 return header.length; 41 } 42 43 public String getColumnName(int column) 44 { 45 return header[column]; 46 } 47 48 public Class getColumnClass(int columnIndex) 49 { 50 switch(columnIndex) 51 { 52 case 0: 53 return Integer .class; 54 case 1: 55 return String .class; 56 default: 57 return String .class; 58 } 59 } 60 61 public Object getValueAt(int rowIndex, int columnIndex) 62 { 63 PermissionDescriptor permission = (PermissionDescriptor)list.get(rowIndex); 64 switch(columnIndex) 65 { 66 case 0: 67 return new Integer (permission.getId()); 68 case 1: 69 return permission.getName(); 70 default: 71 return ""; 72 } 73 } 74 } 75 | Popular Tags |