use of org.compiere.grid.ed.VString in project adempiere by adempiere.
the class FindValueEditor method getTableCellEditorComponent.
// getCellEditorValue
/**
* Get Editor
*
* @param table Table
* @param value Value
* @param isSelected cell is selected
* @param row row
* @param col column
* @return Editor component
*/
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int col) {
// log.config( "FindValueEditor.getTableCellEditorComponent", "r=" + row + ", c=" + col);
// Between - enables valueToColumn
m_between = false;
Object betweenValue = table.getModel().getValueAt(row, Find.INDEX_OPERATOR);
if (m_valueToColumn && betweenValue != null && betweenValue.equals(MQuery.OPERATORS[MQuery.BETWEEN_INDEX]))
m_between = true;
boolean enabled = !m_valueToColumn || (m_valueToColumn && m_between);
log.config("(" + value + ") - Enabled=" + enabled);
if (enabled) {
String columnName = null;
Object column = table.getModel().getValueAt(row, Find.INDEX_COLUMNNAME);
if (column != null)
columnName = ((ValueNamePair) column).getValue();
// Create Editor
GridField field = m_find.getTargetMField(columnName);
// log.fine( "Field=" + field.toStringX());
if (field.isKey())
m_editor = new VNumber(columnName, false, false, true, DisplayType.Integer, columnName);
else
m_editor = VEditorFactory.getEditor(field, true);
if (m_editor == null)
m_editor = new VString();
m_editor.setValue(value);
m_editor.setReadWrite(enabled);
m_editor.setBorder(null);
} else {
m_editor = null;
}
//
return (Component) m_editor;
}
Aggregations