Class DbRecordSettings
- java.lang.Object
-
- com.jalios.jcms.taglib.settings.BasicSettings<T>
-
- com.jalios.jcms.taglib.settings.AbstractTextSettings<T>
-
- com.jalios.jcms.taglib.settings.AbstractTextChooserSettings<DbRecordSettings>
-
- com.jalios.jcms.taglib.settings.impl.DbRecordSettings
-
- All Implemented Interfaces:
ControlSettings<DbRecordSettings>,java.lang.Cloneable
public class DbRecordSettings extends AbstractTextChooserSettings<DbRecordSettings>
DBRecord Settings- Author:
- Nicolas Dos Santos
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCHOOSER_LABEL_COLUMNstatic java.lang.StringCHOOSER_VALUE_COLUMNstatic java.lang.StringCOLUMNSstatic java.lang.StringDATA_SOURCEstatic intDEFAULT_MAX_ROWSstatic java.lang.StringMAX_ROWSstatic java.lang.StringORDER_BYstatic java.lang.StringTABLE-
Fields inherited from class com.jalios.jcms.taglib.settings.BasicSettings
APPEND, ARIA_ATTR_PREFIX, ARIA_ATTRIBUTES, AUTOFOCUS, CLEAR_BUTTON, CSS, DATA_ATTR_PREFIX, DATA_ATTRIBUTES, DISABLED, HIDE_CLEAR_BUTTON, HTML_ATTRIBUTES, ID, LANGUAGE_CHOOSER, MAX_LENGTH, NAME, PLACEHOLDER, PREPEND, READONLY, REQUIRED, TITLE, TRIGGER_ACTION, TRIGGER_EVENT, VALUE
-
-
Constructor Summary
Constructors Constructor Description DbRecordSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbRecordSettingschooserLabelColumn(java.lang.String columnName)Column name used to display the value of this column in the visible field after selecting an item from the database.DbRecordSettingschooserValueColumn(java.lang.String columnName)Column name used to put the value of this column in the hidden field after selecting an item from the database.DbRecordSettingscolumns(java.lang.String[] columnNames)Specify the column names of the DB Table to display in the chooser window.DbRecordSettingscolumns(java.lang.String columnName, java.lang.String... columnNames)Specify the column names of the DB Table to display in the chooser window.DbRecordSettingsdataSource(java.lang.String dataSource)Set the DataSource.protected java.lang.StringgetChooserName()Chooser name used by the databroker when there is a click event in the chooser button.protected java.lang.StringgetChooserOption(java.util.Map<java.lang.String,java.lang.String[]> customOptionMap)Options used by the databroker when there is a click event in the chooser button.java.lang.ObjectgetFirstValue(java.lang.String whereValue)This convenient method performs a query then it returns the value of the first column of the first row of the result set.protected DbRecordSettingsgetThis()Returns the exact type of the this reference.
It's a way to recover the type of thethisobject in a class hierarchy (cf.ControlTypegetType()Returns theControlTyperelated to the currentControlSettingsimplementation.DbRecordSettingsmaxRows(int maxRow)Specify the maximum rows to display per result page in the chooser window.DbRecordSettingsorderBy(java.lang.String orderBy)Specify the order to sort the result-set in ascending or descending order.
Example:new DBRecordSettings().orderBy("column1, column2 DESC");voidresolveOptions(TypeFieldEntry tfe)Set options from the specifiedTypeFieldEntry.DbRecordSettingstable(java.lang.String table)Set the DB table on which the query is made.-
Methods inherited from class com.jalios.jcms.taglib.settings.AbstractTextChooserSettings
addAcChooserOption, addChooserOption, getAcChooserName, getAcChooserOption, getChooserIcon, getChooserTitle, getOption, popupHeight, popupWidth, superGetOption, useCurrentWorkspace, workspace, workspace
-
Methods inherited from class com.jalios.jcms.taglib.settings.AbstractTextSettings
onChange
-
Methods inherited from class com.jalios.jcms.taglib.settings.BasicSettings
addOption, append, aria, aria, autofocus, clearOption, clone, css, dataAttribute, dataAttribute, dataAttributes, disable, getOptionNames, htmlAttributes, htmlAttributes, id, isChannelReady, maxLength, merge, name, onFocusOut, placeholder, prepend, readonly, removeOption, require, showLanguageChooser, sortSet, title, toStringArray, toStringArray, toStringArray, toStringArray, toStringArray, trigger, value
-
-
-
-
Field Detail
-
DEFAULT_MAX_ROWS
public static final int DEFAULT_MAX_ROWS
- See Also:
- Constant Field Values
-
DATA_SOURCE
public static final java.lang.String DATA_SOURCE
- See Also:
- Constant Field Values
-
TABLE
public static final java.lang.String TABLE
- See Also:
- Constant Field Values
-
COLUMNS
public static final java.lang.String COLUMNS
- See Also:
- Constant Field Values
-
MAX_ROWS
public static final java.lang.String MAX_ROWS
- See Also:
- Constant Field Values
-
ORDER_BY
public static final java.lang.String ORDER_BY
- See Also:
- Constant Field Values
-
CHOOSER_VALUE_COLUMN
public static final java.lang.String CHOOSER_VALUE_COLUMN
- See Also:
- Constant Field Values
-
CHOOSER_LABEL_COLUMN
public static final java.lang.String CHOOSER_LABEL_COLUMN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getType
public ControlType getType()
Description copied from interface:ControlSettingsReturns theControlTyperelated to the currentControlSettingsimplementation.- Returns:
ControlType
-
getThis
protected DbRecordSettings getThis()
Description copied from class:BasicSettingsReturns the exact type of the this reference.
It's a way to recover the type of thethisobject in a class hierarchy (cf. getThis "trick").- Specified by:
getThisin classBasicSettings<DbRecordSettings>- Returns:
- The exact type of the this reference
-
resolveOptions
public void resolveOptions(TypeFieldEntry tfe)
Description copied from interface:ControlSettingsSet options from the specifiedTypeFieldEntry.- Specified by:
resolveOptionsin interfaceControlSettings<DbRecordSettings>- Overrides:
resolveOptionsin classBasicSettings<DbRecordSettings>- Parameters:
tfe-TypeFieldEntry
-
getChooserName
protected java.lang.String getChooserName()
Description copied from class:AbstractTextChooserSettingsChooser name used by the databroker when there is a click event in the chooser button.- Specified by:
getChooserNamein classAbstractTextChooserSettings<DbRecordSettings>- Returns:
- The chooser name
- See Also:
- "/js/jalios/core/jalios-widget-chooser.js"
-
getChooserOption
protected java.lang.String getChooserOption(java.util.Map<java.lang.String,java.lang.String[]> customOptionMap)
Description copied from class:AbstractTextChooserSettingsOptions used by the databroker when there is a click event in the chooser button.- Specified by:
getChooserOptionin classAbstractTextChooserSettings<DbRecordSettings>- Parameters:
customOptionMap- Extra chooser options forwarded by the optionChooserConstants.EXTRA_CHOOSER_OPTIONand appended to the query string- Returns:
Stringrepresenting the options as query string
-
dataSource
public DbRecordSettings dataSource(java.lang.String dataSource)
Set the DataSource.- Parameters:
dataSource- the name of the data source (eg. "jdbc/TestDB")- Returns:
- a reference to this object - used to chain calls
-
table
public DbRecordSettings table(java.lang.String table)
Set the DB table on which the query is made.- Parameters:
table- the table name to work with.- Returns:
- a reference to this object - used to chain calls
-
columns
public DbRecordSettings columns(java.lang.String columnName, java.lang.String... columnNames)
Specify the column names of the DB Table to display in the chooser window.- Parameters:
columnName- The first column namecolumnNames- The other column names- Returns:
- a reference to this object - used to chain calls
- See Also:
columns(String[])
-
columns
public DbRecordSettings columns(java.lang.String[] columnNames)
Specify the column names of the DB Table to display in the chooser window.- Parameters:
columnNames- Array of column names- Returns:
- a reference to this object - used to chain calls
- See Also:
table(String)
-
maxRows
public DbRecordSettings maxRows(int maxRow)
Specify the maximum rows to display per result page in the chooser window. Default is 100.- Parameters:
maxRow- Number of maximum rows- Returns:
- a reference to this object - used to chain calls
-
orderBy
public DbRecordSettings orderBy(java.lang.String orderBy)
Specify the order to sort the result-set in ascending or descending order.
Example:new DBRecordSettings().orderBy("column1, column2 DESC");- Parameters:
orderBy- The order- Returns:
- a reference to this object - used to chain calls
-
chooserValueColumn
public DbRecordSettings chooserValueColumn(java.lang.String columnName)
Column name used to put the value of this column in the hidden field after selecting an item from the database.- Parameters:
columnName- Column name- Returns:
- a reference to this object - used to chain calls
-
chooserLabelColumn
public DbRecordSettings chooserLabelColumn(java.lang.String columnName)
Column name used to display the value of this column in the visible field after selecting an item from the database.- Parameters:
columnName- Column name- Returns:
- a reference to this object - used to chain calls
-
getFirstValue
public java.lang.Object getFirstValue(java.lang.String whereValue) throws java.sql.SQLExceptionThis convenient method performs a query then it returns the value of the first column of the first row of the result set.- Parameters:
whereValue- value in the column defined by theCHOOSER_VALUE_COLUMNoption- Returns:
- The first value or null if no result
- Throws:
java.sql.SQLException- if an error occurs
-
-