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

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

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

origin: org.opensingular/form-wicket

/**
 * Recupera o Path a partir de um model
 * @param model o model que representa a instancia
 * @param <T> o tipo do model
 * @return o path
 */
private <T> Optional<String> getPath(IModel<T> model) {
  final T object = model.getObject();
  if (object instanceof SInstance) {
    return Optional.of(((SInstance) object).getPathFromRoot());
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-wicket

/**
 * Recupera o Path a partir de um model
 * @param model o model que representa a instancia
 * @param <T> o tipo do model
 * @return o path
 */
private <T> Optional<String> getPath(IModel<T> model) {
  final T object = model.getObject();
  if (object instanceof SInstance) {
    return Optional.of(((SInstance) object).getPathFromRoot()+ ((SInstance) object).getId());
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-core

private static void defineFocusField(SInstance instance, FormSerialized fs) {
  if (instance.getRoot() != instance) {
    fs.setFocusFieldPath(instance.getPathFromRoot());
  }
}
origin: org.opensingular/form-core

private static void defineFocusField(SInstance instance, FormSerialized fs) {
  if (instance.getDocument().getRoot() != instance) {
    fs.setFocusFieldPath(instance.getPathFromRoot());
  }
}
origin: org.opensingular/singular-form-core

/**
 * Copia para o documento atual todas as anotação do documento fonte que tiverem um caminho corresponde no documento
 * atual.
 */
public void copyAnnotationsFrom(SDocument source) {
  Objects.requireNonNull(source);
  DocumentAnnotations sourceAnnotations = source.getDocumentAnnotations();
  if (sourceAnnotations.hasAnnotations()) {
    for (SIAnnotation sourceAnnotation : sourceAnnotations.annotations) {
      source.findInstanceById(sourceAnnotation.getTargetId()).ifPresent(si -> {
        String pathFromRoot = si.getPathFromRoot();
        //localiza a instancia correspondente no formulario destino
        SInstance targetInstance = document.getRoot();
        if (pathFromRoot != null){
          targetInstance = document.getRoot().getFieldOpt(pathFromRoot).orElse(targetInstance);
        }
        //Copiando todos os valores da anotação (inclusive o id na sinstance antiga)
        SIAnnotation targetAnnotation = getAnnotationOrCreate(targetInstance, sourceAnnotation.getClassifier());
        Value.copyValues(sourceAnnotation, targetAnnotation);
        //Corrigindo o ID
        targetAnnotation.setTarget(targetInstance);
      });
    }
  }
}
origin: org.opensingular/form-core

/**
 * Copia para o documento atual todas as anotação do documento fonte que tiverem um caminho corresponde no documento
 * atual.
 */
public void copyAnnotationsFrom(SDocument source) {
  Objects.requireNonNull(source);
  DocumentAnnotations sourceAnnotations = source.getDocumentAnnotations();
  if (sourceAnnotations.hasAnnotations()) {
    for (SIAnnotation sourceAnnotation : sourceAnnotations.annotations) {
      source.findInstanceById(sourceAnnotation.getTargetId()).ifPresent(si -> {
        String pathFromRoot = si.getPathFromRoot();
        //localiza a instancia correspondente no formulario destino
        SInstance targetInstance = document.getRoot();
        if (pathFromRoot != null){
          targetInstance = ((SIComposite) document.getRoot()).getField(pathFromRoot);
        }
        //Copiando todos os valores da anotação (inclusive o id na sinstance antiga)
        SIAnnotation targetAnnotation = getAnnotationOrCreate(targetInstance, sourceAnnotation.getClassifier());
        Value.copyValues(sourceAnnotation, targetAnnotation);
        //Corrigindo o ID
        targetAnnotation.setTarget(targetInstance);
      });
    }
  }
}
origin: org.opensingular/singular-form-wicket

  @Override
  public void onClick(AjaxRequestTarget target) {
    final SInstance si = m.getObject();
    if (si instanceof SIList) {
      final SIList sil = (SIList) si;
      if (sil.getType().getMaximumSize() != null && sil.getType().getMaximumSize() == sil.size()) {
        target.appendJavaScript(";bootbox.alert('A quantidade máxima de valores foi atingida.');");
        target.appendJavaScript(Scripts.multipleModalBackDrop());
      } else {
        adding = true;
        pushStatus();
        SInstance sInstance = sil.addNew();
        IModel<? extends SInstance> itemModel = new SInstanceFieldModel<>(ctx.getRootContext().getModel(), sInstance.getPathFromRoot());
        showCrud(ctx, target, itemModel);
      }
    }
  }
});
origin: org.opensingular/form-wicket

  @Override
  public void onClick(AjaxRequestTarget target) {
    final SInstance si = m.getObject();
    if (si instanceof SIList) {
      final SIList sil = (SIList) si;
      if (sil.getType().getMaximumSize() != null && sil.getType().getMaximumSize() == sil.size()) {
        target.appendJavaScript(";bootbox.alert('A Quantidade máxima de valores foi atingida.');");
        target.appendJavaScript(Scripts.multipleModalBackDrop());
      } else {
        adding = true;
        pushStatus();
        SInstance sInstance = sil.addNew();
        IModel<? extends SInstance> itemModel = new SInstanceFieldModel<>(ctx.getRootContext().getModel(), sInstance.getPathFromRoot());
        showCrud(ctx, target, itemModel);
      }
    }
  }
});
org.opensingular.formSInstancegetPathFromRoot

Javadoc

Retorna o path da instancia atual relativa ao elemento raiz, ou seja, não inclui o nome da instância raiz no path gerado.

Exemplos, supundo que enderecos e experiencias estao dentro de um elemento raiz (vamos dizer chamado cadastro):

 
"enderecos[0].rua" 
"experiencias[0].empresa.nome" 
"experiencias[1].empresa.ramo" 

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • JLabel (javax.swing)
  • Best plugins for Eclipse
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