Codota Logo
SInstance.getNestedValidationErrors
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
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

  • Updating database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • onCreateOptionsMenu (Activity)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now