예제 #1
0
  /**
   * Opens the Dialog window modal.
   *
   * <p>It checks if the dialog opens with a new or existing object and set the readOnly mode
   * accordingly.
   *
   * @param anOrderposition
   * @throws InterruptedException
   */
  public void doShowDialog(Orderposition anOrderposition) throws InterruptedException {

    // if aBranche == null then we opened the Dialog without
    // args for a given entity, so we get a new Obj().
    if (anOrderposition == null) {

      /** !!! DO NOT BREAK THE TIERS !!! */
      // We don't create a new DomainObject() in the frontend.
      // We GET it from the backend.
      anOrderposition = getOrderService().getNewOrderposition();
    }

    try {

      if (anOrderposition.getOrder() != null) {
        // fill the components with the data
        doWriteBeanToComponents(anOrderposition);
      }

      // set Readonly mode accordingly if the object is new or not.
      if (anOrderposition.isNew()) {
        btnCtrl.setInitNew();
        doEdit();
      } else {
        btnCtrl.setInitEdit();
        doReadOnly();
      }

      // stores the inital data for comparing if they are changed
      // during user action.
      doStoreInitValues();

      orderPositionDialogWindow.doModal(); // open the dialog in
      // modal
      // mode
    } catch (final Exception e) {
      Messagebox.show(e.toString());
    }
  }