Class ParameterImpl

java.lang.Object
com.biglybt.pifimpl.local.ui.config.ParameterImpl
All Implemented Interfaces:
ParameterListener, ConfigParameter, EnablerParameter, Parameter
Direct Known Subclasses:
ActionParameterImpl, BooleanParameterImpl, ColorParameterImpl, DirectoryParameterImpl, FileParameterImpl, FloatParameterImpl, HyperlinkParameterImpl, InfoParameterImpl, IntListParameterImpl, IntParameterImpl, LabelParameterImpl, ParameterGroupImpl, ParameterTabFolderImpl, PasswordParameterImpl, StringListParameterImpl, StringParameterImpl, UIParameterImpl, UITextAreaImpl

public abstract class ParameterImpl extends Object implements EnablerParameter, ParameterListener
  • Field Details

    • configKey

      protected final String configKey
    • labelKey

      private String labelKey
    • label

      private String label
    • mode

      private int mode
    • enabled

      private Boolean enabled
    • visible

      private boolean visible
    • generate_intermediate_events

      private boolean generate_intermediate_events
    • toDisable

      private List<Parameter> toDisable
    • toEnable

      private List<Parameter> toEnable
    • change_listeners

      private List change_listeners
    • impl_listeners

      private List<ParameterImplListener> impl_listeners
    • validator_listeners

      private List<ParameterValidator> validator_listeners
    • parameter_group

      private ParameterGroupImpl parameter_group
    • indent

      private int indent
    • fancyIndent

      private boolean fancyIndent
    • refID

      private String refID
    • allowedUiTypes

      private String[] allowedUiTypes
  • Constructor Details

    • ParameterImpl

      public ParameterImpl(String coreConfigKey, String _labelKey)
  • Method Details

    • getKey

      @Deprecated public String getKey()
      Deprecated.
      (forRemoval=true) Use getConfigKeyName()
    • addDisabledOnSelection

      public void addDisabledOnSelection(Parameter parameter)
      Description copied from interface: EnablerParameter
      disables parameter when EnablerParameter is selected.
      Specified by:
      addDisabledOnSelection in interface EnablerParameter
      Parameters:
      parameter - the Parameter to act on
    • addDisabledOnSelection

      public void addDisabledOnSelection(Parameter... parameters)
      Description copied from interface: EnablerParameter
      disables parameter when EnablerParameter is selected.
      Specified by:
      addDisabledOnSelection in interface EnablerParameter
      Parameters:
      parameters - the Parameter to act on
    • addEnabledOnSelection

      public void addEnabledOnSelection(Parameter paramToEnable)
      Description copied from interface: EnablerParameter
      enables paramToEnable when this EnablerParameter is selected (checked).
      paramToEnable is disabled when this EnablerParameter isn't selected (checked).

      Note: When this EnableParameter is disabled, paramToEnable's state will not be modified. In cases where parameter1 is enabled by its parent, and parameter1 enabled children, you must also parent.addEnabledOnSelection(children) if you want the children to be disabled when parent is unselected (unchecked).

      Specified by:
      addEnabledOnSelection in interface EnablerParameter
      Parameters:
      paramToEnable - the Parameter to act on
    • addEnabledOnSelection

      public void addEnabledOnSelection(Parameter... parameters)
      Description copied from interface: EnablerParameter
      enables paramToEnable when this EnablerParameter is selected (checked).
      paramToEnable is disabled when this EnablerParameter isn't selected (checked).

      Note: When this EnableParameter is disabled, parametersToDisable's state will not be modified. In cases where parameter1 is enabled by its parent, and parameter1 enabled children, you must also parent.addEnabledOnSelection(children) if you want the children to be disabled when parent is unselected (unchecked).

      Specified by:
      addEnabledOnSelection in interface EnablerParameter
      Parameters:
      parameters - the Parameter to act on
    • getDisabledOnSelectionParameters

      public List<Parameter> getDisabledOnSelectionParameters()
    • getEnabledOnSelectionParameters

      public List<Parameter> getEnabledOnSelectionParameters()
    • parameterChanged

      public void parameterChanged(String key)
      Description copied from interface: ParameterListener
      Called, when a parameter has changed. The listener could only react if the parameter name is relevant. Or the listener can just read all parameters again.
      Specified by:
      parameterChanged in interface ParameterListener
      Parameters:
      key - the name of the parameter that has changed
    • fireParameterChanged

      public void fireParameterChanged()
    • setEnabled

      public void setEnabled(boolean e)
      Description copied from interface: Parameter
      Sets whether the UI object for this parameter is enabled (changeable) or disabled (not changeable, and usually grayed out)
      Specified by:
      setEnabled in interface Parameter
      Parameters:
      e - The new enabled state
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: Parameter
      Retrieves the enabled state for the UI object for this parameter
      Specified by:
      isEnabled in interface Parameter
      Returns:
      The enabled state
    • getMinimumRequiredUserMode

      public int getMinimumRequiredUserMode()
      Description copied from interface: Parameter
      Gets the lowest user mode required for this parameter to be displayed.
      Specified by:
      getMinimumRequiredUserMode in interface Parameter
      Returns:
      MODE_ constants above
    • setMinimumRequiredUserMode

      public void setMinimumRequiredUserMode(int _mode)
      Description copied from interface: Parameter
      Sets the lowest user mode required for this parameter to be displayed.
      Specified by:
      setMinimumRequiredUserMode in interface Parameter
      Parameters:
      _mode - see MODE_ constants defined above
    • setVisible

      public void setVisible(boolean _visible)
      Description copied from interface: Parameter
      Sets whether the UI object for this parameter is visible to the user
      Specified by:
      setVisible in interface Parameter
      Parameters:
      _visible - The new visibility state
    • isVisible

      public boolean isVisible()
      Description copied from interface: Parameter
      Retrieves the visiblility state for the UI object for this parameter
      Specified by:
      isVisible in interface Parameter
      Returns:
      The visibility state
    • setGenerateIntermediateEvents

      public void setGenerateIntermediateEvents(boolean b)
      Description copied from interface: Parameter
      Controls whether or not 'parameter change' events are fired for each incremental value change
      Specified by:
      setGenerateIntermediateEvents in interface Parameter
    • getGenerateIntermediateEvents

      public boolean getGenerateIntermediateEvents()
      Specified by:
      getGenerateIntermediateEvents in interface Parameter
      Returns:
    • setGroup

      public void setGroup(ParameterGroupImpl _group)
    • getGroup

      public ParameterGroupImpl getGroup()
    • addListener

      public void addListener(ParameterListener l)
      Description copied from interface: Parameter
      Adds a listener triggered when the parameter is changed by the user
      Specified by:
      addListener in interface Parameter
      Parameters:
      l - Listener to add
    • addAndFireListener

      public void addAndFireListener(ParameterListener l)
      Specified by:
      addAndFireListener in interface Parameter
    • removeListener

      public void removeListener(ParameterListener l)
      Description copied from interface: Parameter
      Removes a previously added listener
      Specified by:
      removeListener in interface Parameter
      Parameters:
      l - Listener to remove.
    • addImplListener

      public void addImplListener(ParameterImplListener l)
    • removeImplListener

      public void removeImplListener(ParameterImplListener l)
    • addConfigParameterListener

      public void addConfigParameterListener(ConfigParameterListener l)
      Specified by:
      addConfigParameterListener in interface ConfigParameter
    • removeConfigParameterListener

      public void removeConfigParameterListener(ConfigParameterListener l)
      Specified by:
      removeConfigParameterListener in interface ConfigParameter
    • addValidator

      public void addValidator(ParameterValidator validator)
      Description copied from interface: Parameter
      Adds a validator to this parameter. The Validator will be called when the user tries to change the value.

      For parameters that have a text field, the validator will be called on each edit of the field. This allows you to notify the user of a potential error while they type.

      Subclasses may have helper functions that cast the "toValue" for you.

      Specified by:
      addValidator in interface Parameter
    • validate

      public ParameterValidator.ValidationInfo validate(Object newValue)
    • getLabelText

      public String getLabelText()
      Description copied from interface: Parameter
      Retrieve the actual text of the label associated with this parameter. This is the text after it has been looked up in the language bundle.
      Specified by:
      getLabelText in interface Parameter
      Returns:
      The label's text
    • setLabelText

      public void setLabelText(String sText)
      Description copied from interface: Parameter
      Set the text of the label associated to with this parameter to the literal text supplied.
      Specified by:
      setLabelText in interface Parameter
      Parameters:
      sText - The actual text to assign to the label
    • getLabelKey

      public String getLabelKey()
      Description copied from interface: Parameter
      Retrieve the language bundle key for the label associated with this parameter.
      Specified by:
      getLabelKey in interface Parameter
      Returns:
      The language bundle key, or null if the label is using literal text
    • setLabelKey

      public void setLabelKey(String sLabelKey)
      Description copied from interface: Parameter
      Set the label to use the supplied language bundle key for the label associated with this parameter
      Specified by:
      setLabelKey in interface Parameter
      Parameters:
      sLabelKey - The language bundle key to use.
    • getConfigKeyName

      public final String getConfigKeyName()
      Specified by:
      getConfigKeyName in interface Parameter
    • hasBeenSet

      public boolean hasBeenSet()
      Description copied from interface: Parameter
      Indicates if a value has been set for the parameter. If no value has been set, the default value will be used.

      To capture a "reset to default" event, you can Parameter.addListener(ParameterListener) or ConfigParameter.addConfigParameterListener(ConfigParameterListener), and check if hasBeenSet is false.

      Specified by:
      hasBeenSet in interface Parameter
    • triggerLabelChanged

      private void triggerLabelChanged(String text, boolean isKey)
    • refreshControl

      public void refreshControl()
    • destroy

      public void destroy()
    • setIndent

      public void setIndent(int indent, boolean fancy)
      Specified by:
      setIndent in interface Parameter
    • getIndent

      public int getIndent()
    • isIndentFancy

      public boolean isIndentFancy()
    • setReferenceID

      public void setReferenceID(String refID)
    • getReferenceID

      public String getReferenceID()
    • setAllowedUiTypes

      public void setAllowedUiTypes(String... uiTypes)
      Specified by:
      setAllowedUiTypes in interface Parameter
    • isForUIType

      public boolean isForUIType(String uiType)
      Specified by:
      isForUIType in interface Parameter
    • resetToDefault

      public boolean resetToDefault()
      Description copied from interface: Parameter
      Resets the parameter to its default value
      Specified by:
      resetToDefault in interface Parameter
      Returns:
      true - value was reset; false - already reset
    • getValueObject

      public Object getValueObject()
      Description copied from interface: Parameter
      Retrieve the parameter's value as an Object. Subclasses will usually have a getValue() that will return a specific type.
      Specified by:
      getValueObject in interface Parameter
    • search

      public boolean search(Pattern regex)