public AccountsController(String companyCodeSys01ACC01, String ledgerCode) { gridFrame = new AccountsGridFrame(this); MDIFrame.add(gridFrame); if (companyCodeSys01ACC01 != null && ledgerCode != null) { gridFrame.getControlCompaniesCombo().setValue(companyCodeSys01ACC01); gridFrame.getControlLedgerCode().setValue(ledgerCode); gridFrame.getControlLedgerCode().getLookupController().forceValidate(); } }
/** * Callback method invoked before saving data when the grid was in INSERT mode (on pressing save * button). * * @return <code>true</code> allows the saving to continue, <code>false</code> the saving is * interrupted */ public boolean beforeInsertGrid(GridControl grid) { boolean ok = super.beforeInsertGrid(grid); if (!ok) return ok; if (gridFrame.getControlCompaniesCombo().getValue() == null || gridFrame.getControlLedgerCode().getValue() == null || gridFrame.getControlLedgerCode().getValue().equals("")) { JOptionPane.showMessageDialog( MDIFrame.getInstance(), ClientSettings.getInstance().getResources().getResource("insert not allowed"), ClientSettings.getInstance().getResources().getResource("Attention"), JOptionPane.WARNING_MESSAGE); return false; } return true; }
/** * Callback method invoked when the user has clicked on the insert button * * @param valueObject empty value object just created: the user can manage it to fill some * attribute values */ public void createValueObject(ValueObject valueObject) throws Exception { AccountVO vo = (AccountVO) valueObject; vo.setCompanyCodeSys01ACC02(gridFrame.getControlCompaniesCombo().getValue().toString()); vo.setLedgerCodeAcc01ACC02(gridFrame.getControlLedgerCode().getValue().toString()); vo.setLedgerDescriptionACC02(gridFrame.getControlLedgerDescr().getValue().toString()); }