private void reNumberCharacteristics() { // update item numbers for (int i = 0; i < characteristics.size(); i++) { AnatomicEntityCharacteristic c = characteristics.get(i); c.setItemNumber(i + 1); } }
public void addCharacteristic(AnatomicEntityCharacteristic characteristic) { if (characteristics == null) { characteristics = new ArrayList<AnatomicEntityCharacteristic>(); } characteristics.add(characteristic); characteristic.setItemNumber(characteristics.size()); characteristic.initRemoveCommand(characteristics); characteristic.initContext(characteristics); characteristic.setNumberingCommand( new NumberingCommand() { @Override public void execute() { reNumberCharacteristics(); } }); }
@SuppressWarnings("unused") @Commit private void afterPropertiesSet() { if (characteristics != null) { for (AnatomicEntityCharacteristic characteristic : characteristics) { characteristic.initRemoveCommand(characteristics); characteristic.initContext(characteristics); characteristic.setNumberingCommand( new NumberingCommand() { @Override public void execute() { reNumberCharacteristics(); } }); } } }