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.

Bug 185196 - OutlineView - Can't disable Quick Filter Popup
Summary: OutlineView - Can't disable Quick Filter Popup
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Outline&TreeTable (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P3 normal with 3 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-28 15:57 UTC by scottg00
Modified: 2010-04-28 15:57 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description scottg00 2010-04-28 15:57:11 UTC
There is no way to disable the Quick Filter Popup for an OutlineView.  OutlineView has a private class OutlinePopupFactory that overrides NodePopupFactory's createPopupMenu method which does not take into account whether NodePopupFactory's showQuickFilter is true or false.

OutlineView view = new OutlineView("Name");
view.getNodePopupFactory().setShowQuickFilter(false);

This will do nothing.  Currently the only way to disable the quick filter popup is to subclass NodePopupFactory.  

OutlineView view = new OutlineView("Name");
view.setNodePopupFactory(new PopupFactory());
view.getNodePopupFactory().setShowQuickFilter(false);

private class PopupFactory extends NodePopupFactory {

    @Override
    public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes,Component component) {
        return super.createPopupMenu(row, column, selectedNodes, component);
    }
}

An easy fix for those not wanting the quick filter popup is to implement that functionality in OutlineView:

private boolean quickFilterPopupEnabled = true;

public void setQuickFilterPopupEnabled(boolean enabled) {
    this.quickFilterPopupEnabled = enabled;
}

private static class OutlinePopupFactory extends NodePopupFactory {
    public OutlinePopupFactory() {}

    @Override
    public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes, Component component) {
        if (component instanceof ETable) {
            ETable et = (ETable)component;
            int modelRowIndex = et.convertColumnIndexToModel(column);
            if(quickFilterPopupEnabled)
                setShowQuickFilter(modelRowIndex != 0);
            else setShowQuickFilter(false);
        }
        return super.createPopupMenu(row, column, selectedNodes, component);
    }
}