Contents |
Number default
Widget is used for numerical input of data by user. Numerical data can be integer or decimal. Value will be stored in couchdb as datatype NUMBER.
Widget id, ${gbamID}
:
numberDefault
Back to GBAM widgets table
Predefined user data
PreLoaded
Properties panel
User will configure this data in properties panels of selected widget:
GENERAL
- "label",
${widgetLabel}
- "hint",
${widgetHint}
VALIDATIONS
- "required", RequiredValidator
- "unique", check uniqueness when widget gets saved into db, having "is part of database" checked
internal validators
Validators not visible to user.
- "max length", TextValidator#maxLength set to 15
- "decimal format", TextValidator#REGEX set to
@string/$decimalPattern
not changeable by user, only error message.
ACTION
- -
ACTION MESSAGES
- -
DATABASE
- "is part of database", checkbox option by default is set as checked. When checked database column is created for this widget.
- "additional ginstr web column settings":
- "percentage %", add to configuration.xml:
<columnNumber> <percentage>true|false</percentage> </columnNumber>
- "horizontal alignment", add to configuration.xml:
<columnNumber> <horizontalAlignment>left|center|right</horizontalAlignment> </columnNumber>
- "list of allowed values", add to configuration.xml:
<columnNumber> <valuesList> <value>0.123</value> <value>1</value> <value>2</value> <value>3.1</value> </valuesList> </columnNumber>
- "related unique columns", add to configuration.xml:
<columnNumber> <uniqueInsideList> <reference> <table>refTableId1</table> <column>refColumnField1</column> </reference> <reference> <table>refTableId2</table> <column>refColumnField2</column> </reference> </uniqueInsideList> </columnNumber>
- "hidden ginstr web column settings":
- "number signs", for positive number add: "equalToZero" and "greaterThanZero", add to configuration.xml:
<numberSigns> <numberSign>lessThanZero</numberSign> <numberSign>equalToZero</numberSign> <numberSign>greaterThanZero</numberSign> </numberSigns>
Code snippets
GBAM Code Variables
Variables which are used in code snippet below but not defined in user modifiable inputs.
Common widget code
<com.ginstr.widgets.GnTextView android:id="@+id/${widgetID}_label" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/${widgetID}" gn:style="@style/numberDefault_label"/> <com.ginstr.widgets.GnEditText android:id="@+id/${widgetID}_input" android:layout_width="match_parent" android:layout_height="wrap_content" gn:s_hint="@string/${widgetID}Hint" gn:s_sourceType="input" gn:dataType="number" gn:inputType="TYPE_CLASS_NUMBER|TYPE_NUMBER_FLAG_SIGNED|TYPE_NUMBER_FLAG_DECIMAL" gn:style="@style/numberDefault_input" />
strings.xml
Lines to be added for each language.
<string name="${widgetID}">${widgetLabel}</string> <string name="${widgetID}Hint">${widgetHint}</string>