Class ModelValidator

java.lang.Object
org.opentcs.guing.persistence.ModelValidator

public class ModelValidator
extends java.lang.Object
Validator for a SystemModel and its ModelComponents. Validates if the model component can safely be added to a system model.
  • Constructor Summary

    Constructors 
    Constructor Description
    ModelValidator()
    Creates a new instance.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String formatDeserializationErrors​(org.opentcs.guing.model.ModelComponent component, java.util.Collection<java.lang.String> errors)  
    java.util.List<java.lang.String> getErrors()
    Returns all errors which happened after the last reset.
    boolean isValidWith​(org.opentcs.guing.model.SystemModel model, org.opentcs.guing.model.ModelComponent component)
    Checks whether the given model will be valid if the component would be added to it.
    void resetErrors()
    Clears all error messages.
    void showLoadingValidationWarning​(java.awt.Component parent, java.util.Collection<java.lang.String> content)  
    void showSavingValidationWarning​(java.awt.Component parent, java.util.Collection<java.lang.String> content)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ModelValidator

      @Inject public ModelValidator()
      Creates a new instance.
  • Method Details

    • getErrors

      public final java.util.List<java.lang.String> getErrors()
      Returns all errors which happened after the last reset.
      Returns:
      the collection of errors as string
    • resetErrors

      public void resetErrors()
      Clears all error messages.
    • isValidWith

      public boolean isValidWith​(org.opentcs.guing.model.SystemModel model, org.opentcs.guing.model.ModelComponent component)
      Checks whether the given model will be valid if the component would be added to it.
      Parameters:
      model - the system model
      component - the model component
      Returns:
      true if the model will be valid after adding the component, false otherwise
    • showLoadingValidationWarning

      public void showLoadingValidationWarning​(java.awt.Component parent, java.util.Collection<java.lang.String> content)
    • showSavingValidationWarning

      public void showSavingValidationWarning​(java.awt.Component parent, java.util.Collection<java.lang.String> content)
    • formatDeserializationErrors

      public java.lang.String formatDeserializationErrors​(org.opentcs.guing.model.ModelComponent component, java.util.Collection<java.lang.String> errors)