/** * Saves the components to table. <br> * * @throws InterruptedException */ public void doSave() throws InterruptedException { final SecRole aRole = getRole(); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // force validation, if on, than execute by component.getValue() // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if (!isValidationOn()) { doSetValidation(); } // fill the object with the components data doWriteComponentsToBean(aRole); // save it to database try { getSecurityService().saveOrUpdate(aRole); } catch (DataAccessException e) { ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString()); // Reset to init values doResetInitValues(); doReadOnly(); btnCtrl.setBtnStatus_Save(); return; } // now synchronize the listBox ListModelList lml = (ListModelList) listBoxSecRoles.getListModel(); // Check if the object is new or updated // -1 means that the obj is not in the list, so it's new. if (lml.indexOf(aRole) == -1) { lml.add(aRole); } else { lml.set(lml.indexOf(aRole), aRole); } doReadOnly(); btnCtrl.setBtnStatus_Save(); // init the old values vars new doStoreInitValues(); }
/** * Saves the components to table. <br> * * @throws InterruptedException */ public void doSave() throws InterruptedException { Orderposition anOrderposition = getOrderposition(); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // force validation, if on, than execute by component.getValue() // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ if (!isValidationOn()) { doSetValidation(); } artNr.getValue(); // additionally calculate new if (isDataChanged()) { doCalculate(); } // fill the objects with the components data doWriteComponentsToBean(anOrderposition); // save it to database try { getOrderService().saveOrUpdate(anOrderposition); } catch (DataAccessException e) { ZksampleMessageUtils.showErrorMessage(e.getMostSpecificCause().toString()); // Reset to init values doResetInitValues(); doReadOnly(); btnCtrl.setBtnStatus_Save(); return; } /** Synchronize the listbox in the OrderDialog */ HibernateSearchObject<Orderposition> soOrderPosition = new HibernateSearchObject<Orderposition>( Orderposition.class, orderDialogCtrl.getPageSizeOrderPosition()); soOrderPosition.addFilter(new Filter("order", getOrder(), Filter.OP_EQUAL)); // deeper loading of a relation to prevent the lazy // loading problem. soOrderPosition.addFetch("article"); // Set the ListModel. getPlwOrderpositions() .init( soOrderPosition, orderDialogCtrl.listBoxOrderOrderPositions, orderDialogCtrl.paging_ListBoxOrderOrderPositions); /** Synchronize the OrderList */ // Listbox listBoxOrderArticle = orderListCtrl.getListBoxOrderArticle(); // listBoxOrderArticle.setModel(orderDialogCtrl.listBoxOrderOrderPositions.getModel()); orderListCtrl .getListBoxOrderArticle() .setModel(orderDialogCtrl.listBoxOrderOrderPositions.getModel()); // synchronize the TotalCount from the paging component orderListCtrl.paging_OrderArticleList.setTotalSize( orderDialogCtrl.paging_ListBoxOrderOrderPositions.getTotalSize()); doReadOnly(); btnCtrl.setBtnStatus_Save(); // init the old values vars new doStoreInitValues(); }