Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 185196 - OutlineView - Can't disable Quick Filter Popup
OutlineView - Can't disable Quick Filter Popup
Status: NEW
Product: platform
Classification: Unclassified
Component: Outline&TreeTable
6.x
PC Windows Vista
: P3 with 3 votes (vote)
: TBD
Assigned To: Martin Entlicher
issues@platform
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-28 15:57 UTC by scottg00
Modified: 2010-04-28 15:57 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


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);
    }
}


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo