From wiki.ginstr.com
Jump to: navigation, search
(Predefined user data)
(Common widget code)
 
Line 115: Line 115:
 
     gn:s_sourceType="input"
 
     gn:s_sourceType="input"
 
     gn:dataType="number"
 
     gn:dataType="number"
     gn:inputType="TYPE_NUMBER_FLAG_DECIMAL"
+
     gn:inputType="TYPE_CLASS_NUMBER|TYPE_NUMBER_FLAG_SIGNED|TYPE_NUMBER_FLAG_DECIMAL"
 
     gn:style="@style/numberDefault_input" />
 
     gn:style="@style/numberDefault_input" />
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 18:31, 23 March 2020

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
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.

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>