/** * Confirms that the user wants to post the act. * * @param act the act to post * @param callback the callback to handle the posting, if the user confirms it */ @Override protected void confirmPost(Act act, Runnable callback) { if (TypeHelper.isA(act, CustomerAccountArchetypes.INVOICE)) { UndispensedOrderChecker checker = new UndispensedOrderChecker(act); if (checker.hasUndispensedItems()) { checker.confirm(getHelpContext(), callback); } else { super.confirmPost(act, callback); } } else { super.confirmPost(act, callback); } }
/** * Lays out the buttons. * * @param buttons the button row */ @Override protected void layoutButtons(ButtonSet buttons) { super.layoutButtons(buttons); buttons.add(createPostButton()); buttons.add(createPreviewButton()); }
/** * Sets the object. * * @param object the object. May be {@code null} */ @Override public void setObject(FinancialAct object) { super.setObject(object); updateContext(CustomerAccountArchetypes.INVOICE, object); }
/** * Enables/disables the buttons that require an object to be selected. * * @param buttons the button set * @param enable determines if buttons should be enabled */ @Override protected void enableButtons(ButtonSet buttons, boolean enable) { super.enableButtons(buttons, enable); buttons.setEnabled(POST_ID, enable); buttons.setEnabled(PREVIEW_ID, enable); }