javax.swing.event.TableModelEvent Java Examples
The following examples show how to use
javax.swing.event.TableModelEvent.
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: CorrelationTableController.java From OpenDA with GNU Lesser General Public License v3.0 | 7 votes |
/** * 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(); } }); }
Example #2
Source File: ProprietiesListener.java From niftyeditor with Apache License 2.0 | 6 votes |
@Override public void tableChanged(TableModelEvent e) { if (e.getType() == TableModelEvent.UPDATE) { EditAttributeCommand command = CommandProcessor.getInstance().getCommand(EditAttributeCommand.class); RemoveAttributeCommand removecommand = CommandProcessor.getInstance().getCommand(RemoveAttributeCommand.class); TableModel mod = (TableModel) e.getSource(); String proName = (String) mod.getValueAt(e.getLastRow(), 0); String proVal = (String) mod.getValueAt(e.getLastRow(), 1); if (proName != null && !proName.isEmpty()) { try{ if (proVal == null || proVal.isEmpty()) { removecommand.setAttributeKey(proName); CommandProcessor.getInstance().excuteCommand(removecommand); } else { command.setAttribute(proName); command.setValue(proVal); CommandProcessor.getInstance().excuteCommand(command); } }catch(Exception ex){ ex.printStackTrace(); JOptionPane.showMessageDialog(null,"Can't set the attribute. " + ex.getMessage()); } } } }
Example #3
Source File: ArrangementMatchingRulesControl.java From consulo with Apache License 2.0 | 6 votes |
private void onTableChange(@Nonnull TableModelEvent e) { final int signum; switch (e.getType()) { case TableModelEvent.INSERT: signum = 1; break; case TableModelEvent.DELETE: signum = -1; for (int i = e.getLastRow(); i >= e.getFirstRow(); i--) { myComponents.remove(i); } break; default: return; } int shift = Math.abs(e.getFirstRow() - e.getLastRow() + 1) * signum; myComponents.shiftKeys(e.getFirstRow(), shift); if (myRowUnderMouse >= e.getFirstRow()) { myRowUnderMouse = -1; } if (getModel().getSize() > 0) { repaintRows(0, getModel().getSize() - 1, false); } }
Example #4
Source File: PropertiesTableModel.java From netbeans with Apache License 2.0 | 6 votes |
/** Fires a TableModelEvent - change of one column */ public void fireTableColumnChanged(int index) { int columnModelIndex = index; // reset the header value as well Object list[] = listenerList.getListenerList(); for (int i = 0; i < list.length; i++) { if (list[i] instanceof JTable) { JTable jt = (JTable)list[i]; try { TableColumn column = jt.getColumnModel().getColumn(index); columnModelIndex = column.getModelIndex(); column.setHeaderValue(jt.getModel().getColumnName(columnModelIndex)); } catch (ArrayIndexOutOfBoundsException abe) { // only catch exception } jt.getTableHeader().repaint(); } } fireTableChanged(new TableModelEvent(this, 0, getRowCount() - 1, columnModelIndex)); }
Example #5
Source File: Model.java From netbeans with Apache License 2.0 | 6 votes |
private void showSubTabs( int row, int col ) { this.selCol = col; this.selRow = row; int newRowCount = rowCount; selectedTopItem = null; if( selCol >= 0 ) { selectedTopItem = selCol == documentCol ? documents[selRow] : views[selRow]; if( selectedTopItem.hasSubItems() ) { newRowCount = Math.max( rowCount, selectedTopItem.getActivatableSubItems().length+selRow); } else { selCol = -1; selRow = -1; selectedTopItem = null; } } if( documentCol >= 0 ) fireTableChanged( new TableModelEvent( this, 0, getRowCount(), documentCol+1 ) ); if( viewCol >= 0 ) fireTableChanged( new TableModelEvent( this, 0, getRowCount(), viewCol+1 ) ); int rowDelta = newRowCount - getRowCount(); extraRows = newRowCount-rowCount; if( rowDelta < 0 ) fireTableRowsDeleted( rowCount, rowCount-rowDelta ); else if( rowDelta > 0 ) fireTableRowsInserted( rowCount, rowCount+rowDelta ); }
Example #6
Source File: MultiImageSVGEditor.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void setImage(com.codename1.ui.Image img) { com.codename1.impl.javase.SVG s = (com.codename1.impl.javase.SVG)img.getSVGDocument(); if(s.getDpis() != null) { for(int iter = 0 ; iter < dpiTable.getRowCount() ; iter++) { dpiTable.setValueAt(Boolean.FALSE, iter, 1); } for(int iter = 0 ; iter < s.getDpis().length ; iter++) { int row = getDPIRow(s.getDpis()[iter]); dpiTable.setValueAt(Boolean.TRUE, row, 1); dpiTable.setValueAt(s.getWidthForDPI()[iter], row, 2); dpiTable.setValueAt(s.getHeightForDPI()[iter], row, 3); } } renderer = new CodenameOneImageRenderer(img); preview.removeAll(); preview.add(BorderLayout.CENTER, renderer); preview.revalidate(); dpiTable.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent e) { updateSVGImage(); } }); }
Example #7
Source File: TableSorter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void newDataAvailable(TableModelEvent e) { super.newDataAvailable(e); invertedIndex = new int[getRowCount()]; for (int i = 0; i < invertedIndex.length; i++) { invertedIndex[i] = i; } sort(this.sortColumn, this.ascending); }
Example #8
Source File: XMBeanAttributes.java From hottub with GNU General Public License v2.0 | 5 votes |
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: JTableInGlassPaneOverlapping.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@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; }
Example #10
Source File: JBComboBoxTableCellEditorComponent.java From consulo with Apache License 2.0 | 5 votes |
private void initAndShowPopup() { myList.removeAll(); final Rectangle rect = myTable.getCellRect(myRow, myColumn, true); final Point point = new Point(rect.x, rect.y); myList.setModel(JBList.createDefaultListModel(myOptions)); if (myRenderer != null) { myList.setCellRenderer(myRenderer); } JBPopupFactory.getInstance() .createListPopupBuilder(myList) .setItemChoosenCallback(new Runnable() { @Override public void run() { final ActionEvent event = new ActionEvent(myList, ActionEvent.ACTION_PERFORMED, "elementChosen"); for (ActionListener listener : myListeners) { listener.actionPerformed(event); } myValue = myList.getSelectedValue(); TableUtil.stopEditing(myTable); myTable.setValueAt(myValue, myRow, myColumn); // on Mac getCellEditorValue() called before myValue is set. myTable.tableChanged(new TableModelEvent(myTable.getModel(), myRow)); // force repaint } }) .setCancelCallback(new Computable<Boolean>() { @Override public Boolean compute() { TableUtil.stopEditing(myTable); return true; } }) .createPopup() .show(new RelativePoint(myTable, point)); }
Example #11
Source File: PanelSupportedFrameworksVisual.java From netbeans with Apache License 2.0 | 5 votes |
public void tableChanged(TableModelEvent e) { FrameworksTableModel model = (FrameworksTableModel) jTableFrameworks.getModel(); if (jTableFrameworks.getSelectedRow() == -1) { return; } FrameworkModelItem item = model.getItem(jTableFrameworks.getSelectedRow()); WebFrameworkProvider framework = item.getFramework(); setConfigPanel(framework, item); }
Example #12
Source File: PumpCalibration.java From NanoJ-Fluidics with MIT License | 5 votes |
@Override public void tableChanged(TableModelEvent e) { if (e.getType() == TableModelEvent.UPDATE || e.getType() == TableModelEvent.INSERT ) { if (!editing) { double diameter; double maxFlowRate; double minFlowRate; diameter = Double.parseDouble((String) tableModel.getValueAt(e.getFirstRow(),DIAMETER)); maxFlowRate = Double.parseDouble((String) tableModel.getValueAt(e.getFirstRow(),MAX_FLOW_RATE)); minFlowRate = Double.parseDouble((String) tableModel.getValueAt(e.getFirstRow(),MIN_FLOW_RATE)); String name = (String) tableModel.getValueAt(e.getFirstRow(),NAME); String subPump = (String) tableModel.getValueAt(e.getFirstRow(),SUB_PUMP); String port = (String) tableModel.getValueAt(e.getFirstRow(),PORT); pumpManager.updateReferenceRate(e.getFirstRow(),new double[] {diameter,maxFlowRate,minFlowRate}); prefs.putDouble(CAL+DIAMETER+name+subPump+port,diameter); prefs.putDouble(CAL+MAX_FLOW_RATE+name+subPump+port,maxFlowRate); prefs.putDouble(CAL+MIN_FLOW_RATE+name+subPump+port,minFlowRate); gui.log.message("Updated calibration of " + name + ", " + subPump + " on port " + port + " to: " + diameter + ", " + maxFlowRate + ", " + minFlowRate); } } }
Example #13
Source File: VTFunctionAssociationProvider.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void tableChanged(TableModelEvent e) { StringBuffer buffy = new StringBuffer(); String sessionName = controller.getVersionTrackingSessionName(); buffy.append("[Session: ").append(sessionName).append("] - "); getTableFilterString("Source Functions", sourceFunctionsModel, buffy); buffy.append(" / "); getTableFilterString("Destination Functions", destinationFunctionsModel, buffy); setSubTitle(buffy.toString()); }
Example #14
Source File: FieldValuesPaneProvider.java From lucene-solr with Apache License 2.0 | 5 votes |
void tableDataChenged(TableModelEvent e) { int row = e.getFirstRow(); int col = e.getColumn(); if (col == FieldsTableModel.Column.LOAD.getIndex()) { boolean isLoad = (boolean) fieldsTable.getModel().getValueAt(row, col); if (!isLoad) { loadAllCB.setSelected(false); } } }
Example #15
Source File: TableSorter.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void sortByColumn(int column, boolean ascending) { this.ascending = ascending; sortingColumns.clear(); sortingColumns.add(new Integer(column)); sort(this); super.tableChanged(new TableModelEvent(this)); }
Example #16
Source File: OTRPrefPanel.java From Spark with Apache License 2.0 | 5 votes |
private void loadRemoteKeys() { for (RosterEntry entry : Roster.getInstanceFor( SparkManager.getConnection() ).getEntries()) { SessionID curSession = new SessionID(SparkManager.getConnection().getUser(), entry.getUser(), "Scytale"); String remoteKey = _keyManager.getRemoteFingerprint(curSession); if (remoteKey != null) { boolean isVerified = _keyManager.isVerified(curSession); _keytable.addEntry(entry.getUser(), remoteKey, isVerified); } } _keytable.addTableChangeListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { int col = e.getColumn(); int row = e.getFirstRow(); if (col == 2) { boolean selection = (Boolean) _keytable.getValueAt(row, col); String JID = (String) _keytable.getValueAt(row, 0); SessionID curSelectedSession = new SessionID(SparkManager.getConnection().getUser(), JID, "Scytale"); if (!selection) { _keyManager.verify(curSelectedSession); } else { _keyManager.unverify(curSelectedSession); } } } }); }
Example #17
Source File: PropertyEditorPanel.java From netbeans with Apache License 2.0 | 5 votes |
public PropertyEditorPanel(Properties initalValue, boolean editable) { initComponents(); this.value = initalValue; this.editable = editable; propertyTable.putClientProperty( "terminateEditOnFocusLost", Boolean.TRUE); //NOI18N updateTableFromEditor(); final TableModel tm = propertyTable.getModel(); tm.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent tme) { synchronized (PropertyEditorPanel.this) { if (updateing) { return; } updateing = true; Properties p = new Properties(); for (int i = 0; i < tm.getRowCount(); i++) { p.setProperty((String) tm.getValueAt(i, 0), (String) tm.getValueAt(i, 1)); } Properties oldValue = value; value = p; firePropertyChange(PROP_VALUE, oldValue, value); updateing = false; } } }); propertyTable.getSelectionModel().addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent lse) { updateRemoveButtonSensible(); } }); updateAddButtonSensible(); updateRemoveButtonSensible(); }
Example #18
Source File: GroupedTableModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected void fireTableModelEvent( final TableModelEvent event ) { final TableModelListener[] listeners = eventListenerList.getListeners( TableModelListener.class ); for ( int i = 0; i < listeners.length; i++ ) { final TableModelListener listener = listeners[ i ]; listener.tableChanged( event ); } }
Example #19
Source File: InfoPanel.java From WorldPainter with GNU General Public License v3.0 | 5 votes |
boolean clear() { if (! rows.isEmpty()) { rows.clear(); layerIndices.clear(); TableModelEvent event = new TableModelEvent(this); for (TableModelListener listener: listeners) { listener.tableChanged(event); } return true; } else { return false; } }
Example #20
Source File: TableSorter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void tableChanged(TableModelEvent e) { System.out.println("Sorter: tableChanged"); reallocateIndexes(); super.tableChanged(e); }
Example #21
Source File: CsvTableEditorSwing.java From intellij-csv-validator with Apache License 2.0 | 5 votes |
public void updateRowHeights(TableModelEvent e) { final int first; final int last; if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) { first = 0; last = this.getTable().getRowCount(); } else { first = e.getFirstRow(); last = e.getLastRow() + 1; } SwingUtilities.invokeLater(() -> { updateRowHeights(first, last); }); }
Example #22
Source File: DataToolStatsTable.java From osp with GNU General Public License v3.0 | 5 votes |
/** * Refresh the data display in this table. */ public void refreshTable() { Runnable refresh = new Runnable() { public synchronized void run() { tableChanged(new TableModelEvent(statsModel, TableModelEvent.HEADER_ROW)); refreshCellWidths(); } }; if(SwingUtilities.isEventDispatchThread()) { refresh.run(); } else { SwingUtilities.invokeLater(refresh); } }
Example #23
Source File: TableSorter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public void tableChanged(TableModelEvent e) { System.out.println("Sorter: tableChanged"); reallocateIndexes(); super.tableChanged(e); }
Example #24
Source File: SortableAndSearchableWrapperTableModel.java From meka with GNU General Public License v3.0 | 5 votes |
/** * This fine grain notification tells listeners the exact range of cells, * rows, or columns that changed. * * @param e the event */ public void tableChanged(TableModelEvent e) { initializeSortIndices(); if (isSorted()) sort(m_SortColumn, m_SortAscending); fireTableChanged(e); }
Example #25
Source File: ClassesInfoPanel.java From hprof-tools with MIT License | 5 votes |
@Override public void tableChanged(TableModelEvent event) { if (event.getFirstRow() == 0 && event.getColumn() == 0) { String query = dataTable.getModel().getValueAt(0, 0).toString(); presenter.onQueryByName(query); } }
Example #26
Source File: ConditionsTableAdapter.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
@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 #27
Source File: TableSorter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public void newDataAvailable(TableModelEvent e) { super.newDataAvailable(e); invertedIndex = new int[getRowCount()]; for (int i = 0; i < invertedIndex.length; i++) { invertedIndex[i] = i; } sort(this.sortColumn, this.ascending); }
Example #28
Source File: CorrelationTableController.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
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); } }); }
Example #29
Source File: InsertRecordDialog.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void tableChanged(TableModelEvent e) { if (SwingUtilities.isEventDispatchThread()) { refreshSQL(); } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { refreshSQL(); } }); } }
Example #30
Source File: TableHeaderPainter.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Installs language listeners. */ protected void installLanguageListeners () { languageSensitive = new LanguageListener () { @Override public void languageChanged ( @NotNull final Language oldLanguage, @NotNull final Language newLanguage ) { if ( isLanguageSensitive () ) { final JTable table = component.getTable (); if ( table != null && table.getModel () instanceof AbstractTableModel ) { // Calling public model methods when possible final AbstractTableModel tableModel = ( AbstractTableModel ) table.getModel (); tableModel.fireTableRowsUpdated ( TableModelEvent.HEADER_ROW, TableModelEvent.HEADER_ROW ); } else { // Simply repainting table header component.repaint (); } } } }; UILanguageManager.addLanguageListener ( component, languageSensitive ); }