/** {@inheritDoc} */ @Override protected void customizeComponents( Map<String, AttributeComponent> name2AttributeComponent, DetailExportStore entity) { super.customizeComponents(name2AttributeComponent, entity); final JTextField tfdQuantity = (JTextField) name2AttributeComponent.get("quantity").getComponent(); final MoneyComponent mPriceUnit = (MoneyComponent) name2AttributeComponent.get("priceUnit").getComponent(); final MoneyComponent mSubtotal = (MoneyComponent) name2AttributeComponent.get("priceSubtotal").getComponent(); tfdQuantity.addFocusListener( new FocusListener() { @Override public void focusLost(FocusEvent e) { mSubtotal.setMoney( StoreViewHelper.calculatePriceSubtotal( tfdQuantity.getText(), mPriceUnit.getMoney())); } @Override public void focusGained(FocusEvent e) {} }); mPriceUnit.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { mSubtotal.setMoney( StoreViewHelper.calculatePriceSubtotal( tfdQuantity.getText(), mPriceUnit.getMoney())); } }); }
@Override protected void setReferenceDataModel(ReferenceDataModel refDataModel, PackageLine entity) { super.setReferenceDataModel(refDataModel, entity); DetachedCriteria dc = daoHelper.getDao(Item.class).getCriteria(); dc.add(Restrictions.eq("product", entity.getProduct())); refDataModel.putRefDataList(REF_ITEMS, daoHelper.getDao(Item.class).findByCriteria(dc)); }
@Override protected void setReferenceDataModel(ReferenceDataModel refDataModel, DetailExportStore entity) { super.setReferenceDataModel(refDataModel, entity); // TODO: Hoang handle after user selects product refDataModel.putRefDataList(REF_ITEM_LIST, getDaoHelper().getDao(Item.class).findAll(), null); // TODO:Hoang should get from ContextProvider UnitOfMeasure baseUom = serviceProvider.getService(IConfigService.class).getBaseUnitUom(); refDataModel.putRefDataList(REF_BASE_UOM_LIST, Arrays.asList(baseUom), null); }