Number integer read only / horizontal
Widget is used for numerical input of data by user. Value will be stored in couchdb as datatype NUMBER. Widget data can not be modified by user input.
Widget id, ${gbamID}
:
see alignment
Back to GBAM widgets table
Datatypes
Value is stored from widget to database as number
datatype.
Predefined user data
PreLoaded
- ${pageName} - name of the page to which widgets are added
Properties panel
User will configure this data in properties panels of selected widget:
GENERAL
- "label",
${widgetLabel}
- "alignment", represented by dropdown with two options
- "vertical",
${gbamID}
:numberIntegerReadOnly
when selected UI should show label above the input field,vertical
xml should be used - "horizontal",
${gbamID}
:numberIntegerReadOnlyHorizontal
when selected UI should show label to right of input field in same line,horizontal
xml should be used
- "vertical",
- "initial value" value which is set into widget on screen load. Attribute is added only if user types initial value and the input can be only valid integer. ${initialValue}=
gn:s_text="${userValue}"
- "is masked" checkbox if selected, the value in input field is masked, by default it's unchecked. If checkbox is selected following code is added to widget. ${isMasked}=
gn:isMasked="true"
VALIDATIONS
- "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
<columnNumber unique="true|false"></columnNumber>
- "compare with", compares current widget with target selected in the validator. Validator has a dropdown to select widget which will be target and also has dropdown to select comparison type
${comparator}
. Validated target has to be of same datatype as current widget, in this casenumber
- allowed comparison types are described here ComparatorValidator#Comparator_types
- only comparator types that are allowed for certain datatype should be shown in dropdown selection where user chooses comparison type
- comparison types should need to have user friendly translations
- Following line should be added to widget:
gn:act_validate="[name:ComparatorValidator],[message=@string/$comparatorValidatorMessage],[targetWidget=@+id/${widgetID}_suffix],[comparator=${comparator}]"
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>1</value> <value>2</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":
- "decimal places", 0 for integer, add to configuration.xml:
<columnNumber> <decimalPlaces>0</decimalPlaces> </columnNumber>
- "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.
Available layouts
vertical layout
<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/numberIntegerReadOnly_label"/> <com.ginstr.widgets.GnEditText android:id="@+id/${widgetID}_input" android:layout_width="match_parent" android:layout_height="wrap_content" gn:s_sourceType="input" gn:dataType="number" gn:inputType="NUMBER" gn:s_decimalFormat="#" ${initialValue} ${isMasked} gn:style="@style/numberIntegerReadOnly_input" />
horizonal layout
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="100" android:orientation="horizontal"> <com.ginstr.widgets.GnTextView android:id="@+id/${widgetID}_label" android:layout_width="0dp" android:layout_weight="66" android:layout_height="wrap_content" android:text="@string/${widgetID}" gn:style="@style/numberIntegerReadOnlyHorizontal_label"/> <com.ginstr.widgets.GnEditText android:id="@+id/${widgetID}_input" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="34" gn:s_sourceType="input" gn:dataType="number" gn:inputType="NUMBER" gn:s_decimalFormat="#" ${initialValue} ${isMasked} gn:style="@style/numberIntegerReadOnlyHorizontal_input"/> </LinearLayout>
strings.xml
Lines to be added for each language.
<string name="${widgetID}">${widgetLabel}</string>