T - Type of ControlSettingspublic abstract class BasicSettings<T extends BasicSettings<T>> extends java.lang.Object implements ControlSettings<T>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
APPEND |
static java.lang.String |
AUTOFOCUS |
static java.lang.String |
CLEAR_BUTTON |
static java.lang.String |
CSS |
static java.lang.String |
DATA_ATTR_PREFIX |
static java.lang.String |
DATA_ATTRIBUTES |
static java.lang.String |
DISABLED |
static java.lang.String |
HIDE_CLEAR_BUTTON |
static java.lang.String |
HTML_ATTRIBUTES |
static java.lang.String |
ID |
static java.lang.String |
LANGUAGE_CHOOSER |
static java.lang.String |
MAX_LENGTH |
static java.lang.String |
NAME |
static java.lang.String |
PLACEHOLDER |
static java.lang.String |
PREPEND |
static java.lang.String |
READONLY |
static java.lang.String |
REQUIRED |
static java.lang.String |
TRIGGER_ACTION |
static java.lang.String |
TRIGGER_EVENT |
static java.lang.String |
VALUE |
| Constructor and Description |
|---|
BasicSettings() |
| Modifier and Type | Method and Description |
|---|---|
T |
addOption(java.lang.String optionName,
java.lang.Object optionValues)
Adds new option with the specified value(s).
|
T |
append(java.lang.String append)
Place an add-on after the control.
|
T |
autofocus()
Specify that an <input> element should automatically get focus when the page loads.
|
protected void |
clearOption()
Removes all current options.
|
T |
clone()
Clone the current ControlSettings.
|
T |
css(java.lang.String css)
Add CSS classes on the control.
|
T |
dataAttribute(java.lang.String dataName,
java.lang.Object dataValue)
Add a data attribute on the control.
The method accepts the data name with or without the 'data-' prefix. |
T |
dataAttributes(java.util.Map<java.lang.String,java.lang.Object> dataAttributes)
Add a map of data attributes on the control.
The map key is the data attribute name, and the map value is the data attribute value. |
T |
disable()
Override field disabled.
|
<V> V |
getOption(java.lang.String optionName)
Returns the value of the specified option.
|
java.util.Collection<java.lang.String> |
getOptionNames()
Returns the names of defined options for the current ControlSettings.
|
protected abstract T |
getThis()
Returns the exact type of the this reference.
It's a way to recover the type of the this object in a class hierarchy (cf. |
T |
htmlAttributes(java.util.Map<java.lang.String,java.lang.Object> htmlAttributesMap)
Add a map of HTML attributes on the control.
The map key is the HTML attribute name, and the map value is the HTML attribute value. |
T |
htmlAttributes(java.lang.String htmlAttributes)
Add additional HTML attributes on the control.
Example: |
T |
id(java.lang.String id)
Override field id.
|
protected boolean |
isChannelReady()
Check if the Channel is ready and available.
|
T |
maxLength(int maxLength)
Specify the maximum number of characters allowed in the control.
|
void |
merge(ControlSettings<?> settings)
Merge the current ControlSettings options with the options of specified ControlSettings.
|
T |
name(java.lang.String name)
Override field name.
|
T |
onChange(java.lang.String action)
Bind the "change" event to the given databroker action.
Example: |
T |
onFocusOut(java.lang.String action)
Bind the "focusout" event to the given databroker action.
Example: |
T |
placeholder(java.lang.String placeholder)
Specify a short hint that describes the expected value of a control.
|
T |
prepend(java.lang.String prepend)
Place an add-on before the control.
|
T |
readonly()
Override field readonly.
|
T |
removeOption(java.lang.String optionName)
Removes the specified option.
|
T |
require()
Override field required.
|
void |
resolveOptions(TypeFieldEntry tfe)
Set options from the specified
TypeFieldEntry. |
T |
showLanguageChooser()
Show the button to select the language at the right of the control.
|
protected static <T> java.util.Set<T> |
sortSet(java.util.Set<T> set,
java.util.Comparator<T> comparator)
Sort the given
Set according to the given Comparator. |
protected static java.lang.String[] |
toStringArray(Data[] dataArray)
Return an array of
Strings representing the given Data. |
protected static java.lang.String[] |
toStringArray(Data data,
Data... otherDatas)
Deprecated.
use
toStringArray(Object, Object...) instead |
protected static java.lang.String[] |
toStringArray(java.lang.Object[] values)
Return an array of
Strings representing the given Object values. |
protected static java.lang.String[] |
toStringArray(java.lang.Object obj,
java.lang.Object... otherObjs)
Return an array of
Strings representing the given objects. |
protected static java.lang.String[] |
toStringArray(java.lang.String firstItem,
java.lang.String[] otherItems)
Return an array of Strings by concatenating the strings in parameter.
If one of string is null, it is ignored. |
T |
trigger(java.lang.String event,
java.lang.String action)
Bind the given event to the specify databroker action.
Example: |
T |
value(java.lang.Object value)
Override field value.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTypepublic static final java.lang.String ID
public static final java.lang.String NAME
public static final java.lang.String VALUE
public static final java.lang.String DISABLED
public static final java.lang.String READONLY
public static final java.lang.String REQUIRED
public static final java.lang.String CSS
public static final java.lang.String HTML_ATTRIBUTES
public static final java.lang.String DATA_ATTRIBUTES
public static final java.lang.String PLACEHOLDER
public static final java.lang.String AUTOFOCUS
public static final java.lang.String MAX_LENGTH
public static final java.lang.String LANGUAGE_CHOOSER
public static final java.lang.String CLEAR_BUTTON
public static final java.lang.String HIDE_CLEAR_BUTTON
public static final java.lang.String PREPEND
public static final java.lang.String APPEND
public static final java.lang.String TRIGGER_EVENT
public static final java.lang.String TRIGGER_ACTION
public static final java.lang.String DATA_ATTR_PREFIX
public T addOption(java.lang.String optionName, java.lang.Object optionValues)
ControlSettingsnull, the option is removed.addOption in interface ControlSettings<T extends BasicSettings<T>>optionName - Option nameoptionValues - Option value(s)public <V> V getOption(java.lang.String optionName)
ControlSettingsgetOption in interface ControlSettings<T extends BasicSettings<T>>optionName - Option namepublic T removeOption(java.lang.String optionName)
ControlSettingsremoveOption in interface ControlSettings<T extends BasicSettings<T>>optionName - Option nameprotected void clearOption()
public java.util.Collection<java.lang.String> getOptionNames()
ControlSettingsgetOptionNames in interface ControlSettings<T extends BasicSettings<T>>Collection of String representing the option namespublic void resolveOptions(TypeFieldEntry tfe)
ControlSettingsTypeFieldEntry.resolveOptions in interface ControlSettings<T extends BasicSettings<T>>tfe - TypeFieldEntrypublic void merge(ControlSettings<?> settings)
ControlSettingsmerge in interface ControlSettings<T extends BasicSettings<T>>settings - ControlSettings to be merged with the current ControlSettingsprotected abstract T getThis()
this object in a class hierarchy (cf. getThis "trick").public T id(java.lang.String id)
id - id to overridepublic T name(java.lang.String name)
ID option has not been set, the id will be generated.name - name to overridepublic T value(java.lang.Object value)
value - to overridepublic T disable()
public T readonly()
public T require()
public T css(java.lang.String css)
css - CSS classespublic T dataAttribute(java.lang.String dataName, java.lang.Object dataValue)
<jalios:control settings='new DefaultSettings().dataAttribute("data-jalios-mydata1", "myvalue1").dataAttribute("jalios-mydata2", "myvalue2")' />
This will add data attributes as follows:
data-jalios-mydata1="myvalue1" data-jalios-mydata2="myvalue2"
dataName - data attribute namedataValue - data attribute valuepublic T dataAttributes(java.util.Map<java.lang.String,java.lang.Object> dataAttributes)
<%
Map<String, Object> map = new HashMap<String>();
map.put("data-jalios-mydata1", "myvalue1");
map.put("jalios-mydata2", "myvalue2");
%>
<jalios:control settings='new DefaultSettings().dataAttributes(map)' />
dataAttributes - Map of data attributesdataAttribute(String, Object)public T htmlAttributes(java.lang.String htmlAttributes)
<jalios:control settings='new DefaultSettings().htmlAttributes("dirname=\"myname.dir\" pattern=\"[A-Za-z]{3}\"")' />
htmlAttributes - String representing the HTML attributes to be addedpublic T htmlAttributes(java.util.Map<java.lang.String,java.lang.Object> htmlAttributesMap)
<%
Map<String, Object> map = new HashMap<String>();
map.put("dirname", "myname.dir");
map.put("pattern", "[A-Za-z]{3}");
%>
<jalios:control settings='new DefaultSettings().htmlAttributes(map)' />
htmlAttributesMap - Map of HTML attributeshtmlAttributes(String)public T placeholder(java.lang.String placeholder)
placeholder - A hint to the user of what can be entered in the control.public T autofocus()
public T maxLength(int maxLength)
maxLength - The maximum number of characters allowed in the controlpublic T showLanguageChooser()
public T prepend(java.lang.String prepend)
prepend - String representing the add-on to be addedpublic T append(java.lang.String append)
append - String representing the add-on to be addedpublic T onChange(java.lang.String action)
<jalios:field name="mytextfield" label="My Textfield" description="<span class='label label-info'>Reversed string: <em class='reverse-string'></em></span>">
<jalios:control settings='<%= new TextFieldSettings().onChange("reverse") %>' />
</jalios:field>
<jalios:javascript>
!function ($) {
// Action regexp
var pattern = /reverse/i;
var callback = function(event) {
var broker = $.jalios.Event.match(event, 'broker', pattern, true);
if (!broker){ return; }
// Element
var elm = broker.source.currentTarget;
broker.options._broked = true;
var reverseString = $(elm).val().split('').reverse().join('');
$(elm).closest('.widget-content').find('.help-block .reverse-string').html(reverseString);
}
var register = function() {
// Register to broker
$(document).on("jalios:broker", callback);
}
// Initialization on DOM ready
$(document).ready(function($) {
register();
});
}(window.jQuery);
</jalios:javascript>
action - databroker actionpublic T onFocusOut(java.lang.String action)
<jalios:field name="mytextfield" label="My Textfield" description="<span class='label label-info'>Reversed string: <em class='reverse-string'></em></span>">
<jalios:control settings='<%= new TextFieldSettings().onFocusOut("reverse") %>' />
</jalios:field>
<jalios:javascript>
!function ($) {
// Action regexp
var pattern = /reverse/i;
var callback = function(event) {
var broker = $.jalios.Event.match(event, 'broker', pattern, true);
if (!broker){ return; }
// Element
var elm = broker.source.currentTarget;
broker.options._broked = true;
var reverseString = $(elm).val().split('').reverse().join('');
$(elm).closest('.widget-content').find('.help-block .reverse-string').html(reverseString);
}
var register = function() {
// Register to broker
$(document).on("jalios:broker", callback);
}
// Initialization on DOM ready
$(document).ready(function($) {
register();
});
}(window.jQuery);
</jalios:javascript>
action - databroker actionpublic T trigger(java.lang.String event, java.lang.String action)
<jalios:field name="mytextfield" label="My Textfield" description="<span class='label label-info'>Reversed string: <em class='reverse-string'></em></span>">
<jalios:control settings='<%= new TextFieldSettings().trigger("change", "reverse") %>' />
</jalios:field>
<jalios:javascript>
!function ($) {
// Action regexp
var pattern = /reverse/i;
var callback = function(event) {
var broker = $.jalios.Event.match(event, 'broker', pattern, true);
if (!broker){ return; }
// Element
var elm = broker.source.currentTarget;
broker.options._broked = true;
var reverseString = $(elm).val().split('').reverse().join('');
$(elm).closest('.widget-content').find('.help-block .reverse-string').html(reverseString);
}
var register = function() {
// Register to broker
$(document).on("jalios:broker", callback);
}
// Initialization on DOM ready
$(document).ready(function($) {
register();
});
}(window.jQuery);
</jalios:javascript>
event - eventaction - databroker actionpublic T clone() throws java.lang.CloneNotSupportedException
ControlSettingsclone in interface ControlSettings<T extends BasicSettings<T>>clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionprotected boolean isChannelReady()
true if the Channel is ready, false insteadprotected static java.lang.String[] toStringArray(java.lang.Object[] values)
Strings representing the given Object values.values - array of Object values to resolve in StringStringsprotected static java.lang.String[] toStringArray(Data[] dataArray)
Strings representing the given Data.dataArray - array of Data to resolve in string (data id)Strings@Deprecated protected static java.lang.String[] toStringArray(Data data, Data... otherDatas)
toStringArray(Object, Object...) insteadtoStringArray(Object, Object...)data - First Data for which we retrieve the idotherDatas - other Data which we retrieve the idsprotected static java.lang.String[] toStringArray(java.lang.Object obj,
java.lang.Object... otherObjs)
Strings representing the given objects.obj - first object to resolve in StringotherObjs - other objects to resolve in StringStringsprotected static java.lang.String[] toStringArray(java.lang.String firstItem,
java.lang.String[] otherItems)
firstItem - first StringotherItems - other StringsStringsprotected static <T> java.util.Set<T> sortSet(java.util.Set<T> set,
java.util.Comparator<T> comparator)
Set according to the given Comparator.set - Set to sortcomparator - Comparator that will be used to order this setSetCopyright © 2001-2018 Jalios SA. All Rights Reserved.