Search in sources :

Example 6 with VString

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;
}
Also used : VString(org.compiere.grid.ed.VString) EventObject(java.util.EventObject) VNumber(org.compiere.grid.ed.VNumber) VString(org.compiere.grid.ed.VString) ValueNamePair(org.compiere.util.ValueNamePair) GridField(org.compiere.model.GridField) Component(java.awt.Component)

Aggregations

VString (org.compiere.grid.ed.VString)6 Component (java.awt.Component)5 VNumber (org.compiere.grid.ed.VNumber)4 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)3 VComboBox (org.compiere.grid.ed.VComboBox)3 Timestamp (java.sql.Timestamp)2 GridField (org.compiere.model.GridField)2 Insets (java.awt.Insets)1 BigDecimal (java.math.BigDecimal)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 EventObject (java.util.EventObject)1 HashSet (java.util.HashSet)1 VChart (org.compiere.grid.ed.VChart)1 VEditor (org.compiere.grid.ed.VEditor)1 VLine (org.compiere.grid.ed.VLine)1 VLookup (org.compiere.grid.ed.VLookup)1 MAttributeSet (org.compiere.model.MAttributeSet)1 MLookup (org.compiere.model.MLookup)1 CButton (org.compiere.swing.CButton)1