org.openide.explorer.view.OutlineView Java Examples

The following examples show how to use org.openide.explorer.view.OutlineView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetadataViewTopComponent.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
private void initView() {
    setLayout(new BorderLayout());
    outlineView = new OutlineView(nodesColumnName);
    outlineView.setPropertyColumns(COLUMN_NAMES);
    final Outline outline = outlineView.getOutline();
    outline.setRootVisible(false);
    DefaultTableCellRenderer decimalTableCellRenderer = new StringDecimalFormatRenderer();
    outline.setDefaultRenderer(Double.class, decimalTableCellRenderer);
    outline.setDefaultRenderer(Float.class, decimalTableCellRenderer);
    outline.setDefaultRenderer(Node.Property.class, new MetadataOutlineCellRenderer());
    final TableColumnModel columnModel = outline.getColumnModel();
    columnModel.getColumn(0).setCellRenderer(new MetadataOutlineCellRenderer());
    final int[] columnWidths = COLUMN_WIDTHS;
    for (int i = 0; i < columnModel.getColumnCount(); i++) {
        columnModel.getColumn(i).setPreferredWidth(columnWidths[i]);
    }
    add(outlineView, BorderLayout.CENTER);
}
 
Example #2
Source File: CreateSiteTemplate.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public CreateSiteTemplate(FileObject root, FileObject externalSiteRoot, WizardPanel wp) {
    this.root = root;
    this.manager = new ExplorerManager();
    this.wp = wp;
    try {
        if (externalSiteRoot != null) {
            ExternalSiteRootNode externalSiteRootNode = new ExternalSiteRootNode(DataObject.find(externalSiteRoot).getNodeDelegate(), externalSiteRoot.isFolder());
            manager.setRootContext(new OurFilteredNode(DataObject.find(root).getNodeDelegate(), externalSiteRootNode));
        } else {
            manager.setRootContext(new OurFilteredNode(DataObject.find(root).getNodeDelegate(), root.isFolder()));
        }
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
    initComponents();
    tree = new OutlineView();
    tree.setTreeSortable(false);
    placeholder.setLayout(new BorderLayout());
    placeholder.add(tree, BorderLayout.CENTER);
    nameTextField.getDocument().addDocumentListener(this);
    fileTextField.getDocument().addDocumentListener(this);
    fileTextField.setText(new File(System.getProperty("user.home")).getAbsolutePath()); // NOI18N
}
 
Example #3
Source File: KnockoutPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the context view.
 */
@NbBundle.Messages({
    "KnockoutPanel.contextView.name=Name",
    "KnockoutPanel.contextView.value=Value"
})
private void initContextView() {
    contextView = new OutlineView(Bundle.KnockoutPanel_contextView_name());
    contextView.setAllowedDragActions(DnDConstants.ACTION_NONE);
    contextView.setAllowedDropActions(DnDConstants.ACTION_NONE);
    contextView.setShowNodeIcons(false);
    contextView.addPropertyColumn(
            KnockoutNode.ValueProperty.NAME,
            Bundle.KnockoutPanel_contextView_value());

    Outline outline = contextView.getOutline();
    outline.setRootVisible(false);
}
 
Example #4
Source File: FileSelectionPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the table of the available files.
 */
@NbBundle.Messages({
    "FileSelectionPanel.fileColumn.title=File",
    "FileSelectionPanel.installColumn.title=Install"
})
private void initOutlineView() {
    outlineView = new OutlineView(Bundle.FileSelectionPanel_fileColumn_title());
    outlineView.setAllowedDragActions(DnDConstants.ACTION_NONE);
    outlineView.setAllowedDropActions(DnDConstants.ACTION_NONE);
    outlineView.setShowNodeIcons(false);
    outlineView.addPropertyColumn(
            FileNode.InstallProperty.NAME,
            Bundle.FileSelectionPanel_installColumn_title());

    Outline outline = outlineView.getOutline();
    outline.setRootVisible(false);        
}
 
Example #5
Source File: BasicSearchResultsPanelTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    rootNode = new RootNode();
    a = rootNode.getChildren().getNodeAt(0);
    b = rootNode.getChildren().getNodeAt(1);
    c = rootNode.getChildren().getNodeAt(2);
    a1 = a.getChildren().getNodeAt(0);
    b2 = b.getChildren().getNodeAt(1);
    c3 = c.getChildren().getNodeAt(2);
    resultsPanel = new AbstractSearchResultsPanel(null, null) {

        @Override
        protected OutlineView getOutlineView() {
            return null;
        }

        @Override
        protected boolean isDetailNode(Node n) {
            return n.getLookup().lookup(TextDetail.class) != null;
        }
    };
}
 
Example #6
Source File: FileTreeView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Start finding for next or previous occurance, from a node or its previous
 * or next sibling of node {@code node}
 *
 * @param node reference node
 * @param offset 0 to start from node {@code node}, 1 to start from its next
 * sibling, -1 to start from its previous sibling.
 * @param dir Direction: 1 for next, -1 for previous.
 */
private Node findUp(Node node, int dir, int offset, OutlineView outlineView,
        boolean canExpand) {
    if (node == null) {
        return null;
    }
    Node parent = node.getParentNode();
    Node[] siblings;
    if (parent == null) {
        siblings = new Node[]{node};
    } else {
        siblings = getChildren(parent, outlineView, canExpand);
    }
    int nodeIndex = findChildIndex(node, siblings);
    if (nodeIndex + offset < 0 || nodeIndex + offset >= siblings.length) {
        return findUp(parent, dir, dir, outlineView, canExpand);
    }
    for (int i = nodeIndex + offset;
            i >= 0 && i < siblings.length; i += dir) {
        Node found = findDown(siblings[i], siblings, i, dir, outlineView,
                canExpand);
        return found;
    }
    return findUp(parent, dir, offset, outlineView, canExpand);
}
 
Example #7
Source File: FileTreeView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Find Depth-first search to find a detail node in the subtree.
 */
private Node findDown(Node node, Node[] siblings, int nodeIndex,
        int dir, OutlineView outlineView, boolean canExpand) {

    Node[] children = getChildren(node, outlineView, canExpand);
    for (int i = dir > 0 ? 0 : children.length - 1;
            i >= 0 && i < children.length; i += dir) {
        Node found = findDown(children[i], children, i, dir, outlineView,
                canExpand);
        if (found != null) {
            return found;
        }
    }
    for (int i = nodeIndex; i >= 0 && i < siblings.length; i += dir) {
        Node converted = convertNode(siblings[i]);
        if (converted != null) {
            return converted;
        }
    }
    return null;
}
 
Example #8
Source File: BasicAbstractResultsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void initAccessibility() {
    ResourceBundle bundle = NbBundle.getBundle(ResultView.class);

    AccessibleContext accessCtx;
    OutlineView outlineView = resultsOutlineSupport.getOutlineView();

    accessCtx = outlineView.getHorizontalScrollBar().getAccessibleContext();
    accessCtx.setAccessibleName(
            bundle.getString("ACSN_HorizontalScrollbar"));          //NOI18N

    accessCtx = outlineView.getVerticalScrollBar().getAccessibleContext();
    accessCtx.setAccessibleName(
            bundle.getString("ACSN_VerticalScrollbar"));            //NOI18N

    accessCtx = outlineView.getAccessibleContext();
    accessCtx.setAccessibleName(
            bundle.getString("ACSN_ResultTree"));                   //NOI18N
    accessCtx.setAccessibleDescription(
            bundle.getString("ACSD_ResultTree"));                   //NOI18N
}
 
Example #9
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Find Depth-first search to find a detail node in the subtree.
 */
private Node findDown(Node node, Node[] siblings, int nodeIndex,
        int dir, OutlineView outlineView, boolean canExpand) {

    Node[] children = getChildren(node, outlineView, canExpand);
    for (int i = dir > 0 ? 0 : children.length - 1;
            i >= 0 && i < children.length; i += dir) {
        Node found = findDown(children[i], children, i, dir, outlineView,
                canExpand);
        if (found != null) {
            return found;
        }
    }
    for (int i = nodeIndex; i >= 0 && i < siblings.length; i += dir) {
        if (isDetailNode(siblings[i])) {
            return siblings[i];
        }
    }
    return null;
}
 
Example #10
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Start finding for next or previous occurance, from a node or its previous
 * or next sibling of node {@code node}
 *
 * @param node reference node
 * @param offset 0 to start from node {@code node}, 1 to start from its next
 * sibling, -1 to start from its previous sibling.
 * @param dir Direction: 1 for next, -1 for previous.
 */
Node findUp(Node node, int dir, int offset, OutlineView outlineView,
        boolean canExpand) {
    if (node == null) {
        return null;
    }
    Node parent = node.getParentNode();
    Node[] siblings;
    if (parent == null) {
        siblings = new Node[]{node};
    } else {
        siblings = getChildren(parent, outlineView, canExpand);
    }
    int nodeIndex = findChildIndex(node, siblings);
    if (nodeIndex + offset < 0 || nodeIndex + offset >= siblings.length) {
        return findUp(parent, dir, dir, outlineView, canExpand);
    }
    for (int i = nodeIndex + offset;
            i >= 0 && i < siblings.length; i += dir) {
        Node found = findDown(siblings[i], siblings, i, dir, outlineView,
                canExpand);
        return found;
    }
    return findUp(parent, dir, offset, outlineView, canExpand);
}
 
Example #11
Source File: EntityMappingMemberPanel.java    From jeddict with Apache License 2.0 6 votes vote down vote up
/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    rootLayeredPane = new javax.swing.JLayeredPane();
    outlineView = new OutlineView(getTitle());

    rootLayeredPane.setLayout(new java.awt.GridLayout(1, 0));

    outlineView.setToolTipText(org.openide.util.NbBundle.getMessage(EntityMappingMemberPanel.class, "EntityMappingMemberPanel.outlineView.toolTipText")); // NOI18N
    rootLayeredPane.add(outlineView);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
    );
}
 
Example #12
Source File: ResultsOutlineSupport.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static int getHorizontalScrollbarPolicy() {
    try {
        String prop = System.getProperty(PROP_HORIZONTAL_SCROLLBAR);
        if (prop == null) {
            return OutlineView.HORIZONTAL_SCROLLBAR_AS_NEEDED;
        }
        switch (prop) {
            case "on":                                              //NOI18N
            case "On":                                              //NOI18N
            case "ON":                                              //NOI18N
                return OutlineView.HORIZONTAL_SCROLLBAR_ALWAYS;
            case "off":                                             //NOI18N
            case "Off":                                             //NOI18N
            case "OFF":                                             //NOI18N
                return OutlineView.HORIZONTAL_SCROLLBAR_NEVER;
            default:
                return OutlineView.HORIZONTAL_SCROLLBAR_AS_NEEDED;
        }
    } catch (Exception e) {
        Logger.getLogger(ResultsOutlineSupport.class.getName()).log(
                Level.INFO, null, e);
        return OutlineView.HORIZONTAL_SCROLLBAR_AS_NEEDED;
    }
}
 
Example #13
Source File: TableMemberPanel.java    From jeddict with Apache License 2.0 6 votes vote down vote up
/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    rootLayeredPane = new javax.swing.JLayeredPane();
    outlineView = new OutlineView(getTitle());

    rootLayeredPane.setLayout(new java.awt.GridLayout(1, 0));

    outlineView.setToolTipText(org.openide.util.NbBundle.getMessage(TableMemberPanel.class, "TableMemberPanel.outlineView.toolTipText")); // NOI18N
    rootLayeredPane.add(outlineView);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
    );
}
 
Example #14
Source File: TreeModelRoot.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public TreeModelRoot (Models.CompoundModel model, OutlineView outlineView) {
    this.model = model;
    this.manager = ExplorerManager.find(outlineView);
    this.treeFeatures = new DefaultTreeFeatures(outlineView);
    this.outlineView = outlineView;
    modelListeners = new ModelChangeListener[] { new ModelChangeListener(model) };
    model.addModelListener (modelListeners[0]);
}
 
Example #15
Source File: FileTreeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Node[] getChildrenInDisplayedOrder(Node parent,
        OutlineView outlineView) {

    Outline outline = outlineView.getOutline();
    Node[] unsortedChildren = parent.getChildren().getNodes(true);
    int rows = outlineView.getOutline().getRowCount();
    int start = findRowIndexInOutline(parent, outline, rows);
    if (start == -1 && parent != ExplorerManager.find(outlineView).getRootContext()) {
        return unsortedChildren;
    }
    List<Node> children = new LinkedList<Node>();
    for (int j = start + 1; j < rows; j++) {
        int childModelIndex = outline.convertRowIndexToModel(j);
        if (childModelIndex == -1) {
            continue;
        }
        Object childObject = outline.getModel().getValueAt(
                childModelIndex, 0);
        Node childNode = Visualizer.findNode(childObject);
        if (childNode.getParentNode() == parent) {
            children.add(childNode);
        } else if (children.size() == unsortedChildren.length) {
            break;
        }
    }
    return children.toArray(new Node[children.size()]);
}
 
Example #16
Source File: FileTreeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Node[] getChildren(Node n, OutlineView outlineView,
        boolean canExpand) {
    if (outlineView != null) {
        if (!outlineView.isExpanded(n)) {
            if (canExpand) {
                outlineView.expandNode(n);
            } else {
                return n.getChildren().getNodes(true);
            }
        }
        return getChildrenInDisplayedOrder(n, outlineView);
    } else {
        return n.getChildren().getNodes(true);
    }
}
 
Example #17
Source File: TreeModelRoot.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public TreeModelRoot (HyperCompoundModel model, OutlineView outlineView) {
    this.hyperModel = model;
    this.model = model.getMain();
    this.manager = ExplorerManager.find(outlineView);
    this.treeFeatures = new DefaultTreeFeatures(outlineView);
    this.outlineView = outlineView;
    int nl = model.getModels().length;
    modelListeners = new ModelChangeListener[nl];
    for (int i = 0; i < nl; i++) {
        Models.CompoundModel m = model.getModels()[i];
        modelListeners[i] = new ModelChangeListener(m);
        m.addModelListener(modelListeners[i]);
    }
}
 
Example #18
Source File: CustomScopePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    outlineView1 = new OutlineView(NbBundle.getMessage(CustomScopePanel.class, "DLG_CustomScope"));

    outlineView1.setDefaultActionAllowed(false);
    outlineView1.setDoubleBuffered(true);
    outlineView1.setDragSource(false);
    outlineView1.setDropTarget(false);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(outlineView1, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE)
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(outlineView1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
            .addContainerGap())
    );
}
 
Example #19
Source File: OrderByPanel.java    From jeddict with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    rootLayeredPane = new javax.swing.JLayeredPane();
    outlineView = new OutlineView("@OrderBy");

    outlineView.setToolTipText(org.openide.util.NbBundle.getMessage(OrderByPanel.class, "OrderByPanel.outlineView.toolTipText")); // NOI18N

    rootLayeredPane.setLayer(outlineView, javax.swing.JLayeredPane.DEFAULT_LAYER);

    javax.swing.GroupLayout rootLayeredPaneLayout = new javax.swing.GroupLayout(rootLayeredPane);
    rootLayeredPane.setLayout(rootLayeredPaneLayout);
    rootLayeredPaneLayout.setHorizontalGroup(
        rootLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(outlineView, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
    );
    rootLayeredPaneLayout.setVerticalGroup(
        rootLayeredPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(outlineView, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane)
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(rootLayeredPane)
    );
}
 
Example #20
Source File: FileTreeView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@NbBundle.Messages({
    "CTL_FileTree.treeColumn.Name=File"
})
public FileTreeView () {
    em = new ExplorerManager();
    view = new OutlineView(Bundle.CTL_FileTree_treeColumn_Name());
    view.getOutline().setShowHorizontalLines(true);
    view.getOutline().setShowVerticalLines(false);
    view.getOutline().setRootVisible(false);
    view.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    view.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    view.setPopupAllowed(false);
    view.getOutline().addMouseListener(this);
    view.getOutline().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction");
    view.getOutline().getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(view.getOutline()));
        }
    });
    view.getOutline().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "slideOut");
    viewComponent = new ViewContainer(em);
    viewComponent.add(view, BorderLayout.CENTER);
    viewComponent.addAncestorListener(this);
    em.addPropertyChangeListener(this);
}
 
Example #21
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Node findShiftNode(int direction, OutlineView outlineView,
        boolean canExpand) {
    Node[] selected = getExplorerManager().getSelectedNodes();
    Node n = null;
    if ((selected == null || selected.length == 0)
            /* TODO && getExplorerManager().getRootContext() == resultsOutlineSupport.getRootNode() */) {
        n = getExplorerManager().getRootContext();
    } else if (selected.length == 1) {
        n = selected[0];
    }
    return n == null ? null : findDetailNode(n, direction, outlineView,
            canExpand);
}
 
Example #22
Source File: ResultsOutlineSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void createOutlineView() {
    outlineView = new OutlineView(UiUtils.getText(
            "BasicSearchResultsPanel.outline.nodes"));              //NOI18N
    outlineView.getOutline().setDefaultRenderer(Node.Property.class,
            new ResultsOutlineCellRenderer());
    setOutlineColumns();
    outlineView.getOutline().setAutoCreateColumnsFromModel(false);
    outlineView.addTreeExpansionListener(
            new ExpandingTreeExpansionListener());
    outlineView.getOutline().setRootVisible(false);
    outlineView.addHierarchyListener(new HierarchyListener() {
        @Override
        public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED)
                    != 0) {
                if (outlineView.isDisplayable()) {
                    outlineView.expandNode(resultsNode);
                }
            }
        }
    });
    outlineView.getOutline().getColumnModel().addColumnModelListener(
            new ColumnsListener());
    outlineView.getOutline().getInputMap().remove(
            KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)); //#209949
    outlineView.getOutline().getInputMap().put(KeyStroke.getKeyStroke(
            KeyEvent.VK_DELETE,
            0), "hide"); //NOI18N
    outlineView.getOutline().getActionMap().put("hide", SystemAction.get( //NOI18N
            HideResultAction.class));
    outlineView.getOutline().setShowGrid(false);
    Font font = outlineView.getOutline().getFont();
    FontMetrics fm = outlineView.getOutline().getFontMetrics(font);
    outlineView.getOutline().setRowHeight(
            Math.max(16, fm.getHeight()) + VERTICAL_ROW_SPACE);
    outlineView.setTreeHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_POLICY);
    setTooltipHidingBehavior();
}
 
Example #23
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Node[] getChildren(Node n, OutlineView outlineView,
        boolean canExpand) {
    if (outlineView != null) {
        if (!outlineView.isExpanded(n)) {
            if (canExpand) {
                outlineView.expandNode(n);
            } else {
                return n.getChildren().getNodes(true);
            }
        }
        return getChildrenInDisplayedOrder(n, outlineView);
    } else {
        return n.getChildren().getNodes(true);
    }
}
 
Example #24
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static Node[] getChildrenInDisplayedOrder(Node parent,
        OutlineView outlineView) {

    Outline outline = outlineView.getOutline();
    Node[] unsortedChildren = parent.getChildren().getNodes(true);
    int rows = outlineView.getOutline().getRowCount();
    int start = findRowIndexInOutline(parent, outline, rows);
    if (start == -1) {
        return unsortedChildren;
    }
    List<Node> children = new LinkedList<Node>();
    for (int j = start + 1; j < rows; j++) {
        int childModelIndex = outline.convertRowIndexToModel(j);
        if (childModelIndex == -1) {
            continue;
        }
        Object childObject = outline.getModel().getValueAt(
                childModelIndex, 0);
        Node childNode = Visualizer.findNode(childObject);
        if (childNode.getParentNode() == parent) {
            children.add(childNode);
        } else if (children.size() == unsortedChildren.length) {
            break;
        }
    }
    return children.toArray(new Node[children.size()]);
}
 
Example #25
Source File: DefaultSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public DefaultSearchResultsPanel(
        SearchResultsDisplayer.NodeDisplayer<T> nodeDisplayer,
        SearchComposition<T> searchComposition,
        Presenter searchProviderPresenter) {

    super(searchComposition, searchProviderPresenter);
    this.resultsNode = new ResultsNode();
    this.nodeDisplayer = nodeDisplayer;
    resultsNode.update();
    outlineView = new OutlineView(UiUtils.getText(
            "BasicSearchResultsPanel.outline.nodes"));              //NOI18N
    outlineView.getOutline().setRootVisible(false);
    initExpandButton();
    getContentPanel().add(outlineView);
}
 
Example #26
Source File: FileTreeView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private Node findDetailNode(Node fromNode, int direction,
        OutlineView outlineView, boolean canExpand) {
    return findUp(fromNode, direction,
            convertNode(fromNode) != null || direction < 0 ? direction : 0,
            outlineView, canExpand);
}
 
Example #27
Source File: BasicAbstractResultsPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public final OutlineView getOutlineView() {
    return resultsOutlineSupport.getOutlineView();
}
 
Example #28
Source File: MetadataViewTopComponent.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
@Override
public OutlineView getView() {
    return outlineView;
}
 
Example #29
Source File: UserCellTupleNode.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void createTableColumns(OutlineView outlineView) {
    outlineView.setPropertyColumns("value", "value");
}
 
Example #30
Source File: OccurrenceTupleNode.java    From Llunatic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void createTableColumns(OutlineView outlineView) {
    outlineView.setPropertyColumns(TID, TID, TABLE, TABLE, ATTRIBUTE, ATTRIBUTE, PREVIOUS_VALUE, Bundle.COL_PreviousValue(), ORIGINAL_VALUE, Bundle.COL_OriginalValue());
}