Class BaseClass

java.lang.Object
com.smartgwt.client.core.BaseClass
All Implemented Interfaces:
HasHandlers
Direct Known Subclasses:
AceAnchor, AceCompleter, AceDocument, AceEditSession, AceMarker, AceRange, AceRenderer, AceUndoManager, AIEngine, CancellationController, CellSelection, DataSource, EditContext, EditProxy, EventStream, HiddenPalette, JSONEncoder, NodeLocator, Process, ProcessElement, Project, RecordList, RemoteWindow, SchemaSet, SimpleType, SyntaxHiliter, TextSettings, ValuesManager, WebService

public abstract class BaseClass extends Object implements HasHandlers
  • Field Details

    • factoryProperties

      protected Map<String,Object> factoryProperties
    • factoryCreated

      protected boolean factoryCreated
    • id

      protected String id
    • config

      protected JavaScriptObject config
    • scClassName

      protected String scClassName
    • configOnly

      protected boolean configOnly
  • Constructor Details

    • BaseClass

      public BaseClass()
    • BaseClass

      protected BaseClass(JavaScriptObject jsObj)
  • Method Details

    • applyFactoryProperties

      public void applyFactoryProperties()
    • setFactoryCreated

      public void setFactoryCreated(boolean createdByBeanFactory)
    • isFactoryCreated

      public boolean isFactoryCreated()
    • getTestInstance

      protected BaseClass getTestInstance()
    • setJavaScriptObject

      public void setJavaScriptObject(JavaScriptObject jsObj)
    • getID

      public String getID()
      Return the ID
      Returns:
      the ID
    • registerID

      protected void registerID(String id, boolean skipUniqueJSIdentifierCheck)
    • internalSetID

      protected void internalSetID(JavaScriptObject jsObj)
    • internalSetID

      protected void internalSetID(String id, boolean autoAssigned)
    • setID

      public BaseClass setID(String id)
    • getClassName

      public String getClassName()
      Returns the javascript class name.
      Returns:
      the class name
    • getScClassName

      public String getScClassName()
      Get the name of the underlying SmartClient class
      Returns:
      the SmartClient class name
    • setScClassName

      public void setScClassName(String scClassName)
      Set the name of the underlying SmartClient class. This is an advanced setting.
      Parameters:
      scClassName - the SmartClient class
    • getConfig

      public JavaScriptObject getConfig()
    • setConfig

      public void setConfig(JavaScriptObject config)
    • isCreated

      public boolean isCreated()
    • getJsObj

      public JavaScriptObject getJsObj()
    • createJsObj

      protected JavaScriptObject createJsObj()
    • getOrCreateJsObj

      public JavaScriptObject getOrCreateJsObj()
    • getRef

      public static BaseClass getRef(JavaScriptObject jsObj)
    • hasAutoAssignedID

      public static boolean hasAutoAssignedID(JavaScriptObject jsObj)
    • asSGWTComponent

      public static <T extends BaseClass> T asSGWTComponent(JavaScriptObject jsObj)
      Returns the existing SGWT component, or creates and returns one if none exist, associated with the supplied JavaScriptObject. If the supplied object is not representable as a SGWT component descended from BaseClass, or if this method is not capable of creating the SGWT wrapper, a warning will be logged and null returned. In the latter case, you must call asSGWTComponent on a more specific class (e.g. ResultSet.asSGWTComponent), or if no such method exists, simply build the wrapper with new, supplying the JavaScriptObject.
      Parameters:
      jsObj - SmartClient component whose wrapper is wanted
      Returns:
      wrapping SGWT component (instance of BaseClass-descended class) or null
    • destroy

      public void destroy()
      Destroy this object.
    • error

      protected void error(String attribute, String value, boolean allowPostCreate) throws IllegalStateException
      Throws:
      IllegalStateException
    • errorIfNotCreated

      protected void errorIfNotCreated(String property) throws IllegalStateException
      Throws:
      IllegalStateException
    • error

      protected void error(String message) throws IllegalStateException
      Throws:
      IllegalStateException
    • create

      protected abstract JavaScriptObject create()
    • doInit

      protected final void doInit()
    • onInit

      protected void onInit()
    • onBind

      protected void onBind()
    • setConfigOnly

      public void setConfigOnly(boolean configOnly)
    • isConfigOnly

      public boolean isConfigOnly()
    • getAttribute

      public String getAttribute(String attribute)
    • getAttributeAsString

      public String getAttributeAsString(String property)
    • getAttributeAsDate

      public Date getAttributeAsDate(String property)
    • getAttributeAsInt

      public Integer getAttributeAsInt(String property)
    • getAttributeAsDouble

      public Double getAttributeAsDouble(String property)
    • getAttributeAsElement

      public Element getAttributeAsElement(String property)
    • getAttributeAsJavaScriptObject

      public JavaScriptObject getAttributeAsJavaScriptObject(String property)
    • getAttributeAsFloat

      public Float getAttributeAsFloat(String property)
    • getAttributeAsBoolean

      public Boolean getAttributeAsBoolean(String property)
    • getAttributeAsStringArray

      protected String[] getAttributeAsStringArray(String property)
    • getAttributeAsMap

      public Map getAttributeAsMap(String property)
    • setAttribute

      public BaseClass setAttribute(String attribute, String value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, Boolean value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, Map value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, int[] value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, Integer[] value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, BaseClass[] value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, DataClass[] value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, double value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, int value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, Date value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, ValueEnum[] value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, DataClass value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, JavaScriptObject value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, String[] value, boolean allowPostCreate)
    • setAttribute

      protected BaseClass setAttribute(String attribute, float[] value, boolean allowPostCreate)
    • setAttribute

      protected BaseClass setAttribute(String attribute, Float[] value, boolean allowPostCreate)
    • setAttribute

      protected BaseClass setAttribute(String attribute, double[] value, boolean allowPostCreate)
    • setAttribute

      protected BaseClass setAttribute(String attribute, Double[] value, boolean allowPostCreate)
    • setAttribute

      protected BaseClass setAttribute(String attribute, boolean value, boolean allowPostCreate)
    • setAttribute

      public BaseClass setAttribute(String attribute, Element value, boolean allowPostCreate)
    • setProperty

      public void setProperty(String property, String value)
    • setProperty

      public void setProperty(String property, boolean value)
    • setProperty

      public void setProperty(String property, double value)
    • setProperty

      public void setProperty(String property, JavaScriptObject value)
    • fireEvent

      public void fireEvent(GwtEvent<?> event)
      Specified by:
      fireEvent in interface HasHandlers
    • doAddHandler

      protected final <H extends EventHandler> HandlerRegistration doAddHandler(H handler, GwtEvent.Type<H> type)
    • getHandlerCount

      public int getHandlerCount(GwtEvent.Type<?> type)
    • setRuleScope

      public BaseClass setRuleScope(String ruleScope) throws IllegalStateException
      ID of the component that manages "rule context" for which this class participates. A non-Canvas class can only use the ruleScope for supporting dynamic properties. Unlike Canvas.setRuleScope ruleScope on a standalone class must be explicitly specified.
      Parameters:
      ruleScope - New ruleScope value. Default value is null
      Returns:
      BaseClass instance, for chaining setter calls
      Throws:
      IllegalStateException - this property cannot be changed after the component has been created
    • getRuleScope

      public String getRuleScope()
      ID of the component that manages "rule context" for which this class participates. A non-Canvas class can only use the ruleScope for supporting dynamic properties. Unlike Canvas.setRuleScope ruleScope on a standalone class must be explicitly specified.
      Returns:
      Current ruleScope value. Default value is null
    • addDynamicProperty

      public void addDynamicProperty(String propertyName, String source)
      Sets up the value of propertyName to be dynamically derived from the ruleScope, by either a simple DataPath into the ruleScope, an AdvancedCriteria built against DataPaths, or via a textual or numeric formula using the ruleScope as available formula inputs.

      The dataPath, criteria, or formula is evaluated immediately when addDynamicProperty() is called, then re-evaluated every time the ruleScope changes. An AdvancedCriteria will always evaluate to boolean true or false, and a UserSummary to a string.

      It is invalid usage to use addDynamicProperty() on a property that is not runtime settable. However, addDynamicProperty() will not throw an error or log a warning if this is done.

      If a property is already dynamic and addDynamicProperty() is called again, the new dynamic behavior replaces the old. If a property should no longer be dynamic, call clearDynamicProperty().

      Dynamic properties can also be declared together via dynamicProperties.

      Note that you may convert a simple criteria to an AdvancedCriteria by calling DataSource.convertCriteria().

      Parameters:
      propertyName - name of a settable property on this instance. See Identifier
      source - a DataPath
      See Also:
    • addDynamicProperty

      public void addDynamicProperty(String propertyName, UserFormula formula)
      Sets up the value of propertyName to be dynamically derived from the ruleScope, by either a simple DataPath into the ruleScope, an AdvancedCriteria built against DataPaths, or via a textual or numeric formula using the ruleScope as available formula inputs.

      The dataPath, criteria, or formula is evaluated immediately when addDynamicProperty() is called, then re-evaluated every time the ruleScope changes. An AdvancedCriteria will always evaluate to boolean true or false, and a UserSummary to a string.

      It is invalid usage to use addDynamicProperty() on a property that is not runtime settable. However, addDynamicProperty() will not throw an error or log a warning if this is done.

      If a property is already dynamic and addDynamicProperty() is called again, the new dynamic behavior replaces the old. If a property should no longer be dynamic, call clearDynamicProperty().

      Dynamic properties can also be declared together via dynamicProperties.

      Note that you may convert a simple criteria to an AdvancedCriteria by calling DataSource.convertCriteria().

      Parameters:
      propertyName - name of a settable property on this instance. See Identifier
      formula - a UserForula
      See Also:
    • addDynamicProperty

      public void addDynamicProperty(String propertyName, UserSummary summary)
      Sets up the value of propertyName to be dynamically derived from the ruleScope, by either a simple DataPath into the ruleScope, an AdvancedCriteria built against DataPaths, or via a textual or numeric formula using the ruleScope as available formula inputs.

      The dataPath, criteria, or formula is evaluated immediately when addDynamicProperty() is called, then re-evaluated every time the ruleScope changes. An AdvancedCriteria will always evaluate to boolean true or false, and a UserSummary to a string.

      It is invalid usage to use addDynamicProperty() on a property that is not runtime settable. However, addDynamicProperty() will not throw an error or log a warning if this is done.

      If a property is already dynamic and addDynamicProperty() is called again, the new dynamic behavior replaces the old. If a property should no longer be dynamic, call clearDynamicProperty().

      Dynamic properties can also be declared together via dynamicProperties.

      Note that you may convert a simple criteria to an AdvancedCriteria by calling DataSource.convertCriteria().

      Parameters:
      propertyName - name of a settable property on this instance. See Identifier
      summary - a UserSummary
      See Also:
    • addDynamicProperty

      public void addDynamicProperty(String propertyName, AdvancedCriteria criteria)
      Sets up the value of propertyName to be dynamically derived from the ruleScope, by either a simple DataPath into the ruleScope, an AdvancedCriteria built against DataPaths, or via a textual or numeric formula using the ruleScope as available formula inputs.

      The dataPath, criteria, or formula is evaluated immediately when addDynamicProperty() is called, then re-evaluated every time the ruleScope changes. An AdvancedCriteria will always evaluate to boolean true or false, and a UserSummary to a string.

      It is invalid usage to use addDynamicProperty() on a property that is not runtime settable. However, addDynamicProperty() will not throw an error or log a warning if this is done.

      If a property is already dynamic and addDynamicProperty() is called again, the new dynamic behavior replaces the old. If a property should no longer be dynamic, call clearDynamicProperty().

      Dynamic properties can also be declared together via dynamicProperties.

      Note that you may convert a simple criteria to an AdvancedCriteria by calling DataSource.convertCriteria().

      Parameters:
      propertyName - name of a settable property on this instance. See Identifier
      criteria - an AdvancedCriteria
      See Also:
    • clearDynamicProperty

      public void clearDynamicProperty(String propertyName)
      Clears a dynamic property previously established via addDynamicProperty().

      If the property is not currently dynamic, nothing will be done (and no warning logged).

      The current value of the property will not be changed by this call.

      Parameters:
      propertyName - name of the dynamic property to clear
    • hasDynamicProperty

      public boolean hasDynamicProperty(String propertyName)
      Returns true if the property is dynamic.
      Parameters:
      propertyName - name of the dynamic property to check
      Returns:
      boolean true if the property is dynamic