/** * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, * java.lang.Object, boolean, boolean, int, int) */ public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof FrameSlotCombination) { FrameSlotCombination fsCombi = (FrameSlotCombination) value; String slotTypeName = fsCombi.getSlot().getDirectType().getName(); // System.out.println("slotName:"+slotTypeName); return getTemplateSlotPolicyBox(table, value, isSelected, hasFocus, row, column); } return this; }
public Component getTemplateSlotPolicyBox( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof FrameSlotCombination) { FrameSlotCombination fsCombi = (FrameSlotCombination) value; Slot aSlot = fsCombi.getSlot(); if (policyFrameworkModel.isPolicyTaggedSlot( aSlot)) { // slotTypeName.equals("PolicyTaggedSlot")){ Collection c = policyFrameworkModel.getAllPolicies(aSlot); int polCount = c.size(); int mPolCount = 0; int dPolCount = 0; String aType; for (Iterator it = c.iterator(); it.hasNext(); ) { if (((PolicyFrameworkModel.PolicyData) it.next()).policyType.equalsIgnoreCase("M")) { mPolCount++; } else { dPolCount++; } } // templateSlotPolicyCheckBox.setIcon(defaultIcon); String text = "<html><body><b><font color='red' >M=" + mPolCount + "</font> <font color='green'>D=" + dPolCount + "</font></b></body></html>"; // templateSlotPolicyCheckBox.setText(text); policyInfoLabel.setText(text); } else { policyInfoLabel.setIcon(noPolicyIcon); policyInfoLabel.setText(""); } } // return templateSlotPolicyCheckBox; return policyInfoLabel; }