Package org.opentcs.guing.persistence
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.StringformatDeserializationErrors(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.booleanisValidWith(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.voidresetErrors()Clears all error messages.voidshowLoadingValidationWarning(java.awt.Component parent, java.util.Collection<java.lang.String> content)voidshowSavingValidationWarning(java.awt.Component parent, java.util.Collection<java.lang.String> content)
-
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 modelcomponent- 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)
-