Class SettingsBase

java.lang.Object
com.motivewave.platform.sdk.common.SettingsBase
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Settings

public class SettingsBase extends Object implements Cloneable
Base (Generic) Settings class.
  • Field Details

  • Constructor Details

    • SettingsBase

      public SettingsBase()
    • SettingsBase

      public SettingsBase(SettingsDescriptor desc)
  • Method Details

    • onUpdated

      protected void onUpdated()
    • setDescriptor

      public void setDescriptor(SettingsDescriptor desc)
      Sets the SettingsDescriptor object. This is called by the underlying study framework.
      Parameters:
      desc - settings descriptor object
    • getDescriptor

      public SettingsDescriptor getDescriptor()
      Gets the SettingsDescriptor object that describes the user settings.
      Returns:
      settings descriptor
    • getPath

      public PathInfo getPath(String id)
      Gets the PathInfo object associated with the given id
      Parameters:
      id - id
      Returns:
      the PathInfo associated to the given id.
    • getInput

      public Object getInput(String id)
      Gets the input associated to the given id.
      Parameters:
      id - id of the input key
      Returns:
      the input key associated to the given id.
    • getInput

      public Object getInput(String id, Object def)
      Gets the input key associated to the given id. The 'def' value is returned if there is no input associated with the given id.
      Parameters:
      id - id of the input
      def - default to return if the input is undefined
      Returns:
      the input key associated to the given id.
    • setInput

      public void setInput(String id, Object input)
      Associates the given input key to the specified id. This is called by the underlying study framework.
      Parameters:
      id - id of the input
      input - input key
    • getMAMethod

      public Enums.MAMethod getMAMethod(String id)
      Gets the Moving Average Calculation method associated to the given id
      Parameters:
      id - id of the method
      Returns:
      the MAMethod associated to the given id.
    • getMAMethod

      public Enums.MAMethod getMAMethod(String id, Enums.MAMethod def)
      Gets the Moving Average Calculation method associated to the given id. The given default value is returned if the method is not defined.
      Parameters:
      id - id of the method
      def - default value to return if the method is not defined
      Returns:
      the MAMethod associated to the given id.
    • setMAMethod

      public void setMAMethod(String id, Enums.MAMethod method)
      Associates the given MAMethod to the specified id. This is called by the underlying study framework.
      Parameters:
      id - id of the method
      method - moving average method
    • getBarSize

      public BarSize getBarSize(String id)
      Gets the bar size associated to the given id.
      Parameters:
      id - id of the bar size
      Returns:
      the BarSize associated to the given id.
    • setBarSize

      public void setBarSize(String id, BarSize barSize)
      Associates the given BarSize to the specified id. This is called by the underlying study framework.
      Parameters:
      id - id of the bar size
      barSize - bar size
    • getInstrument

      public Instrument getInstrument(String id)
      Gets the instrument associated to the given id
      Parameters:
      id - id of the instrument
      Returns:
      the Instrument associated to the given id.
    • setInstrument

      public void setInstrument(String id, Instrument instrument)
      Associates the given Instrument to the specified id. This is called by the underlying study framework.
      Parameters:
      id - id of the instrument
      instrument - instrument to associate
    • getMarker

      public MarkerInfo getMarker(String id)
      Gets the MarkerInfo object associated with the given id
      Parameters:
      id - id used to identify the marker
      Returns:
      the MarkerInfo associated to the given id.
    • getIndicator

      public IndicatorInfo getIndicator(String id)
      Gets the indicator associated with the given id
      Parameters:
      id - id of the indicator
      Returns:
      the IndicatorInfo associated to the given id.
    • getBars

      public BarInfo getBars(String id)
      Gets the bar info associated to the given id.
      Parameters:
      id - id of the bar info
      Returns:
      the BarInfo associated to the given id.
    • getPriceBar

      public PriceBarInfo getPriceBar(String id)
      Gets the bar info associated to the given id.
      Parameters:
      id - id of the bar info
      Returns:
      the BarInfo associated to the given id.
    • getShade

      public ShadeInfo getShade(String id)
      Gets the ShadeInfo object associated to the given id.
      Parameters:
      id - id of the shade
      Returns:
      the ShadeInfo associated to the given id.
    • getGuide

      public GuideInfo getGuide(String id)
      Gets the GuideInfo associated to the given id
      Parameters:
      id - id of the guide
      Returns:
      the GuideInfo associated to the given id.
    • getFont

      public FontInfo getFont(String id)
      Gets the font associated with the given id.
      Parameters:
      id - id of the font
      Returns:
      the FontInfo associated to the given id.
    • getFile

      public File getFile(String id)
      Gets the file associated with the given id.
      Parameters:
      id - id of the file
      Returns:
      the file associated to the given id.
    • getColor

      public Color getColor(String id)
      Gets the color associated to the given id.
      Parameters:
      id - id of the color
      Returns:
      the Color associated to the given id.
    • getColorInfo

      public ColorInfo getColorInfo(String id)
      Gets the color info object associated to the given id
      Parameters:
      id - id of the color
      Returns:
      the Color associated to the given id.
    • getColor

      public Color getColor(String id, Color def)
      Gets the color associated to the given id. The default color is returned if the color is undefined (null).
      Parameters:
      id - id of the color
      def - default value if the color is not defined
      Returns:
      the Color associated to the given id. If the color is null, the default color 'def' is returned.
    • getEnum

      public <T> T getEnum(String id, T def)
    • getEnum

      public <T> T getEnum(String id)
    • getEnumInfo

      public com.motivewave.platform.sdk2.common.EnumInfo getEnumInfo(String id)
    • get

      public <T> T get(String id)
    • get

      public <T> T get(String id, T def)
    • set

      public void set(String id, Object value)
    • setValue

      public void setValue(String id, Object val)
    • getValue

      public Object getValue(String id)
      Gets the set of value associated with the given key.
      Parameters:
      id - id of the value
      Returns:
      value associated to the given id
    • getDouble

      public Double getDouble(String id)
      Gets the double value associated to the given id.
      Parameters:
      id - id of the double value
      Returns:
      double value associated to the given id
    • getTextStyle

      public TextStyle getTextStyle(String id)
      Gets the double value associated to the given id.
      Parameters:
      id - id of the double value
      Returns:
      double value associated to the given id
    • getPoint2D

      public Point2D getPoint2D(String id)
      Gets the double value associated to the given id.
      Parameters:
      id - id of the double value
      Returns:
      double value associated to the given id
    • getDouble

      public double getDouble(String id, double def)
      Gets the double value associated to the given id. The def value is returned if the setting does not exist.
      Parameters:
      id - id of the double value
      def - default value to return if not defined
      Returns:
      double value associated to the given id.
    • setDouble

      public void setDouble(String id, Double val)
      Associates the given double value to the specified id. This is called by the underlying study framework.
      Parameters:
      id - id of the double value
      val - double value
    • getInteger

      public Integer getInteger(String id)
      Gets the integer value associated to the given id.
      Parameters:
      id - id of the value
      Returns:
      integer value associated to the given id
    • getInteger

      public int getInteger(String id, int def)
      Gets the integer value associated to the given id. The def value is returned if the setting does not exist.
      Parameters:
      id - id of the integer value
      def - default value to return if the id does not exist
      Returns:
      integer value
    • getInt

      public int getInt(String id)
      Gets the int value associated to the given id (zero if not set).
      Parameters:
      id - id of the value
      Returns:
      integer value associated to the given id
    • getInt

      public int getInt(String id, int def)
      Gets the int value associated to the given id. The def value is returned if the setting does not exist.
      Parameters:
      id - id of the integer value
      def - default value to return if the id does not exist
      Returns:
      integer value
    • getLong

      public Long getLong(String id)
      Gets the long value associated to the given id.
      Parameters:
      id - id of the value
      Returns:
      long value associated to the given id
    • is

      public boolean is(String id)
      Gets the boolean value associated to the given id.
      Parameters:
      id - id of the value
      Returns:
      associated boolean value
    • has

      public boolean has(String id)
    • is

      public boolean is(String id, boolean def)
      Gets the boolean value associated to the given id.
      Parameters:
      id - id of the value
      def - default value if the current value is null
      Returns:
      associated boolean value
    • getString

      public String getString(String id)
      Gets the string value associated to the given id.
      Parameters:
      id - id of the value
      Returns:
      String value associated to the given id
    • getString

      public String getString(String id, String def)
      Gets the string value associated to the given id. The 'def' value is returned if the value is not defined
      Parameters:
      id - id of the string value
      def - default value to return if the string does not exist
      Returns:
      string value
    • update

      public void update(SettingsBase settings)
      Updates the information from the given object. This is called by the underlying study framework.
      Parameters:
      settings - settings object
    • clone

      public SettingsBase clone()
      Creates a clone (copy) of this object.
      Overrides:
      clone in class Object
      Returns:
      clone of this object
    • equals

      public boolean equals(Object o)
      Compares this settings object with the given object and returns true if they are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - object to compare to
      Returns:
      true if this object equals the given object
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Adds a property change listener.
      Parameters:
      listener - property change listener
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Removes a property change listener.
      Parameters:
      listener - property change listener
    • removeAllPropertyChangeListeners

      public void removeAllPropertyChangeListeners()
      Removes all property change listeners.
    • addListener

      public void addListener(Runnable l)
    • removeListener

      public void removeListener(Runnable l)
    • notifyUpdatedLater

      public void notifyUpdatedLater()
    • notifyUpdated

      public final void notifyUpdated()
    • fromJson

      public void fromJson(Map<String,Object> json)
    • toJsonStr

      public String toJsonStr()
    • toJson

      public Map<String,Object> toJson()
    • clearSets

      protected void clearSets()
    • notifyProperty

      protected void notifyProperty(Object src, String propertyName, Object oldVal, Object newVal)
      Forces a property change event to occur for the given property