private void textChanged () { if (command.isFocusOwner()) { displayer.maybeEvaluate(command.getText()); } }
/** implementation of ActionListener, called by timer, * actually runs search */ @Override public void actionPerformed(ActionEvent e) { updateTimer.stop(); // search only if we are not cancelled already if (comboBar.getCommand().isFocusOwner()) { evaluatorRP.post(new Runnable() { @Override public void run() { if (evalTask != null) { evalTask.removeTaskListener(QuickSearchPopup.this); } evalTask = CommandEvaluator.evaluate(searchedText, rModel); evalTask.addTaskListener(QuickSearchPopup.this); // start waiting on all providers execution RP.post(evalTask); } }); } }
@Override public void focusLost(FocusEvent e) { Component oppositeComponent = e.getOppositeComponent(); boolean focusOwner = textComponent.isFocusOwner(); if (!focusOwner && !(oppositeComponent != null && oppositeComponent.getParent() == suggestionPanel)) { hideSuggestions(); } }
/** * Sets the {@link FocusBehavior} on <code>textComponent</code> and * repaints the component to reflect the changes, if it is the focus owner. * * @param focusBehavior * @param textComponent */ public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) { textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior); if (textComponent.isFocusOwner()) { textComponent.repaint(); } }
/** * Sets the {@link FocusBehavior} on <code>textComponent</code> and * repaints the component to reflect the changes, if it is the focus owner. * * @param focusBehavior * @param textComponent */ public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) { textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior); if (textComponent.isFocusOwner()) { textComponent.repaint(); } }
/** * Sets the {@link FocusBehavior} on <code>textComponent</code> and * repaints the component to reflect the changes, if it is the focus owner. * * @param focusBehavior * @param textComponent */ public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) { textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior); if (textComponent.isFocusOwner()) { textComponent.repaint(); } }
/** * Sets the {@link FocusBehavior} on <code>textComponent</code> and * repaints the component to reflect the changes, if it is the focus owner. * * @param focusBehavior * @param textComponent */ public static void setFocusBehavior(FocusBehavior focusBehavior, JTextComponent textComponent) { textComponent.putClientProperty(FOCUS_BEHAVIOR, focusBehavior); if (textComponent.isFocusOwner()) { textComponent.repaint(); } }
/** ActionListener implementation, reaction to popup menu item invocation */ public void actionPerformed(ActionEvent e) { JRadioButtonMenuItem item = (JRadioButtonMenuItem)e.getSource(); CommandEvaluator.setEvalCat((Category) item.getClientProperty(CATEGORY)); CommandEvaluator.setCatTemporary(false); // refresh hint setShowHint(!command.isFocusOwner()); }
private void updateEditor(final ComboBoxEditor cbe, final @Nullable Object item) { if (lock()) return; try { cbe.setItem(item); if (!(item instanceof String)) return; final JComboBox<E> cb = getComboBox(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; // Compensate for an issue with some look and feels // which select the entire tc if an item is changed. // This is inconvenient for auto completion because the // next typed character would replace the entire tc... final Caret caret = tc.getCaret(); caret.setDot(((String) item).length()); } finally { unlock(); } }
private void updateEditor(final ComboBoxEditor cbe, final @CheckForNull Object item) { if (lock()) return; try { cbe.setItem(item); if (!(item instanceof String)) return; final JComboBox<E> cb = getComboBox(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; // Compensate for an issue with some look and feels // which select the entire tc if an item is changed. // This is inconvenient for auto completion because the // next typed character would replace the entire tc... final Caret caret = tc.getCaret(); caret.setDot(((String) item).length()); } finally { unlock(); } }
private void updateEditor(final ComboBoxEditor cbe, final @CheckForNull Object item) { if (lock()) return; try { cbe.setItem(item); if (!(item instanceof String)) return; final JComboBox<E> cb = getComboBox(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; // Compensate for an issue with some look and feels // which select the entire tc if an item is changed. // This is inconvenient for auto completion because the // next typed character would replace the entire tc... final Caret caret = tc.getCaret(); caret.setDot(((String) item).length()); } finally { unlock(); } }
private void documentUpdated() { if (lock()) return; try { final JComboBox<E> cb = getComboBox(); final ComboBoxEditor cbe = cb.getEditor(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; //cb.setPopupVisible(update(tc.getText())); // doesn't work: adjusts popup size! cb.setPopupVisible(false); if (update(tc.getText())) cb.setPopupVisible(true); } finally { unlock(); } }
private void documentUpdated() { if (lock()) return; try { final JComboBox<E> cb = getComboBox(); final ComboBoxEditor cbe = cb.getEditor(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; //cb.setPopupVisible(update(tc.getText())); // doesn't work: adjusts popup size! cb.setPopupVisible(false); if (update(tc.getText())) cb.setPopupVisible(true); } finally { unlock(); } }
private void documentUpdated() { if (lock()) return; try { final JComboBox<E> cb = getComboBox(); final ComboBoxEditor cbe = cb.getEditor(); final JTextComponent tc = (JTextComponent) cbe.getEditorComponent(); assert cb.isShowing() || !tc.isFocusOwner(); if (!tc.isFocusOwner() /* || !cb.isShowing() */) return; //cb.setPopupVisible(update(tc.getText())); // doesn't work: adjusts popup size! cb.setPopupVisible(false); if (update(tc.getText())) cb.setPopupVisible(true); } finally { unlock(); } }
if ((modelSize > 0 || statusVisible) && comboBar.getCommand().isFocusOwner()) { if (modelSize > 0 && !isVisible()) { jList1.setSelectedIndex(0);
public void performAction() { if (comboBar == null) { comboBar = isAqua ? new AquaQuickSearchComboBar((KeyStroke) this.getValue(Action.ACCELERATOR_KEY)) : new QuickSearchComboBar((KeyStroke) this.getValue(Action.ACCELERATOR_KEY)); } comboBar.displayer.explicitlyInvoked(); if (comboBar.getCommand().isFocusOwner()) { // repetitive action invocation, reset search to all categories comboBar.evaluateCategory(null, false); } else { comboBar.requestFocus(); } }
promptComponent = createPromptComponent(); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIDE_PROMPT) { promptComponent.setText(null); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) { promptComponent.setForeground(txt.getSelectedTextColor());
promptComponent = createPromptComponent(); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIDE_PROMPT) { promptComponent.setText(null); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) { promptComponent.setForeground(txt.getSelectedTextColor());
promptComponent = createPromptComponent(); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIDE_PROMPT) { promptComponent.setText(null); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) { promptComponent.setForeground(txt.getSelectedTextColor());
promptComponent = createPromptComponent(); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIDE_PROMPT) { promptComponent.setText(null); if (txt.isFocusOwner() && PromptSupport.getFocusBehavior(txt) == FocusBehavior.HIGHLIGHT_PROMPT) { promptComponent.setForeground(txt.getSelectedTextColor());