Java Code Examples for javax.swing.event.TableModelEvent#getSource()

The following examples show how to use javax.swing.event.TableModelEvent#getSource() . 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: SchemaPanel.java    From netbeans with Apache License 2.0 8 votes vote down vote up
public void tableChanged(TableModelEvent e) {
    //System.out.println("TBALE changed");
    //boolean prefixFlag = false;
    int row = e.getFirstRow();
    int column = e.getColumn();
    AbstractTableModel tblModel = (AbstractTableModel) e.getSource();
    Object data = tblModel.getValueAt(row, column);
    if(column == SCHEMA_COL) {
        SchemaObject rowValue = (SchemaObject)data;
        if(rowValue.toString().equals(startString))
            return;
        String genPrefix = (String) tblModel.getValueAt(row, PREFIX_COL);
        if (genPrefix == null || genPrefix.equals(" ")  ) {
            String prefix = generateUniquePrefix();               
            tableModel.setValueAt(prefix, row, PREFIX_COL);                 
        }
        if(row == tableModel.getRowCount() - 1) {
            addRow(startString);
        }
        //if its the first row, then select it as primary
        if(row == 0) {
           // System.out.println("added first row");
            tblModel.setValueAt(new Boolean(true), 0, 0);
        }
    } 
}
 
Example 2
Source File: QueryBuilderGraphFrame.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public void tableChanged(TableModelEvent e) {
    
    // if the graph is disabled, do not handle any events.
        if ( _disableQBGF )
 return;
    
    // if the graph is being generated from model, do not handle events.
    if (_queryBuilder._updateModel == false)
 return;
    
    Log.getLogger().finest("Entering QBGF.tableChanged, source: " + e.getSource()); // NOI18N

    if (e.getSource() instanceof QueryBuilderTableModel)
        tableModelChanged(e);
    
    else if (e.getSource() instanceof QueryBuilderInputTableModel)
        inputTableModelChanged(e);
}
 
Example 3
Source File: XMBeanAttributes.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 4
Source File: CertificatesManagerSettingsPanel.java    From Spark with Apache License 2.0 5 votes vote down vote up
@Override
public void tableChanged(TableModelEvent e) {
	int row = e.getFirstRow();
    int column = e.getColumn();
    if (column == 2) {
        TableModel model = (TableModel) e.getSource();
        Boolean checked = (Boolean) model.getValueAt(row, column);
		certControll.addOrRemoveFromExceptionList(checked);
	}
}
 
Example 5
Source File: VariablesTableAdapter.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void tableChanged(TableModelEvent e) {
    final TableModel tableModel = (TableModel) e.getSource();
    final MosaicOp.Variable[] variables = new MosaicOp.Variable[tableModel.getRowCount()];
    for (int i = 0; i < variables.length; i++) {
        variables[i] = new MosaicOp.Variable((String) tableModel.getValueAt(i, 0),
                                             (String) tableModel.getValueAt(i, 1));
    }
    getBinding().setPropertyValue(variables);
}
 
Example 6
Source File: ConditionsTableAdapter.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void tableChanged(TableModelEvent e) {
    final TableModel tableModel = (TableModel) e.getSource();
    final MosaicOp.Condition[] conditions = new MosaicOp.Condition[tableModel.getRowCount()];
    for (int i = 0; i < conditions.length; i++) {
        conditions[i] = new MosaicOp.Condition((String) tableModel.getValueAt(i, 0),
                                               (String) tableModel.getValueAt(i, 1),
                                               Boolean.TRUE.equals(tableModel.getValueAt(i, 2)));
    }
    getBinding().setPropertyValue(conditions);
}
 
Example 7
Source File: XMBeanAttributes.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 8
Source File: XMBeanAttributes.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 9
Source File: XMBeanAttributes.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 10
Source File: XMBeanAttributes.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 11
Source File: XMBeanAttributes.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 12
Source File: XMBeanAttributes.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 13
Source File: XMBeanAttributes.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 14
Source File: XMBeanAttributes.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.TRACE)) {
            LOGGER.log(Level.TRACE,
                "tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 15
Source File: XMBeanAttributes.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 16
Source File: PhpUnitTestGroupsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NbBundle.Messages("PhpUnitTestGroupsPanel.groups.selected.none=All tests will be executed.")
public void tableChanged(TableModelEvent e) {
    TableModel tableModel = (TableModel) e.getSource();
    for (int i = 0; i < tableModel.getRowCount(); i++) {
        Boolean isRowChecked = (Boolean) tableModel.getValueAt(i, 1);
        if (isRowChecked) {
            notificationLineSupport.clearMessages();
            return;
        }
    }
    notificationLineSupport.setInformationMessage(Bundle.PhpUnitTestGroupsPanel_groups_selected_none());
}
 
Example 17
Source File: XMBeanAttributes.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 18
Source File: XMBeanAttributes.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 19
Source File: XMBeanAttributes.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void tableChanged(final TableModelEvent e) {
    // only post changes to the draggable column
    if (isColumnEditable(e.getColumn())) {
        final TableModel model = (TableModel)e.getSource();
        Object tableValue = model.getValueAt(e.getFirstRow(),
                                         e.getColumn());

        if (LOGGER.isLoggable(Level.FINER)) {
            LOGGER.finer("tableChanged: firstRow="+e.getFirstRow()+
                ", lastRow="+e.getLastRow()+", column="+e.getColumn()+
                ", value="+tableValue);
        }
        // if it's a String, try construct new value
        // using the defined type.
        if (tableValue instanceof String) {
            try {
                tableValue =
                    Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
                    (String)tableValue);// value
            } catch (Throwable ex) {
                popupAndLog(ex,"tableChanged",
                            Messages.PROBLEM_SETTING_ATTRIBUTE);
            }
        }
        final String attributeName = getValueName(e.getFirstRow());
        final Attribute attribute =
              new Attribute(attributeName,tableValue);
        setAttribute(attribute, "tableChanged");
    }
}
 
Example 20
Source File: QueryBuilderGraphFrame.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void tableModelChanged(TableModelEvent e) {
    
    Log.getLogger().entering("QueryBuilderGraphFrame", "tableModelChanged");

    // We have a mouse click inside a graph table node, indicating select/deselect.
    // Propagate the information to the input table
    
    // Extract some information from the event
    int row = e.getFirstRow();   // the first row that changed
    int column = e.getColumn();  // the column for this event
    
    QueryBuilderTableModel model = (QueryBuilderTableModel) e.getSource();
    String tableSpec = model.getTableSpec();
    
    // DB column name
    String columnName = (String) model.getValueAt(row, column+2);
    
    // boolean - Selected/deselected
    Object value = model.getValueAt(row, column);
    
    if (value==Boolean.TRUE) {      // A column has been selected
        
        // Update the query model if appropriate
        // Do this first so that it's available when adding the row
        if (_queryBuilder._updateModel) {
            _queryBuilder.getQueryModel().addColumn(tableSpec, columnName);
            _queryBuilderInputTable.selectColumn(tableSpec, columnName, Boolean.TRUE);
        }
    }
    
    else if (value==Boolean.FALSE) { // A column has been deselected
        
        // Update the query model, if we're not being driven by it
        // Do this before updating the grid, because we use the model to generate sortorder
        if (_queryBuilder._updateModel) {
            _queryBuilder.getQueryModel().removeColumn(tableSpec, columnName); }
        
        // do not remove the whole row, just deselect the output column.
        _queryBuilderInputTable.selectColumn(tableSpec, columnName, Boolean.FALSE);
    }
    
    // We used to update the text query after every event.  That
    // caused degraded performance.  Now, we check whether we've
    // received a real event, or we're generating the graph as a
    // batch operation.  Also, we trigger only on TableModel events,
    // so InputTableMode must explicitly invoke
    if (_queryBuilder._updateText) {
        // An interactive event -- update the text query
        _queryBuilder.generateText();
    }
}