@Override protected void initModel() { super.initModel(); Book referenceObject = getReferenceObject(); List<Copy> copiesOfBook = new ArrayList<Copy>(); if (referenceObject != null) { copiesOfBook = Repository.getInstance().getBooksPMod().getCopiesOfBook(referenceObject); } listModelCopies = new CopyListModel(Copy.cloneCopies(copiesOfBook)); }
private void updateViewValues() { // retrieve new possible shelves-data comboShelf.setModel(Repository.getInstance().getShelfPMod().getShelfComboBoxModel()); Book referenceObject = getReferenceObject(); if (referenceObject != null) { txtFieldTitle.setText(referenceObject.getName()); txtFieldAuthor.setText(referenceObject.getAuthor()); txtFieldPublisher.setText(referenceObject.getPublisher()); // select the correct shelf comboShelf.setSelectedItem(referenceObject.getShelf()); } else { comboShelf.setSelectedItem(Shelf.A1); } updateCopiesCount(); }
@Override protected void addObservables() { observables.add(Repository.getInstance().getCopyPMod()); observables.add(Repository.getInstance().getBooksPMod()); }