public void validateNode() {
    boolean prevValid = valid;
    String prevMessages = getValidationMessagesString();

    validate();

    if (suppressEvents == false) {
      this.firePropertyChange(
          "validationMessagesString", prevMessages, getValidationMessagesString());
      this.firePropertyChange("valid", prevValid, valid);
    }

    if (valid) {
      setImage(getValidImage());
    } else {
      setImage(getInvalidImage());
    }

    if (prevValid != valid) {
      // changing of one element could cause others to become valid or invalid
      AbstractModelNode root = getRoot();
      if (root != null && root instanceof AbstractMetaDataModelNode) {
        AbstractMetaDataModelNode rootNode = (AbstractMetaDataModelNode) root;
        rootNode.validateTree();
      }
    }
  }
 @SuppressWarnings("unchecked")
 public void validateTree() {
   for (T t : this) {
     ((AbstractMetaDataModelNode) t).validateTree();
   }
   validateNode();
 };
Exemplo n.º 3
0
  @Override
  public void validate() {
    valid = true;
    this.validationMessages.clear();

    if ("".equals(this.getName())) {
      valid = false;
      this.validationMessages.add(
          "Node is emtpy"); // BaseMessages.getString(ModelerWorkspace.class,
                            // "MainModelNode.ModelNameEmpty")); //$NON-NLS-1$
    }

    if (this.children.size() != 2) {
      valid = false;
      this.validationMessages.add(
          "Invalid Structure"); // BaseMessages.getString(ModelerWorkspace.class,
                                // "MainModelNode.ModelStructureInvalid")); //$NON-NLS-1$
    }
    for (AbstractMetaDataModelNode child : children) {
      valid &= child.isValid();
      this.validationMessages.addAll(child.getValidationMessages());
    }
  }
Exemplo n.º 4
0
 @Override
 public void onAdd(AbstractMetaDataModelNode child) {
   child.addPropertyChangeListener("children", getListener()); // $NON-NLS-1$
   child.addPropertyChangeListener("valid", validListener); // $NON-NLS-1$
 }
Exemplo n.º 5
0
 public void setSupressEvents(boolean suppress) {
   super.setSupressEvents(suppress);
   if (!suppress) {
     firePropertyChange("valid", !isValid(), isValid());
   }
 }
Exemplo n.º 6
0
 @Override
 public void onRemove(AbstractMetaDataModelNode child) {
   child.removePropertyChangeListener(getListener());
   child.removePropertyChangeListener(validListener);
 }