Example #1
0
 protected void applyValidation(de.jutzig.jabylon.properties.Property property) {
   Collection<Review> reviewList =
       reviewService.review(descriptor, currentItem.getSourceProperty(), property);
   reviews.removeAll(currentItem.getKey());
   if (reviewList.isEmpty()) {
     if (translated.getComponentError() != null) translated.setComponentError(null);
   } else {
     reviews.putAll((String) currentItem.getKey(), reviewList);
     List<ErrorMessage> errors = new ArrayList<ErrorMessage>(reviewList.size());
     for (Review review : reviewList) {
       UserError error =
           new UserError(review.getMessage(), UserError.CONTENT_TEXT, ErrorMessage.ERROR);
       errors.add(error);
     }
     CompositeErrorMessage message = new CompositeErrorMessage(errors);
     translated.setComponentError(message);
   }
 }
Example #2
0
  @Override
  public void valueChange(ValueChangeEvent event) {
    Object value = event.getProperty().getValue();
    if (value == null) return;
    Item theItem = propertyPairContainer.getItem(value);
    currentItem = (PropertyPairItem) theItem;
    // a clone, so a change event won't mess the table selection
    PropertyPairItem clone =
        new PropertyPairItem(currentItem.getSourceProperty(), currentItem.getTargetProperty());
    propertyToolArea.selectionChanged(clone, reviews.get((String) clone.getKey()), this);

    keyLabel.setValue(clone.getKey());
    translated.setPropertyDataSource(clone.getTarget());
    orignal.setPropertyDataSource(clone.getSource());

    translatedComment.setPropertyDataSource(clone.getTargetComment());
    orignalComment.setPropertyDataSource(clone.getSourceComment());

    applyValidation(clone.getTargetProperty());
  }