/** * Sets a new value to the item list. * * @param items new value to set. */ public void setItems(ObjectList items) { // Clears the item list _items.clear(); for (int index = 0; index < items.size(); index++) _items.insert(index, (String) items.getObjectAt(index)); // Updates the model fireTableDataChanged(); }
/* * (non-Javadoc) * * @see javax.swing.table.TableModel#getValueAt(int, int) */ @Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case COLUMN_SYMBOL: return (String) _items.getObjectAt(rowIndex); default: return null; } }
/* * (non-Javadoc) * * @see javax.swing.table.AbstractTableModel#setValueAt(java.lang.Object, * int, int) */ @Override public void setValueAt(Object value, int rowIndex, int columnIndex) { // There are changes in the delimiters panel _delimitersPanel.setAreThereChanges(true); switch (columnIndex) { case COLUMN_SYMBOL: _items.setValueAt(rowIndex, value.toString()); fireTableCellUpdated(rowIndex, columnIndex); break; default: return; } }
/* * (non-Javadoc) * * @see javax.swing.table.TableModel#getRowCount() */ @Override public int getRowCount() { if (_items != null) return _items.size(); return 0; }
/** * Removes the item from the item list at the position given as a parameter. * * @param rowIndex position to be removed. */ public void removeItem(int rowIndex) { _items.removeAt(rowIndex); }
/** * Adds a new item (row) to the model. * * @param symbol new item to be added. */ public void addItem(String symbol) { _items.insert(symbol); }