Tabnine Logo
SType
Code IndexAdd Tabnine to your IDE (free)

How to use
SType
in
org.opensingular.form

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

origin: org.opensingular/form-core

/**
 * Listener é invocado quando o campo do qual o tipo depende
 * é atualizado ( a dependencia é expressa via depends on)
 */
public SType<I> withUpdateListener(IConsumer<I> consumer) {
  asAtr().setAttributeValue(SPackageBasic.ATR_UPDATE_LISTENER, consumer);
  return this;
}
origin: org.opensingular/form-core

private void debugAttributesDefined(Appendable appendable, int level) {
  attributesDefined.getAttributes().stream().filter(att -> !getLocalTypeOptional(att.getNameSimple())
      .isPresent()).forEach(att -> {
    try {
      pad(appendable, level + 1).append("att ").append(suppressPackage(att.getName()))
          .append(':').append(suppressPackage(att.getSuperType().getName())).append(
          att.isSelfReference() ? " SELF" : "").append('\n');
    } catch (IOException ex) {
      LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
    }
  });
}
origin: org.opensingular/form-core

public Object getAttributeValueOrDefaultValueIfNull() {
  if (Objects.equals(nameSimple, SPackageBasic.ATR_DEFAULT_IF_NULL.getNameSimple())) {
    return null;
  }
  return getAttributeValue(SPackageBasic.ATR_DEFAULT_IF_NULL);
}
origin: org.opensingular/singular-form-core

public boolean hasValidation() {
  return isRequired() ||
      getAttributeValue(SPackageBasic.ATR_REQUIRED_FUNCTION) != null ||
      hasValidationInternal();
}
origin: org.opensingular/form-core

  public String translateImport(SType<?> superType) {
    String nameFull = superType.getName();
    return imports.contains(nameFull) ? superType.getNameSimple() : nameFull;
  }
}
origin: org.opensingular/singular-requirement-commons

public static <V> Optional<V> getAttribute(SType<?> type, AtrRef<?, ?, V> ref) {
  if (type.hasAttributeDefinedInHierarchy(ref)) {
    return Optional.ofNullable(type.getAttributeValue(ref));
  }
  return Optional.empty();
}
origin: org.opensingular/singular-form-core

DiffInfo(SInstance original, SInstance newer, DiffType type) {
  this.original = original;
  this.newer = newer;
  this.type = type;
  //Copia dados básicos para o caso do diff ser serializado
  SInstance instance = newer == null ? original : newer;
  this.simpleName = instance.getType().getNameSimple();
  this.simpleLabel = instance.getType().asAtr().getLabel();
}
origin: org.opensingular/form-core

private void prepareDefaultImports(SDictionary dictionary) {
  for (SType<?> type : dictionary.getType(SType.class).getPackage().getLocalTypes()) {
    imports.put(type.getNameSimple(), type.getName());
  }
}
origin: org.opensingular/singular-form-core

@SuppressWarnings("unchecked")
private static void realMapToSInstance(Map<Integer, Map<String, Object>> pojoReferenceDataMap, Object pojoDataMap, SInstance rootInstance, boolean strictMode) {
  SType<?> type = rootInstance.getType();
  if (type.isComposite()) {
    mapToSIComposite(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIComposite) rootInstance, strictMode);
  } else if (type.isList()) {
    mapToSIList(pojoReferenceDataMap, (Map<String, Object>) pojoDataMap, (SIList<SInstance>) rootInstance, strictMode, type);
  } else {
    rootInstance.setValue(((Map<String, Object>) pojoDataMap).get(type.getNameSimple()));
  }
}
origin: org.opensingular/singular-requirement-commons

  @Override
  protected void onLoadType(@Nonnull TypeBuilder tb) {
    endpoint = this.addFieldString("endpoint");
    htmlToExport = this.addField("htmlToExport", STypeHTML.class);

    endpoint.setInitialValue(RestfulHtmlToPdfConverter.getEndpointDefault());
    endpoint.asAtr()
        .label("Endpoint:")
        .maxLength(155)
        .enabled(true);

    htmlToExport
        .withInitListener(s -> s.setValue(" teste "))
        .withView(SViewByRichText::new)
        .asAtr()
        .label("HTML Exportação");

  }
}
origin: org.opensingular/form-wicket

if (elementsType.isComposite()) {
  int sumWidthPref = compositeElementsType.getFields().stream().mapToInt((x) -> x.asAtrBootstrap().getColPreference(1)).sum();
    final Integer        preferentialWidth  = tCampo.asAtrBootstrap().getColPreference(1);
    final IModel<String> headerModel        = $m.ofValue(tCampo.asAtr().getLabel());
    final BSTDataCell    cell               = row.newTHeaderCell(headerModel);
    final String         width              = String.format("width:%.0f%%;", (100.0 * preferentialWidth) / sumWidthPref);
    final boolean        isCampoObrigatorio = tCampo.asAtr().isRequired();
origin: org.opensingular/singular-requirement-module

@SuppressWarnings("unchecked")
private List<String> initEnumSelectDomain(SType<?> type) {
  if (selection && type.asAtrProvider().getConverter() instanceof EnumSInstanceConverter) {
    return (List<String>) type
        .asAtrProvider()
        .getProvider()
        .load(new ProviderContext())
        .stream()
        .map(e -> type.asAtrProvider().getDisplayFunction().apply((Serializable) e))
        .collect(Collectors.toList());
  }
  return Collections.emptyList();
}
origin: org.opensingular/singular-form-core

/**
 *
 * @param header
 * a subtype of  element type of the list.
 * it can not be the very element type of the list
 * in order to use de element type as header it is necessary to define a displayString and call {@link #SViewListByForm()}
 */
public SViewListByForm(SType header) {
  this.headerPath = header.getNameSimple();
}
origin: org.opensingular/form-core

private String mapName(String originalName) {
  if (originalName.indexOf('.') == -1) {
    return getName() + '.' + originalName;
  }
  return originalName;
}
origin: org.opensingular/exemplos-form

final STypeString acao = this.addFieldString("acao", true);
acao.selectionOfEnum(AcaoGestaoObras.class)
  .asAtr().label("Ação").asAtrBootstrap().colPreference(3);
  .asAtrBootstrap().colPreference(12)
  .asAtr().label("Todos os dados informados estão corretos");
origin: org.opensingular/form-core

private static void writeType(ContextArchive ctx, SIPersistenceType pType, SType<?> type) {
  pType.setSuperType(ctx.translateImport(type.getSuperType()));
  
  ensureType(ctx, type.getSuperType());
  if (type.isComposite()) {
    //TODO (por Daniel Bordin) O código abaixo ainda precisa resolver a questão de field que foram extendido
    // e tiveram apenas uma atributo alterado
    for (SType<?> localField : ((STypeComposite<?>) type).getFieldsLocal()) {
      SIPersistenceType pMember = pType.addMember(localField.getNameSimple());
      writeType(ctx, pMember, localField);
    }
  }
}
origin: org.opensingular/singular-form-core

/**
 * Checks if the SType is a list or a composite and calls the right method to include the complex element on XSD
 * @param sType The SType that will be inserted on the XSD
 * @param element The parent element 
 */
private static void toXsdFromSType(SType<?> sType, MElement element) {
  if (sType.isList()) {
    toXsdFromList((STypeList<?, ?>) sType, element);
  } else if (sType.isComposite()) {
    toXsdFromComposite((STypeComposite<?>) sType, element);
  }
}

origin: org.opensingular/singular-form-core

  /** Se aplica somene se o tipo for da classe {@link STypeList} */
  @Override
  public boolean isApplicableFor(SType<?> type) {
    return type.isList();
  }
}
origin: org.opensingular/singular-form-core

@Nonnull
final static SType<?> getAttributeDefinedHierarchy(@Nonnull SType<?> type, @Nonnull AttrInternalRef ref) {
  Objects.requireNonNull(type);
  Objects.requireNonNull(ref);
  for (SType<?> current = type; current != null; current = current.getSuperType()) {
    SType<?> att = current.getAttributeDefinedLocally(ref);
    if (att != null) {
      return att;
    }
  }
  throw new SingularFormException("Não existe atributo '" + ref.getName() + "' em " + type.getName(), type);
}
origin: org.opensingular/form-wicket

  private void buildHeader(BSContainer<?> header, Form<?> form, IModel<SIList<SInstance>> list,
               WicketBuildContext ctx, SViewListByTable view, boolean isEdition) {

    final IModel<String> label = $m.ofValue(ctx.getCurrentInstance().getType().asAtr().getLabel());
    final Label          title = new Label("_title", label);

    ctx.configureContainer(label);
    header.appendTag("span", title);
//        header.add($b.visibleIf($m.get(() -> !Strings.isNullOrEmpty(label.getObject()))));

    final SType<SInstance> elementsType = list.getObject().getElementsType();

    if (!elementsType.isComposite() && elementsType.asAtr().isRequired()) {
      title.add($b.classAppender("singular-form-required"));
    }

  }

org.opensingular.formSType

Most used methods

  • asAtr
  • getNameSimple
  • getName
  • asAtrProvider
  • getAttributeValue
  • isList
    Verificar se o tipo é um tipo lista ( STypeList).
  • getValidators
  • withView
  • asAtrBootstrap
  • getInstanceClass
  • isComposite
    Verificar se o tipo é um tipo composto ( STypeComposite).
  • getDependentTypes
  • isComposite,
  • getDependentTypes,
  • getDictionary,
  • hasAttributeDefinedInHierarchy,
  • isDependentType,
  • isTypeOf,
  • newInstance,
  • addAttribute,
  • addDependentType,
  • addInstanceValidator

Popular in Java

  • Finding current android device location
  • getExternalFilesDir (Context)
  • onRequestPermissionsResult (Fragment)
  • setScale (BigDecimal)
  • Menu (java.awt)
  • Kernel (java.awt.image)
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Best IntelliJ plugins
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