package com.thedeanda.ajaxproxy.ui;

import java.awt.Component;

import javax.swing.AbstractCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

import com.thedeanda.ajaxproxy.MergeMode;

public class MergeModeCellEditor extends AbstractCellEditor implements
		TableCellEditor, TableCellRenderer {
	private static final long serialVersionUID = 1L;
	private JComboBox comp;
	private DefaultComboBoxModel model;

	public MergeModeCellEditor() {
		model = new DefaultComboBoxModel();
		model.addElement("");
		for (MergeMode mm : MergeMode.values()) {
			model.addElement(mm);
		}

		comp = new JComboBox(model);

	}

	@Override
	public Object getCellEditorValue() {

		return model.getSelectedItem();
	}

	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean selected, int rowIndex, int colIndex) {
		// TODO Auto-generated method stub
		return comp;
	}

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean selected, boolean focus, int rowIndex, int colIndex) {

		return comp;
	}

}

@@ -503,16 +503,24 @@
 ComboBox
+%3CObject%3E
  comp;%0A%09
@@ -547,16 +547,24 @@
 BoxModel
+%3CObject%3E
  model;%0A
@@ -630,16 +630,24 @@
 BoxModel
+%3CObject%3E
 ();%0A%09%09mo

remove type warnings