Class FWDoubleFormComponent

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, net.simplace.core.FWBusyIndicator, net.simplace.core.FWObserver

public class FWDoubleFormComponent extends FWAbstractFormComponent implements ChangeListener
This component displays a slider next to a text field to let the user specify a decimal value (attribute type: slider shows only the slider, any other type only the text field). Further attributes: min, max and default (expressions with parameter tokens; the component is rebuilt when a used parameter changes), precision (decimal places, default 2), tickspace, labelcount (2-10, default 6).
Author:
Christoph Kunze, Andreas Enders
See Also:
  • Constructor Details

    • FWDoubleFormComponent

      public FWDoubleFormComponent(String aFormId, String aFieldId, boolean aShowLabel, org.jdom2.Element aParameters, net.simplace.core.FWObservable aObservable)
      Constructs a new decimal component and initializes it with aParameters.
      Parameters:
      aFormId - id of the form the component is placed in
      aFieldId - id of the component, also the parameter key of its value
      aShowLabel - Specifies whether or not a descriptive label is shown to the left of the control.
      aParameters - the form element (see class description)
      aObservable - parameters of the functionality
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormComponent
      Returns:
      the string representation of the current value (from the slider if shown, otherwise from the text field)
    • setValue

      public void setValue(Object aValue)
      Allows to set the current value (also of a disabled slider: getValue() returned a stale value otherwise).
      Specified by:
      setValue in class FWAbstractFormComponent
      Parameters:
      aValue - String representation of the new value
    • setEnabled

      public void setEnabled(boolean aIsEnabled)
      Overrides:
      setEnabled in class JComponent
      Parameters:
      aIsEnabled - true to enable slider and text field
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Shows the slider value in the text field (or tool tip) and notifies dependent components (not while the slider is dragged).
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the change event of the slider
    • update

      public void update(net.simplace.core.FWObservable aObservable, Object aKeyOfParameterChanged)
      In addition to the base behaviour, re-evaluates min, max and default when a used parameter changes and rebuilds the controls; a value that changes by this is written to the parameters.
      Specified by:
      update in interface net.simplace.core.FWObserver
      Overrides:
      update in class FWAbstractFormComponent
      Parameters:
      aObservable - the parameters
      aKeyOfParameterChanged - key of the changed parameter
    • processFormFiller

      public void processFormFiller()
      Takes the value (Double) from the form filler as default and, if the slider is enabled, as current value.
      Specified by:
      processFormFiller in class FWAbstractFormComponent
    • getValueCell

      protected com.lowagie.text.Rectangle getValueCell(int aType)
      Description copied from class: FWAbstractFormComponent
      Returns the value cell used for generating the RTF, PDF or HTML version of the form.
      Specified by:
      getValueCell in class FWAbstractFormComponent
      Parameters:
      aType - output type, e.g. PrintHelper.TYPE_PDF
      Returns:
      an iText cell (PdfPCell for PDF, Cell otherwise)