/** * Constructs a new <code>CollectionConnectorTableModel</code> instance. * * @param collectionConnector * the collection connector holding the values of this table model. * @param columnConnectorKeys * the list of column connector ids. */ public CollectionConnectorTableModel( ICollectionConnector collectionConnector, List<String> columnConnectorKeys) { super(); this.collectionConnector = collectionConnector; this.columnConnectorKeys = columnConnectorKeys; bindConnector(); }
public void run() { if (cell.getX() < getRowCount()) { fireTableCellUpdated(cell.getX(), cell.getY()); } } });
@Override public void run() { if (row >= 0 && row < getRowCount()) { fireTableRowsUpdated(row, row); } resetRowSelection(row); } });
if (oldCollectionSize > i) { if (oldCollection.get(i) != element) { fireTableRowsUpdated(i, i); resetRowSelection(i); fireTableRowsInserted(i, i); resetRowSelection(i); fireTableRowsDeleted(newCollectionSize, oldCollectionSize - 1);
CollectionConnectorTableModel tableModel = new CollectionConnectorTableModel(connector, columnConnectorKeys, columnClasses); tableModel.setExceptionHandler(actionHandler); setupTableModel(viewDescriptor, actionHandler, connector, viewComponent, tableModel); viewComponent.setSelectionMode(getSelectionMode(viewDescriptor)); tableModel.setRowBackgroundProperty(dynamicBackgroundProperty); tableModel.setRowForegroundProperty(dynamicForegroundProperty); tableModel.setRowFontProperty(dynamicFontProperty);
CollectionConnectorTableModel tableModel = new CollectionConnectorTableModel( connector, columnConnectorKeys); tableModel.setExceptionHandler(actionHandler); tableModel.setColumnClassesByIds(columnClassesByIds); TableSorter sorterDecorator = new TableSorter(tableModel, viewComponent .getTableHeader());
public void run() { Collection<?> oldCollection = null; if (evt.getOldValue() instanceof Collection) { oldCollection = (Collection<?>) evt.getOldValue(); } Collection<?> newCollection = (Collection<?>) evt.getNewValue(); int oldCollectionSize = 0; int newCollectionSize = 0; if (oldCollection != null) { oldCollectionSize = oldCollection.size(); } if (newCollection != null) { newCollectionSize = newCollection.size(); } if (newCollectionSize > oldCollectionSize) { fireTableRowsInserted(oldCollectionSize, newCollectionSize - 1); for (int row = oldCollectionSize; row < newCollectionSize; row++) { bindChildRowConnector(row); } } else if (newCollectionSize < oldCollectionSize) { fireTableRowsDeleted(newCollectionSize, oldCollectionSize - 1); } if (evt.getNewValue() != null && !((Collection<?>) evt.getNewValue()).isEmpty()) { collectionConnector.setSelectedIndices(new int[] {0}); } } });
/** * {@inheritDoc} */ @Override public boolean isCellEditable(int rowIndex, int columnIndex) { // Editability is only handled at cell level //collectionConnector.isWritable() // && collectionConnector.getChildConnector(rowIndex).isWritable() return getConnectorAt(rowIndex, columnIndex).isWritable(); }
private void bindConnector() { collectionConnector.addValueChangeListener(tableListener); for (int row = 0; row < collectionConnector.getChildConnectorCount(); row++) { bindChildRowConnector(row); } }
/** * Returns the value of the connector which backs the cell model (2nd level of * nesting). * <p> * {@inheritDoc} */ @Override public Object getValueAt(int rowIndex, int columnIndex) { IValueConnector cellConnector = getConnectorAt(rowIndex, columnIndex); if (cellConnector instanceof ICompositeValueConnector) { return cellConnector; } Object connectorValue = cellConnector.getConnectorValue(); return connectorValue; }
private void bindConnector() { collectionConnector .addConnectorValueChangeListener(new TableConnectorListener()); for (int row = 0; row < collectionConnector.getChildConnectorCount(); row++) { bindChildRowConnector(row); } }
public void run() { if (row < getRowCount()) { fireTableRowsUpdated(row, row); } if (collectionConnector.getSelectedIndices() != null) { if (Arrays.binarySearch(collectionConnector.getSelectedIndices(), row) >= 0) { collectionConnector.setSelectedIndices(new int[0]); } } } });
@Override public void run() { if (cell.getX() >= 0 && cell.getY() >= 0 && cell.getX() < getRowCount()) { fireTableCellUpdated(cell.getX(), cell.getY()); } } });
/** * Returns the value of the connector which backs the cell model (2nd level of * nesting). * <p> * {@inheritDoc} */ public Object getValueAt(int rowIndex, int columnIndex) { IValueConnector cellConnector = getConnectorAt(rowIndex, columnIndex); Object connectorValue = cellConnector.getConnectorValue(); if (connectorValue instanceof byte[]) { return null; } return connectorValue; }
/** * Constructs a new {@code CollectionConnectorTableModel} instance. * * @param collectionConnector * the collection connector holding the values of this table model. * @param columnConnectorKeys * the list of column connector ids. * @param columnClasses * the column classes. */ public CollectionConnectorTableModel( ICollectionConnector collectionConnector, List<String> columnConnectorKeys, List<Class<?>> columnClasses) { super(); this.collectionConnector = collectionConnector; this.columnConnectorKeys = columnConnectorKeys; this.columnClasses = columnClasses; this.tableListener = new TableConnectorListener(); this.rowListener = new RowConnectorListener(); this.cellListener = new CellConnectorListener(); bindConnector(); }
/** * Returns the value of the connector which backs the cell model (2nd level of * nesting). * <p> * {@inheritDoc} */ @Override public void setValueAt(Object cellValue, int rowIndex, int columnIndex) { try { getConnectorAt(rowIndex, columnIndex).setConnectorValue(cellValue); } catch (RuntimeException ex) { if (exceptionHandler != null && exceptionHandler.handleException(ex, Collections.<String, Object>emptyMap())) { return; } throw ex; } }
/** * Returns the value of the connector which backs the cell model (2nd level of * nesting). * <p> * {@inheritDoc} */ @Override public void setValueAt(Object cellValue, int rowIndex, int columnIndex) { try { getConnectorAt(rowIndex, columnIndex).setConnectorValue(cellValue); } catch (RuntimeException ex) { if (exceptionHandler != null) { exceptionHandler.handleException(ex, null); } else { throw ex; } } }
/** * {@inheritDoc} */ @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return collectionConnector.isWritable() && collectionConnector.getChildConnector(rowIndex).isWritable() && getConnectorAt(rowIndex, columnIndex).isWritable(); }