1 23 24 package org.objectweb.fractal.gui.dialog.view; 25 26 import org.objectweb.fractal.gui.Constants; 27 import org.objectweb.fractal.gui.model.Interface; 28 29 import java.awt.Color ; 30 31 import javax.swing.JTable ; 32 import javax.swing.table.DefaultTableCellRenderer ; 33 34 38 39 public class InterfaceTableCellRenderer extends DefaultTableCellRenderer { 40 41 public java.awt.Component getTableCellRendererComponent ( 42 final JTable table, 43 final Object value, 44 final boolean isSelected, 45 final boolean hasFocus, 46 final int row, 47 final int column) 48 { 49 super.getTableCellRendererComponent( 50 table, value, isSelected, hasFocus, row, column); 51 Interface itf = (Interface)table.getModel().getValueAt(row, -1); 52 long status = itf.getStatus(); 53 if (itf.getMasterCollectionInterface() != null) { 54 setForeground(Color.gray); 55 } else if ((status & Interface.MANDATORY_INTERFACE_NOT_BOUND) != 0) { 56 setForeground(Constants.ERROR_COLOR); 57 } else if ((status & (Interface.NAME_MISSING)) != 0 && column == 0) { 58 setForeground(Constants.ERROR_COLOR); 59 setText("<empty>"); 60 } else if ((status & (Interface.NAME_ALREADY_USED)) != 0 && column == 0) { 61 setForeground(Constants.ERROR_COLOR); 62 } else if ((status & (Interface.SIGNATURE_MISSING)) != 0 && column == 1) { 63 setForeground(Constants.ERROR_COLOR); 64 setText("<empty>"); 65 } else if ((status & (Interface.SIGNATURE_CLASS_NOT_FOUND)) != 0 66 && column == 1) 67 { 68 setForeground(Constants.ERROR_COLOR); 69 } else { 70 setForeground(Color.black); 71 } 72 return this; 73 } 74 } 75 | Popular Tags |