Class FWDatabaseFormComponentFiller
java.lang.Object
net.simplace.pipe.filler.FWAbstractFormComponentFiller
net.simplace.pipe.filler.FWDatabaseFormComponentFiller
Form component filler that reads data from a database. The content is the JDBC
Connection, the key is
an SQL statement ('' is replaced by '). It generates
- form options (columns: label, value, optional image name); default statement
SELECT DESC_<locale>,JUMP FROM INITIAL WHERE THEME = 'INITIAL' - charts; a chart style can be appended to the statement as
&&<chart style> - objects (the result set positioned on the first row)
- field lists for dynamic forms (columns TYPE, ID, NAME, REQUIRED, ENABLED, MINIMUM, MAXIMUM, DEFAULT, LIST)
formFiller.localizationKeyPrefix (localises option labels),
formFiller.jdbctranspose (false to not transpose category/XY datasets).- Author:
- Andreas Enders
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprefix of localisation keys for option labels (parameterformFiller.localizationKeyPrefix)Fields inherited from class FWAbstractFormComponentFiller
iObervable, iParameterMap -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.jfree.chart.JFreeChartgenerateChart(String aKey, ChartStyle aChartStyle) Creates a chart from the result of the statement.protected List<org.jdom2.Element> generateFieldList(String aKey) Creates form field elements from the rows of the statement: TYPEINTEGER,DOUBLE,LIST/MULTILIST(options from the comma-separated column LIST) or text for other types; further columns ID, NAME, REQUIRED, ENABLED, MINIMUM, MAXIMUM, DEFAULT.protected Vector<FWFormOption> generateFormOptions(String aKey) Creates options from the rows of the statement: column 1 = label, column 2 = value, optional column 3 = image name (images larger than 50 pixels are scaled down).protected ObjectgenerateObject(String aKey) Executes the statement.voidinitialize(Object aContent, Map<String, Object> aParameterMap, net.simplace.core.FWObservable aObservable, String aSystemID, org.jdom2.Element aConfiguration) Initialises the filler and reads the localisation key prefix; has to be called after instantiation by class name.Methods inherited from class FWAbstractFormComponentFiller
getChart, getConfiguration, getContent, getFieldList, getFormOptions, getObject, getParameter, getStringInParameter, getStringParameter, getSystemID, getTitle, hasConfiguration, hasParameter, replaceParamTokens, setContent, setTitle
-
Field Details
-
iLocalizationKeyPrefix
prefix of localisation keys for option labels (parameterformFiller.localizationKeyPrefix)
-
-
Constructor Details
-
FWDatabaseFormComponentFiller
public FWDatabaseFormComponentFiller()
-
-
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 and reads the localisation key prefix; has to be called after instantiation by class name.- Overrides:
initializein classFWAbstractFormComponentFiller- Parameters:
aContent- the JDBC connectionaParameterMap- parameters configuring the filleraObservable- parameters of the functionality, used as fallbackaSystemID- id of the system the form belongs toaConfiguration- optional configuration element, ornull
-
generateFormOptions
Creates options from the rows of the statement: column 1 = label, column 2 = value, optional column 3 = image name (images larger than 50 pixels are scaled down).- Specified by:
generateFormOptionsin classFWAbstractFormComponentFiller- Parameters:
aKey- SQL statement, ornullfor the default statement- Returns:
- the options; empty if the statement fails (only logged at debug level)
-
generateChart
Creates a chart from the result of the statement.- Specified by:
generateChartin classFWAbstractFormComponentFiller- Parameters:
aKey- SQL statement, optionally followed by&&<chart style>aChartStyle- default style of the chart- Returns:
- the chart, or
nullif no style or dataset is available (warning is logged)
-
generateObject
Executes the statement.- Specified by:
generateObjectin classFWAbstractFormComponentFiller- Parameters:
aKey- SQL statement- Returns:
- the result set positioned on the first row (the caller has to close its statement, see
FWAbstractFormComponentFiller.getObject(String, String)), ornullif it is empty or the statement fails (error is logged)
-
generateFieldList
Creates form field elements from the rows of the statement: TYPEINTEGER,DOUBLE,LIST/MULTILIST(options from the comma-separated column LIST) or text for other types; further columns ID, NAME, REQUIRED, ENABLED, MINIMUM, MAXIMUM, DEFAULT.- Specified by:
generateFieldListin classFWAbstractFormComponentFiller- Parameters:
aKey- SQL statement- Returns:
- the field elements, or
nullif the statement fails (error is logged)
-