1 24 25 package org.objectweb.cjdbc.console.gui.model; 26 27 import javax.management.MBeanOperationInfo ; 28 import javax.management.MBeanParameterInfo ; 29 import javax.swing.table.AbstractTableModel ; 30 31 import org.objectweb.cjdbc.console.gui.constants.GuiConstants; 32 33 39 public class OperationModel extends AbstractTableModel 40 { 41 private MBeanOperationInfo [] info; 42 43 48 public OperationModel(MBeanOperationInfo [] info) 49 { 50 this.info = info; 51 } 52 53 56 public int getColumnCount() 57 { 58 return 2; 59 } 60 61 66 public MBeanOperationInfo [] getInfo() 67 { 68 return info; 69 } 70 71 74 public int getRowCount() 75 { 76 return info.length; 77 } 78 79 82 public boolean isCellEditable(int rowIndex, int columnIndex) 83 { 84 return false; 85 } 86 87 90 public Object getValueAt(int rowIndex, int columnIndex) 91 { 92 if ((rowIndex >= 0 && rowIndex < info.length) == false) 93 return null; 94 switch (columnIndex) 95 { 96 case 0 : 97 StringBuffer name = new StringBuffer (info[rowIndex].getName()); 98 MBeanParameterInfo [] param = info[rowIndex].getSignature(); 99 name.append("("); 100 for (int i = 0; i < param.length; i++) 101 { 102 if (i != 0) 103 name.append(","); 104 name.append(GuiConstants.getParameterType(param[i].getType())); 105 } 106 name.append(")"); 107 return name.toString(); 108 case 1 : 109 return GuiConstants.getParameterType(info[rowIndex].getReturnType()); 110 default : 111 return null; 112 } 113 } 114 115 118 public String getColumnName(int column) 119 { 120 switch (column) 121 { 122 case 0 : 123 return "Name"; 124 case 1 : 125 return "Return"; 126 default : 127 return null; 128 } 129 } 130 } | Popular Tags |