/** 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; } }
public void stateChanged(ChangeEvent ce) { /** Reset format combo box **/ if (((Integer) numOfVars.getValue()).intValue() == 0 || inputTable.getRowCount() == 0) { formatchooser.setSelectedIndex(-1); } /** Decrement number of variables shows by spinner **/ if (((Integer) numOfVars.getValue()).intValue() < inputTable.getRowCount() && inputTable.getRowCount() > 0) { ((JWatVariableInputTableModel) inputTable.getModel()).deleteRow(inputTable.getRowCount() - 1); inputTable.tableChanged(new TableModelEvent(inputTable.getModel())); formatchooser.setSelectedIndex(-1); return; } /** Add a variabile on spinner **/ if (((Integer) numOfVars.getValue()).intValue() > inputTable.getRowCount()) { addVariable(); } }
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); }
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 ); }
/** 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)); }
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); } }); }
private void tMacrosTableChanged(final TableModelEvent evt) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (evt.getType() == TableModelEvent.INSERT) { tMacros.getSelectionModel().setSelectionInterval(evt.getFirstRow(), evt.getFirstRow()); } else if (evt.getType() == TableModelEvent.DELETE) { // try the next row after the deleted one int tableRow = evt.getLastRow(); if (tableRow < tMacros.getModel().getRowCount()) { tMacros.getSelectionModel().setSelectionInterval(tableRow, tableRow); } else { // try the previous row tableRow = evt.getFirstRow() - 1; if (tableRow >= 0) { tMacros.getSelectionModel().setSelectionInterval(tableRow, tableRow); } else { tMacros.getSelectionModel().clearSelection(); } } } } }); }
@Override public void tableChanged(TableModelEvent tme) { int seriesIndex = tme.getFirstRow(); try{ if(tme.getColumn() == 0){ this.setSeriesLabel(seriesIndex, (String) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 0)); }else if(tme.getColumn() == 1){ this.setSeriesColor(seriesIndex, (Color) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 1)); }else if(tme.getColumn() == 2){ this.setSeriesLineWidth(seriesIndex, (Float) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 2)); } } catch (NoSuchSeriesException ex) { System.err.println("Error changing settings for series "+seriesIndex); ex.printStackTrace(); } }
public void tableChanged(TableModelEvent e) { // If a row changed and is a complete entry(both x and y values) // plot the points on the display. if(e.getType() == TableModelEvent.UPDATE) { Object blank = ""; if(e.getFirstRow() != TableModelEvent.HEADER_ROW) { if(tableModel.getValueAt(e.getFirstRow(), 0).equals(blank) == false && tableModel.getValueAt(e.getFirstRow(), 1).equals(blank) == false) { updateAction.actionPerformed(); } } } // If a row is removed, remove it from the display. else if(e.getType() == TableModelEvent.DELETE) { updateAction.actionPerformed(); } }
public void tableChanged(TableModelEvent e) { Object blank = ""; if(e.getType() == TableModelEvent.UPDATE) { if(e.getColumn() == TableModelEvent.ALL_COLUMNS) { ; } else if(e.getFirstRow() == TableModelEvent.HEADER_ROW) { ; } else { if(e.getFirstRow() == numRows-1) { if(getValueAt(e.getFirstRow(), e.getColumn()).equals(blank) == false) { addEmptyRow(); } } } } else if(e.getType() == TableModelEvent.DELETE) { } }
/** * Updates region spinner and region list to reflect current blocking regions */ private void update() { regionsNumSpinner.setValue(new Integer(bd.getRegionKeys().size())); regions.tableChanged(new TableModelEvent(regions.getModel())); regions.repaint(); if (bd.getRegionKeys().size() >= MAX_NUMBER_OF_REGIONS) { addRegion.setEnabled(false); } else { addRegion.setEnabled(true); } // Selects first blocking region if none selected and if present if (regions.getSelectedRow() < 0) { regions.getSelectionModel().setSelectionInterval(0, 0); } }
public void sortByColumn(int column, boolean ascending) { sortBy = column; this.ascending = ascending; sortingColumns.removeAllElements(); sortingColumns.addElement(new Integer(column)); sort(this); super.tableChanged(new TableModelEvent(this)); }
@Override public void tableChanged(TableModelEvent e) { System.out.println("Sorter: tableChanged"); reallocateIndexes(); super.tableChanged(e); }
private void addDataManagers() { addModeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { stopAllCellEditing(); int index = stationData.getTransitionModeListSize(stationKey); stationData.addTransitionMode(stationKey, Defaults.get("transitionModeName") + (index + 1)); OptionTable.tableChanged(new TableModelEvent(OptionTable.getModel())); } }); }
public void propertyChange(PropertyChangeEvent evt) { // We get this event while editing stopCellEditingNoCommit(); if( SwingUtilities.isEventDispatchThread() ) { outline.tableChanged(new TableModelEvent(outline.getModel(), 0, outline.getRowCount())); } else { SwingUtilities.invokeLater( new Runnable() { public void run() { outline.tableChanged(new TableModelEvent(outline.getModel(), 0, outline.getRowCount())); } }); } }
/** * Overridden for efficiency reasons (provides a better calculation of the * dirty region). See * <a href="http://www.objectdefinitions.com/odblog/2009/jtable-setrowheight-causes-slow-repainting/">this page</a> * for a more complete discussion. */ @Override public void tableChanged(TableModelEvent e) { //if just an update, and not a data or structure changed event or an insert or delete, use the fixed row update handling //otherwise call super.tableChanged to let the standard JTable update handling manage it if ( e != null && e.getType() == TableModelEvent.UPDATE && e.getFirstRow() != TableModelEvent.HEADER_ROW && e.getLastRow() != Integer.MAX_VALUE) { handleRowUpdate(e); } else { super.tableChanged(e); } }
/** Overridden to store some data in the event of a recoverable change, * such as the row currently being edited */ @Override public void tableChanged(TableModelEvent e) { boolean ed = isEditing(); lastSelectedRow = ed ? getEditingRow() : getSelectionModel().getAnchorSelectionIndex(); if (ed) { getEditor().stopCellEditing(); } super.tableChanged(e); restoreEditingState(); }
public void actionPerformed(ActionEvent arg0) { if (clusteringTable.getSelectedRow() >= 0) { session.removeClustering(clusteringTable.getSelectedRow()); clusteringTable.tableChanged(new TableModelEvent(clusteringTable.getModel())); //Non ci sono pi� clustering passo a finestra precedente if (session.getListOfClustering().size() == 0) { parent.setLastPanel(WORKLOAD_CLUSTERING_PANEL); parent.setLastPanel(); } } }
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()); }
private void refreshComponents() { if (measureTable != null) { measureTable.tableChanged(new TableModelEvent(measureTable.getModel())); } if (warningPanel != null) { warningPanel.clearCheckVectors(); warningPanel.addCheckVector(classData.getClassKeys()); warningPanel.addCheckVector(stationData.getStationRegionKeysNoSourceSink()); } }
public void setData(StationDefinition sd, ClassDefinition cd, Object stationKey) { stationData = sd; classData = cd; this.stationKey = stationKey; classEditor.setData(cd); if (joinStrategies != null) { joinStrategies.tableChanged(new TableModelEvent(joinStrategies.getModel())); } }
private static String tableModelEventToString (TableModelEvent e) { StringBuilder sb = new StringBuilder(); sb.append ("TableModelEvent "); switch (e.getType()) { case TableModelEvent.INSERT : sb.append ("insert "); break; case TableModelEvent.DELETE : sb.append ("delete "); break; case TableModelEvent.UPDATE : sb.append ("update "); break; default : sb.append("Unknown type ").append(e.getType()); } sb.append ("from "); switch (e.getFirstRow()) { case TableModelEvent.HEADER_ROW : sb.append ("header row "); break; default : sb.append (e.getFirstRow()); sb.append (' '); } sb.append ("to "); sb.append (e.getLastRow()); sb.append (" column "); switch (e.getColumn()) { case TableModelEvent.ALL_COLUMNS : sb.append ("ALL_COLUMNS"); break; default : sb.append (e.getColumn()); } return sb.toString(); }
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); } }
@Override public void tableChanged(TableModelEvent e) { // TODO Auto-generated method stub try{ System.out.println("HI"); } catch(NullPointerException n){ } }
/** * Make the column sorted. Value of columnIndex is in the model coordinates. * <strong>Be careful</strong> with the columnIndes parameter: again, it * is in the <strong>model</strong> coordinates. * @param columnIndex column in ETable column model * @param ascending true means ascending * @param rank value 1 means that this is the most important sorted * column, number 2 means second etc. Value 0 means that this column * is not sorted. */ public void setColumnSorted(int columnIndex, boolean ascending, int rank) { int ii = convertColumnIndexToView(columnIndex); if (ii < 0) { return; } sortable = true; TableColumnModel tcm = getColumnModel(); if (tcm instanceof ETableColumnModel) { ETableColumnModel etcm = (ETableColumnModel)tcm; TableColumn tc = tcm.getColumn(ii); if (tc instanceof ETableColumn) { ETableColumn etc = (ETableColumn)tc; if (! etc.isSortingAllowed()) { return; } SelectedRows selectedRows; int wasSelectedColumn; if (getUpdateSelectionOnSort()) { selectedRows = getSelectedRowsInModel(); wasSelectedColumn = getSelectedColumn(); } else { selectedRows = null; wasSelectedColumn = -1; } etcm.setColumnSorted(etc, ascending, rank); resetPermutation (); ETable.super.tableChanged(new TableModelEvent(getModel(), -1, getRowCount())); if (selectedRows != null) { changeSelectionInModel(selectedRows, wasSelectedColumn); } } } }
public void setData(StationDefinition sd, ClassDefinition cd, Object stationKey) { stationData = sd; classData = cd; this.stationKey = stationKey; classEditor.setData(cd); if (semaphoreStrategies != null) { semaphoreStrategies.tableChanged(new TableModelEvent(semaphoreStrategies.getModel())); } }
@Override public void tableChanged(TableModelEvent e) { super.tableChanged(e); if (e.getType() == TableModelEvent.INSERT) scrollToBottom(); else if (e.getType() == 42) { finishcolor = (finishcolor+1)%2; totalRenderer.setHighlight(finishcolor); seqRenderer.setHighlight(finishcolor); getSelectionModel().setSelectionInterval(e.getFirstRow(), e.getLastRow()); Toolkit.getDefaultToolkit().beep(); } }
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"); } }
private void onTableChage(TableModelEvent e) { int row = e.getFirstRow(); int column = e.getColumn(); MatchRule rule = scan.getMatchRule(row); if (rule == null) { rule = new MatchRule(Pattern.compile("."), 1, "", ScanIssueSeverity.LOW, ScanIssueConfidence.CERTAIN); scan.addMatchRule(rule); } switch (column) { case 0: mCallbacks.printOutput("new pattern: " + (String)model.getValueAt(row, column)); rule.setPattern(Pattern.compile((String)model.getValueAt(row, column))); break; case 1: rule.setMatchGroup((Integer)model.getValueAt(row, column)); break; case 2: rule.setType((String)model.getValueAt(row, column)); break; case 3: rule.setSeverity(ScanIssueSeverity.fromName((String)model.getValueAt(row, column))); break; case 4: rule.setConfidence(ScanIssueConfidence.fromName((String)model.getValueAt(row, column))); break; } }
/** * Add a row to the end of the model. * Notification of the row being added will be generated. * @param object Object to add */ public void addRow(ColumnItem object) { data.add(object); addToKeyLists(object); fireTableChanged(new TableModelEvent(this, getRowCount()-1, getRowCount()-1, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); }
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; }
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); } }); }
private void refreshComponents() { stationTable.tableChanged(new TableModelEvent(stationTable.getModel())); try { stationNumSpinner.setValue(new Integer(data.getStationKeys().size())); } catch (NumberFormatException nfe) { // Nothing to be done } if (data.getStationKeys().size() >= MAX_NUMBER_OF_STATIONS) { addStation.setEnabled(false); } else { addStation.setEnabled(true); } }
private void addVariable() { // Adds new row to table ((JWatVariableInputTableModel) inputTable.getModel()).addNewRow(); // Notify to inputTable changes inputTable.tableChanged(new TableModelEvent(inputTable.getModel())); // Update Spinner numOfVars.setValue(new Integer(inputTable.getRowCount())); // Refresh values in varchooser comboBox reset value to null and clean option panel centerFilterOpt.removeAll(); // Set formatchooser to none formatchooser.setSelectedIndex(-1); }
@Override public void tableChanged(TableModelEvent e) { super.tableChanged(e); if (e == null || e.getFirstRow() == TableModelEvent.HEADER_ROW) { setColumnWidths(); } }