Lines 228-233
Link Here
|
228 |
transient private int allowedDragActions = DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE; |
228 |
transient private int allowedDragActions = DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE; |
229 |
transient private int allowedDropActions = DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE; |
229 |
transient private int allowedDropActions = DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_REFERENCE; |
230 |
|
230 |
|
|
|
231 |
/** Quick Search support */ |
232 |
transient private boolean allowedQuickSearch = true; |
233 |
transient private KeyAdapter quickSearchKeyAdapter = null; |
234 |
|
231 |
/** |
235 |
/** |
232 |
* Whether the quick search uses prefix or substring. |
236 |
* Whether the quick search uses prefix or substring. |
233 |
* Defaults to false meaning prefix is used. |
237 |
* Defaults to false meaning prefix is used. |
Lines 452-457
Link Here
|
452 |
} |
456 |
} |
453 |
|
457 |
|
454 |
/** |
458 |
/** |
|
|
459 |
* Get whether the quick search feature enable or not. |
460 |
* Defaults enable (false). |
461 |
* @since 6.33 |
462 |
* @return true if quick search feature enabled, false |
463 |
* otherwise. |
464 |
*/ |
465 |
public boolean isQuickSearchAllowed() { |
466 |
return allowedQuickSearch; |
467 |
} |
468 |
|
469 |
/** |
470 |
* Set whether the quick search feature enable or not. |
471 |
* Defaults enable (false). |
472 |
* @since 6.33 |
473 |
* @param allowedQuickSearch <code>true</code> if quick search need to enable |
474 |
*/ |
475 |
public void setQuickSearchAllowed(boolean allowedQuickSearch) { |
476 |
this.allowedQuickSearch = allowedQuickSearch; |
477 |
|
478 |
if(quickSearchKeyAdapter !=null && tree !=null ){ |
479 |
if(allowedQuickSearch){ |
480 |
tree.addKeyListener(quickSearchKeyAdapter); |
481 |
}else{ |
482 |
removeSearchField(); |
483 |
tree.removeKeyListener(quickSearchKeyAdapter); |
484 |
} |
485 |
} |
486 |
} |
487 |
|
488 |
|
489 |
/** |
455 |
* Set whether the quick search feature uses substring or prefix |
490 |
* Set whether the quick search feature uses substring or prefix |
456 |
* matching for the typed characters. Defaults to prefix (false). |
491 |
* matching for the typed characters. Defaults to prefix (false). |
457 |
* @since 6.11 |
492 |
* @since 6.11 |
Lines 967-973
Link Here
|
967 |
} |
1002 |
} |
968 |
}); |
1003 |
}); |
969 |
} |
1004 |
} |
970 |
|
1005 |
|
|
|
1006 |
|
1007 |
|
971 |
/** Synchronize the selected nodes from the manager of this Explorer. |
1008 |
/** Synchronize the selected nodes from the manager of this Explorer. |
972 |
* The default implementation does nothing. |
1009 |
* The default implementation does nothing. |
973 |
*/ |
1010 |
*/ |
Lines 1629-1635
Link Here
|
1629 |
} |
1666 |
} |
1630 |
|
1667 |
|
1631 |
TreePath[] origSelectionPaths = null; |
1668 |
TreePath[] origSelectionPaths = null; |
1632 |
private JPanel searchpanel = null; |
1669 |
JPanel searchpanel = null; |
1633 |
// searchTextField manages focus because it handles VK_TAB key |
1670 |
// searchTextField manages focus because it handles VK_TAB key |
1634 |
private JTextField searchTextField = new JTextField() { |
1671 |
private JTextField searchTextField = new JTextField() { |
1635 |
@Override |
1672 |
@Override |
Lines 1968-1975
Link Here
|
1968 |
removeKeyListener(keyListeners[i]); |
2005 |
removeKeyListener(keyListeners[i]); |
1969 |
} |
2006 |
} |
1970 |
|
2007 |
|
1971 |
// Add new key listeners |
2008 |
// create new key listeners |
1972 |
addKeyListener( |
2009 |
quickSearchKeyAdapter = ( |
1973 |
new KeyAdapter() { |
2010 |
new KeyAdapter() { |
1974 |
@Override |
2011 |
@Override |
1975 |
public void keyTyped(KeyEvent e) { |
2012 |
public void keyTyped(KeyEvent e) { |
Lines 2001-2007
Link Here
|
2001 |
} |
2038 |
} |
2002 |
} |
2039 |
} |
2003 |
); |
2040 |
); |
2004 |
|
2041 |
if(isQuickSearchAllowed()){ |
|
|
2042 |
addKeyListener(quickSearchKeyAdapter); |
2043 |
} |
2005 |
// Create a the "multi-event" listener for the text field. Instead of |
2044 |
// Create a the "multi-event" listener for the text field. Instead of |
2006 |
// adding separate instances of each needed listener, we're using a |
2045 |
// adding separate instances of each needed listener, we're using a |
2007 |
// class which implements them all. This approach is used in order |
2046 |
// class which implements them all. This approach is used in order |
Lines 2011-2017
Link Here
|
2011 |
searchTextField.addFocusListener(searchFieldListener); |
2050 |
searchTextField.addFocusListener(searchFieldListener); |
2012 |
searchTextField.getDocument().addDocumentListener(searchFieldListener); |
2051 |
searchTextField.getDocument().addDocumentListener(searchFieldListener); |
2013 |
} |
2052 |
} |
2014 |
|
2053 |
|
2015 |
private List<TreePath> doSearch(String prefix) { |
2054 |
private List<TreePath> doSearch(String prefix) { |
2016 |
List<TreePath> results = new ArrayList<TreePath>(); |
2055 |
List<TreePath> results = new ArrayList<TreePath>(); |
2017 |
|
2056 |
|