Beispiel #1
0
  private void checkDataBinding(Class<? extends AbstractField> class1) {
    boolean ok = false;
    AbstractField b;
    try {
      b = class1.newInstance();
      b.setCaption("Button of type " + class1.getSimpleName());
      try {
        b.setWriteThrough(true);
        b.setReadThrough(true);
        ObjectProperty<String> prop = new ObjectProperty<String>("ABC 123");
        /*
         * This should throw an exception or somehow tell that the
         * property was invalid (wrong type). See #2223.
         */
        b.setPropertyDataSource(prop);
      } catch (Exception e) {
        e.printStackTrace();
      }
    } catch (Exception e1) {
      e1.printStackTrace();
      return;
    }

    if (ok) {
      status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + "/DB: OK");
    } else {
      status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + "/DB: FAILED");
    }
  }
Beispiel #2
0
  private void checkButton(Class<? extends Button> class1) {
    boolean ok = false;
    AbstractComponent b;
    try {
      b = class1.newInstance();
      b.setCaption("Button of type " + class1.getSimpleName());
      ok = true;
    } catch (Exception e1) {
      e1.printStackTrace();
    }

    if (ok) {
      status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + ": OK");
    } else {
      status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + ": FAILED");
    }
  }
Beispiel #3
0
  private void checkCheckBox(Class<? extends CheckBox> class1) {
    boolean ok = false;
    CheckBox b;
    try {
      b = class1.newInstance();
    } catch (Exception e1) {
      e1.printStackTrace();
      return;
    }

    b.setCaption("Button of type " + class1.getSimpleName());
    status.setValue(status.getValue() + " " + class1.getClass().getSimpleName() + ": OK");
  }
Beispiel #4
0
  @Override
  public void buttonClick(ClickEvent event) {
    Notification errorN = null;
    try {
      vegaFileName.validate();
      VegaDokuman dokuman =
          VegaDokumanReader.readDokuman(
              vegaKlasor.getValue().toString().trim()
                  + vegaFileName.getValue().toString().trim()
                  + ".xls",
              null,
              false);

      Fatura fatura = null;
      Product product = null;

      Long barcode = 0L;
      int change = 0;
      for (int i = 0; i < dokuman.getFaturaListesi().size(); i++) {
        fatura = dokuman.getFaturaListesi().get(i);
        for (int j = 0; j < fatura.getUrunListesi().size(); j++) {
          try {
            barcode = Long.parseLong(fatura.getUrunListesi().get(j).getBarKodu());
          } catch (NumberFormatException e) {

          }
          if (barcode != 0) {
            product = definitionAPI.getProductByBarcode(barcode);
            if (product != null) {
              log.info(
                  fatura.getUrunListesi().get(j).getBirimAlisFiyati()
                      + " işletme - depo "
                      + product.getBuyPrice());
            }
            if (product != null
                && fatura
                        .getUrunListesi()
                        .get(j)
                        .getBirimAlisFiyati()
                        .compareTo(product.getBuyPrice())
                    != 0) {
              log.info(
                  product.getBarcode()
                      + " barkodlu ürünün aliş fiyatı değişmiştir "
                      + product.getBuyPrice()
                      + " --> "
                      + fatura.getUrunListesi().get(j).getBirimAlisFiyati());
              product.setBuyPrice(fatura.getUrunListesi().get(j).getBirimAlisFiyati());
              definitionAPI.saveProduct(product);
              change++;
            }
          }
        }
      }

      Notification transactionComplate =
          new Notification(
              change + " tane ürünün fiyatları başarı ile güncellenmiştir.",
              Notification.TYPE_HUMANIZED_MESSAGE);
      transactionComplate.setDelayMsec(-1);
      getWindow().showNotification(transactionComplate);
    } catch (EmptyValueException e) {
      errorN =
          new Notification(
              "Zorunlu Alanları Doldurup Tekrar Deniyeniz!!!", Notification.TYPE_WARNING_MESSAGE);
      errorN.setDelayMsec(-1);
      getWindow().showNotification(errorN);
    } catch (StockManagementException e) {
      if (e.getMessage() != null && e.getMessage().contains("OutOfMemoryError")) {
        getWindow()
            .showNotification(
                "Bilgisayar hafızası yetersiz!!! Bilgisayarı yeniden başlatıp tekrar deneyiniz.",
                Notification.TYPE_ERROR_MESSAGE);
      } else if (e.getCode() != null && e.getCode().equals("1")) {
        getWindow()
            .showNotification(
                vegaKlasor.getValue().toString().trim()
                    + vegaFileName.getValue().toString().trim()
                    + ".xls"
                    + " dosyasında okunacak sayfa bulunamıyor. Lütfen Dosyayı kontrol ediniz!!!",
                Notification.TYPE_ERROR_MESSAGE);
      } else if (e.getCode() != null && e.getCode().equals("2")) {
        getWindow().showNotification(e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
      } else if (e.getCode() != null && e.getCode().equals("3")) {
        getWindow().showNotification(e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
      } else if (e.getCode() != null && e.getCode().equals("4")) {
        getWindow().showNotification(e.getMessage(), Notification.TYPE_ERROR_MESSAGE);
      } else if (e.getMessage() != null && e.getMessage().contains("Row Number")) {
        getWindow()
            .showNotification(
                vegaKlasor.getValue().toString().trim()
                    + vegaFileName.getValue().toString().trim()
                    + ".xls"
                    + " dosyasındaki "
                    + e.getMessage().substring(e.getMessage().lastIndexOf("Row Number") + 11)
                    + " nolu satırda hata var. Lütfen kontrol ediniz!!!",
                Notification.TYPE_ERROR_MESSAGE);
      }
    }
  }
    @Override
    public Component generateBlock(final SimpleOpportunity opportunity, int blockIndex) {
      CssLayout beanBlock = new CssLayout();
      beanBlock.addStyleName("bean-block");
      beanBlock.setWidth("350px");

      VerticalLayout blockContent = new VerticalLayout();
      MHorizontalLayout blockTop = new MHorizontalLayout().withWidth("100%");
      CssLayout iconWrap = new CssLayout();
      iconWrap.setStyleName("icon-wrap");
      FontIconLabel opportunityIcon =
          new FontIconLabel(CrmAssetsManager.getAsset(CrmTypeConstants.OPPORTUNITY));
      iconWrap.addComponent(opportunityIcon);
      blockTop.addComponent(iconWrap);

      VerticalLayout opportunityInfo = new VerticalLayout();
      opportunityInfo.setSpacing(true);

      MButton btnDelete = new MButton(FontAwesome.TRASH_O);
      btnDelete.addClickListener(
          new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
              ConfirmDialogExt.show(
                  UI.getCurrent(),
                  AppContext.getMessage(
                      GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()),
                  AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                  AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                  AppContext.getMessage(GenericI18Enum.BUTTON_NO),
                  new ConfirmDialog.Listener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClose(ConfirmDialog dialog) {
                      if (dialog.isConfirmed()) {
                        ContactService contactService =
                            ApplicationContextUtil.getSpringBean(ContactService.class);
                        ContactOpportunity associateOpportunity = new ContactOpportunity();
                        associateOpportunity.setContactid(contact.getId());
                        associateOpportunity.setOpportunityid(opportunity.getId());
                        contactService.removeContactOpportunityRelationship(
                            associateOpportunity, AppContext.getAccountId());
                        ContactOpportunityListComp.this.refresh();
                      }
                    }
                  });
            }
          });

      btnDelete.addStyleName(UIConstants.BUTTON_ICON_ONLY);

      blockContent.addComponent(btnDelete);
      blockContent.setComponentAlignment(btnDelete, Alignment.TOP_RIGHT);

      Label opportunityName =
          new Label(
              String.format(
                  "Name: <a href='%s%s'>%s</a>",
                  SiteConfiguration.getSiteUrl(AppContext.getUser().getSubdomain()),
                  CrmLinkGenerator.generateCrmItemLink(
                      CrmTypeConstants.OPPORTUNITY, opportunity.getId()),
                  opportunity.getOpportunityname()),
              ContentMode.HTML);

      opportunityInfo.addComponent(opportunityName);

      Label opportunityAmount =
          new Label("Amount: " + (opportunity.getAmount() != null ? opportunity.getAmount() : ""));
      if (opportunity.getCurrency() != null && opportunity.getAmount() != null) {
        opportunityAmount.setValue(
            opportunityAmount.getValue() + opportunity.getCurrency().getSymbol());
      }
      opportunityInfo.addComponent(opportunityAmount);

      Label opportunitySaleStage =
          new Label(
              "Sale Stage: "
                  + (opportunity.getSalesstage() != null ? opportunity.getSalesstage() : ""));
      opportunityInfo.addComponent(opportunitySaleStage);

      ELabel opportunityExpectedCloseDate =
          new ELabel(
                  "Expected Closed Date: "
                      + AppContext.formatPrettyTime(opportunity.getExpectedcloseddate()))
              .withDescription(AppContext.formatDate(opportunity.getExpectedcloseddate()));
      opportunityInfo.addComponent(opportunityExpectedCloseDate);

      blockTop.with(opportunityInfo).expand(opportunityInfo);
      blockContent.addComponent(blockTop);

      blockContent.setWidth("100%");

      beanBlock.addComponent(blockContent);
      return beanBlock;
    }