Example #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);
   }
 }
Example #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);
     }
   }
 }
Example #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);
   }
 }
Example #4
0
 @Override
 protected Object getValue(Object element) {
   CatRateLinkEntity entity = (CatRateLinkEntity) element;
   return rates.indexOf(entity.getRate());
 }
Example #5
0
 @Override
 protected Object getValue(Object element) {
   CatRateLinkEntity entity = (CatRateLinkEntity) element;
   Integer defValue = entity.getDefValue();
   return String.valueOf(defValue);
 }
Example #6
0
 @Override
 public String getText(Object o) {
   CatRateLinkEntity entity = (CatRateLinkEntity) o;
   return String.valueOf(entity.getDefValue());
 }
Example #7
0
 @Override
 public String getText(Object o) {
   CatRateLinkEntity entity = (CatRateLinkEntity) o;
   return entity.getRate().getName();
 }