From wiki.ginstr.com
Revision as of 14:45, 5 November 2019 by Danijel (talk | contribs) (VALIDATIONS)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Text read only

Widget is commonly used to load textual data made by user in ginstr web. Value can not be entered via ginstr app in the widget.Value that is in widget will be stored as datatype TEXT.

Widget id, ${gbamID}:
see alignment

Back to GBAM widgets table

Datatypes

Value is stored from widget to database as text 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}:textReadOnly when selected UI should show label above the input field, vertical xml should be used
    • "horizontal", ${gbamID}:textReadOnlyHorizontal when selected UI should show label to right of input field in same line, horizontal xml should be used
VALIDATIONS
  • "unique", check uniqueness when widget gets saved into db, having "is part of database" checked, add to configuration.xml:
    <columnText unique="true|false"></columnText>
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":
  • "max length", add to configuration.xml:
<columnText>
    <len>null|>=0|<=10000</len>
</columnText>
  • "align text", radio button options with values: "left", "middle", "right", add to configuration.xml:
<columnText>
    <horizontalAlignment>left|center|right</horizontalAlignment>
</columnText>
  • "list of allowed values" array with list of allowed values, add to configuration.xml:
<columnText>
  <valuesList>
    <value>val1</value>
    <value>val2</value>
  </valuesList>
</columnText>
  • "pattern", add to configuration.xml:
<columnText>
    <pattern errorMessage="invalidTextTableValue">[0-9A-Z]{3}</pattern>
</columnText>
  • "related unique columns", add to configuration.xml:
<columnText>
    <uniqueInsideList>
        <reference>
          <table>refTableId1</table>
          <column>refColumnField1</column>
        </reference>
        <reference>
          <table>refTableId2</table>
          <column>refColumnField2</column>
        </reference>
    </uniqueInsideList>
</columnText>

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/textReadOnly_label"/>

<com.ginstr.widgets.GnEditText
    android:id="@+id/${widgetID}_input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    gn:dataType="text"
    gn:s_sourceType="input"
    ${isMasked}
    gn:style="@style/textReadOnly_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/textReadOnlyHorizontal_label"/>

	<com.ginstr.widgets.GnEditText
		android:id="@+id/${widgetID}_input"
		android:layout_width="0dp"
		android:layout_height="wrap_content"
                android:layout_weight="34"
		gn:dataType="text"
		gn:s_sourceType="input"	
                ${isMasked}
		gn:style="@style/textReadOnlyHorizontal_input"/>
</LinearLayout>

strings.xml

Lines to be added for each language.

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