Class ViewContext

java.lang.Object
io.vertigo.ui.core.ViewContext
All Implemented Interfaces:
Serializable

public final class ViewContext extends Object implements Serializable
Liste des couples (clé, object) enregistrés.
Author:
npiedeloup
See Also:
  • Field Details

    • MODE_CONTEXT_KEY

      public static final ViewContextKey<FormMode> MODE_CONTEXT_KEY
      Clé de context du mode.
    • MODE_EDIT_CONTEXT_KEY

      public static final ViewContextKey<Boolean> MODE_EDIT_CONTEXT_KEY
      Clé de context du mode Edit.
    • MODE_READ_ONLY_CONTEXT_KEY

      public static final ViewContextKey<Boolean> MODE_READ_ONLY_CONTEXT_KEY
      Clé de context du mode ReadOnly.
    • MODE_CREATE_CONTEXT_KEY

      public static final ViewContextKey<Boolean> MODE_CREATE_CONTEXT_KEY
      Clé de context du mode Create.
    • CTX

      public static final ViewContextKey<String> CTX
      Clée de l'id de context dans le context.
    • CTX_CREATION_INSTANT

      public static final ViewContextKey<String> CTX_CREATION_INSTANT
      Clée de l'instant de creation de context dans le context.
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Returns:
      Clé de ce context
    • setInputCtxId

      public void setInputCtxId(String ctxId)
    • setCtxId

      public void setCtxId()
    • makeModifiable

      public void makeModifiable()
      Génère un nouvel Id et passe le context en modifiable.
    • makeUnmodifiable

      public void makeUnmodifiable()
      passe le context en non-modifiable.
    • markDirty

      public void markDirty()
      Mark this context as Dirty : shouldn't be stored and keep old id.
    • isDirty

      public boolean isDirty()
      Returns:
      if context dirty : shouldn't be stored and keep old id
    • asMap

      public ViewContextMap asMap()
    • asUpdatesMap

      public ViewContextMap asUpdatesMap()
    • getFilteredViewContextAsJson

      public String getFilteredViewContextAsJson()
    • markModifiedKeys

      public void markModifiedKeys(ViewContextKey... newModifiedKeys)
    • markModifiedKeys

      public void markModifiedKeys(String... newModifiedKeys)
    • get

      public Serializable get(Object key)
    • containsKey

      public boolean containsKey(Object key)
    • findKey

      public String findKey(UiObject<?> uiObject)
      Parameters:
      uiObject - UiObject recherché
      Returns:
      Clé de context de l'élément (null si non trouvé)
    • findKey

      public String findKey(io.vertigo.datamodel.structure.model.DtObject dtObject)
      Parameters:
      dtObject - DtObject recherché
      Returns:
      Clé de context de l'élément (null si non trouvé)
    • publishRef

      public <O extends Serializable> ViewContext publishRef(ViewContextKey<O> key, O value)
      Parameters:
      key - Clé de context
      Returns:
      UiObject du context
    • publishTypedRef

      public <O extends Serializable> void publishTypedRef(ViewContextKey<O> key, O value, Type paramType)
      Parameters:
      key - Clé de context
    • getUiObject

      public <O extends io.vertigo.datamodel.structure.model.DtObject> UiObject<O> getUiObject(ViewContextKey<O> key)
      Parameters:
      key - Clé de context
      Returns:
      UiObject du context
    • getUiList

      public <O extends io.vertigo.datamodel.structure.model.DtObject> UiList<O> getUiList(ViewContextKey<O> key)
      Parameters:
      key - Clé de context
      Returns:
      UiList du context
    • getUiListModifiable

      public <O extends io.vertigo.datamodel.structure.model.DtObject> BasicUiListModifiable<O> getUiListModifiable(ViewContextKey<O> key)
      Parameters:
      key - Clé de context
      Returns:
      UiListModifiable du context
    • getString

      public String getString(ViewContextKey<String> key)
      Parameters:
      key - Clé de context
      Returns:
      String du context
    • getLong

      public Long getLong(ViewContextKey<Long> key)
      Parameters:
      key - Clé de context
      Returns:
      Long du context
    • getInteger

      public Integer getInteger(ViewContextKey<Integer> key)
      Parameters:
      key - Clé de context
      Returns:
      Integer du context
    • getBoolean

      public Boolean getBoolean(ViewContextKey<Boolean> key)
      Parameters:
      key - Clé de context
      Returns:
      Boolean du context
    • publishDto

      public <O extends io.vertigo.datamodel.structure.model.DtObject> ViewContext publishDto(ViewContextKey<O> contextKey, O dto)
      Ajoute un objet de type form au context.
      Parameters:
      dto - Objet à publier
    • checkDtoErrors

      public <O extends io.vertigo.datamodel.structure.model.DtObject> void checkDtoErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
      Vérifie les erreurs de l'objet. Celles-ci sont ajoutées à l'uiMessageStack si nécessaire.
    • readDto

      public <O extends io.vertigo.datamodel.structure.model.DtObject> O readDto(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
      Returns:
      objet métier valid�. Lance une exception si erreur.
    • readDto

      public <O extends io.vertigo.datamodel.structure.model.DtObject> O readDto(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
      Returns:
      objet métier validé. Lance une exception si erreur.
    • publishDtList

      public <O extends io.vertigo.datamodel.structure.model.DtObject> ViewContext publishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, io.vertigo.datamodel.structure.model.DtList<O> dtList)
      Ajoute une liste au context.
      Parameters:
      dtList - List à publier
    • publishDtList

      public <O extends io.vertigo.datamodel.structure.model.DtObject> ViewContext publishDtList(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
      Ajoute une liste au context.
      Parameters:
      dtList - List à publier
    • readDtList

      public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtList(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
      Returns:
      List des objets métiers validée. Lance une exception si erreur.
    • readDtList

      public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtList(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
      Returns:
      List des objets métiers validée. Lance une exception si erreur.
    • publishDtListModifiable

      public <O extends io.vertigo.datamodel.structure.model.DtObject> ViewContext publishDtListModifiable(ViewContextKey<O> contextKey, io.vertigo.datamodel.structure.model.DtList<O> dtList)
      Ajoute une liste au context.
      Parameters:
      dtList - List à publier
    • checkDtListErrors

      public <O extends io.vertigo.datamodel.structure.model.DtObject> void checkDtListErrors(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
      Vérifie les erreurs de la liste. Celles-ci sont ajoutées à l'uiMessageStack si nécessaire.
    • readDtListModifiable

      public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtListModifiable(ViewContextKey<O> contextKey, UiMessageStack uiMessageStack)
      Returns:
      List des objets métiers validée. Lance une exception si erreur.
    • readDtListModifiable

      public <O extends io.vertigo.datamodel.structure.model.DtObject> io.vertigo.datamodel.structure.model.DtList<O> readDtListModifiable(ViewContextKey<O> contextKey, DtObjectValidator<O> validator, UiMessageStack uiMessageStack)
      Returns:
      List des objets métiers validée. Lance une exception si erreur.
    • publishMdl

      public <E extends io.vertigo.datamodel.structure.model.Entity> ViewContext publishMdl(ViewContextKey<E> contextKey, Class<E> entityClass, String code)
      Publie une liste de référence.
      Parameters:
      contextKey - Context key
      entityClass - Class associée
      code - Code
    • getFileInfoURI

      public Optional<io.vertigo.datastore.filestore.model.FileInfoURI> getFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
      Get UI file uri.
      Parameters:
      contextKey - Context key
    • getFileInfoURIs

      public ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI> getFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey)
      Get UI file info uri list.
      Parameters:
      contextKey - Context key
    • publishFileInfoURI

      public ViewContext publishFileInfoURI(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, io.vertigo.datastore.filestore.model.FileInfoURI fileInfoURI)
      Publish file's info.
      Parameters:
      contextKey - Context key
      fileInfo - file's info
    • publishFileInfoURIs

      public ViewContext publishFileInfoURIs(ViewContextKey<io.vertigo.datastore.filestore.model.FileInfoURI> contextKey, ArrayList<io.vertigo.datastore.filestore.model.FileInfoURI> fileInfoURIs)
      Publish list of file's info.
      Parameters:
      contextKey - Context key
      fileInfos - list of file's info.
    • publishFacetedQueryResult

      public <O extends io.vertigo.datamodel.structure.model.DtObject> ViewContext publishFacetedQueryResult(ViewContextKey<FacetedQueryResult<O,SearchQuery>> contextKey, io.vertigo.datamodel.structure.definitions.DtFieldName<O> keyFieldName, FacetedQueryResult<O,SearchQuery> facetedQueryResult, ViewContextKey<?> criteriaContextKey)
      Publie une FacetedQueryResult.
      Parameters:
      contextKey - Context key
      keyFieldName - Id's fieldName
      facetedQueryResult - Result
    • getSelectedFacetValues

      public <O extends io.vertigo.datamodel.structure.model.DtObject> SelectedFacetValues getSelectedFacetValues(ViewContextKey<FacetedQueryResult<O,FacetedQuery>> contextKey)
      Returns selectedFacetValues of a given facetedQuery.
      Parameters:
      contextKey - Context key
      Returns:
      selectedFacetValues
    • toModeEdit

      public void toModeEdit()
      Passe en mode edition.
    • toModeCreate

      public void toModeCreate()
      Passe en mode creation.
    • toModeReadOnly

      public void toModeReadOnly()
      Passe en mode readonly.
    • isModeEdit

      public boolean isModeEdit()
      Returns:
      Si on est en mode edition
    • isModeRead

      public boolean isModeRead()
      Returns:
      Si on est en mode readOnly
    • isModeCreate

      public boolean isModeCreate()
      Returns:
      Si on est en mode create