static AutoCompleteDocument createAutoCompleteDocument( AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter, Document delegate) { if (delegate instanceof StyledDocument) { return new AutoCompleteStyledDocument(adaptor, strictMatching, stringConverter, (StyledDocument) delegate); } return new AutoCompleteDocument(adaptor, strictMatching, stringConverter, delegate); }
private LookupResult lookupItem(String pattern, Comparator<String> comparator) { // iterate over all items and return first match for (int i = 0, n = adaptor.getItemCount(); i < n; i++) { Object currentItem = adaptor.getItem(i); LookupResult result = lookupOneItem(currentItem, pattern, comparator); if (result != null) return result; } return null; }
/** * Selects the given item using the AbstractAutoCompleteAdaptor. * @param itemAsString string representation of the item to be selected * @param item the item that is to be selected */ private void setSelectedItem(Object item, String itemAsString) { selecting = true; adaptor.setSelectedItem(item); adaptor.setSelectedItemAsString(itemAsString); selecting = false; }
/** * Marks/selects the entire text that is displayed inside the text component. */ public void markEntireText() { markText(0); }
/** * Implementation side effect - do not invoke. * @param actionEvent - */ // ActionListener (listening to comboBox) public void actionPerformed(ActionEvent actionEvent) { markEntireText(); }
/** * {@inheritDoc} */ @Override public void removeDocumentListener(DocumentListener listener) { handler.removeDocumentListener(listener); }
/** * {@inheritDoc} */ public void addUndoableEditListener(UndoableEditListener listener) { handler.addUndoableEditListener(listener); }
/** * {@inheritDoc} */ public void addDocumentListener(DocumentListener listener) { handler.addDocumentListener(listener); }
final int TEXT_FIELD_SIZE = 12; final JTextField jtf_key = new JTextField(TEXT_FIELD_SIZE); if(!keys.isEmpty()) {AutoCompleteDecorator.decorate(jtf_key, keys, false);} final JTextField jtf_value = new JTextField(TEXT_FIELD_SIZE); jl_key.setDisplayedMnemonic('k');
private static AutoCompleteDocument createAutoCompleteDocument( AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter, Document delegate) { if (delegate instanceof StyledDocument) { return new AutoCompleteStyledDocument(adaptor, strictMatching, stringConverter, (StyledDocument) delegate); } return new AutoCompleteDocument(adaptor, strictMatching, stringConverter, delegate); }
private LookupResult lookupItem(String pattern, Comparator<String> comparator) { // iterate over all items and return first match for (int i = 0, n = adaptor.getItemCount(); i < n; i++) { Object currentItem = adaptor.getItem(i); LookupResult result = lookupOneItem(currentItem, pattern, comparator); if (result != null) return result; } return null; }
/** * Marks/selects the entire text that is displayed inside the text component. */ public void markEntireText() { markText(0); }
/** * Implementation side effect - do not invoke. * @param actionEvent - */ // ActionListener (listening to comboBox) @Override public void actionPerformed(ActionEvent actionEvent) { markEntireText(); }
/** * Enables automatic completion for the given JComboBox. The automatic * completion will be strict (only items from the combo box can be selected) * if the combo box is not editable. * @param comboBox a combo box * @see #decorate(JComboBox, ObjectToStringConverter) */ public static void decorate(JComboBox comboBox) { decorate(comboBox, null); }
static AutoCompleteDocument createAutoCompleteDocument( AbstractAutoCompleteAdaptor adaptor, boolean strictMatching, ObjectToStringConverter stringConverter, Document delegate) { if (delegate instanceof StyledDocument) { return new AutoCompleteStyledDocument(adaptor, strictMatching, stringConverter, (StyledDocument) delegate); } return new AutoCompleteDocument(adaptor, strictMatching, stringConverter, delegate); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param textComponent the text component that will be used for automatic * completion. * @param items contains the items that are used for autocompletion * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching) { decorate(textComponent, items, strictMatching, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given JList. The two components will be * synchronized. The automatic completion will always be strict. * @param list a <tt>JList</tt> containing the items for automatic completion * @param textComponent the text component that will be enabled for automatic * completion */ public static void decorate(JList list, JTextComponent textComponent) { decorate(list, textComponent, ObjectToStringConverter.DEFAULT_IMPLEMENTATION); }
/** * Enables automatic completion for the given JTextComponent based on the * items contained in the given <tt>List</tt>. * @param textComponent the text component that will be used for automatic * completion. * @param items contains the items that are used for autocompletion * @param strictMatching <tt>true</tt>, if only given items should be allowed to be entered */ public static void decorate(JTextComponent textComponent, List<?> items, boolean strictMatching) { decorate(textComponent, items, strictMatching, null); }
/** * Ajout l'auto-complétion sur une liste déroulante, en utilisant le * converteur donné pour afficher les données. * * @param combo la combo à décorer * @param convertor le converter utilisé pour afficher les données. */ public static void decorate(JComboBox combo, ObjectToStringConverter convertor) { org.jdesktop.swingx.autocomplete.AutoCompleteDecorator.decorate(combo, convertor); }