org.openstreetmap.josm.actions.search
Class SearchAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by org.openstreetmap.josm.actions.JosmAction
          extended by org.openstreetmap.josm.actions.search.SearchAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, AdaptableAction, ParameterizedAction, Destroyable

public class SearchAction
extends JosmAction
implements ParameterizedAction

See Also:
Serialized Form

Nested Class Summary
private static class SearchAction.DescriptionTextBuilder
           
private static class SearchAction.SearchKeywordRow
           
static class SearchAction.SearchMode
           
static class SearchAction.SearchSetting
           
 
Field Summary
static int DEFAULT_SEARCH_HISTORY_SIZE
           
private static SearchAction.SearchSetting lastSearch
           
private static java.lang.String SEARCH_EXPRESSION
           
private static java.util.LinkedList<SearchAction.SearchSetting> searchHistory
           
 
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
SearchAction()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void actionPerformed(java.awt.event.ActionEvent e, java.util.Map<java.lang.String,java.lang.Object> parameters)
           
private static void buildHints(javax.swing.JPanel right)
           
private static void buildHintsNew(javax.swing.JPanel right, HistoryComboBox hcbSearchString)
           
static java.lang.String escapeStringForSearch(java.lang.String s)
           
 java.util.List<ActionParameter<?>> getActionParameters()
           
static java.util.List<java.lang.String> getSearchExpressionHistory()
           
static java.util.Collection<SearchAction.SearchSetting> getSearchHistory()
           
static int getSelection(SearchAction.SearchSetting s, java.util.Collection<OsmPrimitive> sel, Predicate<OsmPrimitive> p)
           
static void getSelection(SearchAction.SearchSetting s, java.util.Collection<OsmPrimitive> all, Property<OsmPrimitive,java.lang.Boolean> p)
          Version of getSelection that is customized for filter, but should also work in other context.
static void saveToHistory(SearchAction.SearchSetting s)
           
static void search()
          Launches the dialog for specifying search criteria and runs a search
static void search(SearchAction.SearchSetting s)
           
static void search(java.lang.String search, SearchAction.SearchMode mode)
           
static void searchWithHistory(SearchAction.SearchSetting s)
          Adds the search specified by the settings in s to the search history and performs the search.
static void searchWithoutHistory(SearchAction.SearchSetting s)
           
static SearchAction.SearchSetting showSearchDialog(SearchAction.SearchSetting initialValues)
           
protected  void updateEnabledState()
          Refreshes the enabled state
 
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.Action
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 

Field Detail

DEFAULT_SEARCH_HISTORY_SIZE

public static final int DEFAULT_SEARCH_HISTORY_SIZE
See Also:
Constant Field Values

SEARCH_EXPRESSION

private static final java.lang.String SEARCH_EXPRESSION
See Also:
Constant Field Values

searchHistory

private static java.util.LinkedList<SearchAction.SearchSetting> searchHistory

lastSearch

private static SearchAction.SearchSetting lastSearch
Constructor Detail

SearchAction

public SearchAction()
Method Detail

getSearchHistory

public static java.util.Collection<SearchAction.SearchSetting> getSearchHistory()

saveToHistory

public static void saveToHistory(SearchAction.SearchSetting s)

getSearchExpressionHistory

public static java.util.List<java.lang.String> getSearchExpressionHistory()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e,
                            java.util.Map<java.lang.String,java.lang.Object> parameters)
Specified by:
actionPerformed in interface ParameterizedAction

showSearchDialog

public static SearchAction.SearchSetting showSearchDialog(SearchAction.SearchSetting initialValues)

buildHints

private static void buildHints(javax.swing.JPanel right)

buildHintsNew

private static void buildHintsNew(javax.swing.JPanel right,
                                  HistoryComboBox hcbSearchString)

search

public static void search()
Launches the dialog for specifying search criteria and runs a search


searchWithHistory

public static void searchWithHistory(SearchAction.SearchSetting s)
Adds the search specified by the settings in s to the search history and performs the search.

Parameters:
s -

searchWithoutHistory

public static void searchWithoutHistory(SearchAction.SearchSetting s)

getSelection

public static int getSelection(SearchAction.SearchSetting s,
                               java.util.Collection<OsmPrimitive> sel,
                               Predicate<OsmPrimitive> p)

getSelection

public static void getSelection(SearchAction.SearchSetting s,
                                java.util.Collection<OsmPrimitive> all,
                                Property<OsmPrimitive,java.lang.Boolean> p)
Version of getSelection that is customized for filter, but should also work in other context.

Parameters:
s - the search settings
all - the collection of all the primitives that should be considered
p - the property that should be set/unset if something is found

search

public static void search(java.lang.String search,
                          SearchAction.SearchMode mode)

search

public static void search(SearchAction.SearchSetting s)

updateEnabledState

protected void updateEnabledState()
Refreshes the enabled state

Overrides:
updateEnabledState in class JosmAction
See Also:
JosmAction.updateEnabledState(Collection), JosmAction.initEnabledState()

getActionParameters

public java.util.List<ActionParameter<?>> getActionParameters()
Specified by:
getActionParameters in interface ParameterizedAction

escapeStringForSearch

public static java.lang.String escapeStringForSearch(java.lang.String s)


JOSM