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

Dropdown local number

Widget is represented by a label and dropdown below label. Data that is saved to database is of datatype "number".

Widget id, ${gbamID}:

dropdownLocalNumber

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as number datatype.

Predefined user data

PreLoaded

Properties panel

User will configure this data in properties panels of selected widget:

GENERAL
VALIDATIONS
    <columnNumber required="true|false"></columnNumber>
  • "decimal format", TextValidator#REGEX set to @string/$decimalPattern not changeable by user, only error message.
  • "decimal places", places the n number of 0 after the "."(dot) in gn:s_decimalFormat="0.00". Default is 2. This can not exceed total allowed size of decimal number of 15, add to configuration.xml:
<columnNumber>
    <decimalPlaces>null|>=0|<=13</decimalPlaces>
</columnNumber>
ACTION
  • "dropdown items", ${dropdownItemsList} = ${<item>${dropdownListItem}</item>} - repeats to how many dropdown items were entered by user.
  • ${dropdownListItem} - single "dropdown items" item entered by user. Only number input up to 15 digits is allowed, integer or decimal.
ACTION MESSAGES
  • "message in case of no data", if $defaultApp resource ${$dropDownNoData}, if we override then it has to be formed {@string/${widgetID}NoData} - message which appears when user clicks on dropdown and no data is loaded into dropdown
  • "no selection text", if $defaultApp resource ${$dropDownZeroItem}, if we override then it has to be formed ${@string/${widgetID}ZeroItem} - text which appears when dropdown is initially loaded and nothing is selected in it
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":
  • "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/dropdownLocalNumber_label" />

<com.ginstr.widgets.GnDropDown
	android:id="@+id/${widgetID}_input"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	gn:s_ZeroItemText="@string/${$dropDownZeroItem}"
	gn:noData="@string/${$dropDownNoData}" 
	gn:s_sourceType="local"
        gn:dataType="number"
	gn:data_source_key_local="@array/${widgetID}"
	gn:act_afterLoad="[gn:act_fill_dropdown]|[@+id/${widgetID}_input]"
	gn:style="@style/dropdownLocalNumber_input"/>

strings.xml

Lines to be added for each language.

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


arrays.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
	<string-array name="${widgetID}">
		${dropdownItemsList}
	</string-array>
</resources>