Java Code Examples for org.netbeans.swing.outline.Outline#getSelectedRow()

The following examples show how to use org.netbeans.swing.outline.Outline#getSelectedRow() . 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: 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 2
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 3
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 4
Source File: HistoryFileView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
boolean isLastRow() {
    Outline outline = tablePanel.treeView.getOutline();
    return outline.getSelectedRow() == outline.getRowCount() - 1;
}