1 14 package org.wings.table; 15 16 import org.wings.SComponent; 17 import org.wings.SIcon; 18 import org.wings.SLabel; 19 import org.wings.STable; 20 21 25 public class SDefaultTableCellRenderer 26 extends SLabel 27 implements STableCellRenderer 28 { 29 SIcon editIcon; 30 31 public SIcon getEditIcon() { 32 return editIcon; 33 } 34 35 public void setEditIcon(SIcon editIcon) { 36 this.editIcon = editIcon; 37 } 38 39 public SComponent getTableCellRendererComponent(STable table, 40 Object value, 41 boolean selected, 42 int row, 43 int col) { 44 setText(null); 45 setIcon(null); 46 47 if (value == null) { 48 if (editIcon != null && table.isCellEditable(row, col)) 49 setIcon(editIcon); 50 } 51 else if (value instanceof SIcon) 52 setIcon((SIcon)value); 53 else if (value instanceof SComponent) 54 return (SComponent)value; 55 else 56 setText(value.toString()); 57 58 return this; 59 } 60 } 61 | Popular Tags |