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

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

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

origin: org.opensingular/exemplos-form

private SInstance getRoot(SInstance instance) {
  while (instance.getParent() != null) {
    instance = instance.getParent();
  }
  return instance;
}
origin: org.opensingular/singular-form-core

public boolean isDescendantOf(SInstance ancestor) {
  for (SInstance current = getParent(); current != null; current = current.getParent()) {
    if (current == ancestor) {
      return true;
    }
  }
  return false;
}
origin: org.opensingular/form-core

public static SIComposite getRootInstance(SInstance instance) {
  //TODO (by Daniel) Deveria retornar SInstance. Refatorar.
  SInstance i = instance;
  while (i.getParent() != null) {
    i = i.getParent();
  }
  return (SIComposite) i;
}
origin: org.opensingular/form-core

public boolean isDescendantOf(SInstance ancestor) {
  for (SInstance current = getParent(); current != null; current = current.getParent()) {
    if (current == ancestor) {
      return true;
    }
  }
  return false;
}
origin: org.opensingular/form-wicket

private static boolean isOrphan(SInstance i) {
  return !(i instanceof SIComposite) && i.getParent() == null;
}
origin: org.opensingular/singular-form-core

private static boolean isOrphan(SInstance i) {
  return !(i instanceof SIComposite) && i.getParent() == null;
}
origin: org.opensingular/singular-form-wicket

  @Override
  public Optional<SInstanceConverter> apply(SInstance inst) {
    return Optional.ofNullable(inst.getParent()).map(SAttributeEnabled::asAtrProvider).map(AtrProvider::getConverter);
  }
}
origin: org.opensingular/form-core

@Nonnull
public static <A extends SType<?>> Optional<SInstance> findAncestor(SInstance node, Class<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.getType().getClass().equals(ancestorType)) {
      return Optional.of(parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-core

@Nonnull
public static <A extends SType<?>> Optional<SInstance> findAncestor(SInstance node, Class<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.getType().getClass().equals(ancestorType)) {
      return Optional.of(parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-core

/**
 * Busca por um ancestral de <code>node</code> do tipo especificado.
 *
 * @param node         instância inicial da busca
 * @param ancestorType tipo do ancestral
 * @return Optional da instância do ancestral do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <A extends SInstance & ICompositeInstance> Optional<A> findAncestor(SInstance node, SType<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.isTypeOf(ancestorType)) {
      return Optional.of((A) parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-core

/**
 * Busca por um ancestral de <code>node</code> do tipo especificado.
 * @param node instância inicial da busca
 * @param ancestorType tipo do ancestral
 * @return Optional da instância do ancestral do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <A extends SInstance & ICompositeInstance> Optional<A> findAncestor(SInstance node, SType<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.getType().isTypeOf(ancestorType)) {
      return Optional.of((A) parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-core

/**
 * Criar um XPath para a instância no formato "order[@id=1]/address[@id=4]/street[@id=5]".
 */
private StringBuilder buildXPath(SInstance instance, StringBuilder path) {
  if (instance.getParent() != null) {
    buildXPath(instance.getParent(), path);
  }
  if (path.length() != 0) {
    path.append('/');
  }
  path.append(instance.getName()).append("[@id=").append(instance.getId()).append(']');
  return path;
}
origin: org.opensingular/form-core

/**
 * Criar um XPath para a instância no formato "order[@id=1]/address[@id=4]/street[@id=5]".
 */
private StringBuilder buildXPath(SInstance instance, StringBuilder path) {
  if (instance.getParent() != null) {
    buildXPath(instance.getParent(), path);
  }
  if (path.length() != 0) {
    path.append('/');
  }
  path.append(instance.getName()).append("[@id=").append(instance.getId()).append("]");
  return path;
}
origin: org.opensingular/form-core

/**
 * Lista os ancestrais de <code>node</code>.
 * @param instance instância inicial da busca
 * @return Lista das instâncias de ancestrais do tipo especificado
 */
public static List<SInstance> listAscendants(SInstance instance, SType<?> limitInclusive, boolean selfIncluded) {
  List<SInstance> list = new ArrayList<>();
  if (selfIncluded) {
    list.add(instance);
  }
  SInstance node = instance.getParent();
  while (node != null && !node.getType().isTypeOf(limitInclusive)) {
    list.add(node);
    node = node.getParent();
  }
  return list;
}
origin: org.opensingular/singular-form-core

@SuppressWarnings("unchecked")
public static <A extends SInstance> Optional<A> findNearest(SInstance children, SInstance node, Class<? extends SType<A>> targetTypeClass) {
  Optional<A> desc = (Optional<A>) SInstances.streamDescendants(node, true)
    .filter(sInstance -> sInstance != children)
    .filter(sInstance -> targetTypeClass.isAssignableFrom(sInstance.getType().getClass()))
    .findFirst();
  if (desc.isPresent()) {
    return desc;
  } else if (node.getParent() != null) {
    return findNearest(node, node.getParent(), targetTypeClass);
  } else {
    return Optional.empty();
  }
}
origin: org.opensingular/singular-form-core

private void assertCorrectParentRelation(SInstance target) {
  for (SInstance child : target.getChildren()) {
    if (target != child.getParent()) {
      throw new AssertionError(
          "Incossitência Interna: A instância '" + child.getPathFull() + "', filho de '" +
              target.getPathFull() + "', aponta para um outro pai: '" + child.getParent() + "'");
    }
    assertCorrectParentRelation(child);
  }
}
origin: org.opensingular/form-wicket

public SelectSInstanceAwareModel.SelectConverterResolver getCustomSelectConverterResolver(){
  return si -> Optional.ofNullable(si.getParent().asAtrProvider().getConverter());
}
origin: org.opensingular/singular-form-core

protected static Optional<SInstance> findAncestor(SInstance instance, SType<?> type) {
  for (SInstance current = instance; current != null; current = current.getParent()) {
    if (current.getType().getSuperType() == type || current.getType() == type) {
      return Optional.of(current);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-wicket

  @Override
  protected void buildFields(WicketBuildContext ctx, BSGrid grid) {
    if ((ctx.getCurrentInstance().getParent() == null && !ctx.isNested())
        || (ctx.getParent().getView() instanceof SViewTab && !(ctx.getView() instanceof SViewByBlock))) {
      grid.setCssClass("singular-container");
    }
    super.buildFields(ctx, grid);
  }
}
origin: org.opensingular/singular-form-wicket

  @Override
  protected void buildFields(WicketBuildContext ctx, BSGrid grid) {
    if (((ctx.getCurrentInstance().getParent() == null) && (!ctx.isNested())) ||
      ((ctx.getParent().getView() instanceof SViewTab) && !(ctx.getView() instanceof SViewByBlock))) {
      grid.setCssClass("singular-container");
    }
    super.buildFields(ctx, grid);
  }
}
org.opensingular.formSInstancegetParent

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
  • getValue
  • isEmptyOfData
    Retorna true se a instancia não conter nenhuma informação diferente de null. A pesquisa é feita em
  • asAtr
  • isEmptyOfData,
  • asAtr,
  • asAtrAnnotation,
  • asAtrProvider,
  • attachEventCollector,
  • detachEventCollector,
  • getDictionary,
  • getField,
  • getPathFromRoot

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • compareTo (BigDecimal)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • 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