/** * Remove all recent searches. */ public void removeAll() { recentSearches.clear(); save(); fireChangeEvent(); }
/** * Remove all recent searches. */ public void removeAll() { recentSearches.clear(); save(); fireChangeEvent(); }
/** * Remove all recent searches. */ public void removeAll() { recentSearches.clear(); save(); fireChangeEvent(); }
/** * Remove all recent searches. */ public void removeAll() { recentSearches.clear(); save(); fireChangeEvent(); }
/** * Add a search string as the first element. If the search string is * <code>null</code> or empty nothing will be added. If the search string * already exists, the old element will be removed. The modified list will * automatically be persisted. * * If the number of elements exceeds the maximum number of entries, the last * entry will be removed. * * @see #getMaxRecents() * @param searchString * the search string to add */ public void put(String searchString) { if (searchString == null || searchString.trim().length() == 0) { return; } int lastIndex = recentSearches.indexOf(searchString); if (lastIndex != -1) { recentSearches.remove(lastIndex); } recentSearches.add(0, searchString); if (getLength() > getMaxRecents()) { recentSearches.remove(recentSearches.size() - 1); } save(); fireChangeEvent(); }
/** * Add a search string as the first element. If the search string is * <code>null</code> or empty nothing will be added. If the search string * already exists, the old element will be removed. The modified list will * automatically be persisted. * * If the number of elements exceeds the maximum number of entries, the last * entry will be removed. * * @see #getMaxRecents() * @param searchString * the search string to add */ public void put(String searchString) { if (searchString == null || searchString.trim().length() == 0) { return; } int lastIndex = recentSearches.indexOf(searchString); if (lastIndex != -1) { recentSearches.remove(lastIndex); } recentSearches.add(0, searchString); if (getLength() > getMaxRecents()) { recentSearches.remove(recentSearches.size() - 1); } save(); fireChangeEvent(); }
/** * Add a search string as the first element. If the search string is * <code>null</code> or empty nothing will be added. If the search string * already exists, the old element will be removed. The modified list will * automatically be persisted. * * If the number of elements exceeds the maximum number of entries, the last * entry will be removed. * * @see #getMaxRecents() * @param searchString * the search string to add */ public void put(String searchString) { if (searchString == null || searchString.trim().length() == 0) { return; } int lastIndex = recentSearches.indexOf(searchString); if (lastIndex != -1) { recentSearches.remove(lastIndex); } recentSearches.add(0, searchString); if (getLength() > getMaxRecents()) { recentSearches.remove(recentSearches.size() - 1); } save(); fireChangeEvent(); }
/** * Add a search string as the first element. If the search string is * <code>null</code> or empty nothing will be added. If the search string * already exists, the old element will be removed. The modified list will * automatically be persisted. * * If the number of elements exceeds the maximum number of entries, the last * entry will be removed. * * @see #getMaxRecents() * @param searchString * the search string to add */ public void put(String searchString) { if (searchString == null || searchString.trim().length() == 0) { return; } int lastIndex = recentSearches.indexOf(searchString); if (lastIndex != -1) { recentSearches.remove(lastIndex); } recentSearches.add(0, searchString); if (getLength() > getMaxRecents()) { recentSearches.remove(recentSearches.size() - 1); } save(); fireChangeEvent(); }