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

Number default read only / horizontal

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 data can not be modified by user input.

Widget id, ${gbamID}:
see alignment

Back to GBAM widgets table

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}:numberDefaultReadOnly when selected UI should show label above the input field, vertical xml should be used
    • "horizontal", ${gbamID}:numberDefaultReadOnlyHorizontal when selected UI should show label to right of input field in same line, horizontal xml should be used
VALIDATIONS
  • -
ACTION
  • -
ACTION MESSAGES
  • -

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/numberDefaultReadOnly_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:style="@style/numberDefaultReadOnly_input" />

horizonal layout

<RelativeLayout
	android:layout_width="match_parent"
	android:layout_height="wrap_content">
		
	<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/numberDefaultReadOnlyHorizontal_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"
		android:layout_toRightOf="@+id/${widgetID}_label"
		gn:style="@style/numberDefaultReadOnlyHorizontal_input"/>
</RelativeLayout>

strings.xml

Lines to be added for each language.

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