List of usage examples for javax.swing JTextField getToolkit
public Toolkit getToolkit()
From source file:edu.ku.brc.specify.tasks.ExpressSearchTask.java
/** * Performs the express search and returns the results to the ExpressSearchResultsPaneIFace. * If the control is null then it will use the string. * * @param searchTextArg the Text Control that contains the search string (can be null) * @param searchTextStr the Text Control that contains the search string (can be null) * @param tables ExpressResultsTableInfo hash * @param esrPane the pane that the results will be set into * @return true if results were found, false if not results *//*from www . jav a 2 s . co m*/ public synchronized boolean doQuery(final JTextField searchTextArg, final String searchTextStr, final ExpressSearchResultsPaneIFace esrPane) { doingDebug = AppPreferences.getLocalPrefs().getBoolean("esdebug", false); searchWarningsResults = null; String searchTerm = (searchTextArg != null ? searchTerm = searchTextArg.getText() : searchTextStr); if (!ESTermParser.getInstance().parse(searchTerm, false)) { setUserInputToNotFound("BAD_SEARCH_TERMS", false); return false; } //boolean hasResults = true; if (StringUtils.isNotEmpty(searchTerm)) { SearchTableConfig context = SearchConfigService.getInstance().getSearchContext(); if (context == null) { SearchConfig config = SearchConfigService.getInstance().getSearchConfig(); if (config.getTables().size() > 0) { sqlHasResults = false; if (searchTextArg != null) { searchTextArg.setEnabled(false); } if (searchBtn != null) { searchBtn.setEnabled(false); } queryList.clear(); // Just in case queryCount = 0; queryCountDone = 0; int cnt = 0; for (SearchTableConfig table : config.getTables()) { if (!table.getTableInfo().isHidden()) { if (AppContextMgr.isSecurityOn()) { if (table.getTableInfo().getPermissions().canView()) { if (startSearchJPA(esrPane, table, searchTerm, ESTermParser.getInstance().getFields()) != null) { cnt++; } } else { log.debug("Skipping [" + table.getTableInfo().getTitle() + "]"); } } else { if (startSearchJPA(esrPane, table, searchTerm, ESTermParser.getInstance().getFields()) != null) { cnt++; } } } } if (cnt == 0) { setUserInputToNotFound("NO_FIELDS_TO_SEARCH", true); searchText.setEnabled(true); searchBtn.setEnabled(true); return false; } // Check to see if any queries got started. if (queryList.size() == 0) { completionUIHelper(null); } else { return true; } } else { searchTextArg.getToolkit().beep(); } } else { if (startSearchJPA(esrPane, context, searchTerm, ESTermParser.getInstance().getFields()) != null) { return true; } setUserInputToNotFound("NO_FIELDS_TO_SEARCH", true); return true; // if we return false then this error gets overwritten with a different error } } else { //System.err.println("SearchTableConfig service has not been loaded or is empty."); log.error("SearchTableConfig service has been loaded or is empty."); } return false; }