com.smartgwt.client.data

## Class FacadeDataSource

- java.lang.Object
- - com.smartgwt.client.core.BaseClass
  - - com.smartgwt.client.data.DataSource
    - - com.smartgwt.client.data.FacadeDataSource

- All Implemented Interfaces:
    com.google.gwt.event.shared.HasHandlers, HasDataChangedHandlers, HasHandleErrorHandlers

      public class FacadeDataSource
      extends DataSource

  Extends an arbitrary `DataSource` with the ability to queue requests made on it and dispatch the queued requests on demand. To use, create a FacadeDataSource instance with the `inheritsFrom` property set to the DataSource that you wish to extend.

  This advanced class is intended to be used for testing data-bound components. This should not be used in production code.

  See also the overview of the `DataSource Facade pattern`.

- - ### Field Summary

    - ### Fields inherited from class com.smartgwt.client.core.BaseClass

      `config, configOnly, factoryCreated, factoryProperties, id, scClassName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FacadeDataSource()`
    `FacadeDataSource(com.google.gwt.core.client.JavaScriptObject jsObj)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearQueue()` Shorthand to clear the `request queue` without changing the value of `queueRequests`.
    `com.google.gwt.core.client.JavaScriptObject` | `create()`
    `static FacadeDataSource` | `getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)`
    `DSRequest[]` | `getQueuedRequests()` An array of derived DS requests that are queued to be `executed` on the underlying `inherited` DataSource.
    `boolean` | `getQueueRequests()` Should requests be queued?
    `static void` | `setDefaultProperties(FacadeDataSource facadeDataSourceProperties)` Class level method to set the default properties of this class.
    `FacadeDataSource` | `setQueueRequests(boolean queueRequests)` Should requests be queued?

    - ### Methods inherited from class com.smartgwt.client.data.DataSource

      `addData, addData, addData, addDataChangedHandler, addField, addHandleErrorHandler, addSearchOperator, applyFilter, applyFilter, canFlattenCriteria, clearValueAtDataPath, clearValueAtDataPath, clearValueAtDataPath, clearValueAtDataPath, cloneDSRequest, cloneDSResponse, combineCriteria, combineCriteria, combineCriteria, compareCriteria, compareCriteria, compareCriteria, compareDates, convertCriteria, convertCriteria, convertDataSourceCriteria, convertDataSourceCriteria, convertRelativeDates, convertRelativeDates, convertRelativeDates, convertRelativeDates, copyCriteria, copyRecord, copyRecords, createAlias, downloadFile, downloadFile, downloadFile, evaluateCriterion, execute, exportClientData, exportClientDataStatic, exportData, exportData, exportData, exportData, fetchData, fetchData, fetchData, fetchData, fetchRecord, fetchRecord, fetchRecord, fieldMatchesFilter, fieldMatchesFilter, filterData, filterData, filterData, filterData, flattenCriteria, formatFieldValue, get, get, getAddedAuditFields, getAddGlobalId, getAdvancedCriteriaDescription, getAdvancedCriteriaDescription, getAggregationDescription, getAllowAdvancedCriteria, getAllowAggregation, getAllowDynamicTreeJoins, getAllowRelatedFieldsInCriteria, getAllPathsToRelation, getAllPathsToRelation, getArrayCriteriaForceExact, getAutoCacheAllData, getAutoConvertRelativeDates, getAutoDeriveTitles, getAutoDiscoverTree, getAutoTitle, getCacheAcrossOperationIds, getCacheAllData, getCacheAllOperationId, getCacheData, getCacheMaxAge, getCallbackParam, getCanAggregate, getCanMultiSort, getChildrenField, getClientOnly, getClientOnlyDataSource, getClientOnlyDataSource, getClientOnlyDataSource, getClientOnlyResponse, getCriteriaPolicy, getDataField, getDataFormat, getDataProtocol, getDataSource, getDataSource, getDataTransport, getDataURL, getDeepCloneNonFieldValuesOnEdit, getDeepCloneOnEdit, getDefaultParams, getDefaultPathToRelation, getDefaultPathToRelation, getDefaultTextMatchStyle, getDescription, getDescriptionField, getDiscoverTreeSettings, getDisplayValue, getDropExtraFields, getDropUnknownCriteria, getEnforceSecurityOnClient, getFetchDataURL, getFetchDataURL, getField, getFieldAutoTitle, getFieldCriterion, getFieldDefaultOperator, getFieldDefaultOperator, getFieldForDataPath, getFieldNames, getFieldNames, getFieldOperators, getFieldOperators, getFields, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFieldValue, getFile, getFileURL, getFileURL, getFileURL, getFileVersion, getGlobalNamespaces, getIconField, getIgnoreTextMatchStyleCaseSensitive, getImplicitCriteria, getInfoField, getInheritsFrom, getIsSampleDS, getJsObj, getJsonPrefix, getJsonSuffix, getLegalChildTags, getLoaderURL, getMockDataCriteria, getMockDataRows, getMockMode, getOperationBindings, getPatternEscapeChar, getPatternMultiWildcard, getPatternMultiWildcardAsString, getPatternMultiWildcardAsStringArray, getPatternSingleWildcard, getPatternSingleWildcardAsString, getPatternSingleWildcardAsStringArray, getPluralTitle, getPreventHTTPCaching, getPrimaryKeyField, getPrimaryKeyFieldName, getPrimaryKeyFieldNames, getPrimaryKeyFields, getProgressiveLoading, getQualifyColumnNames, getRecordName, getRecordXPath, getRequestProperties, getRequiredMessage, getResultBatchSize, getResultSetClass, getResultTreeClass, getSampleData, getSchemaNamespace, getSendExtraFields, getSendParentNode, getServiceNamespace, getShortestPathToRelation, getShortestPathToRelation, getShowLocalFieldsOnly, getShowPrompt, getSkipJSONValidation, getSortBy, getSortSpecifiers, getSortSpecifiers, getStrictSQLFiltering, getTagName, getTestData, getTitle, getTitleField, getTranslatePatternOperators, getTrimMilliseconds, getTypeOperators, getTypeOperators, getTypeOperators, getUseFlatFields, getUseHttpProxy, getUseLocalValidators, getUseOfflineStorage, getUseParentFieldOrder, getUseStrictJSON, getUseTestDataFetch, getValidateRelatedRecords, hasAllData, hasCustomTypeOperators, hasCustomTypeOperators, hasCustomTypeOperators, hasFile, hasFileVersion, invalidateCache, invalidateCache, isAdvancedCriteria, isAdvancedCriteria, isCalculated, isCalculated, isCreated, isFlatCriteria, listFiles, listFileVersions, load, load, load, load, loadWithParents, loadWithParents, loadWithParents, loadWithParents, makeFileSpec, onInit, performCustomOperation, performCustomOperation, performCustomOperation, performCustomOperation, processResponse, recordsAreEqual, recordsAsText, recordsAsText, recordsFromText, recordsFromText, recordsFromXML, registerID, removeData, removeData, removeData, removeFile, removeFile, removeFile, removeFileVersion, removeFileVersion, renameFile, renameFile, saveFile, saveFile, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, saveValueViaDataPath, setAddedAuditFields, setAddGlobalId, setAllowAdvancedCriteria, setAllowAggregation, setAllowDynamicTreeJoins, setAllowRelatedFieldsInCriteria, setArrayCriteriaForceExact, setAutoCacheAllData, setAutoConvertRelativeDates, setAutoDeriveTitles, setAutoDiscoverTree, setCacheAcrossOperationIds, setCacheAllData, setCacheAllOperationId, setCacheData, setCacheMaxAge, setCallbackParam, setCanAggregate, setCanMultiSort, setChildrenField, setClientOnly, setCriteriaPolicy, setDataField, setDataFormat, setDataProtocol, setDataTransport, setDataURL, setDeepCloneNonFieldValuesOnEdit, setDeepCloneOnEdit, setDefaultParams, setDefaultProperties, setDefaultTextMatchStyle, setDescription, setDescriptionField, setDiscoverTreeSettings, setDropExtraFields, setDropUnknownCriteria, setEnforceSecurityOnClient, setEnumConstantProperty, setEnumOrdinalProperty, setEnumTranslateStrategy, setFields, setGlobalNamespaces, setHandleErrorCallback, setIconField, setID, setIgnoreTextMatchStyleCaseSensitive, setImplicitCriteria, setInfoField, setInheritsFrom, setInheritsFrom, setIsSampleDS, setJsonPrefix, setJsonSuffix, setLoaderURL, setMockDataCriteria, setMockDataRows, setMockMode, setOperationBindings, setPatternEscapeChar, setPatternMultiWildcard, setPatternMultiWildcard, setPatternSingleWildcard, setPatternSingleWildcard, setPluralTitle, setPreventHTTPCaching, setProgressiveLoading, setQualifyColumnNames, setRecordName, setRecordXPath, setRequestProperties, setRequiredMessage, setResultBatchSize, setResultSetClass, setResultTreeClass, setSampleData, setSendExtraFields, setSendParentNode, setServiceNamespace, setShowLocalFieldsOnly, setShowPrompt, setSkipJSONValidation, setStrictSQLFiltering, setTagName, setTestData, setTitle, setTitleField, setTranslatePatternOperators, setTrimMilliseconds, setTypeOperators, setTypeOperators, setUseFlatFields, setUseHttpProxy, setUseLocalValidators, setUseOfflineStorage, setUseParentFieldOrder, setUseStrictJSON, setUseTestDataFetch, setValidateRelatedRecords, setXmlNamespaces, splitCriteria, splitCriteria, supportsAdvancedCriteria, supportsDynamicTreeJoins, supportsTextMatchStyle, transformRequest, transformResponse, updateCaches, updateCaches, updateData, updateData, updateData, useOfflineResponse, validateData, validateData, validateData, verifyDataSourcePair, viewFile, viewFile, viewFile, xmlSerialize, xmlSerialize, xmlSerialize, xmlSerialize, xmlSerialize`

    - ### Methods inherited from class com.smartgwt.client.core.BaseClass

      `addDynamicProperty, addDynamicProperty, addDynamicProperty, addDynamicProperty, applyFactoryProperties, asSGWTComponent, clearDynamicProperty, createJsObj, destroy, doAddHandler, doInit, error, error, errorIfNotCreated, fireEvent, getAttribute, getAttributeAsBoolean, getAttributeAsDate, getAttributeAsDouble, getAttributeAsElement, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAttributeAsMap, getAttributeAsString, getAttributeAsStringArray, getClassName, getConfig, getHandlerCount, getID, getOrCreateJsObj, getRef, getRuleScope, getScClassName, getTestInstance, hasAutoAssignedID, hasDynamicProperty, internalSetID, internalSetID, isConfigOnly, isFactoryCreated, onBind, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoID, setConfig, setConfigOnly, setFactoryCreated, setJavaScriptObject, setProperty, setProperty, setProperty, setProperty, setRuleScope, setScClassName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Constructor Detail

    - #### FacadeDataSource

          public FacadeDataSource()

    - #### FacadeDataSource

          public FacadeDataSource(com.google.gwt.core.client.JavaScriptObject jsObj)

  - ### Method Detail

    - #### getOrCreateRef

          public static FacadeDataSource getOrCreateRef(com.google.gwt.core.client.JavaScriptObject jsObj)

    - #### create

          public com.google.gwt.core.client.JavaScriptObject create()

      Overrides:
        `create` in class `DataSource`

    - #### getQueuedRequests

          public DSRequest[] getQueuedRequests()
                                        throws java.lang.IllegalStateException

      An array of derived DS requests that are queued to be `executed` on the underlying `inherited` DataSource.

      When a DS request is made on this FacadeDataSource, if `queueRequests` is true, then a new DS request is created based on the given DS request and added to this queue.

      To clear the queue, set `queueRequests` to false or call `clearQueue()`.

      Note : This method should be called only after the underlying component has been created.

      Returns:
        Current queuedRequests value. Default value is null
      Throws:
        `java.lang.IllegalStateException` - if the underlying component has not yet been created.

    - #### setQueueRequests

          public FacadeDataSource setQueueRequests(boolean queueRequests)

      Should requests be queued?

      When DS requests are made on the FacadeDataSource, a new, derived DS request on the underlying `inherited` DataSource is created. If queueRequests is true, then the derived DS request is added to the `queuedRequests` array. If false, then the derived DS request is `executed` immediately on the inherited DataSource.
      If this method is called after the component has been drawn/initialized: Setter for `queueRequests`.

      Parameters:
        `queueRequests` - New queueRequests value. Default value is false
      Returns:
        `FacadeDataSource` instance, for chaining setter calls

    - #### getQueueRequests

          public boolean getQueueRequests()

      Should requests be queued?

      When DS requests are made on the FacadeDataSource, a new, derived DS request on the underlying `inherited` DataSource is created. If queueRequests is true, then the derived DS request is added to the `queuedRequests` array. If false, then the derived DS request is `executed` immediately on the inherited DataSource.

      Returns:
        Current queueRequests value. Default value is false

    - #### clearQueue

          public void clearQueue()

      Shorthand to clear the `request queue` without changing the value of `queueRequests`.

    - #### setDefaultProperties

          public static void setDefaultProperties(FacadeDataSource facadeDataSourceProperties)

      Class level method to set the default properties of this class. If set, then all existing and subsequently created instances of this class will automatically have default properties corresponding to the properties set on the SmartGWT class instance passed to this function before its underlying SmartClient JS object was created. This is a powerful feature that eliminates the need for users to create a separate hierarchy of subclasses that only alter the default properties of this class. Can also be used for skinning / styling purposes.

      Note: This method is intended for setting default attributes only and will affect all instances of the underlying class (including those automatically generated in JavaScript). This method should not be used to apply standard EventHandlers or override methods for a class - use a custom subclass instead. Calling this method after instances have been created can result in undefined behavior, since it bypasses any setters and a class instance may have already examined a particular property and not be expecting any changes through this route.

      Parameters:
        `facadeDataSourceProperties` - properties that should be used as new defaults when instances of this class are created
      See Also:
        `SGWTProperties`