Exemple #1
0
 public void setBinding(AbstractBinding value) {
   AbstractBinding oldValue = this.binding;
   if (oldValue == null) {
     if (value == null) {
       return; // No change
     } else {
       this.binding = value;
       unparsedBinding = value != null ? value.getStringRepresentation() : null;
       updateDependancies();
       if (bindingAttribute != null) {
         owner.notify(
             new FIBAttributeNotification<AbstractBinding>(bindingAttribute, oldValue, value));
       }
       owner.notifyBindingChanged(this);
       return;
     }
   } else {
     if (oldValue.equals(value)) {
       return; // No change
     } else {
       this.binding = value;
       unparsedBinding = value != null ? value.getStringRepresentation() : null;
       if (logger.isLoggable(Level.FINE)) {
         logger.fine("Binding takes now value " + value);
       }
       updateDependancies();
       if (bindingAttribute != null) {
         owner.notify(
             new FIBAttributeNotification<AbstractBinding>(bindingAttribute, oldValue, value));
       }
       owner.notifyBindingChanged(this);
       return;
     }
   }
 }
 protected final void validate(ValidationReport report) {
   applyValidation(report);
   if (getEmbeddedObjects() != null) {
     for (FIBModelObject o : getEmbeddedObjects()) {
       o.validate(report);
     }
   }
 }
 private static boolean isNameUsedInHierarchy(String aName, FIBModelObject object) {
   if (object.getName() != null && object.getName().equals(aName)) {
     return true;
   }
   if (object.getEmbeddedObjects() != null) {
     for (FIBModelObject o : object.getEmbeddedObjects()) {
       if (isNameUsedInHierarchy(aName, o)) return true;
     }
   }
   return false;
 }
 private static List<FIBModelObject> retrieveObjectsWithName(
     String aName, FIBModelObject object, List<FIBModelObject> list) {
   if (object.getName() != null && object.getName().equals(aName)) {
     list.add(object);
   }
   if (object.getEmbeddedObjects() != null) {
     for (FIBModelObject o : object.getEmbeddedObjects()) {
       retrieveObjectsWithName(aName, o, list);
     }
   }
   return list;
 }
 @Override
 public ValidationIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> applyValidation(
     FIBModelObject object) {
   if (StringUtils.isNotEmpty(object.getName())) {
     List<FIBModelObject> allObjectsWithThatName = object.getObjectsWithName(object.getName());
     if (allObjectsWithThatName.size() > 1) {
       allObjectsWithThatName.remove(object);
       GenerateUniqueName fixProposal = new GenerateUniqueName();
       ProblemIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> returned;
       if (object instanceof FIBWidget && ((FIBWidget) object).getManageDynamicModel()) {
         returned =
             new ValidationError<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>(
                 this, object, "object_($object.toString)_has_duplicated_name", fixProposal);
       } else {
         returned =
             new ValidationWarning<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>(
                 this, object, "object_($object.toString)_has_duplicated_name", fixProposal);
       }
       returned.addToRelatedValidableObjects(allObjectsWithThatName);
       return returned;
     }
   }
   return null;
 }
Exemple #6
0
 protected void finalizeDeserialization() {
   finalizeDeserialization(false);
   if (owner != null && hasBinding() && isValid()) {
     owner.notifyBindingChanged(this);
   }
 }