Class FWTextFormComponent

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

public class FWTextFormComponent extends FWAbstractFormComponent implements FocusListener
Form component with a text field. Attributes: maxlength (at least 3, default 50; more than 100 gives a scrollable text area), regexp (input filter, only up to 100 characters) and default (with parameter tokens; re-evaluated when a parameter used in it changes). If the parameter SimVariable.DATA_TYPE is set, the input filter is adapted to that data type.
Author:
Andreas Enders
See Also:
  • Constructor Details

    • FWTextFormComponent

      public FWTextFormComponent(String aFormId, String aFieldId, boolean aShowLabel, org.jdom2.Element aParameters, net.simplace.core.FWObservable aObservabal)
      Parameters:
      aFormId - id of the form the component is placed in
      aFieldId - id of the component, also the parameter key of its value
      aShowLabel - true to show a caption label
      aParameters - the form element (attributes maxlength, regexp, default)
      aObservabal - parameters of the functionality
  • Method Details

    • getValue

      public String getValue()
      Specified by:
      getValue in class FWAbstractFormComponent
      Returns:
      the entered text
    • setValue

      public void setValue(Object aValue)
      Sets the text, cut to the maximum length; ignored if empty or if the component has a form filler.
      Specified by:
      setValue in class FWAbstractFormComponent
      Parameters:
      aValue - the text
    • update

      public void update(net.simplace.core.FWObservable aObservable, Object aKeyOfParameterChanged)
      In addition to the base behaviour, adapts the input filter to SimVariable.DATA_TYPE and re-evaluates the default when a parameter used in it changes (only a non-empty result is set).
      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()
      Description copied from class: FWAbstractFormComponent
      Fills the component from its form filler (e.g. options or a chart); called after initialisation and whenever the jumper rule of the form filler changes.
      Specified by:
      processFormFiller in class FWAbstractFormComponent
    • setEnabled

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

      public void focusGained(FocusEvent aFocusEvent)
      Specified by:
      focusGained in interface FocusListener
    • focusLost

      public void focusLost(FocusEvent aE)
      Specified by:
      focusLost in interface FocusListener
    • 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)