@Test public void testGetValueAt() { EventList<Color> colors = new BasicEventList<>(); colors.add(Color.RED); colors.add(Color.GREEN); colors.add(Color.BLUE); TableFormat<Color> colorTableFormat = GlazedLists.tableFormat(new String[] { "red", "green", "blue" }, new String[] { "Red", "Green", "Blue" }); DefaultEventTableModel<Color> tableModel = new DefaultEventTableModel<>(colors, colorTableFormat); assertEquals(new Integer(Color.RED.getRed()), tableModel.getValueAt(0, 0)); assertEquals(new Integer(Color.GREEN.getGreen()), tableModel.getValueAt(1, 1)); assertEquals(new Integer(Color.BLUE.getBlue()), tableModel.getValueAt(2, 2)); try { tableModel.getValueAt(100, 0); fail("failed to receive IndexOutOfBoundsException for invalid index"); } catch (IndexOutOfBoundsException e) { } try { tableModel.getValueAt(-1, 0); fail("failed to receive IndexOutOfBoundsException for invalid index"); } catch (IndexOutOfBoundsException e) { } }
@Override public Object getValueAt(int row, int column) { source.getReadWriteLock().readLock().lock(); try { return tableFormat.getColumnValue(source.get(row), column); } finally { source.getReadWriteLock().readLock().unlock(); } }
DefaultEventTableModel extends AbstractTableModel implements AdvancedTableModel<E>, ListEventListener<E> { @Override public Object getValueAt(int row, int column) { source.getReadWriteLock().readLock().lock(); try { return tableFormat.getColumnValue(source.get(row), column); } finally { source.getReadWriteLock().readLock().unlock(); } } }
DefaultEventTableModel extends AbstractTableModel implements AdvancedTableModel<E>, ListEventListener<E> { @Override public Object getValueAt(int row, int column) { source.getReadWriteLock().readLock().lock(); try { return tableFormat.getColumnValue(source.get(row), column); } finally { source.getReadWriteLock().readLock().unlock(); } } DefaultEventTableModel(EventList<E> source, TableFormat<? super E> tableFormat);  DefaultEventTableModel(EventList<E> source, boolean disposeSource, TableFormat<? super E> tableFormat); }
DefaultEventTableModel extends AbstractTableModel implements AdvancedTableModel<E>, ListEventListener<E> { @Override public Object getValueAt(int row, int column) { source.getReadWriteLock().readLock().lock(); try { return tableFormat.getColumnValue(source.get(row), column); } finally { source.getReadWriteLock().readLock().unlock(); } } DefaultEventTableModel(EventList<E> source, TableFormat<? super E> tableFormat);  DefaultEventTableModel(EventList<E> source, boolean disposeSource, TableFormat<? super E> tableFormat); @Override TableFormat<? super E> getTableFormat(); @Override void setTableFormat(TableFormat<? super E> tableFormat); @Override E getElementAt(int index); @Override void listChanged(ListEvent<E> listChanges); @Override String getColumnName(int column); @Override int getRowCount(); @Override int getColumnCount(); @Override Class<?> getColumnClass(int columnIndex); @Override Object getValueAt(int row, int column); @Override boolean isCellEditable(int row, int column); @Override void setValueAt(Object editedValue, int row, int column); @Override void dispose(); final TableModelEventAdapter<E> getEventAdapter(); final void setEventAdapter(TableModelEventAdapter<E> eventAdapter); }
DefaultEventTableModel extends AbstractTableModel implements AdvancedTableModel<E>, ListEventListener<E> { @Override public Object getValueAt(int row, int column) { source.getReadWriteLock().readLock().lock(); try { return tableFormat.getColumnValue(source.get(row), column); } finally { source.getReadWriteLock().readLock().unlock(); } } DefaultEventTableModel(EventList<E> source, TableFormat<? super E> tableFormat);  DefaultEventTableModel(EventList<E> source, boolean disposeSource, TableFormat<? super E> tableFormat); @Override TableFormat<? super E> getTableFormat(); @Override void setTableFormat(TableFormat<? super E> tableFormat); @Override E getElementAt(int index); @Override void listChanged(ListEvent<E> listChanges); @Override String getColumnName(int column); @Override int getRowCount(); @Override int getColumnCount(); @Override Class<?> getColumnClass(int columnIndex); @Override Object getValueAt(int row, int column); @Override boolean isCellEditable(int row, int column); @Override void setValueAt(Object editedValue, int row, int column); @Override void dispose(); final TableModelEventAdapter<E> getEventAdapter(); final void setEventAdapter(TableModelEventAdapter<E> eventAdapter);  }