private void actionText(){
  String text=m_text.getText();
  if (text != null && text.length() > 0 && text.equals(m_lastDisplay)) {
    log.finest("Nothing entered [SKIP]");
    return;
  }
  if (text == null || text.length() == 0 || text.equals("%")) {
    actionButton(text);
    return;
  }
  text=text.toUpperCase();
  log.config(m_columnName + " - " + text);
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  String rSQL=getDirectAccessSQL(text);
  if (rSQL == null || rSQL.length() == 0) {
    log.severe("Search enabled on field " + m_columnName + ". Associated table has no standard/identifier columns.");
    return;
  }
  String finalSQL=Msg.parseTranslation(Env.getCtx(),rSQL);
  int id=-3;
  try {
    pstmt=DB.prepareStatement(finalSQL,null);
    rs=pstmt.executeQuery();
    if (rs.next()) {
      id=rs.getInt(1);
      if (rs.next())       id=-1;
    }
  }
 catch (  Exception e) {
    log.log(Level.SEVERE,finalSQL,e);
    id=-2;
  }
 finally {
    DB.close(rs,pstmt);
    rs=null;
    pstmt=null;
  }
  if (id == -3) {
    rSQL=getDirectAccessSQL(Info.getSQLText(text));
    if (rSQL == null || rSQL.length() == 0) {
      log.severe("Search enabled on field " + m_columnName + ". Associated table has no standard/identifier columns.");
      return;
    }
    finalSQL=Msg.parseTranslation(Env.getCtx(),rSQL);
    try {
      pstmt=DB.prepareStatement(finalSQL,null);
      rs=pstmt.executeQuery();
      if (rs.next()) {
        id=rs.getInt(1);
        if (rs.next())         id=-1;
      }
    }
 catch (    Exception e) {
      log.log(Level.SEVERE,finalSQL,e);
      id=-2;
    }
 finally {
      DB.close(rs,pstmt);
      rs=null;
      pstmt=null;
    }
  }
  if (id <= 0) {
    if (id == -3)     log.fine(m_columnName + " - Not Found - " + finalSQL);
 else     log.fine(m_columnName + " - Not Unique - " + finalSQL);
    m_value=null;
    actionButton(m_text.getText());
    return;
  }
  log.fine(m_columnName + " - Unique ID=" + id);
  m_value=null;
  resetTabInfo();
  actionCombo(new Integer(id));
  if (id <= 0) {
    m_text.requestFocus();
  }
}

private void actionText ( ) { String text = m_text . getText ( ) ; if ( text != null && text . length ( ) > 0 && text . equals ( m_lastDisplay ) ) { log . finest ( "Nothing entered [SKIP]" ) ; return ; } if ( text == null || text . length ( ) == 0 || text . equals ( "%" ) ) { actionButton ( text ) ; return ; } text = text . toUpperCase ( ) ; log . config ( m_columnName + " - " + text ) ; PreparedStatement pstmt = null ; ResultSet rs = null ; String rSQL = getDirectAccessSQL ( text ) ; if ( rSQL == null || rSQL . length ( ) == 0 ) { log . severe ( "Search enabled on field " + m_columnName + ". Associated table has no standard/identifier columns." ) ; return ; } String finalSQL = Msg . parseTranslation ( Env . getCtx ( ) , rSQL ) ; int id = - 3 ; try { pstmt = DB . prepareStatement ( finalSQL , null ) ; rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { id = rs . getInt ( 1 ) ; if ( rs . next ( ) ) id = - 1 ; } } catch ( Exception e ) { log . log ( Level . SEVERE , finalSQL , e ) ; id = - 2 ; } finally { DB . close ( rs , pstmt ) ; rs = null ; pstmt = null ; } if ( id == - 3 ) { rSQL = getDirectAccessSQL ( Info . getSQLText ( text ) ) ; if ( rSQL == null || rSQL . length ( ) == 0 ) { log . severe ( "Search enabled on field " + m_columnName + ". Associated table has no standard/identifier columns." ) ; return ; } finalSQL = Msg . parseTranslation ( Env . getCtx ( ) , rSQL ) ; try { pstmt = DB . prepareStatement ( finalSQL , null ) ; rs = pstmt . executeQuery ( ) ; if ( rs . next ( ) ) { id = rs . getInt ( 1 ) ; if ( rs . next ( ) ) id = - 1 ; } } catch ( Exception e ) { log . log ( Level . SEVERE , finalSQL , e ) ; id = - 2 ; } finally { DB . close ( rs , pstmt ) ; rs = null ; pstmt = null ; } } if ( id <= 0 ) { if ( id == - 3 ) log . fine ( m_columnName + " - Not Found - " + finalSQL ) ; else log . fine ( m_columnName + " - Not Unique - " + finalSQL ) ; m_value = null ; actionButton ( m_text . getText ( ) ) ; return ; } log . fine ( m_columnName + " - Unique ID=" + id ) ; m_value = null ; resetTabInfo ( ) ; actionCombo ( new Integer ( id ) ) ; if ( id <= 0 ) { m_text . requestFocus ( ) ; } }
check , if data returns unique entry , otherwise involve info via button
