Exemplo n.º 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());
    }
  }
Exemplo n.º 2
0
  /**
   * Before binding the data and calling the dialog window we check, if the zul-file is called with
   * a parameter for a selected user object in a Map.
   *
   * @param event
   * @throws Exception
   */
  public void onCreate$orderPositionDialogWindow(Event event) throws Exception {
    /* set components visible dependent of the users rights */
    doCheckRights();

    // create the Button Controller. Disable not used buttons during working
    btnCtrl =
        new ButtonStatusCtrl(
            getUserWorkspace(),
            btnCtroller_RightPrefix,
            true,
            btnNew,
            btnEdit,
            btnDelete,
            btnSave,
            btnCancel,
            btnClose);

    // get the params map that are overhanded by creation.
    Map<String, Object> args = getCreationArgsMap(event);

    if (args.containsKey("order")) {
      order = (Order) args.get("order");
    } else {
      setOrder(null);
    }

    if (args.containsKey("orderposition")) {
      orderposition = (Orderposition) args.get("orderposition");
      setOrderposition(orderposition);
      // we must addionally check if there is NO order object in the
      // orderPosition, so its new.
      if (orderposition.getOrder() != null) {
        setOrder(this.order);
        setArticle(this.orderposition.getArticle());
        setCustomer(this.order.getCustomer());
      }
    } else {
      setOrderposition(null);
    }

    // we get the listBox Object for the offices list. So we have access
    // to it and can synchronize the shown data when we do insert, edit or
    // delete orderPositions here.
    if (args.containsKey("listBoxOrderOrderPositions")) {
      listBoxOrderOrderPositions = (Listbox) args.get("listBoxOrderOrderPositions");
    } else {
      listBoxOrderOrderPositions = null;
    }

    if (args.containsKey("orderDialogCtrl")) {
      orderDialogCtrl = (OrderDialogCtrl) args.get("orderDialogCtrl");
    } else {
      orderDialogCtrl = null;
    }

    if (args.containsKey("orderListCtrl")) {
      orderListCtrl = (OrderListCtrl) args.get("orderListCtrl");
    } else {
      orderListCtrl = null;
    }

    setPageSizeArticleSearch(20);
    paging_ListBoxArticleSearch.setPageSize(getPageSizeArticleSearch());
    paging_ListBoxArticleSearch.setDetailed(true);

    /* Sorting Comparator for search bandbox article list */
    listheader_ArticleSearch_artNr.setSortAscending(new FieldComparator("artNr", true));
    listheader_ArticleSearch_artNr.setSortDescending(new FieldComparator("artNr", true));

    listheader_ArticleSearch_artKurzbezeichnung.setSortAscending(
        new FieldComparator("article.artKurzbezeichnung", true));
    listheader_ArticleSearch_artKurzbezeichnung.setSortDescending(
        new FieldComparator("article.artKurzbezeichnung", true));

    listBoxArticleSearch.setItemRenderer(new SearchArticleListModelItemRenderer());

    doShowDialog(getOrderposition());
  }