Class FWIntegerFormComponent

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

public class FWIntegerFormComponent extends FWAbstractFormComponent implements ChangeListener
This component displays a slider next to a spinner to let the user specify an integer value (attribute type: slider or spinner shows only one of them). Further attributes: min, max and default (expressions with parameter tokens; the component is rebuilt when a used parameter changes), tickspace, ticklabels, labelcount (2-10, default 6).
Author:
Christoph Kunze, Andreas Enders
See Also:
  • Constructor Details

    • FWIntegerFormComponent

      public FWIntegerFormComponent(String aFormId, String aFieldId, boolean aShowLabel, org.jdom2.Element aParameters, net.simplace.core.FWObservable aObservable)
      Constructs a new integer 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 currently selected integer value
    • setValue

      public void setValue(Object aValue)
      Allows to set the currently selected integer (spinner and/or slider).
      Specified by:
      setValue in class FWAbstractFormComponent
      Parameters:
      aValue - String representation of the new integer value (decimals are cut off)
    • setEnabled

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

      public void stateChanged(ChangeEvent e)
      Keeps the ui subcomponents (slider and spinner) synchronized and notifies dependent components (not while the slider is dragged).
      Specified by:
      stateChanged in interface ChangeListener
      Parameters:
      e - the change event of the spinner model or 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 (Integer) from the form filler as default and 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)