Class AngleDegreesConverter

java.lang.Object
org.bidib.wizard.mvc.stepcontrol.view.converter.AngleDegreesConverter
All Implemented Interfaces:
com.jgoodies.binding.value.BindingConverter<Number,String>

public final class AngleDegreesConverter extends Object implements com.jgoodies.binding.value.BindingConverter<Number,String>
Converts Values to Strings and vice-versa using a given Format.
  • Constructor Details

    • AngleDegreesConverter

      public AngleDegreesConverter(Format format, long totalSteps)
      Constructs a StringConverter on the given subject using the specified Format.
      Parameters:
      format - the Format used to format and parse
      Throws:
      NullPointerException - if the subject or the format is null.
    • AngleDegreesConverter

      public AngleDegreesConverter(long totalSteps)
      Constructs a StringConverter on the given subject using the default DecimalFormat.
  • Method Details

    • targetValue

      public String targetValue(Number sourceValue)
      Formats the source value and returns a String representation.
      Specified by:
      targetValue in interface com.jgoodies.binding.value.BindingConverter<Number,String>
      Parameters:
      sourceValue - the source value
      Returns:
      the formatted sourceValue
    • getPositionAsAngle

      public static double getPositionAsAngle(long position, long totalSteps)
      Returns:
      the position
    • sourceValue

      public Number sourceValue(String targetValue)
      Parses the given String encoding and sets it as the subject's new value. Silently catches ParseException.
      Specified by:
      sourceValue in interface com.jgoodies.binding.value.BindingConverter<Number,String>
      Parameters:
      targetValue - the value to be converted and set as new subject value