void modifierCompte() {
    try {
      Compte compte = compteManager.get(Long.parseLong(idCompte.getValue()));
      compte.setNom(nom.getValue());
      compte.setSolde(solde.getValue().floatValue());
      compte.setSoldeReel(soldeReel.getValue().floatValue());
      compte.setSoldePrevisionnel(soldePrevisionnel.getValue().floatValue());

      compteManager.update(compte);

      for (Object object :
          self.getDesktop()
              .getPage("mainPage")
              .getFellow("contentNiv2")
              .getFellow("contentNiv3")
              .getFellows()) {
        System.out.println("fellow : " + object.toString() + " - " + object.getClass().getName());
      }
      List<Compte> listCompte = compteManager.getAll();
      ListModelList listModelList = new ListModelList();
      listModelList.addAll(listCompte);

      ((Listbox)
              self.getDesktop()
                  .getPage("mainPage")
                  .getFellow("contentNiv2")
                  .getFellow("contentNiv3")
                  .getFellow("main")
                  .getFellow("list"))
          .setModel(listModelList);
      win.detach();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /** Resets the init values from mem vars. <br> */
  private void doResetInitValues() {

    artNr.setValue(oldVar_artNr);
    artKurzbezeichnung.setValue(oldVar_artKurzbezeichnung);
    aupMenge.setValue(oldVar_aupMenge);
    aupEinzelwert.setValue(oldVar_aupEinzelwert);
    aupGesamtwert.setValue(oldVar_aupGesamtwert);
  }
  /** Stores the init values in mem vars. <br> */
  private void doStoreInitValues() {

    oldVar_artNr = artNr.getValue();
    oldVar_artKurzbezeichnung = artKurzbezeichnung.getValue();
    oldVar_aupMenge = aupMenge.getValue();
    oldVar_aupEinzelwert = aupEinzelwert.getValue();
    oldVar_aupGesamtwert = aupGesamtwert.getValue();
  }
  /**
   * Writes the bean data to the components.<br>
   *
   * @param anOrderposition Orderposition
   */
  public void doWriteBeanToComponents(Orderposition anOrderposition) {

    artNr.setValue(anOrderposition.getArticle().getArtNr());
    artKurzbezeichnung.setValue(anOrderposition.getArticle().getArtKurzbezeichnung());
    aupMenge.setValue(anOrderposition.getAupMenge());
    aupEinzelwert.setValue(anOrderposition.getAupEinzelwert());
    aupGesamtwert.setValue(anOrderposition.getAupGesamtwert());
  }
  /** Disables the Validation by setting empty constraints. */
  private void doRemoveValidation() {

    setValidationOn(false);

    artNr.setConstraint("");
    aupMenge.setConstraint("");
    aupEinzelwert.setConstraint("");
    aupGesamtwert.setConstraint("");
  }
  /** Sets the Validation by setting the accordingly constraints to the fields. */
  private void doSetValidation() {

    setValidationOn(true);

    artNr.setConstraint(new SimpleConstraint("NO EMPTY"));
    aupMenge.setConstraint("NO EMPTY, NO ZERO");
    aupEinzelwert.setConstraint("NO EMPTY, NO ZERO");
    aupGesamtwert.setConstraint("NO EMPTY, NO ZERO");
  }
  /**
   * Cancel the actual operation. <br>
   * <br>
   * Resets to the original status.<br>
   */
  private void doCancel() {
    doResetInitValues();

    aupMenge.setReadonly(true);
    aupEinzelwert.setReadonly(true);
    aupGesamtwert.setReadonly(true);

    btnCtrl.setInitEdit();
  }
  /** Set the components to ReadOnly. <br> */
  public void doReadOnly() {

    // artNr + description are only be filled by searchBox
    artNr.setReadonly(true);
    artKurzbezeichnung.setReadonly(true);
    bandbox_OrderPositionDialog_ArticleSearch.setDisabled(true);

    aupMenge.setReadonly(true);
    aupEinzelwert.setReadonly(true);
    aupGesamtwert.setReadonly(true);
  }
  /**
   * Writes the components values to the bean.<br>
   *
   * @param anOrderposition
   */
  public void doWriteComponentsToBean(Orderposition anOrderposition) {

    Order anOrder = getOrder();
    Article anArticle = getArticle();

    anOrderposition.setOrder(anOrder);
    anOrderposition.setArticle(anArticle);
    anOrderposition.setAupMenge(aupMenge.getValue());
    anOrderposition.setAupEinzelwert(aupEinzelwert.getValue());
    anOrderposition.setAupGesamtwert(aupGesamtwert.getValue());
  }
Example #10
0
  /** Clears the components values. <br> */
  public void doClear() {

    // remove validation, if there are a save before
    doRemoveValidation();

    artNr.setValue("");
    artKurzbezeichnung.setValue("");
    bandbox_OrderPositionDialog_ArticleSearch.setValue("");
    aupMenge.setValue(new BigDecimal(0));
    aupEinzelwert.setValue(new BigDecimal(0));
    aupGesamtwert.setValue(new BigDecimal(0));
  }
Example #11
0
  /** Set the components for edit mode. <br> */
  private void doEdit() {

    // artNr + description are only be filled by searchBox
    artNr.setReadonly(true);
    artKurzbezeichnung.setReadonly(true);
    bandbox_OrderPositionDialog_ArticleSearch.setDisabled(false);

    aupMenge.setReadonly(false);
    aupEinzelwert.setReadonly(false);
    aupGesamtwert.setReadonly(false);

    btnCtrl.setBtnStatus_Edit();

    // remember the old vars
    doStoreInitValues();
  }
Example #12
0
  /**
   * when doubleClick on a item in the bandbox search list.<br>
   * <br>
   * Select the customer and search all orders for him.
   *
   * @param event
   */
  public void onDoubleClickedArticleItem(Event event) {
    // logger.debug(event.toString());

    // get the customer
    Listitem item = this.listBoxArticleSearch.getSelectedItem();
    if (item != null) {

      // get and cast the selected object
      setArticle((Article) item.getAttribute("data"));

      artNr.setValue(article.getArtNr());
      artKurzbezeichnung.setValue(article.getArtKurzbezeichnung());
      aupEinzelwert.setValue(article.getArtPreis());
    }

    // clear old stuff at end, because the NO EMPTY validation
    aupMenge.setValue(new BigDecimal(0));
    aupGesamtwert.setValue(new BigDecimal(0));

    // close the bandbox
    bandbox_OrderPositionDialog_ArticleSearch.close();
  }
Example #13
0
  /**
   * Checks, if data are changed since the last call of <br>
   * doStoreInitData() . <br>
   *
   * @return true, if data are changed, otherwise false
   */
  private boolean isDataChanged() {
    boolean changed = false;

    if (oldVar_artNr != artNr.getValue()) {
      changed = true;
    }
    if (oldVar_artKurzbezeichnung != artKurzbezeichnung.getValue()) {
      changed = true;
    }

    if (oldVar_aupMenge != aupMenge.getValue()) {
      changed = true;
    }

    if (oldVar_aupEinzelwert != aupEinzelwert.getValue()) {
      changed = true;
    }

    if (oldVar_aupGesamtwert != aupGesamtwert.getValue()) {
      changed = true;
    }

    return changed;
  }
Example #14
0
  /** Calculates all necessary values new. */
  private void doCalculate() {

    if (!(aupMenge.getValue() == null) && !(aupEinzelwert.getValue() == null)) {
      if (!aupMenge.getValue().equals(new BigDecimal(0))
          && !aupEinzelwert.getValue().equals(new BigDecimal(0))) {

        BigDecimal count = aupMenge.getValue();
        BigDecimal singlePrice = aupEinzelwert.getValue();
        BigDecimal amount = count.multiply(singlePrice);

        aupGesamtwert.setValue(amount);
      }
    }
  }