/** Change to dependent object... */
  public void stateChanged(ChangeEvent e) {
    Object source = e.getSource();
    while (source instanceof OrderCommodityDetailFrame) {
      // Some order commodity has changed.
      // Try to find it, then update order model

      // Sanity Check
      OrderValue ov = (OrderValue) getModel();
      if (ov == null) {
        break;
      }

      // Which OC ID to find?
      OrderCommodityDetailFrame ocdf = (OrderCommodityDetailFrame) source;
      OrderCommodityValue changedOCV = (OrderCommodityValue) ocdf.getModel();
      OrderCommodityPK ocpk = (OrderCommodityPK) changedOCV.getPK();
      if (ocpk == null) {
        break;
      }
      Long changeOrderCommodityId = ocpk.getId();
      if (changeOrderCommodityId == null || changeOrderCommodityId.longValue() == 0) {
        break;
      }

      // Check OrderValues, find it.
      Collection orderCommodities = ov.getOrderCommodities();
      for (Iterator it = orderCommodities.iterator(); it.hasNext(); ) {
        OrderCommodityValue ocv = (OrderCommodityValue) it.next();
        if (ocv.getId().equals(changeOrderCommodityId)) {
          ocv.setCommodity(changedOCV.getCommodity());
          ocv.setHazardousDetails(changedOCV.getHazardousDetails());
          orderPanel.stateChanged(new ChangeEvent(ocv));
          break;
        }
      }
      break;
    }
    hasChanged();
  }
 /*
  * (non-Javadoc)
  *
  * @see net.metaship.swing.generic.ContextJInternalDetailFrame#refreshModel()
  */
 protected void refreshModel() {
   orderPanel.refreshOnUpdatedModel();
   getModel().getClientValueObjectProxy().setChanged(false);
 }
 /**
  * Call the order panel's check method.
  *
  * @return
  * @throws FieldValueException
  * @throws UserCancelSaveException
  */
 public boolean checkForDuplicateContainerNumber()
     throws FieldValueException, UserCancelSaveException {
   return orderPanel.checkForDuplicateContainerNumber();
 }
 public void refreshAfterSuccessfulSave() {
   orderPanel.refreshAfterSuccessfulSave();
 }
 public boolean checkFields() throws FieldValueException, UserCancelSaveException {
   return orderPanel.checkFields();
 }
 /** @see net.metaship.swing.generic.ContextJInternalDetailFrame#refreshView() */
 public void refreshView() {
   orderPanel.refreshView();
 }
 public void validateOrder() {
   orderPanel.validateOrder();
 }