Class Argument

All Implemented Interfaces:
Serializable, ListModel
Direct Known Subclasses:
DateArgument, FileArgument, FormatArgument, NumberArgument

public abstract class Argument extends AbstractListBean
A base class for all arguments.

Aside from being a bean this class also provides a ListModel interface on the allowed values for this argument

See Also:
  • Field Details

    • PROPERTY_VALUE

      public static final String PROPERTY_VALUE
      The property name for the argument's raw value.
      See Also:
    • PROPERTY_OPERATOR

      public static final String PROPERTY_OPERATOR
      The property name for the argument's current operator.
      See Also:
    • DEFERRED_LIST

      public static final List<Object> DEFERRED_LIST
    • path2LoadedValues

      public static final HashMap<String,List<Object>> path2LoadedValues
    • path2LoadedValuesHeader

      public static final HashMap<String,String[]> path2LoadedValuesHeader
    • type

      protected final ArgumentType type
    • value

      protected Object value
    • defaultValue

      protected final Object defaultValue
    • allowedValues

      protected List<Object> allowedValues
  • Constructor Details

    • Argument

      public Argument(ArgumentType type, ArgumentDescription argDescr, Boolean optional, Object defaultValue, List<? extends Object> allowedValues, URI valuesPath, List<String> operators, Boolean advanced, Integer displayWidth)
      Base constructor for all arguments.

      All extensions of this abstract type are recommended to build via this constructor

      Parameters:
      type - - the type of argument
      argDescr - - the argument description
      optional - - true if this argument is not required, false otherwise
      defaultValue - - the initial value for this argument
      allowedValues - - a list of allowed values for this argument
      operators - - a list of operators supported by this argument
      advanced - - true if argument is advanced, otherwise false. Can be used to determine visibility mode of argument.
    • Argument

      public Argument(Argument arg)
      Constructor that copies the input argument.
      Parameters:
      arg - the argument to copy
  • Method Details

    • getName

      public String getName()
      Get argument name.
      Returns:
      the argument name
    • getDescription

      public String getDescription()
      Get argument description.
      Returns:
      the argument description
    • getTooltip

      public String getTooltip()
      Get argument tooltip.
      Returns:
      the argument tooltip
    • isOptional

      public boolean isOptional()
      Get if argument is optional.
      Returns:
      true if argument is optional, otherwise false
    • isEmpty

      public boolean isEmpty()
      Get if argument is empty.
      Returns:
      true if argument is empty, otherwise false
    • isAdvanced

      public boolean isAdvanced()
      Get if argument is advanced.
      Returns:
      true if argument is advanced, otherwise false
    • getDisplayWidth

      public Integer getDisplayWidth()
      Get the display width for argument.
      Returns:
      the display width for argument
    • setDisplayWidth

      public void setDisplayWidth(Integer displayWidth)
      Set the display width for argument.
      Parameters:
      displayWidth - the display width to set
    • getDisplayName

      public String getDisplayName()
      Get the name to display for argument.
      Returns:
      display name
    • getType

      public ArgumentType getType()
    • getValuesPath

      public String getValuesPath()
    • getDefaultValue

      public Object getDefaultValue()
    • checkAllowed

      protected void checkAllowed(Object theValue)
    • setValue

      public void setValue(Object value, boolean checkCommaSeparatedValues)
    • getValue

      public Object getValue()
    • setValue

      public void setValue(Object value)
    • getOperator

      public String getOperator()
    • setOperator

      public void setOperator(String operator)
    • getOperators

      public List<String> getOperators()
      Returns:
      a list of available operators
    • getElementAt

      public Object getElementAt(int index)
    • getSize

      public int getSize()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasDeferredValues

      public boolean hasDeferredValues()
    • deferredValuesLoaded

      public boolean deferredValuesLoaded()
    • getValuesHeader

      public String[] getValuesHeader()
      Get the values header.
      Returns:
      the values header
    • setValuesHeader

      public void setValuesHeader(String[] valuesHeader)
    • loadDeferredValues

      public void loadDeferredValues(boolean checkForHeader, Function<String,BufferedReader> fileResolver) throws IOException
      Possibly long running, should not be called on the EDT.
      Throws:
      IOException
    • parseValue

      protected Object parseValue(String val)
    • copyArgument

      public abstract Argument copyArgument()
      Make a copy of the argument.
      Returns:
      the argument copy