Tabnine Logo
SInstance.asAtrAnnotation
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.opensingular/singular-form-core

  /**
   * Retorna true sea instância ou algums de seus filhos é capaz de receber anotação. Ou seja, se foi marcado como
   * anotável.
   */
  public boolean hasAnyAnnotable(SInstance instance) {
    return SInstances.hasAny(instance, i -> i.asAtrAnnotation().isAnnotated());
  }
}
origin: org.opensingular/form-core

  /**
   * Retorna true sea instância ou algums de seus filhos é capaz de receber anotação. Ou seja, se foi marcado como
   * anotável.
   */
  public boolean hasAnyAnnotable(SInstance instance) {
    return SInstances.hasAny(instance, i -> i.asAtrAnnotation().isAnnotated());
  }
}
origin: org.opensingular/singular-form-core

private static boolean isRejected(SInstance instance) {
  return isFalse(instance.asAtrAnnotation().approved());
}
origin: org.opensingular/singular-form-core

private static boolean isApproved(SInstance instance) {
  return isTrue(instance.asAtrAnnotation().approved());
}
origin: org.opensingular/singular-form-core

/**
 * Verifica se a anotação existe e possui o texto experado. Se o caminho for null, então faz o teste para a
 * instância atual.
 */
public AssertionsSInstance isAnnotationTextEquals(String fieldPath, String expectedText) {
  AssertionsSInstance field = field(fieldPath);
  String currentText = field.getTarget().asAtrAnnotation().text();
  if(! Objects.equals(expectedText, currentText)) {
    throw new AssertionError(field.errorMsg("Texto da anotação incorreto", expectedText, currentText));
  }
  return this;
}
origin: org.opensingular/form-wicket

protected static String getTitle(ISInstanceAwareModel<SIComposite> referenced) {
  final String annotationLabel = referenced.getMInstancia().asAtrAnnotation().label();
  if (isNotBlank(annotationLabel))
    return annotationLabel;
  final String referencedLabel = referenced.getMInstancia().asAtr().getLabel();
  if (isNotBlank(referencedLabel))
    return String.format("Comentários sobre %s", referencedLabel);
  return "Comentários";
}
origin: org.opensingular/form-core

/** Retorna true se a instância ou algum de seus filhos tiver uma anotação marcadada como não aprovada. */
public boolean hasAnyRefusal(SInstance instance) {
  return SInstances.hasAny(instance, i -> hasAnnotation(i) && !i.asAtrAnnotation().annotation().getApproved());
}
origin: org.opensingular/singular-form-core

/** Retorna true se a instância ou algum de seus filhos tiver uma anotação marcadada como não aprovada. */
public boolean hasAnyRefusal(SInstance instance) {
  return SInstances.hasAny(instance, i -> hasAnnotation(i) && BooleanUtils.isFalse(i.asAtrAnnotation().annotation().getApproved()));
}
origin: org.opensingular/singular-form-core

/**
 * Returns true if the given instance or any of its children is annotated with an refusal
 * @param instance
 * @return
 */
public boolean hasAnyRefusalOnTree(SInstance instance) {
  return SInstances.hasAny(instance, i -> hasAnnotation(i) && BooleanUtils.isFalse(i.asAtrAnnotation().annotation().getApproved()));
}
origin: org.opensingular/singular-form-core

  @Override
  public void onAction(SInstanceAction action, ISupplier<SInstance> actionInstanceSupplier, Delegate delegate) {
    final SInstance formInstance = formDelegate.getFormInstance();
    final SInstance fieldInstance = delegate.getInstanceRef().get();
    final SIAnnotation annotationInstance = fieldInstance.asAtrAnnotation().annotation();
    annotationInstance.setApproved(formInstance.getValue(EditAnotacaoRefType.APPROVED));
    annotationInstance.setText(formInstance.getValue(EditAnotacaoRefType.JUSTIFICATION));
    delegate.refreshFieldForInstance(fieldInstance);
    formDelegate.close();
  }
}
origin: org.opensingular/singular-form-wicket

private void checkSubtree(String name) {
  SInstance field = instance.getField(name);
  if (field != null) {
    AtrAnnotation annotatedField = field.asAtrAnnotation();
    if (annotatedField.hasAnyAnnotationOnTree()) {
      checkAnnotation(annotatedField);
    } else if (ctx.getRootContext().getAnnotationMode().editable() &&
        annotatedField.hasAnyAnnotable()) {
      isAnnotated = true;
    }
  }
}
origin: org.opensingular/singular-form-wicket

private BSActionPanel.ActionConfig<SInstance> buildShowAnnotationsActionConfig() {
  IPredicate<SInstance> hasAnyRefusal = it -> it.asAtrAnnotation().hasAnyRefusal();
  IPredicate<SInstance> hasAnyAnnotable = it -> it.asAtrAnnotation().hasAnyAnnotable();
  IPredicate<SInstance> hasAnyAnnotation = it -> it.asAtrAnnotation().hasAnyAnnotationOnTree();
  //@formatter:off
  IFunction<SInstance, String> titleFunc = it ->
      hasAnyRefusal.test(it) ? "Possui anotação rejeitada"
          : hasAnyAnnotation.test(it) ? "Possui anotação"
          : hasAnyAnnotable.test(it) ? "Possui anotável"
          : null;
  IFunction<SInstance, IModel<Icon>> iconFunc = it ->
      $m.ofValue(
          hasAnyRefusal.test(it) ? Icon.of("annotation-icon annotation-icon-rejected")
              : hasAnyAnnotation.test(it) ? Icon.of("annotation-icon annotation-icon-approved")
              : hasAnyAnnotable.test(it) ? Icon.of("annotation-icon annotation-icon-empty")
              : null
      );
  //@formatter:on
  return new BSActionPanel.ActionConfig<SInstance>()
    .iconFunction(rowModel -> iconFunc.apply(rowModel.getObject()))
    .titleFunction(rowModel -> titleFunc.apply(rowModel.getObject()))
    .style($m.ofValue("line-height:1em; font-size: 1em;"));
}
origin: org.opensingular/form-wicket

private void checkSubtree(String name) {
  SInstance field = instance.getField(name);
  if (field != null) {
    AtrAnnotation annotatedField = field.asAtrAnnotation();
    if (annotatedField.hasAnyAnnotationOnTree()) {
      checkAnnotation(annotatedField);
    } else if (ctx.getRootContext().getAnnotationMode().editable() &&
      annotatedField.hasAnyAnnotable()) {
      isAnnotated = true;
    }
  }
}
origin: org.opensingular/singular-form-core

@Override
public Iterable<SInstanceAction> getActions(ISInstanceActionCapable target, SInstance instance) {
  final boolean annotatable = instance.asAtrAnnotation().isAnnotated();
  if (!annotatable || !annotationsVisible.test(instance))
    return Collections.emptyList();
  final boolean editable = annotationsEditable.test(instance);
  SInstanceAction editAction = new SInstanceAction(SInstanceAction.ActionType.NORMAL)
      .setIcon(resolveIcon(instance))
      .setText(getEditActionTitle(instance))
      .setPosition(Integer.MAX_VALUE)
      .setPreview(resolvePreview(instance, editable))
      .setActionHandler(new EditAnnotationHandler());
  return Collections.singletonList(editAction);
}
origin: org.opensingular/singular-form-core

  @Override
  public void onAction(SInstanceAction action, ISupplier<SInstance> fieldInstance, Delegate delegate) {
    Out<FormDelegate> formDelegate = new Out<>();
    delegate.openForm(formDelegate,
        "Você está prestes a remover este comentário",
        "Deseja realmente prosseguir e apagá-lo?",
        () -> null,
        fd -> Arrays.asList(
            new SInstanceAction(ActionType.CONFIRM)
                .setText("Apagar")
                .setActionHandler((a, i, d) -> {
                  d.getInstanceRef().get().asAtrAnnotation().clear();
                  d.refreshFieldForInstance(d.getInstanceRef().get());
                  fd.close();
                }),
            new SInstanceAction(ActionType.CANCEL)
                .setText("Cancelar")
                .setActionHandler((a, i, d) -> fd.close())//
        ));
  }
}
origin: org.opensingular/singular-form-core

    + "%s"
    + "</div>",
HTMLUtil.escapeHtml(Objects.toString(instance.asAtrAnnotation().text(), "")),
isTrue(instance.asAtrAnnotation().approved())
    ? "<div class='annotation-status annotation-status-approved'>Aprovado</div>"
    : isFalse(instance.asAtrAnnotation().approved())
    ? "<div class='annotation-status annotation-status-rejected'>Rejeitado</div>"
    : ""))
origin: org.opensingular/singular-form-core

  @Override
  public void onAction(SInstanceAction action, ISupplier<SInstance> fieldInstance, Delegate delegate) {
    ISupplier<SInstance> formSupplier = () -> {
      SInstance ins = SDocumentFactory.empty().createInstance(new EditAnotacaoRefType());
      ins.getField(EditAnotacaoRefType.APPROVED)
          .setValue(fieldInstance.get().asAtrAnnotation().approved());
      ins.getField(EditAnotacaoRefType.JUSTIFICATION)
          .setValue(fieldInstance.get().asAtrAnnotation().text());
      return ins;
    };
    Out<SInstanceAction.FormDelegate> formDelegate = new Out<>();
    delegate.openForm(formDelegate,
        getEditActionTitle(fieldInstance.get()),
        null,
        formSupplier,
        fd -> Arrays.asList(
            new SInstanceAction(SInstanceAction.ActionType.CONFIRM)
                .setText("Confirmar")
                .setActionHandler(new ConfirmarEdicaoHandler(fd)), //
            new SInstanceAction(SInstanceAction.ActionType.CANCEL)
                .setText("Cancelar")
                .setActionHandler(new CloseFormHandler(fd)) //
        ));
  }
}
org.opensingular.formSInstanceasAtrAnnotation

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,
  • asAtrProvider,
  • attachEventCollector,
  • detachEventCollector,
  • getDictionary,
  • getField,
  • getPathFromRoot

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JFrame (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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