Exemple #1
0
 @Override
 protected void setValue(Object element, Object value) {
   CatRateLinkEntity linkEntity = (CatRateLinkEntity) element;
   String valueStr = (String) value;
   try {
     linkEntity.setDefValue(Integer.valueOf(valueStr));
     DbHelper.merge(linkEntity);
     viewer.update(element, null);
   } catch (Exception e) {
     Util.dbError(shell, e);
   }
 }
Exemple #2
0
 @Override
 protected void setValue(Object element, Object value) {
   if ((Integer) value > -1) {
     RateRbEntity rateEntity = rates.get((Integer) value);
     CatRateLinkEntity entity = (CatRateLinkEntity) element;
     try {
       entity.setRate(rateEntity);
       DbHelper.merge(entity);
       viewer.update(element, null);
     } catch (Exception e) {
       Util.dbError(shell, e);
     }
   }
 }
Exemple #3
0
 /** Добавление строки в таблицу. */
 @SuppressWarnings({"unchecked"})
 public void append() {
   EntityManager em = DbHelper.getEm();
   Query query = em.createQuery("select r from RateRbEntity r");
   List<RateRbEntity> rbEntities = query.getResultList();
   if (rbEntities.size() == 0) {
     Util.warning(
         getShell(), "Внимание", "Сначала необходимо внести оценки в справочник оценок!");
     return;
   }
   CatRateLinkEntity linkEntity = new CatRateLinkEntity();
   linkEntity.setCat(catCurrent);
   linkEntity.setRate(rbEntities.get(0));
   linkEntity.setDefValue(0);
   try {
     DbHelper.persist(linkEntity);
     entityList.add(linkEntity);
   } catch (Exception e) {
     Util.dbError(getShell(), e);
   }
 }
Exemple #4
0
 @Override
 protected Object getValue(Object element) {
   CatRateLinkEntity entity = (CatRateLinkEntity) element;
   return rates.indexOf(entity.getRate());
 }
Exemple #5
0
 @Override
 protected Object getValue(Object element) {
   CatRateLinkEntity entity = (CatRateLinkEntity) element;
   Integer defValue = entity.getDefValue();
   return String.valueOf(defValue);
 }
Exemple #6
0
 @Override
 public String getText(Object o) {
   CatRateLinkEntity entity = (CatRateLinkEntity) o;
   return String.valueOf(entity.getDefValue());
 }
Exemple #7
0
 @Override
 public String getText(Object o) {
   CatRateLinkEntity entity = (CatRateLinkEntity) o;
   return entity.getRate().getName();
 }