@Override public void update(Observable o, Object arg) { if (o.getClass().equals(CopyPMod.class) || o.getClass().equals(BooksPMod.class)) { Preconditions.checkNotNull(arg); if (getReferenceObject().equals(arg)) { lblMessage.setText(Texts.get("BookDetailMainView.optimisticlock.error")); lblMessage.setIcon(IconUtil.loadIcon("warning.png")); logger.info("Book changed in the background, disabling view..."); disableComponents( btnSave, btnAdd, btnRemove, btnSetCondition, listCopies, txtFieldAuthor, txtFieldPublisher, txtFieldTitle, comboShelf); } else { logger.info("A different book changed in the background. Doing nothing..."); } } else { super.update(o, arg); } }
@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)); }
/** * Initialize the contents of the frame. * * @wbp.parser.entryPoint */ @Override protected void initUIElements() { super.initUIElements(); getContainer().setBounds(100, 100, 650, 445); container.setMinimumSize(new Dimension(650, 445)); Container contentPane = getContainer().getContentPane(); contentPane.setLayout(new BorderLayout(0, 0)); JPanel pnMainPanel = new JPanel(); contentPane.add(pnMainPanel, BorderLayout.CENTER); pnMainPanel.setLayout(new BorderLayout(0, 0)); createBookInfoPanel(pnMainPanel); createCopiesPanel(pnMainPanel); createControlPanel(); JPanel pnValidationContainer = createValidationPanel(contentPane); createButtonsPanel(pnValidationContainer); }