/* (non-Javadoc)
   * @see javax.swing.JTable#isCellEditable(int, int)
   */
  public boolean isCellEditable(int row, int column) {
    // names are not editable
    if (column == 0) {
      return false;
    }

    PropertySheetTableModel.Item item = getSheetModel().getPropertySheetElement(row);
    return item.isProperty() && item.getProperty().isEditable();
  }
  /**
   * Overriden
   * <li>to prevent the cell focus rect to be painted
   * <li>to disable ({@link Component#setEnabled(boolean)} the renderer if the Property is not
   *     editable
   */
  public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
    Object value = getValueAt(row, column);
    boolean isSelected = isCellSelected(row, column);
    Component component =
        renderer.getTableCellRendererComponent(this, value, isSelected, false, row, column);

    PropertySheetTableModel.Item item = getSheetModel().getPropertySheetElement(row);
    if (item.isProperty()) {
      component.setEnabled(item.getProperty().isEditable());
    }
    return component;
  }
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
      PropertySheetTableModel.Item item = (Item) value;

      // shortcut if we are painting the category column
      if (column == PropertySheetTableModel.VALUE_COLUMN && !item.isProperty()) {
        setBackground(getBackground(item.isProperty(), isSelected));
        setText("");
        return this;
      }

      setBorder(border);

      // configure the border
      border.configure((PropertySheetTable) table, item);

      setBackground(getBackground(item.isProperty(), isSelected));
      setForeground(getForeground(item.isProperty(), isSelected));

      setEnabled(isSelected || !item.isProperty() ? true : item.getProperty().isEditable());
      setText(item.getName());

      return this;
    }
  /* (non-Javadoc)
   * @see javax.swing.JTable#getCellRenderer(int, int)
   */
  public TableCellRenderer getCellRenderer(int row, int column) {
    PropertySheetTableModel.Item item = getSheetModel().getPropertySheetElement(row);

    switch (column) {
      case PropertySheetTableModel.NAME_COLUMN:
        // name column gets a custom renderer
        return nameRenderer;

      case PropertySheetTableModel.VALUE_COLUMN:
        {
          if (!item.isProperty()) return nameRenderer;

          // property value column gets the renderer from the factory
          Property property = item.getProperty();
          TableCellRenderer renderer = getRendererFactory().createTableCellRenderer(property);
          if (renderer == null) renderer = getCellRenderer(property.getType());
          return renderer;
        }
      default:
        // when will this happen, given the above?
        return super.getCellRenderer(row, column);
    }
  }