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

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

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

origin: org.opensingular/singular-form-core

  public void fromRelationalColumn(Object dbData, SInstance toInstance) {
    if (dbData == null) {
      toInstance.clearInstance();
    } else {
      toInstance.setValue(dbData.toString());
    }
  }
}
origin: org.opensingular/form-wicket

public static void restoreState(final SInstance instance, final FormState state) {
  instance.clearInstance();
  hydrate(instance, state.value);
}
origin: org.opensingular/singular-form-wicket

public static void restoreState(final SInstance instance, final FormState state) {
  instance.clearInstance();
  hydrate(instance, state.value);
}
origin: org.opensingular/singular-form-wicket

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setObject(T object) {
  SInstance target = getTarget();
  if (target instanceof SIList) {
    target.clearInstance();
    ((List) object).forEach(((SIList) target)::addValue);
  } else {
    target.setValue(object);
  }
}
origin: org.opensingular/form-wicket

@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void setObject(T object) {
  SInstance target = getTarget();
  if (target instanceof SIList) {
    target.clearInstance();
    ((List) object).forEach(((SIList) target)::addValue);
  } else {
    target.setValue(object);
  }
}
origin: org.opensingular/singular-form-core

/** Copia os valores de uma instância para outra. Presupõem que as instâncias são do mesmo tipo. */
public static void copyValues(SInstance origin, SInstance target) {
  target.clearInstance();
  hydrate(target, dehydrate(origin));
}
origin: org.opensingular/form-core

/** Copia os valores de uma instância para outra. Presupõem que as instâncias são do mesmo tipo. */
public static void copyValues(SInstance origin, SInstance target) {
  target.clearInstance();
  hydrate(target, dehydrate(origin));
}
origin: org.opensingular/singular-studio-core

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
          filterPanel.getInstanceModel().getObject().clearInstance();
          form.clearInput();
//                    filterPanel.getInstanceModel().getObject().init();
          target.add(filterPanel);
        }
      };
origin: org.opensingular/singular-form-core

  public void fromRelationalColumn(Object dbData, SInstance toInstance) {
    if (dbData == null) {
      toInstance.clearInstance();
      return;
    }
    try {
      Blob blob = (Blob) dbData;
      File tempFile = File.createTempFile("blob_" + toInstance.getName(), null);
      tempFile.deleteOnExit();
      try (InputStream input = blob.getBinaryStream(); FileOutputStream output = new FileOutputStream(tempFile)) {
        IOUtils.copy(input, output);
      }
      ((SIAttachment) toInstance).setContent(tempFile.getName(), tempFile, blob.length(),
          HashUtil.toSHA1Base16(tempFile));
    } catch (Exception e) {
      throw SingularException.rethrow("Error on converting BLOB data to SInstance", e);
    }
  }
}
origin: org.opensingular/singular-form-core

@SuppressWarnings("unchecked")
public void collectSelectedInstances(SInstance instance, List<Serializable> values, SInstanceConverter converter,
                   List<Object> ids, IFunction<Object, Object> idFunction,
                   List<SInstance> selectedInstances) {
  for (int i = 0; i < selectedInstances.size(); i += 1) {
    SInstance          ins       = selectedInstances.get(i);
    final Serializable converted = converter.toObject(ins);
    if (converted != null && !ids.contains(idFunction.apply(converted))) {
      if (!enableDanglingValues) {
        if(instance instanceof SIList){
          ((SIList) instance).remove(ins);
        } else {
          instance.clearInstance();
        }
      } else {
        values.add(i, converted);
      }
    }
  }
}
origin: org.opensingular/form-wicket

@Override
public void setObject(String key) {
  if (StringUtils.isEmpty(key)) {
    getRequestCycle().setMetaData(WicketFormProcessing.MDK_SKIP_VALIDATION_ON_REQUEST, true);
    getMInstancia().clearInstance();
  } else {
    final Serializable val = getValueFromChace(key).map(TypeaheadCache::getTrueValue).orElse(getValueFromProvider(key).orElse(null));
    if (val != null) {
      instance().asAtrProvider().getConverter().fillInstance(getMInstancia(), val);
    } else {
      getMInstancia().clearInstance();
    }
  }
}
origin: org.opensingular/singular-form-core

private static void fromXML(@Nonnull SInstance instance, @Nullable MElement xml) {
  if (xml == null)
    return; // Não precisa fazer nada
  instance.clearInstance();
  readAttributes(instance, xml);
  if (instance instanceof SISimple) {
    fromXMLSISImple((SISimple<?>) instance, xml);
  } else if (instance instanceof SIComposite) {
    fromXMLSIComposite((SIComposite) instance, xml);
  } else if (instance instanceof SIList) {
    fromXMLSIList((SIList<?>) instance, xml);
  } else {
    throw new SingularFormException(
        "Conversão não implementando para a classe " + instance.getClass().getName(), instance);
  }
}
origin: org.opensingular/form-core

public void updateExists() {
  SInstances.updateBooleanAttribute(this, SPackageBasic.ATR_EXISTS, SPackageBasic.ATR_EXISTS_FUNCTION);
  if (!exists())
    SInstances.visitPostOrder(this, (i, v) -> i.clearInstance());
}
origin: org.opensingular/singular-form-wicket

protected void setVallIfNullorClear(String key, SInstance instance) {
  final Serializable val = getValueFromChace(key).map(TypeaheadCache::getTrueValue).orElse(getValueFromProvider(key).orElse(null));
  if (val != null) {
    instance().asAtrProvider().getConverter().fillInstance(instance, val);
  } else {
    instance.clearInstance();
  }
}
origin: org.opensingular/singular-form-core

public void updateExists() {
  SInstances.updateBooleanAttribute(this, SPackageBasic.ATR_EXISTS, SPackageBasic.ATR_EXISTS_FUNCTION);
  if (!exists())
    SInstances.visitPostOrder(this, (i, v) -> i.clearInstance());
}
origin: org.opensingular/singular-form-wicket

  @Override
  public void setObject(String key) {
    if (StringUtils.isEmpty(key)) {
      getRequestCycle().setMetaData(WicketFormProcessing.MDK_SKIP_VALIDATION_ON_REQUEST, Boolean.TRUE);
      getSInstance().clearInstance();
    } else {
      setVallIfNullorClear(key, getSInstance());
    }
  }
};
origin: org.opensingular/singular-form-wicket

private void clearInput(AjaxRequestTarget target) {
  getModal().hide(target);
  valueModel.getSInstance().clearInstance();
  target.add(valueField);
  valueField.getBehaviors(AjaxUpdateInputBehavior.class)
      .forEach(ajax -> ajax.onUpdate(target));
}
origin: org.opensingular/singular-form-wicket

@Override
public void setObject(Serializable object) {
  SInstance instance = getSInstance();
  if (object == null) {
    instance.clearInstance();
  } else {
    Optional<SInstanceConverter> converter = resolver.apply(instance);
    if (converter.isPresent()) {
      converter.get().fillInstance(instance, object);
    } else if (instance instanceof SIComposite) {
      throw new SingularFormException("Nenhum converter foi informado para o tipo " + instance.getName(),
          instance);
    } else {
      instance.setValue(object);
    }
  }
}
origin: org.opensingular/form-wicket

@Override
public void setObject(Serializable object) {
  SInstance instance = getMInstancia();
  if (object == null) {
    instance.clearInstance();
  } else {
    Optional<SInstanceConverter> converter = resolver.apply(instance);
    if (converter.isPresent()) {
      converter.get().fillInstance(instance, object);
    } else if (instance instanceof SIComposite) {
      throw new SingularFormException("Nenhum converter foi informado para o tipo " + instance.getName(),
          instance);
    } else {
      instance.setValue(object);
    }
  }
}
origin: org.opensingular/singular-form-core

/**
 * Configura os valores contidos em value na MInstancia passara como
 * parametro recursivamente. Usualmente content é o retorno do metodo
 * dehydrate.
 */
public static void hydrate(SInstance instance, Content content) {
  if (instance != null) {
    if (instance instanceof SIComposite) {
      fromMap((Map<String, Content>) content.getRawContent(), (SIComposite) instance);
    } else if (instance instanceof SISimple) {
      if (content.getRawContent() == null) {
        instance.clearInstance();
      } else {
        instance.setValue(content.getRawContent());
      }
    } else if (instance instanceof SIList) {
      fromList((List<Content>) content.getRawContent(), (SIList) instance);
    } else {
      throw new SingularFormException("Tipo de instancia não suportado: " + instance.getClass().getName(), instance);
    }
  }
}
org.opensingular.formSInstanceclearInstance

Javadoc

Apaga os valores associados a instância. Se for uma lista ou composto, apaga os valores em profundidade.

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.
  • getName
  • getParent
  • 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
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JTextField (javax.swing)
  • Top Vim 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