Class FWAbstractFormComponentFiller

java.lang.Object
net.simplace.pipe.filler.FWAbstractFormComponentFiller
Direct Known Subclasses:
FWASCIIFormComponentFiller, FWClasspathFormComponentFiller, FWDatabaseFormComponentFiller, FWFilebasedFormComponentFiller, FWMapFormComponentFiller, FWSimCacheListFormComponentFiller, FWSimOutputFormComponentFiller, FWSimVariablesFormComponentFiller

public abstract class FWAbstractFormComponentFiller extends Object
Base class of form component fillers, which read data from different sources (e.g. ASCII files, a database or the parameters) and provide dynamic content for form components: options, charts, objects or field lists. Fillers are instantiated by class name; initialize(Object, Map, FWObservable, String, Element) has to be called afterwards.
Author:
Andreas Enders
  • Field Details

    • iParameterMap

      protected Map<String,Object> iParameterMap
      parameters configuring the filler
    • iObervable

      protected net.simplace.core.FWObservable iObervable
      parameters of the functionality, used as fallback
  • Constructor Details

    • FWAbstractFormComponentFiller

      public FWAbstractFormComponentFiller()
  • Method Details

    • initialize

      public void initialize(Object aContent, Map<String,Object> aParameterMap, net.simplace.core.FWObservable aObservable, String aSystemID, org.jdom2.Element aConfiguration)
      Initialises the filler; has to be called after instantiation by class name.
      Parameters:
      aContent - content the filler works on (e.g. a file name or an SQL statement)
      aParameterMap - parameters configuring the filler
      aObservable - parameters of the functionality, used as fallback
      aSystemID - id of the system the form belongs to
      aConfiguration - optional configuration element, or null
    • generateFormOptions

      protected abstract Vector<FWFormOption> generateFormOptions(String aKey)
      Parameters:
      aKey - key (id) of the form component
      Returns:
      the options for a choice component, or null if not supported
    • generateChart

      protected abstract org.jfree.chart.JFreeChart generateChart(String aKey, ChartStyle aChartStyle)
      Parameters:
      aKey - key (id) of the form component
      aChartStyle - style of the chart
      Returns:
      the chart, or null if not supported
    • generateObject

      protected abstract Object generateObject(String aKey)
      Parameters:
      aKey - key (id) of the form component
      Returns:
      the value for the form component, or null if not supported
    • generateFieldList

      protected abstract List<org.jdom2.Element> generateFieldList(String aKey)
      Parameters:
      aKey - key (id) of the form component
      Returns:
      form field elements to be added to the form, or null if not supported
    • getContent

      protected Object getContent()
      Returns:
      the content
    • hasParameter

      protected Boolean hasParameter(String aKey)
      Parameters:
      aKey - parameter key
      Returns:
      true if the parameter is set in the filler parameters (the observable is not checked)
    • getStringParameter

      protected String getStringParameter(String aKey)
      Parameters:
      aKey - parameter key
      Returns:
      the parameter from the filler parameters, or else from the observable, as string; null if not set
    • getStringInParameter

      protected String getStringInParameter(String aKey)
      Parameters:
      aKey - parameter key
      Returns:
      the parameter from the filler parameters as string; a value consisting of a parameter token is replaced from the observable; null if the parameter is missing
    • getParameter

      protected Object getParameter(String aKey)
      Parameters:
      aKey - parameter key
      Returns:
      the parameter from the filler parameters, or else from the observable; null if not set
    • replaceParamTokens

      protected String replaceParamTokens(String aKey, String aDefault)
      Replaces parameter tokens from the filler parameters.
      Parameters:
      aKey - text containing parameter tokens
      aDefault - replacement for unknown tokens
      Returns:
      the text with tokens replaced
    • setContent

      protected void setContent(Object aContent)
      Parameters:
      aContent - the content the filler works on
    • getFormOptions

      public Vector<FWFormOption> getFormOptions(String aKey)
      Parameters:
      aKey - key (id) of the form component
      Returns:
      the options for a choice component (see generateFormOptions(String))
    • getFieldList

      public List<org.jdom2.Element> getFieldList(String aKey)
      Parameters:
      aKey - key (id) of the form component
      Returns:
      form field elements (see generateFieldList(String))
    • getChart

      public org.jfree.chart.JFreeChart getChart(String aKey, ChartStyle aChartStyle)
      Parameters:
      aKey - key (id) of the form component
      aChartStyle - style of the chart
      Returns:
      the chart (see generateChart(String, ChartStyle))
    • getObject

      public Object getObject(String aKey, String aClassname)
      Returns the value generated by generateObject(String), converted to the requested type: from a result set the first column is read (unless java.sql.ResultSet is requested), strings are converted to java.lang.Integer or java.lang.Double, other values to java.lang.String if requested.
      Parameters:
      aKey - key (id) of the form component
      aClassname - fully qualified name of the requested type, or null for no conversion
      Returns:
      the (converted) value, or null
    • getSystemID

      protected String getSystemID()
      Returns:
      id of the system the form belongs to
    • getConfiguration

      protected org.jdom2.Element getConfiguration()
      Returns:
      the configuration element, or null
    • hasConfiguration

      protected boolean hasConfiguration()
      Returns:
      true if a configuration element is set
    • getTitle

      public String getTitle()
      Returns:
      the title, e.g. of a generated chart
    • setTitle

      public void setTitle(String aTitle)
      Parameters:
      aTitle - the title, e.g. of a generated chart