package com.vci.client.uif.engine.client.tableArea.editable.editor; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JTextField; import javax.swing.event.ChangeEvent; import com.vci.client.uif.engine.client.controls.VCIJComboBoxModelValueObject; /** * 文本框、下列列表类型列的编辑器对象 * @author xiongchao * */ public class TextFieldAndComboBoxEditor extends BaseCellEditor { /** * */ private static final long serialVersionUID = 340849736463848404L; public TextFieldAndComboBoxEditor(JCheckBox checkBox) { super(checkBox); } public TextFieldAndComboBoxEditor(JComboBox comboBox) { super(comboBox); } public TextFieldAndComboBoxEditor(JTextField textField) { super(textField); } @Override public void editingStopped(ChangeEvent e) { if(!checkValueChanged()) return; //setCellValue(); resetSelectedCheckbox(); } /** * 当前编辑的值是否发生了变更 * @return */ @Override protected boolean checkValueChanged(){ Object newValueObj = getCellEditorValue(); if(newValueObj == null){ return false; } String newValue = newValueObj.toString(); if(newValueObj instanceof VCIJComboBoxModelValueObject){ newValue = ((VCIJComboBoxModelValueObject)newValueObj).getName(); } boolean changed = !tablePanel.getOldValue().equals(newValue); tablePanel.setChanged(changed); return changed; } }