congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
SInstance.getNestedValidationErrors
Code IndexAdd Tabnine to your IDE (free)

How to use
getNestedValidationErrors
method
in
org.opensingular.form.SInstance

Best Java code snippets using org.opensingular.form.SInstance.getNestedValidationErrors (Showing top 4 results out of 315)

origin: org.opensingular/singular-form-wicket

@Override
public void execute(AjaxRequestTarget target, IModel<SInstance> model) {
  SInstance baseInstance = model.getObject();
  SDocument doc = baseInstance.getDocument();
  Collection<ValidationError> errors = baseInstance.getNestedValidationErrors();
  if ((errors != null) && !errors.isEmpty()) {
    String alertLevel = errors.stream()
      .map(ValidationError::getErrorLevel).max(Comparator.naturalOrder())
      .map(it -> it.le(ValidationErrorLevel.WARNING) ? "alert-warning" : "alert-danger")
      .orElse(null);
    final StringBuilder sb = new StringBuilder("<div><ul class='list-unstyled alert ").append(alertLevel).append("'>");
    for (ValidationError error : errors) {
      Optional<SInstance> inst = doc.findInstanceById(error.getInstanceId());
      inst.ifPresent(sInstance -> sb.append("<li>")
        .append(SFormUtil.generateUserFriendlyPath(sInstance, baseInstance))
        .append(": ")
        .append(error.getMessage())
        .append("</li>"));
    }
    sb.append("</ul></div>");
    target.appendJavaScript(";bootbox.alert('" + JavaScriptUtils.javaScriptEscape(sb.toString()) + "');");
    target.appendJavaScript(Scripts.multipleModalBackDrop());
  }
}
origin: org.opensingular/form-wicket

@Override
public void execute(AjaxRequestTarget target, IModel<SInstance> model) {
  SInstance                    baseInstance = model.getObject();
  SDocument                    doc          = baseInstance.getDocument();
  Collection<IValidationError> errors       = baseInstance.getNestedValidationErrors();
  if ((errors != null) && !errors.isEmpty()) {
    String alertLevel = errors.stream()
        .map(IValidationError::getErrorLevel)
        .collect(Collectors.maxBy(Comparator.naturalOrder()))
        .map(it -> it.le(ValidationErrorLevel.WARNING) ? "alert-warning" : "alert-danger")
        .orElse(null);
    final StringBuilder sb = new StringBuilder("<div><ul class='list-unstyled alert " + alertLevel + "'>");
    for (IValidationError error : errors) {
      Optional<SInstance> inst = doc.findInstanceById(error.getInstanceId());
      if (inst.isPresent()) {
        sb.append("<li>")
            .append(SFormUtil.generateUserFriendlyPath(inst.get(), baseInstance))
            .append(": ")
            .append(error.getMessage())
            .append("</li>");
      }
    }
    sb.append("</ul></div>");
    target.appendJavaScript(";bootbox.alert('" + JavaScriptUtils.javaScriptEscape(sb.toString()) + "');");
    target.appendJavaScript(Scripts.multipleModalBackDrop());
  }
}
origin: org.opensingular/singular-form-wicket

private BSActionPanel.ActionConfig<SInstance> buildShowErrorsActionConfig(IModel<? extends SInstance> model) {
  return new BSActionPanel.ActionConfig<SInstance>()
    .iconeModel(IReadOnlyModel.of(() -> DefaultIcons.EXCLAMATION_TRIANGLE))
    .styleClasses(Model.of("red"))
    .titleFunction(rowModel -> IMappingModel.of(rowModel).map(it -> (it.getNestedValidationErrors().size() + " erro(s) encontrado(s)")).getObject())
    .visibleFor(rowModel -> !rowModel.getObject().getNestedValidationErrors().isEmpty())
    .style($m.ofValue(MapperCommons.BUTTON_STYLE));
}
origin: org.opensingular/form-wicket

private BSActionPanel.ActionConfig<SInstance> buildShowErrorsActionConfig(IModel<? extends SInstance> model) {
  IMappingModel.of(model).map(it -> it.getNestedValidationErrors().size()).getObject();
  return new BSActionPanel.ActionConfig<SInstance>()
      .iconeModel(IReadOnlyModel.of(() -> Icone.EXCLAMATION_TRIANGLE))
      .styleClasses(Model.of("red"))
      .titleFunction(rowModel -> IMappingModel.of(rowModel).map(it -> (it.getNestedValidationErrors().size() + " erro(s) encontrado(s)")).getObject())
      .style($m.ofValue(MapperCommons.BUTTON_STYLE));
}
org.opensingular.formSInstancegetNestedValidationErrors

Popular methods of SInstance

  • getDocument
    Retorna o documento ao qual pertence a instância atual.
  • getType
  • toStringDisplay
  • getId
    Retorna um ID único dentre as instâncias do mesmo documento. Um ID nunca é reutilizado, mesmo se a i
  • getAttributeValue
  • findNearest
    Returns the nearest SInstance for the given type in the form SInstance tree. The search is performed
  • setId
    Apenas para uso nas soluções de persistencia. Não deve ser usado fora dessa situação.
  • clearInstance
    Apaga os valores associados a instância. Se for uma lista ou composto, apaga os valores em profundid
  • getName
  • getParent
  • getValue
  • isEmptyOfData
    Retorna true se a instancia não conter nenhuma informação diferente de null. A pesquisa é feita em
  • getValue,
  • isEmptyOfData,
  • asAtr,
  • asAtrAnnotation,
  • asAtrProvider,
  • attachEventCollector,
  • detachEventCollector,
  • getDictionary,
  • getField,
  • getPathFromRoot

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • findViewById (Activity)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now