Java 8 TableModelEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TableModelEvent class.

This code example shows how to use the following methods:getColumn, getFirstRow, getLastRow, getType
    } 
 
    public void tableChanged(final TableModelEvent e)
    { 
      recomputeRowCount(); 
      if (e.getFirstRow() == 0 && e.getLastRow() == Integer.MAX_VALUE)
      { 
        fireTableModelEvent(new TableModelEvent(GroupedTableModel.this,
            e.getFirstRow(), e.getLastRow(), e.getColumn(), e.getType()));
        return; 
      } 
 
      final TableModelEvent event = new TableModelEvent(GroupedTableModel.this,
          mapFromModel(e.getFirstRow()), mapFromModel(e.getLastRow()), e.getColumn(), e.getType());
      fireTableModelEvent(event);
    } 
  } 
 
  private EventListenerList eventListenerList;
  private GroupingModel parent;
6
CodeRank
This code example shows how to use the following methods:getColumn, getFirstRow, getLastRow, getType
		fireTableDataChanged(); 
	} 
	 
	public void tableChanged(final TableModelEvent e) {
		super.tableChanged(e);
		fireTableChanged(new TableModelEvent(this, e.getFirstRow(), e.getLastRow(), e.getColumn(), e.getType()));
	} 
} 
6
CodeRank
This code example shows how to use the following methods:
    public void sortByColumn(int column, boolean ascending) {
        this.ascending = ascending;
        sortingColumns.removeAllElements();
        sortingColumns.addElement(Integer.valueOf(column));
        sort(this);
        super.tableChanged(new TableModelEvent(this));
    } 
 
    // There is no-where else to put this. 
    // Add a mouse listener to the Table to trigger a table sort 
    // when a column heading is clicked in the JTable. 
    public void addMouseListenerToHeaderInTable(JTable table) {
        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
6
CodeRank
This code example shows how to use the following methods:getColumn, getFirstRow, getLastRow, getType
    } 
 
    public void tableChanged(final TableModelEvent e)
    { 
      recomputeRowCount(); 
      if (e.getFirstRow() == 0 && e.getLastRow() == Integer.MAX_VALUE)
      { 
        // a table-data-changed event.. 
        applyFilter(); 
        fireTableModelEvent(new TableModelEvent(DefaultFilterTableModel.this,
            e.getFirstRow(), e.getLastRow(), e.getColumn(), e.getType()));
        return; 
      } 
 
      final TableModelEvent event = new TableModelEvent(DefaultFilterTableModel.this,
          mapFromModel(e.getFirstRow()), mapFromModel(e.getLastRow()), e.getColumn(), e.getType());
      fireTableModelEvent(event);
    } 
  } 
 
  private EventListenerList eventListenerList;
6
CodeRank
This code example shows how to use the following methods:getColumn, getFirstRow, getLastRow, getType
		fireTableDataChanged(); 
	} 
	 
	public void tableChanged(final TableModelEvent e) {
		super.tableChanged(e);
		fireTableChanged(new TableModelEvent(this, e.getFirstRow(), e.getLastRow(), e.getColumn(), e.getType()));
	} 
} 
6
CodeRank
This code example shows how to use the following methods:getSource, getColumn, getFirstRow, getLastRow, getType
    /** 
     * Listens to the underlying table model and forwards events as required. 
     */ 
    private class HugeModelListener implements TableModelListener {
        public void tableChanged( TableModelEvent evt ) {
            Object src = evt.getSource();
            TableModel tmodelSrc = src instanceof TableModel
                                 ? (TableModel) src
                                 : null; 
            int hugeRow0 = evt.getFirstRow();
            int hugeRow1 = evt.getLastRow();
            int type = evt.getType();
            int icol = evt.getColumn();
            final TableModelEvent viewEvt;
            if ( type == TableModelEvent.UPDATE &&
                 hugeRow1 < hugeModel_.getRowCount() ) {
                viewEvt = new TableModelEvent( tmodelSrc,
                                               hugeToView( hugeRow0 ),
                                               hugeToView( hugeRow1 ),
                                               icol, type );
6
CodeRank
This code example shows how to use the following methods:getSource, getColumn, getFirstRow, getLastRow
	//WORKSPACE - DOCEAR todo: make sure the right db is active in jabref 
	public void tableChanged(TableModelEvent e) {
		// do not use locking mechanism --> changes made to jabref should change all associated entries in mindmap nodes as well 
 
		// if changes only happened one row and one column 
		if (e.getFirstRow() == e.getLastRow() && e.getColumn() > 0) {
			JabRefAttributes jabRefAttributes = ReferencesController.getController().getJabRefAttributes();
			NodeAttributeTableModel table = (NodeAttributeTableModel) e.getSource();
			Attribute attribute = table.getAttribute(e.getFirstRow());
			 
 
			String key = null;
			//only act on known attributes 
			if (attribute.getName().equals(jabRefAttributes.getKeyAttribute())) {
				//TODO - what should be done here???				 
			} 
			else if (jabRefAttributes.getValueAttributes().containsKey(attribute.getName())) {				
				int pos = table.getAttributePosition(jabRefAttributes.getKeyAttribute());
				if (pos >= 0) {
					key = (String) table.getValue(pos);
6
CodeRank
This code example shows how to use the following methods:getFirstRow, getLastRow, getType
	 * (non-Javadoc) 
	 * @seejavax.swing.event.TableModelListener#tableChanged(javax.swing.event. 
	 * TableModelEvent) 
	 */ 
	public void tableChanged(final TableModelEvent e) {
		if (e.getType() == TableModelEvent.DELETE) {
			fireIntervalRemoved(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
		if (e.getType() == TableModelEvent.UPDATE) {
			fireContentsChanged(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
		if (e.getType() == TableModelEvent.INSERT) {
			fireIntervalAdded(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getFirstRow, getLastRow, getType
	 * (non-Javadoc) 
	 * @seejavax.swing.event.TableModelListener#tableChanged(javax.swing.event. 
	 * TableModelEvent) 
	 */ 
	public void tableChanged(final TableModelEvent e) {
		if (e.getType() == TableModelEvent.DELETE) {
			fireIntervalRemoved(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
		if (e.getType() == TableModelEvent.UPDATE) {
			fireContentsChanged(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
		if (e.getType() == TableModelEvent.INSERT) {
			fireIntervalAdded(this, e.getFirstRow(), e.getLastRow());
			return; 
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getColumn, getType
		} 
	} 
 
	public void tableChanged(final TableModelEvent e) {
		super.tableChanged(e);
		if (e.getType() != TableModelEvent.UPDATE || e.getColumn() != 0) {
			rebuildTableModel(); 
		} 
		fireTableDataChanged(); 
	} 
} 
5
CodeRank
See Code Examples for Java 8 TableModelEvent Methods: