From wiki.ginstr.com
Jump to: navigation, search

Number currency (currently not shown in gBAM)

Widget is used for numerical input of data by user. Value will be stored in couchdb as datatype NUMBER.

Widget id, ${gbamID}:

numberCurrency

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}
  • "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}"
VALIDATIONS
  • "required", RequiredValidator
  • "unique", check uniqueness when widget gets saved into db, having "is part of database" checked
  • "decimal format", TextValidator#REGEX set to @string/$currencyPattern not changeable by user, only error message.
internal validators

Validators not visible to user.

ACTION
  • -
ACTION MESSAGES
  • -

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/numberCurrency_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_NUMBER_FLAG_DECIMAL"
    gn:s_decimalFormat="0.00000"
    ${initialValue}
    gn:style="@style/numberCurrency_input" />

strings.xml

Lines to be added for each language.

<string name="${widgetID}">${widgetLabel}</string>
<string name="${widgetID}Hint">${widgetHint}</string>