org.netbeans.swing.outline.Outline Java Examples

The following examples show how to use org.netbeans.swing.outline.Outline. 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: DelegatingCellRenderer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Outline outline = (Outline) table;
    Node n = getNodeAt(outline, row);
    if (n instanceof TreeModelNode) {
        TreeModelNode tmn = (TreeModelNode) n;
        TableRendererModel trm = tmn.getModel();
        try {
            if (trm.canRenderCell(tmn.getObject(), columnID)) {
                TableCellRenderer renderer = trm.getCellRenderer(tmn.getObject(), columnID);
                if (renderer != null) {
                    return renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                }
            }
        } catch (UnknownTypeException ex) {
        }
    }
    // No specific renderer
    return defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
 
Example #2
Source File: FileTreeView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static int findRowIndexInOutline(Node node, Outline outline,
        int rows) {

    int startRow = Math.max(outline.getSelectedRow(), 0);
    int offset = 0;
    while (startRow + offset < rows || startRow - offset >= 0) {
        int up = startRow + offset + 1;
        int down = startRow - offset;

        if (up < rows && testNodeInRow(outline, node, up)) {
            return up;
        } else if (down >= 0 && testNodeInRow(outline, node, down)) {
            return down;
        } else {
            offset++;
        }
    }
    return -1;
}
 
Example #3
Source File: HistoryFileView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private int getPrevRow(int row) {
    row = row - 1;
    Outline outline = tablePanel.treeView.getOutline();
    if(row < 0 || row >= outline.getRowCount()) {
        return -1;
    }
    TreePath path = outline.getOutlineModel().getLayout().getPathForRow(row);
    Node node = Visualizer.findNode(path.getLastPathComponent());
    if(node.isLeaf()) {
        if(node instanceof RevisionNode || node instanceof RevisionNode.FileNode) {
            return row;
        } else {
            return -1;
        }
    } else {
        TreePathSupport support = outline.getOutlineModel().getTreePathSupport();
        if(support.isExpanded(path)) {
            return getPrevRow(row);
        } else {
            support.expandPath(path);
            return row + node.getChildren().getNodesCount();
        }
    }
}
 
Example #4
Source File: HistoryFileView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private int getNextRow(int row) {
    row = row + 1;
    Outline outline = tablePanel.treeView.getOutline();
    if(row < 0 || row >= outline.getRowCount()) {
        return -1;
    }
    TreePath path = outline.getOutlineModel().getLayout().getPathForRow(row);
    Node node = Visualizer.findNode(path.getLastPathComponent());
    if(node.isLeaf()) {
        if(node instanceof RevisionNode || node instanceof RevisionNode.FileNode) {
            return row;
        } else {
            return -1;
        }
    } else {
        TreePathSupport support = outline.getOutlineModel().getTreePathSupport();
        if(support.isExpanded(path)) {
            return getPrevRow(row);
        } else {
            support.expandPath(path);
            return row + 1;
        }
    }
}
 
Example #5
Source File: DelegatingCellEditor.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
    Outline outline = (Outline) table;
    Node n = DelegatingCellRenderer.getNodeAt(outline, row);
    if (n instanceof TreeModelNode) {
        TreeModelNode tmn = (TreeModelNode) n;
        TableRendererModel trm = tmn.getModel();
        try {
            if (trm.canEditCell(tmn.getObject(), columnID)) {
                TableCellEditor editor = trm.getCellEditor(tmn.getObject(), columnID);
                if (editor != null) {
                    currentEditor = editor;
                    return editor.getTableCellEditorComponent(table, value, isSelected, row, column);
                }
            }
        } catch (UnknownTypeException ex) {
        }
    }
    // No specific editor
    currentEditor = defaultEditor;
    return defaultEditor.getTableCellEditorComponent(table, value, isSelected, row, column);
}
 
Example #6
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 #7
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 #8
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static int findRowIndexInOutline(Node node, Outline outline,
        int rows) {

    int startRow = Math.max(outline.getSelectedRow(), 0);
    int offset = 0;
    while (startRow + offset < rows || startRow - offset >= 0) {
        int up = startRow + offset + 1;
        int down = startRow - offset;

        if (up < rows && testNodeInRow(outline, node, up)) {
            return up;
        } else if (down >= 0 && testNodeInRow(outline, node, down)) {
            return down;
        } else {
            offset++;
        }
    }
    return -1;
}
 
Example #9
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 #10
Source File: DbPagedTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        outlineView1.setNodePopupFactory(new TablePopupFactory());
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
        outline.setCellSelectionEnabled(true);
//        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
        outline.setAutoResizeMode(ETable.AUTO_RESIZE_ALL_COLUMNS);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("tid");
        outline.setFullyNonEditable(true);
    }
 
Example #11
Source File: OrderingAttributesTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
//        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
//        TableColumnModel columnModel = outline.getColumnModel();
//        ETableColumn column = (ETableColumn) columnModel.getColumn(0);
//        ((ETableColumnModel) columnModel).setColumnHidden(column, true);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(Bundle.COL_Attribute());
        OrderingAttributeNode.createTableColumns(outlineView1);
        outline.setFullyNonEditable(true);
    }
 
Example #12
Source File: OutlineNavigatorTest.java    From jlibs with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"unchecked"})
public static void main(String[] args) throws Exception{
    String url = JOptionPane.showInputDialog("File/URL", "http://schemas.xmlsoap.org/wsdl/");
    if(url==null)
        return;
    XSModel model = new XSParser().parse(url);
    MyNamespaceSupport nsSupport = XSUtil.createNamespaceSupport(model);

    Navigator navigator1 = new FilteredTreeNavigator(new XSNavigator(), new XSDisplayFilter());
    Navigator navigator = new PathNavigator(navigator1);
    XSPathDiplayFilter filter = new XSPathDiplayFilter(navigator1);
    navigator = new FilteredTreeNavigator(navigator, filter);
    TreeModel treeModel = new NavigatorTreeModel(new Path(model), navigator);
    RowModel rowModel = new DefaultRowModel(new DefaultColumn("Detail", String.class, new XSDisplayValueVisitor(nsSupport))/*, new ClassColumn()*/);
    
    OutlineNavigatorTest test = new OutlineNavigatorTest("Navigator Test");
    Outline outline = test.getOutline();
    outline.setShowGrid(false);
    outline.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14));
    outline.setModel(DefaultOutlineModel.createOutlineModel(treeModel, rowModel));
    outline.getColumnModel().getColumn(1).setMinWidth(150);

    DefaultRenderDataProvider dataProvider = new DefaultRenderDataProvider();
    dataProvider.setDisplayNameVisitor(new XSDisplayNameVisitor(nsSupport, filter));
    dataProvider.setForegroundVisitor(new XSColorVisitor(filter));
    dataProvider.setFontStyleVisitor(new XSFontStyleVisitor(filter));
    outline.setRenderDataProvider(dataProvider);
    
    test.setVisible(true);
}
 
Example #13
Source File: DelegatingCellRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static final Node getNodeAt(Outline outline, int rowInUI) {
    Node result = null;
    OutlineModel om = (OutlineModel) outline.getModel();
    int row = outline.convertRowIndexToModel(rowInUI);
    TreePath path = om.getLayout().getPathForRow(row);
    if (path != null) {
        result = Visualizer.findNode(path.getLastPathComponent());
    }
    return result;
}
 
Example #14
Source File: HistoryFileView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void selectPrevEntry() {
    Outline outline = tablePanel.treeView.getOutline();
    if(outline.getSelectedRowCount() != 1) {
        return;
    }
    int row = outline.getSelectedRow();
    if(row - 1 < 0) {
        return;
    }
    row = getPrevRow(row);
    if(row > -1) {
        outline.getSelectionModel().setSelectionInterval(row, row);
        scrollToVisible(row, -1);
    } 
}
 
Example #15
Source File: OutlineTable.java    From netbeans with Apache License 2.0 5 votes vote down vote up
MyTreeTable () {
    super ();
    Outline outline = getOutline();
    outline.setShowHorizontalLines (true);
    outline.setShowVerticalLines (false);
    filterInputMap(outline, JComponent.WHEN_FOCUSED);
    filterInputMap(outline, JComponent.WHEN_IN_FOCUSED_WINDOW);
    filterInputMap(outline, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    outline.putClientProperty("PropertyToolTipShortDescription", Boolean.TRUE);
}
 
Example #16
Source File: DelegatingCellEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean shouldSelectCell(EventObject anEvent) {
    if (!(anEvent.getSource() instanceof Outline)) {
        return false;
    }
    Outline outline = (Outline) anEvent.getSource();
    if (!(anEvent instanceof MouseEvent)) {
        return false;
    }
    MouseEvent event = (MouseEvent) anEvent;
    Point p = event.getPoint();

    // Locate the editor under the event location
    //int column = outline.columnAtPoint(p);
    int row = outline.rowAtPoint(p);
    Node n = DelegatingCellRenderer.getNodeAt(outline, row);
    if (n instanceof TreeModelNode) {
        TreeModelNode tmn = (TreeModelNode) n;
        TableRendererModel trm = tmn.getModel();
        try {
            if (trm.canEditCell(tmn.getObject(), columnID)) {
                TableCellEditor editor = trm.getCellEditor(tmn.getObject(), columnID);
                if (editor != null) {
                    return editor.shouldSelectCell(anEvent);
                }
            }
        } catch (UnknownTypeException ex) {
        }
    }
    return defaultEditor.shouldSelectCell(anEvent);
}
 
Example #17
Source File: DbPagedTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Cell getSelectedCell() throws IllegalAccessException, InvocationTargetException {
    Outline o = outlineView1.getOutline();
    int selectedColumn = o.getSelectedColumn();
    if (selectedColumn > 0) {
        String columnName = o.getColumnName(selectedColumn);
        TableTupleNode node = getSelectedNode();
        return node.getCell(columnName);
    }
    return null;
}
 
Example #18
Source File: DbTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
private void initTable() {
        outlineView1.setNodePopupFactory(new TablePopupFactory());
        Outline outline = outlineView1.getOutline();
        outline.setRootVisible(false);
        outline.setCellSelectionEnabled(true);
        outline.setAutoResizeMode(ETable.AUTO_RESIZE_OFF);
//        TableColumnModel columnModel = outline.getColumnModel();
//        ETableColumn column = (ETableColumn) columnModel.getColumn(0);
//        ((ETableColumnModel) columnModel).setColumnHidden(column, true);
        ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel("tid");
        outline.setFullyNonEditable(true);
    }
 
Example #19
Source File: DelegatingCellEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isCellEditable(EventObject anEvent) {
    if (!(anEvent.getSource() instanceof Outline)) {
        return false;
    }
    Outline outline = (Outline) anEvent.getSource();
    int row;
    if (anEvent instanceof MouseEvent) {
        MouseEvent event = (MouseEvent) anEvent;
        Point p = event.getPoint();
        // Locate the editor under the event location
        //int column = outline.columnAtPoint(p);
        row = outline.rowAtPoint(p);
    } else {
        row = outline.getSelectedRow();
    }
    Node n = DelegatingCellRenderer.getNodeAt(outline, row);
    if (n instanceof TreeModelNode) {
        TreeModelNode tmn = (TreeModelNode) n;
        TableRendererModel trm = tmn.getModel();
        try {
            boolean canEdit = trm.canEditCell(tmn.getObject(), columnID);
            if (canEdit) {
                TableCellEditor tce = trm.getCellEditor(tmn.getObject(), columnID);
                canEdit = tce.isCellEditable(anEvent);
                return canEdit;
            }
        } catch (UnknownTypeException ex) {
        }
    }
    return defaultEditor.isCellEditable(anEvent);
}
 
Example #20
Source File: DbTableTopComponent.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Cell getSelectedCell() throws IllegalAccessException, InvocationTargetException {
    Outline o = outlineView1.getOutline();
    int selectedColumn = o.getSelectedColumn();
    if (selectedColumn > 0) {
        String columnName = o.getColumnName(selectedColumn);
        TableTupleNode node = getSelectedNode();
        return node.getCell(columnName);
    }
    return null;
}
 
Example #21
Source File: HistoryFileView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
void selectNextEntry() {
    Outline outline = tablePanel.treeView.getOutline();
    if(outline.getSelectedRowCount() != 1) {
        return;
    }
    int row = outline.getSelectedRow();
    if(row == outline.getRowCount() - 1) {
        return;
    }
    row = getNextRow(row);
    if(row > -1) {
        outline.getSelectionModel().setSelectionInterval(row, row);
        scrollToVisible(row, 1);
    }
}
 
Example #22
Source File: ResamplingDialog.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private JPanel createAdvancedMethodDefinitionPanel() {
    final TableLayout tableLayoutMethodDefinition = new TableLayout(1);
    tableLayoutMethodDefinition.setTableAnchor(TableLayout.Anchor.NORTHWEST);
    tableLayoutMethodDefinition.setTableFill(TableLayout.Fill.HORIZONTAL);
    tableLayoutMethodDefinition.setTableWeightX(1.0);
    tableLayoutMethodDefinition.setTablePadding(4, 4);
    JPanel panel = new JPanel(tableLayoutMethodDefinition);
    if(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct() != null) {
        BandsTreeModel myModel = new BandsTreeModel(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct());

        bandResamplingPresets = new BandResamplingPreset[myModel.getTotalRows()];
        for(int i = 0 ; i < myModel.getTotalRows() ; i++) {
            bandResamplingPresets[i] = new BandResamplingPreset(myModel.getRows()[i], (String) (parameterSupport.getParameterMap().get("downsamplingMethod")) , (String) (parameterSupport.getParameterMap().get("upsamplingMethod")));
        }

        resamplingRowModel = new ResamplingRowModel(bandResamplingPresets, myModel);

        mdl = DefaultOutlineModel.createOutlineModel(
                myModel, resamplingRowModel, true, "Bands");

        outline1 = new Outline();
        outline1.setRootVisible(false);
        outline1.setModel(mdl);

        ResamplingUtils.setUpUpsamplingColumn(outline1,outline1.getColumnModel().getColumn(1), (String) parameterSupport.getParameterMap().get("upsamplingMethod"));
        ResamplingUtils.setUpDownsamplingColumn(outline1,outline1.getColumnModel().getColumn(2), (String) parameterSupport.getParameterMap().get("downsamplingMethod"));
        JScrollPane tableContainer = new JScrollPane(outline1);
        panel.add(tableContainer);

        panel.setVisible(false);
    }
    return panel;
}
 
Example #23
Source File: SelectEventsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setData(String[] names, boolean[] logging) {
    int n = names.length;
    for (int i = 0; i < n; i++) {
        Event e = new Event(names[i], logging[i]);
        events.add(e);
    }
    OutlineModel om = DefaultOutlineModel.createOutlineModel(new EventsTreeModel(events), new EventsRowModel(events));
    table.setModel(om);
    ((Outline) table).setRenderDataProvider(new EventsDataProvider(events));
    table.setShowHorizontalLines(false);
    table.setTableHeader(null);
    ((Outline) table).setRootVisible(false);
}
 
Example #24
Source File: OutlineViewTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Test for bug 236331 - After reading the persistence settings all the
 * OutlineView property cells become empty.
 *
 * @throws Exception
 */
public void testPropertiesPersistence2() throws Exception {

    TestNode[] childrenNodes = new TestNode[2];
    childrenNodes[0] = new TestNode(Children.LEAF, "First");
    childrenNodes[1] = new TestNode(Children.LEAF, "Second");
    Children.Array children = new Children.Array();
    children.add(childrenNodes);
    Node rootNode = new TestNode(children, "Invisible Root");

    OutlineViewComponentWithLabels comp
            = new OutlineViewComponentWithLabels(rootNode);
    OutlineView ov = comp.getOutlineView();
    Outline o = ov.getOutline();

    ov.expandNode(rootNode);
    o.moveColumn(1, 0);
    assertEquals("First", getDummyValue(o.getValueAt(0, 0)));
    assertEquals("Second", getDummyValue(o.getValueAt(1, 0)));

    Properties p = new Properties();
    o.writeSettings(p, "test");

    OutlineViewComponentWithLabels comp2
            = new OutlineViewComponentWithLabels(rootNode);
    OutlineView ov2 = comp2.getOutlineView();
    Outline o2 = ov2.getOutline();

    ov2.readSettings(p, "test");
    ov2.expandNode(rootNode);
    assertNotSame(o, o2);

    // ensure the order of columns was restored
    assertEquals("First", getDummyValue(o2.getValueAt(0, 0)));
    assertEquals("Second", getDummyValue(o2.getValueAt(1, 0)));
}
 
Example #25
Source File: SelectEventsPanel.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() {

    selectLabel = new javax.swing.JLabel();
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new Outline();

    selectLabel.setText(org.openide.util.NbBundle.getMessage(SelectEventsPanel.class, "SelectEventsPanel.selectLabel.text")); // NOI18N

    jScrollPane1.setViewportView(table);

    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()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
                .addComponent(selectLabel))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(selectLabel)
            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE))
    );
}
 
Example #26
Source File: ResultsOutlineSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void setOutlineColumns() {
    if (details) {
        outlineView.addPropertyColumn(
                "detailsCount", UiUtils.getText( //NOI18N
                "BasicSearchResultsPanel.outline.detailsCount"), //NOI18N
                UiUtils.getText(
                "BasicSearchResultsPanel.outline.detailsCount.desc"));//NOI18N
    }
    outlineView.addPropertyColumn("path", UiUtils.getText(
            "BasicSearchResultsPanel.outline.path"), //NOI18N
            UiUtils.getText(
            "BasicSearchResultsPanel.outline.path.desc")); //NOI18N
    outlineView.addPropertyColumn("size", UiUtils.getText(
            "BasicSearchResultsPanel.outline.size"), //NOI18N
            UiUtils.getText(
            "BasicSearchResultsPanel.outline.size.desc"));          //NOI18N
    outlineView.addPropertyColumn("lastModified", UiUtils.getText(
            "BasicSearchResultsPanel.outline.lastModified"),//NOI18N
            UiUtils.getText(
            "BasicSearchResultsPanel.outline.lastModified.desc"));  //NOI18N
    outlineView.getOutline().setAutoResizeMode(
            Outline.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    this.columnModel =
            (ETableColumnModel) outlineView.getOutline().getColumnModel();
    Enumeration<TableColumn> cols = columnModel.getColumns();
    while (cols.hasMoreElements()) {
        allColumns.add(cols.nextElement());
    }
    loadColumnState();
    outlineView.setVerticalScrollBarPolicy(
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
}
 
Example #27
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 #28
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static boolean testNodeInRow(Outline outline, Node node, int i) {
    int modelIndex = outline.convertRowIndexToModel(i);
    if (modelIndex != -1) {
        Object o = outline.getModel().getValueAt(modelIndex, 0);
        Node n = Visualizer.findNode(o);
        if (n == node) {
            return true;
        }
    }
    return false;
}
 
Example #29
Source File: PropertiesRowModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void fireToolTipChanged(final Outline outline, final int row) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            if (lastMouseMovedEvent != null) {
                int r = outline.rowAtPoint(lastMouseMovedEvent.getPoint());
                if (r == row) {
                    ToolTipManager.sharedInstance().mouseMoved(lastMouseMovedEvent);
                }
            }
        }
    });
}
 
Example #30
Source File: PropertiesRowModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void setOutline(Outline outline) {
    if (this.outline != null) {
        this.outline.removeMouseListener(otu);
        this.outline.removeMouseMotionListener(otu);
    }
    this.outline = outline;
    outline.addMouseListener(otu);
    outline.addMouseMotionListener(otu);
}