Example usage for javax.swing JTable getEditingColumn

List of usage examples for javax.swing JTable getEditingColumn

Introduction

In this page you can find the example usage for javax.swing JTable getEditingColumn.

Prototype

public int getEditingColumn() 

Source Link

Document

Returns the index of the column that contains the cell currently being edited.

Usage

From source file:fll.subjective.SubjectiveFrame.java

/**
 * Stop the cell editors to ensure data is flushed
 *//* w w w.j  a  v a  2 s.  c  om*/
private void stopCellEditors() {
    final Iterator<JTable> iter = _tables.values().iterator();
    while (iter.hasNext()) {
        final JTable table = iter.next();
        final int editingColumn = table.getEditingColumn();
        final int editingRow = table.getEditingRow();
        if (editingColumn > -1) {
            final TableCellEditor cellEditor = table.getCellEditor(editingRow, editingColumn);
            if (null != cellEditor) {
                cellEditor.stopCellEditing();
            }
        }
    }
}

From source file:gdt.jgui.tool.JEntityEditor.java

private boolean hasEditingCell() {
    try {/*w ww .j  ava 2 s.  co  m*/
        JScrollPane scrollPane = (JScrollPane) tabbedPane.getSelectedComponent();
        JTable table = (JTable) scrollPane.getViewport().getView();
        //         System.out.println("Entityeditor:hasEditingCell:x="+table.getEditingRow()+" y="+table.getEditingColumn());
        if (table.getEditingColumn() > -1 && table.getEditingRow() > -1)
            return true;
    } catch (Exception e) {
        LOGGER.severe(e.toString());
    }
    return false;
}

From source file:gdt.jgui.entity.fields.JFieldsEditor.java

private String getEditCellLocator() {
    try {/*from   w  ww.j  a  v  a  2  s  .c  o m*/
        save();
        String locator$ = getLocator();
        if (entihome$ != null)
            locator$ = Locator.append(locator$, Entigrator.ENTIHOME, entihome$);
        if (entityKey$ != null)
            locator$ = Locator.append(locator$, EntityHandler.ENTITY_KEY, entityKey$);
        JTable table = (JTable) scrollPane.getViewport().getView();
        int x = table.getEditingRow();
        int y = table.getEditingColumn();
        String cellField$ = CELL_FIELD_NAME;
        if (y == 1)
            cellField$ = CELL_FIELD_VALUE;
        TableModel model = table.getModel();
        text$ = (String) model.getValueAt(x, y);
        String fieldName$ = (String) model.getValueAt(x, 0);
        locator$ = Locator.append(locator$, JTextEditor.TEXT, text$);
        locator$ = Locator.append(locator$, CELL_FIELD, cellField$);
        locator$ = Locator.append(locator$, CELL_FIELD_NAME, fieldName$);
        if (requesterResponseLocator$ != null)
            locator$ = Locator.append(locator$, JRequester.REQUESTER_RESPONSE_LOCATOR,
                    requesterResponseLocator$);
        locator$ = Locator.append(locator$, BaseHandler.HANDLER_METHOD, JFacetOpenItem.METHOD_RESPONSE);
        // System.out.println("FieldsEditor:getEditCellLocator:END:"+locator$);
        return locator$;
    } catch (Exception e) {
        LOGGER.severe(e.toString());
        return null;
    }
}

From source file:gdt.jgui.tool.JEntityEditor.java

private String getEditCellLocator() {
    try {//from  www. j  a v  a  2  s  .  co m
        save();
        JTextEditor textEditor = new JTextEditor();
        String locator$ = textEditor.getLocator();
        locator$ = Locator.merge(getLocator(), locator$);
        JScrollPane scrollPane = (JScrollPane) tabbedPane.getSelectedComponent();
        JTable table = (JTable) scrollPane.getViewport().getView();
        int i = tabbedPane.getSelectedIndex();
        String element$ = tabbedPane.getTitleAt(i);
        int x = table.getEditingRow();
        int y = table.getEditingColumn();
        String cellField$ = CELL_FIELD_TYPE;
        if (y == 1)
            cellField$ = CELL_FIELD_NAME;
        else if (y == 2)
            cellField$ = CELL_FIELD_VALUE;
        TableModel model = table.getModel();
        String text$ = (String) model.getValueAt(x, y);
        text$ = Locator.compressText(text$);
        locator$ = Locator.append(locator$, JTextEditor.IS_BASE64, Locator.LOCATOR_TRUE);
        String coreName$ = (String) model.getValueAt(x, 1);
        locator$ = Locator.append(locator$, JTextEditor.TEXT, text$);
        locator$ = Locator.append(locator$, ELEMENT, element$);
        locator$ = Locator.append(locator$, CELL_FIELD, cellField$);
        locator$ = Locator.append(locator$, CORE_NAME, coreName$);
        locator$ = Locator.append(locator$, JRequester.REQUESTER_ACTION, ACTION_EDIT_CELL);
        locator$ = Locator.append(locator$, Locator.LOCATOR_TITLE, "Edit item");
        locator$ = Locator.append(locator$, BaseHandler.HANDLER_CLASS, JTextEditor.class.getName());
        return locator$;
    } catch (Exception e) {
        LOGGER.severe(e.toString());
        return null;
    }
}

From source file:gdt.jgui.entity.fields.JFieldsEditor.java

private boolean hasEditingCell() {
    try {/*ww  w .j  ava  2s.  c  o m*/

        JTable table = (JTable) scrollPane.getViewport().getView();
        //System.out.println("Entityeditor:hasEditingCell:x="+table.getEditingRow()+" y="+table.getEditingColumn());
        if (table.getEditingColumn() > -1 && table.getEditingRow() > -1)
            return true;
    } catch (Exception e) {
        LOGGER.severe(e.toString());
    }
    return false;
}

From source file:org.isatools.isacreator.api.utils.SpreadsheetUtils.java

public static void stopCellEditingInTable(JTable table) {
    if (table.getEditingColumn() != -1) {
        // the ontology cell editor is a JFrame, so closing it is useless since it will close when it loses focus anyway.
        if (!(table.getCellEditor() instanceof OntologyCellEditor)) {
            table.getCellEditor(table.getEditingRow(), table.getEditingColumn()).stopCellEditing();
        }//from w  w  w  .j  a  v a  2s .c  o  m
    }
}