Java 类javax.swing.event.TableModelListener 实例源码

项目:marathonv5    文件:SwingInterop.java   
private BarChart createBarChart() {
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(tableModel.getColumnNames()));
    xAxis.setLabel("Year");

    double tickUnit = tableModel.getTickUnit();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickUnit(tickUnit);
    yAxis.setLabel("Units Sold");

    final BarChart chart = new BarChart(xAxis, yAxis, tableModel.getBarChartData());
    tableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                final int row = e.getFirstRow();
                final int column = e.getColumn();
                final Object value = ((SampleTableModel) e.getSource()).getValueAt(row, column);

                Platform.runLater(new Runnable() {
                    public void run() {
                        XYChart.Series<String, Number> s = (XYChart.Series<String, Number>) chart.getData().get(row);
                        BarChart.Data data = s.getData().get(column);
                        data.setYValue(value);
                    }
                });
            }
        }
    });
    return chart;
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Fires multiple table model events, setting the inMultiEvent flag
 * as appropriate. */
private void fireTableChange (TableModelEvent[] e) {
    //Event may be null for offscreen info, etc.
    if (e == null || e.length==0) {
        return;
    }

    TableModelListener[] listeners = getTableModelListeners();
    inMultiEvent = e.length > 1;
    //System.err.println("fireTableChange("+Arrays.toString(e)+")");
    try {
        for (int i=0; i < e.length; i++) {
            if (i == e.length-1) {
                inMultiEvent = false;
            }
            fireTableChange (e[i], listeners);
        }
    } finally {
        inMultiEvent = false;
    }
}
项目:rapidminer    文件:RowNumberTable.java   
@Override
public void propertyChange(PropertyChangeEvent evt) {
    // Keep the row table in sync with the main table
    if ("rowHeight".equals(evt.getPropertyName())) {
        repaint();
    }

    if ("model".equals(evt.getPropertyName())) {
        contentTable.getModel().addTableModelListener(new TableModelListener() {

            @Override
            public void tableChanged(TableModelEvent e) {
                revalidate();
            }
        });
        revalidate();
    }
}
项目:OpenDA    文件:VariationPerParameterTableController.java   
private void setupTableModelListener() {
//add listener which responds to tableChanged that is fired
//by variationPerParameterTableModel.setValueAt().
      this.variationPerParameterTableModel.addTableModelListener(new TableModelListener() {
        public void tableChanged(TableModelEvent e) {
            //update currentVariationFunctionContext.
            Variation variationFunction = variationPerParameterTableModel.getUncertaintiesObject()
                .getVariationFunction(variationPerParameterTableModel.getCurrentRow());
            setCurrentVariationFunctionContext(new VariationFunctionContext(variationFunction));

            //update panel.
            updateVariationPerParameterSidePanel();

            //select row of currentVariationFunctionContext.
            int selectedRowIndex = variationPerParameterTableModel.getCurrentRow();
            setSelectedRow(selectedRowIndex);
        }
      });
  }
项目:OpenDA    文件:CorrelationTableController.java   
/**
    * Update the Correlation model Parameters Table.
    */
private void updateCorrelationModelParametersTable() {
    // Populate the correlation model parameters table.
    FunctionParameterTableModel parameterTableModel = new FunctionParameterTableModel(this.currentAutoCorrelationFunctionContext);

    this.parentController.getMainPanel().getAutoCorrelationParameterAndGraphPanel().getParametersTable()
            .setModel(parameterTableModel);

    //setup cell editor.
    TableColumn columnValue = parentController.getMainPanel().getAutoCorrelationParameterAndGraphPanel()
        .getParametersTable().getColumnModel().getColumn(FunctionParameterTableModel.COLUMN_VALUE);
    columnValue.setCellEditor(new TextCellEditor());

    parameterTableModel.addTableModelListener(new TableModelListener() {
        public void tableChanged(TableModelEvent e) {
            updateCorrelationModelGraph();
        }
    });
}
项目:OpenDA    文件:PDFDefinitionTableController.java   
/**
    * Update the PDFDefinition Parameters Table.
    */
private void updatePDFDefinitionParametersTable() {
    // Populate the correlation model parameters table.
        FunctionParameterTableModel parameterTableModel;
       if (this.currentPdfContext != null && this.currentPdfContext.getPdfObject() != null) {
        parameterTableModel = new FunctionParameterTableModel(this.currentPdfContext);

        parentController.getMainPanel().getPdfParameterAndGraphPanel().getParametersTable()
            .setModel(parameterTableModel);

        //setup cell editor.
        TableColumn columnValue = parentController.getMainPanel().getPdfParameterAndGraphPanel()
            .getParametersTable().getColumnModel().getColumn(FunctionParameterTableModel.COLUMN_VALUE);
        columnValue.setCellEditor(new TextCellEditor());

        parameterTableModel.addTableModelListener(new TableModelListener() {
            public void tableChanged(TableModelEvent e) {
                updatePDFDefinitionGraph();
            }
        });
       }
}
项目:JavaGraph    文件:GraphEditorTab.java   
private PropertiesTable getPropertiesPanel() {
    PropertiesTable result = this.propertiesPanel;
    if (result == null) {
        this.propertiesPanel = result = new PropertiesTable(GraphProperties.Key.class, true);
        result.setName("Properties");
        result.setBackground(JAttr.EDITOR_BACKGROUND);
        result.setProperties(GraphInfo.getProperties(getGraph()));
        // add the listener after initialising the properties, to avoid needless refreshes
        result.getModel()
            .addTableModelListener(new TableModelListener() {
                @Override
                public void tableChanged(TableModelEvent e) {
                    if (GraphEditorTab.this.listenToPropertiesPanel) {
                        changeProperties(GraphEditorTab.this.propertiesPanel.getProperties(),
                            false);
                        setDirty(false);
                    }
                }
            });
        this.listenToPropertiesPanel = true;
    }
    return result;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:JtableUtils.java   
/**
 * Delete a single column from the table model
 *
 * @param table target table
 * @param col target column
 * @deprecated
 */
static void deletecol(JTable table, int col) {
    DefaultTableModel tmodel = (DefaultTableModel) table.getModel();
    DefaultTableModel tmodel1 = new DefaultTableModel();
    TableModelListener[] listeners = tmodel.getTableModelListeners();

    Vector<?> v = tmodel.getDataVector();
    Vector<?> v1 = newvector(v, col);
    tmodel1.setDataVector(v1, getColumnIdentifiersremovecol(table, col));
    table.setModel(tmodel1);
    for (TableModelListener l : listeners) {
        tmodel1.addTableModelListener(l);
    }
}
项目:incubator-netbeans    文件:OutlineView218096Test.java   
public void test218096() {
    String[][] nodesDesc = new String[][]{
        new String[]{"a", "b", "c"},
        new String[]{"D", "E", "F"},
        new String[]{"g", "h", "i"}};
    Node rootNode = new TestNode(new StringListKeys(nodesDesc), "root");
    OutlineViewComponent comp = new OutlineViewComponent(rootNode);
    Node[] rootChildNodes = rootNode.getChildren().getNodes();
    assertEquals(3, rootChildNodes.length);
    Node[] firstNodeChildren = rootChildNodes[0].getChildren().getNodes();
    assertEquals(3, firstNodeChildren.length);
    comp.view.expandNode(rootChildNodes[0]);
    assertEquals(6, comp.view.getOutline().getRowCount());
    VisualizerNode dParentVisNode = (VisualizerNode) comp.view.getOutline()
            .getModel().getValueAt(4, 0);
    assertEquals("Dparent", dParentVisNode.getDisplayName());
    TestNode.MarkedCookie mc = rootChildNodes[1].getLookup().lookup(
            TestNode.MarkedCookie.class);
    final AtomicBoolean notifiedAboutChange = new AtomicBoolean(false);
    comp.view.getOutline().getModel().addTableModelListener(
            new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (e.getFirstRow() <= 4 && e.getLastRow() >= 4) {
                notifiedAboutChange.set(true);
            }
        }
    });
    mc.setMarked(true);
    assertTrue("Table model should be notified about name change",
            notifiedAboutChange.get());
}
项目:incubator-netbeans    文件:RunPortBindingsVisual.java   
/**
 * Creates new form RunNetworkVisual
 */
public RunPortBindingsVisual(DockerImageDetail info) {
    initComponents();
    this.info = info;

    addExposedButton.setEnabled(info != null && !info.getExposedPorts().isEmpty());
    portMappingTable.setModel(model);
    UiUtils.configureRowHeight(portMappingTable);

    TableColumn typeColumn = portMappingTable.getColumnModel().getColumn(0);
    JComboBox typeCombo = new JComboBox(ExposedPort.Type.values());
    typeColumn.setCellEditor(new DefaultCellEditor(typeCombo));
    typeColumn.setPreferredWidth(typeColumn.getPreferredWidth() / 2);

    TableColumn portColumn = portMappingTable.getColumnModel().getColumn(2);
    portColumn.setCellRenderer(new CellRenderer("<random>", false));

    TableColumn addressColumn = portMappingTable.getColumnModel().getColumn(3);
    JComboBox addressCombo = new JComboBox(UiUtils.getAddresses(false, false).toArray());
    addressCombo.setEditable(true);
    addressColumn.setCellEditor(new DefaultCellEditor(addressCombo));
    addressColumn.setCellRenderer(new CellRenderer("<any>", false));
    addressColumn.setPreferredWidth(addressColumn.getPreferredWidth() * 2);

    portMappingTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    model.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            changeSupport.fireChange();
        }
    });
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Fire a table change to the list of listeners supplied. The event should
 * already have its source set to be the OutlineModel we're proxying for. */
private void fireTableChange (TableModelEvent e, TableModelListener[] listeners) {
    //Event may be null for offscreen info, etc.
    if (e == null) {
        return;
    }

    assert (e.getSource() == getModel());

    log ("fireTableChange", e);

    for (int i=0; i < listeners.length; i++) {
        listeners[i].tableChanged(e);
    }
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Fetch an array of the currently registered table model listeners */
private TableModelListener[] getTableModelListeners() {
    TableModelListener[] listeners;
    synchronized (this) {
        listeners = new TableModelListener[
            tableListeners.size()];

        listeners = tableListeners.toArray(listeners);
    }
    return listeners;
}
项目:incubator-netbeans    文件:ProxyTableModel.java   
private void fire (TableModelEvent e) {
    TableModelListener[] l;
    synchronized (this) {
        l = new TableModelListener[listeners.size()];
        l = listeners.toArray (l);
    }
    for (int i=0; i < l.length; i++) {
        l[i].tableChanged(e);
    }
}
项目:incubator-netbeans    文件:TabTable.java   
protected TabTable( TabTableModel tableModel, int orientation ) {
    super( tableModel );
    this.orientation = orientation;
    getModel().addTableModelListener( new TableModelListener() {
        @Override
        public void tableChanged( TableModelEvent e ) {
            if( e.getFirstRow() != TableModelEvent.HEADER_ROW )
                adjustColumnWidths();
        }
    });

    configure();
}
项目:incubator-netbeans    文件:SwingInterop.java   
private BarChart createBarChart() {
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(tableModel.getColumnNames()));
    xAxis.setLabel("Year");

    double tickUnit = tableModel.getTickUnit();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickUnit(tickUnit);
    yAxis.setLabel("Units Sold");

    final BarChart chart = new BarChart(xAxis, yAxis, tableModel.getBarChartData());
    tableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                final int row = e.getFirstRow();
                final int column = e.getColumn();
                final Object value = ((SampleTableModel) e.getSource()).getValueAt(row, column);

                Platform.runLater(new Runnable() {
                    public void run() {
                        XYChart.Series<String, Number> s = (XYChart.Series<String, Number>) chart.getData().get(row);
                        BarChart.Data data = s.getData().get(column);
                        data.setYValue(value);
                    }
                });
            }
        }
    });
    return chart;
}
项目:incubator-netbeans    文件:FmtImports.java   
private void separateStaticImportsCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_separateStaticImportsCheckBoxActionPerformed
    TableModel oldModel = importLayoutTable.getModel();
    TableModel newModel = (DefaultTableModel)createTableModel(importGroupsOrder, preferences);
    importLayoutTable.setModel(newModel);
    setImportLayoutTableColumnsWidth();
    for (TableModelListener l : ((DefaultTableModel)oldModel).getTableModelListeners()) {
        oldModel.removeTableModelListener(l);
        newModel.addTableModelListener(l);
        l.tableChanged(null);
    }
}
项目:rapidminer    文件:TablePanel.java   
/**
 * Creates a new {@link TablePanel} instance.
 *
 * @param model
 * @param useScrollPane
 *            if set to <code>true</code>, will add a scrollpane around the GUI.
 * @param hideUnavailableContentAssist
 *            if <code>true</code>, the content assist button will be hidden if no content
 *            assist is available for the given field
 */
public TablePanel(final TablePanelModel model, boolean useScrollPane, boolean hideUnavailableContentAssist) {
    this.mapOfComponents = new HashMap<>();
    this.useScrollPane = useScrollPane;
    this.hideUnavailableContentAssist = hideUnavailableContentAssist;
    this.listener = new TableModelListener() {

        @Override
        public void tableChanged(TableModelEvent e) {
            // table structure changed, re-create it
            if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
                createGUI();
            } else {
                updateComponent(e.getFirstRow(), e.getColumn());
            }
        }
    };

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            initGUI();
            setModel(model);
        }

    });
}
项目:marathonv5    文件:SwingInterop.java   
private BarChart createBarChart() {
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(tableModel.getColumnNames()));
    xAxis.setLabel("Year");

    double tickUnit = tableModel.getTickUnit();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickUnit(tickUnit);
    yAxis.setLabel("Units Sold");

    final BarChart chart = new BarChart(xAxis, yAxis, tableModel.getBarChartData());
    tableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                final int row = e.getFirstRow();
                final int column = e.getColumn();
                final Object value = ((SampleTableModel) e.getSource()).getValueAt(row, column);

                Platform.runLater(new Runnable() {
                    public void run() {
                        XYChart.Series<String, Number> s = (XYChart.Series<String, Number>) chart.getData().get(row);
                        BarChart.Data data = s.getData().get(column);
                        data.setYValue(value);
                    }
                });
            }
        }
    });
    return chart;
}
项目:OpenDA    文件:CorrelationTableController.java   
private void setupTableModelListener() {
//add listener which responds to tableChanged that is fired
//by correlationTableModel.setValueAt().
      this.correlationTableModel.addTableModelListener(new TableModelListener() {
        public void tableChanged(TableModelEvent e) {
            //(re)select row after setValueAt was called.

            //select row of currentCorrelationContext.
            int selectedRowIndex = correlationTableModel.getCurrentRow();
            setSelectedRow(selectedRowIndex);
        }
      });
  }
项目:KernelHive    文件:SourceFilePropertiesDialog.java   
@Override
public void setValueAt(final Object aValue, final int rowIndex,
        final int columnIndex) {
    if (rowIndex < dynamicArray.size() && columnIndex < 2) {
        dynamicArray.get(rowIndex)[columnIndex] = aValue;
    }
    for (final TableModelListener l : getTableModelListeners()) {
        l.tableChanged(new TableModelEvent(this, rowIndex, rowIndex,
                columnIndex, TableModelEvent.UPDATE));
    }
}
项目:KernelHive    文件:NodePropertiesDialog.java   
@Override
public void setValueAt(final Object aValue, final int rowIndex,
        final int columnIndex) {
    if (rowIndex < dynamicArray.size() && columnIndex < 2) {
        dynamicArray.get(rowIndex)[columnIndex] = aValue;
    }
    for (final TableModelListener l : getTableModelListeners()) {
        l.tableChanged(new TableModelEvent(this, rowIndex, rowIndex,
                columnIndex, TableModelEvent.UPDATE));
    }
}
项目:KernelHive    文件:WorkflowViewerPanel.java   
@Override
public void setValueAt(final Object aValue, final int rowIndex,
        final int columnIndex) {
    if (rowIndex < data.size() && columnIndex < columnSize) {
        data.get(rowIndex)[columnIndex] = aValue;
    }
    for (final TableModelListener l : this.getTableModelListeners()) {
        l.tableChanged(new TableModelEvent(this, rowIndex, rowIndex,
                columnIndex, TableModelEvent.UPDATE));
    }
}
项目:JavaGraph    文件:PropertiesTable.java   
/** Creates an instance of {@link TableModel}. */
private TableModel getTableModel() {
    if (this.tableModel == null) {
        this.tableModel = new TableModel();
        this.tableModel.addTableModelListener(new TableModelListener() {
            @Override
            public void tableChanged(TableModelEvent e) {
                setChanged(true);
            }
        });
    }
    return this.tableModel;
}
项目:openjdk-jdk10    文件:JTableInGlassPaneOverlapping.java   
@Override
protected JComponent getSwingComponent() {
    // Create columns names
    String columnNames[] = {"Column 1", "Column 2", "Column 3"};

    // Create some data
    String dataValues[][] = {
        {"12", "234", "67"},
        {"-123", "43", "853"},
        {"93", "89.2", "109"},
        {"279", "9033", "3092"},
        {"12", "234", "67"},
        {"-123", "43", "853"},
        {"93", "89.2", "109"},
        {"279", "9033", "3092"},
        {"12", "234", "67"},
        {"-123", "43", "853"},
        {"93", "89.2", "109"},
        {"279", "9033", "3092"},
        {"12", "234", "67"},
        {"-123", "43", "853"},
        {"93", "89.2", "109"},
        {"279", "9033", "3092"}
    };

    // Create a new table instance
    JTable jt = new JTable(dataValues, columnNames);
    jt.getModel().addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            System.err.println("table changed");
        }
    });
    return jt;
}
项目:parabuild-ci    文件:DefaultSortedTableModel.java   
public void removeTableModelListener( TableModelListener tml )
{
    if (baseModel != null)
        return;

    baseModel.removeTableModelListener(tml);
}
项目:parabuild-ci    文件:DefaultSortedTableModel.java   
public TableModelListener[] getTableModelListeners()
{
    if (baseModel == null)
        return new TableModelListener[0];

    return baseModel.getTableModelListeners();
}
项目:incubator-netbeans    文件:NbiTreeTableModel.java   
public void addTableModelListener(TableModelListener listener) {
    synchronized (listeners) {
        listeners.add(listener);
    }
}
项目:incubator-netbeans    文件:NbiTreeTableModel.java   
public void removeTableModelListener(TableModelListener listener) {
    synchronized (listeners) {
        listeners.remove(listener);
    }
}
项目:incubator-netbeans    文件:NbiTreeTableModel.java   
private void fireTableDataChanged(TableModelEvent event) {
    for (TableModelListener listener: listeners.toArray(new TableModelListener[0])) {
        listener.tableChanged(event);
    }
}
项目:incubator-netbeans    文件:ConfigFilesUIs.java   
@Override
public void addTableModelListener(TableModelListener l) {
}
项目:incubator-netbeans    文件:ConfigFilesUIs.java   
@Override
public void removeTableModelListener(TableModelListener l) {
}
项目:incubator-netbeans    文件:SpringXMLConfigGroupVisual.java   
public void addTableModelListener(TableModelListener l) {
}
项目:incubator-netbeans    文件:SpringXMLConfigGroupVisual.java   
public void removeTableModelListener(TableModelListener l) {
}
项目:incubator-netbeans    文件:DefaultOutlineModel.java   
@Override
public final synchronized void addTableModelListener(TableModelListener l) {
    broadcaster.addTableModelListener (l);
}
项目:incubator-netbeans    文件:DefaultOutlineModel.java   
@Override
public final synchronized void removeTableModelListener(TableModelListener l) {
    broadcaster.removeTableModelListener(l);
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ImageORObject.java   
@JsonIgnore
@Override
public void addTableModelListener(TableModelListener tl) {
    super.addTableModelListener(tl);
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Remove a table model listener.  */
public synchronized void removeTableModelListener(TableModelListener l) {
    tableListeners.remove(l);
}
项目:incubator-netbeans    文件:ProxyTableModel.java   
@Override
public synchronized void removeTableModelListener(TableModelListener l) {
    listeners.remove(l);
}
项目:scorekeeperfrontend    文件:TimerModel.java   
@Override
public void removeTableModelListener(TableModelListener l)
{
    tableListeners.remove(l);
}