This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 215833
Collapse All | Expand All

(-)a/openide.awt/apichanges.xml (+14 lines)
Lines 50-55 Link Here
50
<apidef name="awt">AWT API</apidef>
50
<apidef name="awt">AWT API</apidef>
51
</apidefs>
51
</apidefs>
52
<changes>
52
<changes>
53
    <change id="QuickSearch.alwaysShown">
54
      <api name="awt"/>
55
      <summary>QuickSearch allows to customize of whether the quick search field should always be shown, or not.</summary>
56
      <version major="7" minor="49"/>
57
      <date day="1" month="8" year="2012"/>
58
      <author login="theofanis"/>
59
      <compatibility addition="yes" binary="compatible" source="compatible" deprecation="no" semantic="compatible" modification="no" deletion="no"/>
60
      <description>
61
          QuickSearch.isAlwaysShown() and QuickSearch.setAlwaysShown(boolean) methods are added.
62
          They can be used to change the default behavior of not showing the quick search field until something is typed.
63
      </description>
64
      <class package="org.openide.awt" name="QuickSearch"/>
65
        <issue number="215833"/>
66
    </change>
53
    <change id="CheckForUpdatesProvider">
67
    <change id="CheckForUpdatesProvider">
54
        <api name="awt"/>
68
        <api name="awt"/>
55
        <summary>Support for Check for Updates feature</summary>
69
        <summary>Support for Check for Updates feature</summary>
(-)a/openide.awt/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.openide.awt
2
OpenIDE-Module: org.openide.awt
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/awt/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 7.47
5
OpenIDE-Module-Specification-Version: 7.48
6
6
(-)a/openide.awt/src/org/openide/awt/QuickSearch.java (-2 / +36 lines)
Lines 84-89 Link Here
84
    private final RequestProcessor rp;
84
    private final RequestProcessor rp;
85
    private static enum QS_FIRE { UPDATE, NEXT, MAX }
85
    private static enum QS_FIRE { UPDATE, NEXT, MAX }
86
    private AnimationTimer animationTimer;
86
    private AnimationTimer animationTimer;
87
    private boolean alwaysShown = false;
87
    
88
    
88
    private QuickSearch(JComponent component, Object constraints,
89
    private QuickSearch(JComponent component, Object constraints,
89
                        Callback callback, boolean asynchronous, JMenu popupMenu) {
90
                        Callback callback, boolean asynchronous, JMenu popupMenu) {
Lines 200-205 Link Here
200
        setEnabled(false);
201
        setEnabled(false);
201
        component.putClientProperty(CLIENT_PROPERTY_KEY, null);
202
        component.putClientProperty(CLIENT_PROPERTY_KEY, null);
202
    }
203
    }
204
205
    /**
206
     * Test whether the quick search field is always shown. 
207
     * This is <code>false</code> by default.
208
     * @return <code>true</code> when the search field is always shown,
209
     *                           <code>false</code> otherwise.
210
     * @since 7.48
211
     */
212
    public boolean isAlwaysShown() {
213
        return alwaysShown;
214
    }
215
216
    /**
217
     * Set whether the quick search field should always be shown.
218
     * @param alwaysShown <code>true</code> to always show the search field,
219
     *                           <code>false</code> otherwise.
220
     * @since 7.48
221
     */
222
    public void setAlwaysShown(boolean alwaysShown) {
223
        this.alwaysShown = alwaysShown;
224
        if(alwaysShown) {
225
            displaySearchField();
226
        }
227
    }
203
    
228
    
204
    /**
229
    /**
205
     * Test whether the quick search is enabled. This is <code>true</code>
230
     * Test whether the quick search is enabled. This is <code>true</code>
Lines 322-328 Link Here
322
        searchTextField.addKeyListener(searchFieldListener);
347
        searchTextField.addKeyListener(searchFieldListener);
323
        searchTextField.addFocusListener(searchFieldListener);
348
        searchTextField.addFocusListener(searchFieldListener);
324
        searchTextField.getDocument().addDocumentListener(searchFieldListener);
349
        searchTextField.getDocument().addDocumentListener(searchFieldListener);
325
        
350
        if(isAlwaysShown()) {
351
            displaySearchField();
352
        }
326
    }
353
    }
327
    
354
    
328
    private void displaySearchField() {
355
    private void displaySearchField() {
Lines 354-359 Link Here
354
            animationTimer = null;
381
            animationTimer = null;
355
        }
382
        }
356
        searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
383
        searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS));
384
        searchPanel.setBackground(component.getBackground());
357
        searchPanel.add(lbl);
385
        searchPanel.add(lbl);
358
        searchPanel.add(searchTextField);
386
        searchPanel.add(searchTextField);
359
        lbl.setLabelFor(searchTextField);
387
        lbl.setLabelFor(searchTextField);
Lines 373-378 Link Here
373
    }
401
    }
374
    
402
    
375
    private void removeSearchField() {
403
    private void removeSearchField() {
404
        if (isAlwaysShown()) {
405
            searchTextField.setText("");
406
            return;
407
        }
376
        if (searchPanel == null) {
408
        if (searchPanel == null) {
377
            return;
409
            return;
378
        }
410
        }
Lines 710-716 Link Here
710
742
711
        @Override
743
        @Override
712
        public void focusLost(FocusEvent e) {
744
        public void focusLost(FocusEvent e) {
713
            if (e.isTemporary()) return ;
745
            if (e.isTemporary() || isAlwaysShown()) {
746
                return ;
747
            }
714
            Component oppositeComponent = e.getOppositeComponent();
748
            Component oppositeComponent = e.getOppositeComponent();
715
            if (e.getSource() != searchTextField) {
749
            if (e.getSource() != searchTextField) {
716
                ((Component) e.getSource()).removeFocusListener(this);
750
                ((Component) e.getSource()).removeFocusListener(this);

Return to bug 215833